-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (77 loc) · 2.64 KB
/
Makefile
File metadata and controls
91 lines (77 loc) · 2.64 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
.PHONY: setup clean dev lint format submodules
PYTHON := python3.11
UV := uv
VENV_BIN := $(CURDIR)/.venv/bin
CONDA_ENV_NAME := vortex
PYTHON_VERSION := $(shell $(PYTHON) -c 'import sys; print(sys.version_info[0])')
TARGET_PYTHON_VERSION := 3.11
CUDA_PATH := /usr/local/cuda
CUDA_INCLUDE_PATH := $(CUDA_PATH)/include
CUDA_LIB_PATH := $(CUDA_PATH)/lib64
CPATH := $(CUDA_INCLUDE_PATH):/usr/local/cuda/include
CUDACXX := /usr/local/cuda/bin/nvcc
CUDA_HOME := $(CUDA_PATH)
_detect_cuda_path:
ifndef CUDA_PATH
NVCC_BIN := $(shell which nvcc 2>/dev/null)
ifneq ($(NVCC_BIN),)
# Derive CUDA_PATH by going one directory up from nvcc's bin directory
CUDA_PATH := $(dir $(NVCC_BIN))..
CUDA_PATH := $(realpath $(CUDA_PATH))
endif
endif
_check_env_enabled:
ifneq ($(VIRTUAL_ENV),)
$(info Detected active Python venv at $(VIRTUAL_ENV))
ENV_ACTIVE := UV # Using a UV/venv environment
else ifdef CONDA_PREFIX
$(info Detected Conda environment "$(CONDA_DEFAULT_ENV)")
ifeq ($(CONDA_DEFAULT_ENV), base)
$(info Base Conda environment is active; please create a new environment for vortex)
exit 1
endif
ENV_ACTIVE := CONDA # Using a Conda environment
else
ENV_ACTIVE := NONE # No environment active
endif
_setup_missing_env:
ifeq ($(ENV_ACTIVE), NONE)
ifneq ($(shell which uv 2>/dev/null),)
$(info No env active; creating a new uv virtual environment)
uv venv .venv --python=$(TARGET_PYTHON_VERSION)
source .venv/bin/activate # activate it for the remainder of the make
else ifneq ($(shell which conda 2>/dev/null),)
$(info No env active; creating a new Conda environment)
conda env create -n $(CONDA_ENV_NAME) -f environment.yml
conda activate $(CONDA_ENV_NAME)
else
$(error Neither uv nor Conda is available for environment creation)
endif
endif
setup-full: submodules
pip install ninja cmake pybind11 numpy psutil
pip install transformer-engine-torch==2.3.0
pip install flash-attn==2.8.0.post2
pip install -e .
setup-vortex-ops: submodules _check_env_enabled _setup_missing_env
pip install ninja cmake pybind11 numpy psutil
cd vortex/ops/hyenax && pip install -e .
pip install -e . --config-settings=build-script=local_setup.py
setup-vortex-ops-hyenax: _check_env_enabled _setup_missing_env
cd vortex/ops/hyenax && pip install -e .
submodules:
git submodule update --init --recursive
clean:
rm -rf .venv
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
lint:
ruff check .
black --check .
format:
ruff check --fix .
black -l 120 .
rebuild: clean setup