Skip to content

Commit

Permalink
patch setuptools (#135)
Browse files Browse the repository at this point in the history
1. adding --no-ninja option to use make instead;
2. adding BSD-3-Clause as license for the wheel package;
3. skip `nvfuser-patch` for bdist_wheel build, since we are not
installation the package entry_points are not available yet.
  • Loading branch information
jjsjann123 authored Apr 8, 2023
1 parent 94cfd37 commit 8cdb366
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pybind11[global]
ninja
23 changes: 18 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
# --no-benchmark
# Skips benchmark target `nvfuser_bench`
#
# --no-ninja
# In case you want to use make instead of ninja for build
#

import multiprocessing
import os
Expand All @@ -34,6 +37,8 @@
NO_PYTHON = False
NO_TEST = False
NO_BENCHMARK = False
NO_NINJA = False
PATCH_NVFUSER = True
forward_args = []
for i, arg in enumerate(sys.argv):
if arg == "--cmake-only":
Expand All @@ -48,9 +53,15 @@
if arg == "--no-benchmark":
NO_BENCHMARK = True
continue
if arg == "--no-ninja":
NO_NINJA = True
continue
if arg in ["clean"]:
# only disables BUILD_SETUP, but keep the argument for setuptools
BUILD_SETUP = False
if arg in ["bdist_wheel"]:
# bdist_wheel doesn't install entry-points, so we can't really patch it yet
PATCH_NVFUSER = False
forward_args.append(arg)
sys.argv = forward_args

Expand Down Expand Up @@ -207,10 +218,11 @@ def cmake():
pytorch_cmake_config,
"-B",
build_dir_name,
"-G",
"Ninja",
".",
]
if not NO_NINJA:
cmd_str.append("-G")
cmd_str.append("Ninja")
cmd_str.append(".")
if not NO_TEST:
cmd_str.append("-DBUILD_TEST=ON")
if not NO_PYTHON:
Expand Down Expand Up @@ -251,8 +263,8 @@ def main():

setup(
name="nvfuser",
# query nvfuser version
version=get_version(),
url="https://github.com/NVIDIA/Fuser",
description="A Fusion Code Generator for NVIDIA GPUs (commonly known as 'nvFuser')",
packages=["nvfuser", "nvfuser_python_utils"],
ext_modules=[Extension(name=str("nvfuser._C"), sources=[])],
Expand All @@ -270,9 +282,10 @@ def main():
"patch-nvfuser = nvfuser_python_utils:patch_installation",
],
},
license="BSD-3-Clause",
)

if BUILD_SETUP:
if BUILD_SETUP and PATCH_NVFUSER:
subprocess.check_call(["patch-nvfuser"])


Expand Down

0 comments on commit 8cdb366

Please sign in to comment.