A safe Rust FFI binding for the NVIDIA® Tools Extension SDK (NVTX).

Overview

NVIDIA Logo

nvtx-rs

Crates.io Documentation Build Status dependency status

An safe rust wrapper for the NVIDIA® Tools Extension SDK (NVTX).

NVIDIA® Tools Extension SDK (NVTX) is a C-based Application Programming Interface (API) for annotating events, code ranges, and resources in your applications. Official documentation for NVIDIA®'s NVTX can be found here.

Motivation

The intent is wrap to safely wrap the NVTX library in "Rust" fashion to provide a proper cross-platform library for GPU and CPU profiling.

Ideally this library would be used in benchmarking rust applications and performing research on rust projects such as a GPU analysis with zero-cost abstraction.

Sections

Using nvtx-rs

nvtx-rs is designed to be easy to use. The crate is published on crates.io and the easiest way to use nvtx-rs is by adding the lone dependency to your Cargo.toml file:

nvtx-rs = "0.11.0"

Getting Started

Screenshot from 2021-05-24 19-54-07

There are several examples in the example folder which can be run from applications such as NVIDIA NSight Systems. Each example has a README with easy to read steps, screenshots, and documentation. Check out the first example, 'Hello, World!'

State

nvtx-rs is in active development and maturing. Right now development is driven by necessity. In the following months I will be performing a GPU analysis and thus will wrap the appropriate (common) functionality one would need or seem important to me.

FAQ

I need help!

Don't hesitate to file an issue or contact @simbleau by e-mail.

Contributing

I encourage all contributions by pull request. Please check the issues first if you'd like to help. Another great place to start would be binding more functions and wrapping them in a safe way. I will not accept unsafe functionality unless truly required. FFI handling is tricky, and be aware that there are several inline functions in the NVTX header files. This makes converting them automatically (with tools such as bindgen) more difficult. If you have a good way to do it, I'd love to see it! I ended up going the manual translation route because automatic binding was troublesome.

The Rust code of conduct applies.

License

This project is dual-licensed under both Apache 2.0 and MIT licenses.

