-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathsetup.py
More file actions
110 lines (98 loc) · 3.48 KB
/
Copy pathsetup.py
File metadata and controls
110 lines (98 loc) · 3.48 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# SPDX-FileCopyrightText: Copyright (c) 2025-present NVIDIA CORPORATION & AFFILIATES.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Usage:
# pip install --no-build-isolation -e python -v
# This build command is equivalent to: python setup.py develop
# Options:
# -v: verbose output
# --no-build-isolation: don't build in a temporary directory
# -e: install in development mode
#
# Environment variables used during build:
# MAX_JOBS
# maximum number of compile jobs we should use to compile your code
#
# NVFUSER_BUILD_CMAKE_ONLY
# Only generate ./build directory with cmake setup
#
# NVFUSER_BUILD_NO_PYTHON
# Skips python API target `libnvfuser.so`, i.e. `_C.cpython-xxx.so`
#
# NVFUSER_BUILD_NO_TEST
# Skips cpp tests `test_nvfuser`
#
# NVFUSER_BUILD_NO_BENCHMARK
# Skips benchmark target `nvfuser_bench`
#
# NVFUSER_BUILD_NO_NINJA
# In case you want to use make instead of ninja for build
#
# NVFUSER_BUILD_WITH_UCC
# Build nvfuser with UCC support. You may need to specify environment variables of UCC_HOME, UCC_DIR, UCX_HOME, UCX_DIR.
#
# NVFUSER_BUILD_WITHOUT_DISTRIBUTED
# Build nvfuser without multidevice support
#
# NVFUSER_BUILD_BUILD_TYPE=Debug
# Building nvfuser in debug mode
#
# NVFUSER_BUILD_BUILD_TYPE=RelwithDebInfo
# Building nvfuser in release mode with debug info, a.k.a. RelwithDebInfo
#
# NVFUSER_BUILD_DIR=<ABSOLUTE PATH>
# Specify in which directory to build nvfuser. If not specified, the default build directory is "./build".
#
# NVFUSER_BUILD_INSTALL_DIR=<ABSOLUTE PATH>
# Specify in which directory to install nvfuser. If not specified, the default install directory is "./python/nvfuser".
#
# NVFUSER_BUILD_VERSION_TAG=TAG
# Specify the tag for build nvfuser version, this is used for pip wheel
# package nightly where we might want to add a date tag
# nvfuser-VERSION+TAG+gitSHA1-....-whl
#
# NVFUSER_BUILD_INSTALL_REQUIRES=pkg0[,pkg1...]
# this is used for pip wheel build to specify package required for install
# e.g. NVFUSER_BUILD_INSTALL_REQUIRES=nvidia-cuda-nvrtc-cu12
#
# NVFUSER_BUILD_NVMMH_INCLUDE_DIR=<ABSOLUTE PATH>
# Specify the location to find nvMatmulHeuristics.h
#
# NVFUSER_BUILD_WHEEL_NAME=NAME
# Specify the wheel name this is used for pip wheel package where we want
# to identify the cuda toolkit version
#
# NVFUSER_BUILD_CPP_STANDARD=STANDARD
# Specify the C++ standard to use for building nvfuser. The default is C++20.
#
# NVFUSER_BUILD_ENABLE_PCH=1
# Enable precompiled headers to speed up compilation. Default is OFF.
#
import sys
from utils import (
BuildConfig,
run,
override_build_config_from_env,
)
def version_tag(config):
from tools.gen_nvfuser_version import get_version
version = get_version()
if config.overwrite_version:
version = version.split("+")[0]
if len(config.version_tag) != 0:
# use "." to be pypi friendly
version = ".".join([version, config.version_tag])
return version
def main():
config = BuildConfig()
# Override build config from environment variables.
override_build_config_from_env(config)
if "clean" in sys.argv:
# only disables BUILD_SETUP, but keep the argument for setuptools
config.build_setup = False
if config.cpp_standard < 20:
raise ValueError("nvfuser requires C++20 standard or higher")
run(config, version_tag(config), relative_path="..")
if __name__ == "__main__":
main()