Metadata-Version: 2.4
Name: gwatch
Version: 0.0.10
Summary: G-Watch is a toolbox for GPU profiling and program analysis.
Home-page: https://github.com/G-Watch/G-Watch
Author: Zhuobin Huang
Author-email: zhuobin@u.nus.edu
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: prettytable
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# G-Watch

<div align="center" style="display: flex; margin:10px;">
    <img src="https://raw.githubusercontent.com/mars-compute-ai/G-Watch/refs/heads/main/docs/logo.jpg" style="width: 350px; margin: 0px; padding: 0px;" />
</div>

***G-Watch*** is a toolbox for agentic GPU kernel optimization.
It features rich **Profiling** capabilities on both NVIDIA and AMD GPUs.
Additionally,
G-Watch offers **Program Analysis** tools for inspecting compiler-generated GPU binaries,
facilitating secondary development tasks such as register analysis and binary instrumentation.


## Installation

[![Install](https://img.shields.io/badge/Install-red.svg?logo=pypi)]() You can install G-Watch directly from PyPI:

``` bash
# install gwatch
pip install gwatch

# install gwatch skills for codex/claude/gemini-cli
gwatch install_skill
```


### [![build via conda](https://img.shields.io/badge/Development-pink.svg?logo=python)]() Build from source with `Conda`

If you prefer not to use Docker, you can set up the development environment directly on your host machine using Conda.

1. Clone this repository
    ```bash
    git clone --recursive [https://github.com/mars-compute-ai/G-Watch-dev.git](https://github.com/mars-compute-ai/G-Watch-dev.git)
    cd G-Watch-dev
    ```

2. Create and activate a conda environment
    ```bash
    conda create -n gw312 python=3.12
    conda activate gw312
    ```

3. Install system dependencies and build tools via Conda
    ```bash
    conda install -c conda-forge gcc_linux-64 gxx_linux-64 cmake make meson pkg-config \
        eigen elfutils libwebsockets protobuf libcurl openssl libdwarf \
        sqlite nlohmann_json pybind11_json pybind11
    ```


4. Install Python dependencies
    ```bash
    pip3 install pytest perfetto PyYAML tqdm packaging loguru PrettyTable matplotlib pandas ninja==1.11.1.3
    pip3 install torch torchvision torchaudio
    ```

5. Build and install python package from source
    ```bash
    # build and install gwatch
    python3 setup.py clean  
    python3 setup.py install

    # install gwatch skills for codex/claude/gemini-cli
    gwatch install_skill
    ```


### [![release](https://img.shields.io/badge/Release-pink.svg?logo=pypi)]() Build Wheel

1. Build the wheel package

    ```bash
    cd G-Watch-dev
    python3 setup.py clean
    python3 setup.py bdist_wheel

    # Optional: use auditwheel to bundle external system libraries if needed
    # Note: auditwheel requires the 'auditwheel' package (pip install auditwheel)
    auditwheel repair \
        --exclude "libcuda.so.*"        \
        --exclude "libcudart.so*"       \
        --exclude "libcupti.so*"        \
        --exclude "libnvperf.so*"       \
        --exclude "libnvidia-ml.so*"    \
        --exclude "libcheckpoint.so"    \
        ./dist/gwatch*.whl
    ```

2. Release the wheel package

    ```bash
    # check the wheel package
    twine check wheelhouse/gwatch*.whl

    # upload the wheel package to PyPI
    twine upload wheelhouse/gwatch*.whl
    ```
