Metadata-Version: 2.4
Name: gwatch
Version: 0.0.16
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

![nvidia](https://img.shields.io/badge/NVIDIA-Supported-green.svg?logo=nvidia)
![nvidia](https://img.shields.io/badge/AMD-Supported-red.svg?logo=amd)

<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.


## ⚙️ Build and Installation

### Option 1. Direct Install

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
```


### Option 2. Build from Source with `Conda`

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
    cd G-Watch-dev
    ```

2. Create and activate a conda environment
    ```bash
    conda create -n gw312 python=3.12 gcc_linux-64=13 gxx_linux-64=13 sysroot_linux-64=2.34 -c conda-forge
    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 libprotobuf=4.25.1 protobuf=4.25.1 libcurl openssl libdwarf \
        sqlite nlohmann_json pybind11_json pybind11 yaml-cpp
    ```


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
    # export conda environment variables for linking
    export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH

    # build and install gwatch
    python3 setup.py clean  
    python3 setup.py bdist_wheel
    pip3 install dist/gwatch*.whl

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


## 📃 Usage

In your Code Agent, use G-Watch skills, and run

```bash
# the auto optimization skill
/gwatch_cuda_auto_optimization

# brief description of the workload
workload is under xxx/xxx, i want to optimize the performance of xx operator/kernel 
```
