[BUILD] use ninja (#2318)

This commit is contained in:
Justin Lebar
2023-09-17 02:08:04 -07:00
committed by GitHub
parent c98671cf7c
commit 073aa16379
4 changed files with 7 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools>=40.8.0", "wheel", "cmake>=3.18"]
requires = ["setuptools>=40.8.0", "wheel", "cmake>=3.18", "ninja>=1.11.1"]
[tool.autopep8]
aggressive = 1

View File

@@ -127,13 +127,10 @@ def get_thirdparty_packages(triton_cache_path):
def download_and_copy(src_path, version, url_func):
base_dir = os.path.dirname(__file__)
# src_path = "bin/ptxas"
# version = "12.1.105"
arch = platform.machine()
if arch == "x86_64":
arch = "64"
url = url_func(arch, version)
# url = f"https://conda.anaconda.org/nvidia/label/cuda-12.1.1/linux-{arch}/cuda-nvcc-{version}-0.tar.bz2"
dst_prefix = os.path.join(base_dir, "triton")
dst_suffix = os.path.join("third_party", "cuda", src_path)
dst_path = os.path.join(dst_prefix, dst_suffix)
@@ -219,6 +216,7 @@ class CMakeBuild(build_ext):
def build_extension(self, ext):
lit_dir = shutil.which('lit')
ninja_dir = shutil.which('ninja')
user_home = os.getenv("HOME") or os.getenv("USERPROFILE") or \
os.getenv("HOMEPATH") or None
if not user_home:
@@ -233,6 +231,8 @@ class CMakeBuild(build_ext):
# python directories
python_include_dir = sysconfig.get_path("platinclude")
cmake_args = [
"-G", "Ninja", # Ninja is much faster than make
"-DCMAKE_MAKE_PROGRAM=" + ninja_dir, # Pass explicit path to ninja otherwise cmake may cache a temporary path
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DLLVM_ENABLE_WERROR=ON",
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + extdir,