forked from frkri/ModelRunner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (64 loc) · 1.73 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Variables
CARGO := cargo
BIN_NAME := model_runner
# Default target
all: build-cuda
# Detect OS for Metal support
UNAME_S := $(shell uname -s)
# Build the project with CUDA support
build-cuda:
$(CARGO) build --bin $(BIN_NAME) --release --features cuda,cudnn
# Build the project with Metal support (macOS only)
build-metal:
ifeq ($(UNAME_S),Darwin)
$(CARGO) build --bin $(BIN_NAME) --release --features metal
else
@echo "Metal is only supported on macOS"
endif
# Run the project with CUDA
run-cuda: build-cuda
$(CARGO) run --bin $(BIN_NAME) --release --features cuda,cudnn
# Run the project with Metal (macOS only)
run-metal: build-metal
ifeq ($(UNAME_S),Darwin)
$(CARGO) run --bin $(BIN_NAME) --release --features metal
else
@echo "Metal is only supported on macOS"
endif
# Clean the project
clean:
$(CARGO) clean
# Check the project for errors without building (CUDA)
check-cuda:
$(CARGO) check --bin $(BIN_NAME) --features cuda,cudnn
# Check the project for errors without building (Metal)
check-metal:
ifeq ($(UNAME_S),Darwin)
$(CARGO) check --bin $(BIN_NAME) --features metal
else
@echo "Metal is only supported on macOS"
endif
# Run tests (CUDA)
test-cuda:
$(CARGO) test --features cuda,cudnn
# Run tests (Metal)
test-metal:
ifeq ($(UNAME_S),Darwin)
$(CARGO) test --features metal
else
@echo "Metal is only supported on macOS"
endif
# Format the code
fmt:
$(CARGO) fmt
# Run clippy for linting (CUDA)
lint-cuda:
$(CARGO) clippy --features cuda,cudnn
# Run clippy for linting (Metal)
lint-metal:
ifeq ($(UNAME_S),Darwin)
$(CARGO) clippy --features metal
else
@echo "Metal is only supported on macOS"
endif
.PHONY: all build-cuda build-metal run-cuda run-metal clean check-cuda check-metal test-cuda test-metal fmt lint-cuda lint-metal