SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.PHONY: help doctor bootstrap-cutlass cutlass-check docs docs-open examples profile matmul-profile dense-vector-profile graph-profile check
CUTLASS_VERSION := v4.4.2
CUTLASS_DIR ?= $(HOME)/.cache/mircuda/cutlass-$(CUTLASS_VERSION)
help:
@awk 'BEGIN {FS = ":.*## "; printf "Mircuda commands:\n\n"} \
/^[a-zA-Z_-]+:.*## / {printf " %-14s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
doctor:
@test "$$(uname -s)" = Linux
@command -v nvidia-smi >/dev/null
@command -v nvcc >/dev/null
@command -v rustc >/dev/null
@nvidia-smi --query-gpu=name,compute_cap --format=csv,noheader
@nvcc --version | tail -1
@rustc --version
bootstrap-cutlass:
@if test ! -d "$(CUTLASS_DIR)/.git"; then \
mkdir -p "$(dir $(CUTLASS_DIR))"; \
git clone --depth 1 --branch "$(CUTLASS_VERSION)" \
https://github.com/NVIDIA/cutlass.git "$(CUTLASS_DIR)"; \
fi
@git -C "$(CUTLASS_DIR)" describe --tags --exact-match
cutlass-check: doctor bootstrap-cutlass
@cargo test -p mircuda --test cutlass_dense
@cargo test -p mircuda --test cutlass_fp4
@cargo test -p mircuda --test cutlass_fp8
@cargo test -p mircuda --test cutlass_grouped_fp4
docs:
@RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps
docs-open:
@RUSTDOCFLAGS="-D warnings" cargo doc -p mircuda --no-deps --open
examples:
@cargo check -p mircuda --examples
profile: doctor
@cargo run --release --example profile
matmul-profile: doctor bootstrap-cutlass
@cargo run --release --example matmul
dense-vector-profile: doctor bootstrap-cutlass
@cargo run --release --example dense-vector
graph-profile: doctor bootstrap-cutlass
@cargo run --release --example graph
check:
@if test "$$(uname -s)" = Linux; then $(MAKE) --no-print-directory bootstrap-cutlass; fi
@cargo fmt --all --check
@cargo clippy --workspace --all-targets --all-features -- -D warnings
@cargo test --workspace --all-features
@$(MAKE) docs