Comments
  • Expected to work with RustGPU?

    Expected to work with RustGPU?

    Hello, I am interested in using this with a project of mine which is using https://github.com/Rust-GPU/Rust-CUDA/. Is it expected that this will work properly in that context? I'm assuming the idea is to instrument the kernel code itself with the nvtx code here, and then a profile will be made available ... somewhere? Perhaps NSight extracts it from the running GPU, or some well known location on the GPU host, is that correct?

    opened by thedodd 5
  • Update github/codeql-action action to v2

    Update github/codeql-action action to v2

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github/codeql-action | action | major | v1 -> v2 |


    Release Notes

    github/codeql-action

    v2

    Compare Source


    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Configure Renovate

    Configure Renovate

    WhiteSource Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • Cargo.toml (cargo)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this onboarding PR is merged
    • Enable Renovate Dependency Dashboard creation
    • If semantic commits detected, use semantic commit type fix for dependencies and chore for all others
    • Ignore node_modules, bower_components, vendor and various test/tests directories
    • Autodetect whether to pin dependencies or maintain ranges
    • Rate limit PR creation to a maximum of two per hour
    • Limit to maximum 10 open PRs at any time
    • Group known monorepo packages together
    • Use curated list of recommended non-monorepo package groupings
    • Fix some problems with very old Maven commons versions
    • Ignore spring cloud 1.x releases
    • Ignore web3j 5.0.0 release
    • Ignore http4s digest-based 1.x milestones
    • Use node versioning for @types/node
    • Limit concurrent requests to reduce load on Repology servers until we can fix this properly, see issue 10133
    • Do not upgrade from Alpine stable to edge

    🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    It looks like your repository dependencies are already up-to-date and no Pull Requests will be necessary right away.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update Rust crate cc to 1.0.76

    Update Rust crate cc to 1.0.76

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | cc | build-dependencies | patch | 1.0.73 -> 1.0.76 |


    Release Notes

    rust-lang/cc-rs

    v1.0.76

    Compare Source

    Version 1.0.76

    Changelog

    • When compiling with clang-cl, we now only use -- to separate flags/options from input files when not using the assembler, which doesn't support that option. This is a fix for a regression introduced in 1.0.74 (by #​514) (present in 1.0.75 as well). (#​747)

    This is essentially a bugfix release, so that's all!

    v1.0.75

    Compare Source

    Version 1.0.75

    Changelog

    • When Rust debuginfo is enabled, debuginfo is passed to MSVC assemblers (#​742)
    • When locating an ar executable, *-ar is now preferred to *-gcc-ar (#​741)
    • On MSVC 15+, the atlmfc directory is now correctly located (#​699)

    Additionally, a number of smaller changes which shouldn't impact users have been made; see the commit history for complete details.

    Thanks to everybody who contributed to this release!

    v1.0.74

    Compare Source

    Version 1.0.74

    Changelog

    • When compiling with clang-cl, we now use -- to separate flags/options from input files. (#​514)
    • We now fall back to RUSTC_LINKER's prefix (rather than erroring) if we fail to determine the prefix to use for the given target. (#​685)
    • A Build::link_lib_modifier function was added to allow control which library modifiers are used when linking with the generated library. (#​671)
    • When searching for an ar binary to use, we now try {target}-ar in addition to {target}-gcc-ar. If they're both present, {target}-ar will be preferred. (#​735, #​736)
    • We now emit cargo:rerun-if-env-changed messages for environment variables that influence the build. This is only done if cargo_metadata is enabled, and can be disabled by passing false to the new Build::emit_rerun_if_env_changed builder function. (#​701, #​738)
    New Targets

    The following targets are now supported:

    • The Apple WatchOS (and simulator) targets (*-watchos and *-watchos-sim). (#​662)
    • The LLVM-based MinGW targets (*-pc-windows-gnullvm). (#​734)
    • The Xous microkernel (riscv32imac-unknown-xous-elf). (#​686)

    Additionally, a number of smaller changes which shouldn't impact users have been made; see the commit history for complete details.

    Thanks to everybody who contributed to this release!


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Enabled.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update actions-rs/toolchain digest to 16499b5

    Update actions-rs/toolchain digest to 16499b5

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions-rs/toolchain | action | digest | 88dc235 -> 16499b5 |


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Dependency Dashboard

    Dependency Dashboard

    This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

    Open

    These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

    Detected dependencies

    cargo
    Cargo.toml
    • cc 1.0.73
    github-actions
    .github/workflows/build.yml
    • actions/checkout v3
    .github/workflows/clippy.yml
    • actions/checkout v3
    • actions-rs/toolchain v1@88dc2356392166efad76775c878094f4e83ff746
    • github/codeql-action v2

    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
Releases(v1.1.1)
  • v1.1.1(Jul 10, 2022)

  • v1.1.0(May 30, 2022)

    Added

    • Users can now annotate thread names with name_thread!(...) to wrap the canonical nvtxNameOsThread(uint32_t, const *char) from NVTX.

    Changed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(May 30, 2022)

    Added

    • Nothing

    Changed

    • range_push The range_push(&str) function was changed to range_push!(...) which uses argument format capturing similar to the println!(...) macro. This is a breaking change.
    • range_pop The range_pop() function was changed to range_push!(). This is a breaking change.
    • mark The mark(&str) function was changed to mark!(...) which uses argument format capturing similar to the println!(...) macro. This is a breaking change.

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(May 25, 2021)

    Added

    • Feature Users can use the method mark(&str) to wrap the canonical nvtxMarkA(const *char) from NVTX.
    • Example Added an example which uses marks.
    • Example Added an example which uses thread ranges.

    Changed

    • Hello, World! Changed the structure of the example to hold its own folder and README.

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(May 24, 2021)

    Added

    • Feature Users can use the method range_push(&str) to wrap the canonical nvtxRangePushA(const *char) from NVTX.
    • Feature Users can use the method range_pop() to wrap the canonical nvtxRangePop(void) from NVTX.

    Changed

    • Nothing

    Fixed

    • Nothing
    Source code(tar.gz)
    Source code(zip)
Owner
Spencer Imbleau
Obtaining my M.Sc. in Computer Science at Appalachian State University. Hobbyist tinkerer and lover of space, physics, and computer science!
Spencer Imbleau
Rust Attribute-Based Encryption library rabe's C FFI binding , support CP-ABE and KP-ABE encrypt and decrypt, submodule of Rabe.Core c# library.

Rabe-ffi Rust Attribute-Based Encryption library rabe's C FFI binding , support CP-ABE and KP-ABE encrypt and decrypt, submodule of Rabe.Core c# libra

Aya0wind 2 Oct 10, 2022
High-level memory-safe binding generator for Flutter/Dart <-> Rust

flutter_rust_bridge: High-level memory-safe binding generator for Flutter/Dart <-> Rust Want to combine the best between Flutter, a cross-platform hot

fzyzcjy 2.1k Dec 31, 2022
Automatically generates Rust FFI bindings to C (and some C++) libraries.

bindgen bindgen automatically generates Rust FFI bindings to C (and some C++) libraries. For example, given the C header doggo.h: typedef struct Doggo

The Rust Programming Language 3.2k Jan 4, 2023
Rust in Haskell FFI Example

Provides an example for using Rust in Haskell. To use this you'll need cargo, rustc, cabal and GHC installed. To execute the example run the following

Michael Gattozzi 21 Oct 1, 2022
Handy macro to generate C-FFI bindings to Rust for Haskell

hs-bindgen Handy macro to generate C-FFI bindings to Rust for Haskell. This library intended to work best in a project configured by cargo-cabal. N.B.

Yvan Sraka 32 Feb 16, 2023
libc - Raw FFI bindings to platforms' system libraries

libc provides all of the definitions necessary to easily interoperate with C code (or "C-like" code) on each of the platforms that Rust supports. This includes type definitions (e.g. c_int), constants (e.g. EINVAL) as well as function headers (e.g. malloc).

The Rust Programming Language 1.5k Jan 1, 2023
A cross-platform crate with FFI bindings to allow for complex vehicle ECU diagnostics.

ecu_diagnostics A cross-platform crate with FFI bindings to allow for complex vehicle ECU diagnostics. IMPORTANT Currently this crate is not 100% read

Ashcon Mohseninia 80 Dec 24, 2022
Benchmark over Node.js binding frameworks in Rust

Benchmark over Node.js binding frameworks in Rust

LongYinan 7 Dec 28, 2022
CO-RE binding generation for Rust, based on BTF

rust-struct-bindgen Here the repo of rust-struct-bindgen, a rust source code generator to read & write native structs with BTF. There are three crates

eunomia-bpf 3 Apr 21, 2023
lzma-rs binding to Node.js via napi-rs.

@napi-rs/lzma lzma-rs binding to Node.js via napi-rs. ?? Help me to become a full-time open-source developer by sponsoring me on Github Install yarn a

LongYinan 8 Aug 16, 2022
Whitewash is python binding for Ammonia.

Whitewash Whitewash is python binding for Ammonia. Ammonia is a whitelist-based HTML sanitization library. It is designed to prevent cross-site script

Vivek Kushwaha 1 Nov 23, 2021
Ypy - a Python binding for Y-CRDT

Ypy is a Python binding for Y-CRDT. It provides distributed data types that enable real-time collaboration between devices. Ypy can sync data with any other platform that has a Y-CRDT binding, allowing for seamless cross-domain communication. The library is a thin wrapper around Yrs, taking advantage of the safety and performance of Rust.

null 51 Dec 20, 2022
A setuptools/wheel/cffi extension to embed a binary data in wheels

Milksnake Milksnake is an extension for setuptools that allows you to distribute dynamic linked libraries in Python wheels in the most portable way im

Sentry 752 Dec 30, 2022
Mod_wasm - an extension module for the Apache HTTP Server (httpd) that enables the usage of WebAssembly (Wasm).

mod_wasm is an extension module for the Apache HTTP Server (httpd) that enables the usage of WebAssembly (Wasm). This module will allow to execute certain tasks in the backend in a very efficient and secure way.

VMware  Labs 67 Dec 21, 2022
Simulation tools for animating interacting soft objects

Softy Simulation tools and libraries for animating rigid and soft objects (including cloth) subject to frictional contacts against smooth implicit sur

Egor Larionov 23 Jul 7, 2022
Low level tooling for WebAssembly in JavaScript using wasm-tools

js-wasm-tools js-wasm-tools compiles some of the API of wasm-tools to JavaScript and WebAssembly via wasm-bindgen. This offers low level tooling for W

Dominic Elm 59 Dec 19, 2022
Safe interop between Rust and C++

CXX — safe FFI between Rust and C++ This library provides a safe mechanism for calling C++ code from Rust and Rust code from C++, not subject to the m

David Tolnay 4.4k Jan 7, 2023
Safe Rust bridge for creating Erlang NIF functions

Rustler Documentation | Getting Started | Example Rustler is a library for writing Erlang NIFs in safe Rust code. That means there should be no ways t

Rusterlium 3.5k Jan 7, 2023
Safe Rust bindings to Lua 5.1

rust-lua Copyright 2014 Lily Ballard Description This is a set of Rust bindings to Lua 5.1. The goal is to provide a (relatively) safe interface to Lu

Lily Ballard 124 Jan 5, 2023