Skip to content

Commit

Permalink
[BUILD] use ninja (triton-lang#2318)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlebar authored and zhanglx13 committed Sep 18, 2023
1 parent b25557a commit 2a3746b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
cd python
python3 -m pip install --upgrade pip
python3 -m pip install cmake==3.24
python3 -m pip install ninja
python3 -m pip install --no-build-isolation -vvv '.[tests]'
python3 -m pip install pytest-xdist
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ git checkout triton-mlir
# Build
```
cd python
pip3 install cmake; # build time dependency
pip3 install ninja cmake; # build time dependencies
pip3 install -e .
```
# Run tests:
Expand All @@ -60,7 +60,7 @@ lit -v test
```
git clone https://github.com/openai/triton.git;
cd triton/python;
pip install cmake; # build-time dependency
pip install ninja cmake; # build-time dependencies
pip install -e .
```

Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def get_cmake_dir(self):

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:
Expand All @@ -216,6 +217,8 @@ def build_extension(self, 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,
Expand Down

0 comments on commit 2a3746b

Please sign in to comment.