Metadata-Version: 2.4
Name: gstub
Version: 1.0.1
Summary: A Python package with Rust extension
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# gstub

A Generic GPU API Stub framework that enables developers to implement plugins based on a protocol, allowing custom logic to be injected at GPU API call sites.

## Installation

```bash
pip install .
```

## Getting started

```bash
# Initialize gstub
gstub init
eval "$(gstub setup)" 
```

## Testing

Tests live under the `tests/` directory. After building the workspace, load the example plugin `gtracer` and run the tests twice - first a plain run to build and verify the test programs, then a second run under gaudit so the GPU API calls they make are intercepted:

```bash
# Load the tracer plugin
gstub load gtracer

# Build and run the integration tests
cd tests/cmake_test
cargo test

# Re-run the tests under gaudit so GPU API calls are intercepted
gaudit cargo test
```

 `gtracer` writes a Chrome Trace JSON to `gtracer_<timestamp>.json` (override the path with the `GTRACER_OUTPUT` environment variable).

## Plugin Development

Plugins can be developed following the gstub protocol to hook into GPU API calls. See [PROTOCOL.md](./PROTOCOL.md) for more details.

## License


gstub is released under the [MIT License](./LICENSE).
