[BUILD] Change the default build type to Release (#571)
This commit is contained in:
@@ -3,11 +3,6 @@ include(ExternalProject)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
if(NOT TRITON_LLVM_BUILD_DIR)
|
|
||||||
set(TRITON_LLVM_BUILD_DIR ${CMAKE_BINARY_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
project(triton)
|
project(triton)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
|
@@ -7,7 +7,6 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
import tempfile
|
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
@@ -15,6 +14,20 @@ from setuptools import Extension, setup
|
|||||||
from setuptools.command.build_ext import build_ext
|
from setuptools.command.build_ext import build_ext
|
||||||
|
|
||||||
|
|
||||||
|
# Taken from https://github.com/pytorch/pytorch/blob/master/tools/setup_helpers/env.py
|
||||||
|
def check_env_flag(name: str, default: str = "") -> bool:
|
||||||
|
return os.getenv(name, default).upper() in ["ON", "1", "YES", "TRUE", "Y"]
|
||||||
|
|
||||||
|
|
||||||
|
def get_build_type():
|
||||||
|
if check_env_flag("DEBUG"):
|
||||||
|
return "Debug"
|
||||||
|
elif check_env_flag("REL_WITH_DEB_INFO"):
|
||||||
|
return "RelWithDebInfo"
|
||||||
|
else:
|
||||||
|
return "Release"
|
||||||
|
|
||||||
|
|
||||||
def get_llvm():
|
def get_llvm():
|
||||||
# tries to find system LLVM
|
# tries to find system LLVM
|
||||||
versions = ['-11.0', '-11', '-11-64']
|
versions = ['-11.0', '-11', '-11-64']
|
||||||
@@ -80,15 +93,10 @@ class CMakeBuild(build_ext):
|
|||||||
|
|
||||||
def build_extension(self, ext):
|
def build_extension(self, ext):
|
||||||
llvm_include_dir, llvm_library_dir = get_llvm()
|
llvm_include_dir, llvm_library_dir = get_llvm()
|
||||||
self.debug = True
|
|
||||||
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.path)))
|
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.path)))
|
||||||
# create build directories
|
# create build directories
|
||||||
build_suffix = 'debug' if self.debug else 'release'
|
|
||||||
llvm_build_dir = os.path.join(tempfile.gettempdir(), "llvm-" + build_suffix)
|
|
||||||
if not os.path.exists(self.build_temp):
|
if not os.path.exists(self.build_temp):
|
||||||
os.makedirs(self.build_temp)
|
os.makedirs(self.build_temp)
|
||||||
if not os.path.exists(llvm_build_dir):
|
|
||||||
os.makedirs(llvm_build_dir)
|
|
||||||
# python directories
|
# python directories
|
||||||
python_include_dirs = [distutils.sysconfig.get_python_inc()] + ['/usr/local/cuda/include']
|
python_include_dirs = [distutils.sysconfig.get_python_inc()] + ['/usr/local/cuda/include']
|
||||||
cmake_args = [
|
cmake_args = [
|
||||||
@@ -99,11 +107,10 @@ class CMakeBuild(build_ext):
|
|||||||
"-DLLVM_LIBRARY_DIR=" + llvm_library_dir,
|
"-DLLVM_LIBRARY_DIR=" + llvm_library_dir,
|
||||||
# '-DPYTHON_EXECUTABLE=' + sys.executable,
|
# '-DPYTHON_EXECUTABLE=' + sys.executable,
|
||||||
# '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON',
|
# '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON',
|
||||||
"-DTRITON_LLVM_BUILD_DIR=" + llvm_build_dir,
|
|
||||||
"-DPYTHON_INCLUDE_DIRS=" + ";".join(python_include_dirs)
|
"-DPYTHON_INCLUDE_DIRS=" + ";".join(python_include_dirs)
|
||||||
]
|
]
|
||||||
# configuration
|
# configuration
|
||||||
cfg = "Debug" if self.debug else "Release"
|
cfg = get_build_type()
|
||||||
build_args = ["--config", cfg]
|
build_args = ["--config", cfg]
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
|
Reference in New Issue
Block a user