A simple tool to compile and run CUDA kernels on local GPUs or Modal cloud infrastructure
Project description
minimodal
A simple command-line tool to compile and run CUDA kernels on local GPUs or Modal cloud infrastructure.
Features:
- Automatic GPU detection and architecture mapping
- Seamless fallback to Modal cloud GPUs when local GPU isn't available
- Support for include directories and custom nvcc flags
- Works with Modal GPU naming convention (A10G, H100, B200, etc.)
Installation
uv pip install minimodal
Or install from source:
cd minimodal
uv pip install -e .
Usage
Basic usage (defaults to A10G):
minimodal v1.cu
With a specific GPU:
minimodal v1.cu --gpu H100
With include directories:
minimodal v1.cu --gpu B200 -I ./includes
With execution arguments:
minimodal v1.cu --gpu A100 --exec-args "--N 2097152 --warmup 5"
With custom nvcc flags:
minimodal kernel.cu --gpu H100 -I ./includes --nvcc-flags "-O3 --ptxas-options=-v"
Supported GPUs
The tool automatically detects GPU architecture for common GPU models:
- H100 / H800 → sm_90
- A100 / A800 → sm_80
- A10G → sm_86
- B200 / B100 → sm_100a
- RTX4090 → sm_89
- RTX3090 / RTX3080 → sm_86
- V100 → sm_70
- T4 → sm_75
You can also specify the architecture directly using --arch:
minimodal kernel.cu --arch 100a
Options
--gpu,-g: GPU name (e.g., A10G, H100, B200, A100) or architecture (e.g., 100a, 90). Default: A10G--include-dir,-I: Include directory. Can be specified multiple times.--exec-args: Arguments to pass to the compiled CUDA executable.--arch: Override architecture. If not specified, inferred from--gpu.--output,-o: Output executable path. If not specified, uses temporary file.--keep-binary: Keep the compiled binary after execution.--nvcc-flags: Additional flags to pass to nvcc (e.g., '-O3 --ptxas-options=-v').
Requirements
- CUDA toolkit with
nvcccompiler - NVIDIA GPU drivers
nvidia-smicommand-line tool
Examples
Compile and run a CUDA kernel (defaults to A10G):
minimodal v1.cu
Compile and run on a specific GPU:
minimodal v1.cu --gpu H100
Compile with multiple include directories:
minimodal kernel.cu --gpu B200 -I ./includes -I ./headers
Run with custom arguments:
minimodal benchmark.cu --gpu A100 --exec-args "--size 4096 --iterations 100"
Development
To develop locally:
git clone <repository-url>
cd minimodal
uv pip install -e .
Publishing to PyPI
# Build distribution
uv build
# Upload to PyPI
uv pip install twine
twine upload dist/*
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minimodal-0.1.0.tar.gz.
File metadata
- Download URL: minimodal-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c59d7444cb116c3bcc99b001f4377b68d200e584eacc2f00e35e8e8361b49b96
|
|
| MD5 |
c6351c44f005d3211333c2406ef5584c
|
|
| BLAKE2b-256 |
5db8ebe3808d5d0806858c195fcfbc31f086fad86d9faea8cf89b905b0d78cbc
|
File details
Details for the file minimodal-0.1.0-py3-none-any.whl.
File metadata
- Download URL: minimodal-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2fc70d48aab1acaad684a9417a7bdcadf0c77b446a076d882c042b1ea685040
|
|
| MD5 |
8a84e713478ea3147030f11c029298a9
|
|
| BLAKE2b-256 |
5cf9533a55e3ae6dcc2eba8761e17f1de3a2a0006b8f6dc60adb89faf2ef894e
|