[TRITON][PYTHON] Reverted back to distutils
This commit is contained in:
committed by
Philippe Tillet
parent
955b027103
commit
c33d6d15f5
@@ -39,7 +39,7 @@ def _build(src, path, name):
|
|||||||
libraries = ['triton']
|
libraries = ['triton']
|
||||||
# create extension module
|
# create extension module
|
||||||
abi = fw.torch._C._GLIBCXX_USE_CXX11_ABI
|
abi = fw.torch._C._GLIBCXX_USE_CXX11_ABI
|
||||||
extra_compile_args = ['-fPIC', '-Wno-deprecated-declarations', '-D_GLIBCXX_USE_CXX11_ABI={abi}'.format(abi=abi)]
|
extra_compile_args = ['-fPIC', '-Wno-deprecated-declarations', f'-D_GLIBCXX_USE_CXX11_ABI={str(int(abi))}']
|
||||||
extra_compile_args += ['-DTORCH_EXTENSION_NAME={}'.format(name)]
|
extra_compile_args += ['-DTORCH_EXTENSION_NAME={}'.format(name)]
|
||||||
extra_compile_args += ['-DTORCH_API_INCLUDE_EXTENSION_H']
|
extra_compile_args += ['-DTORCH_API_INCLUDE_EXTENSION_H']
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ def _make_framework_op(arg_types):
|
|||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
pass
|
pass
|
||||||
suffix = sysconfig.get_config_var('EXT_SUFFIX')
|
suffix = sysconfig.get_config_var('EXT_SUFFIX')
|
||||||
so = os.path.join(root, f'{name}.so')
|
so = os.path.join(root, f'op{suffix}')
|
||||||
cpp = os.path.join(root, f'op.cpp')
|
cpp = os.path.join(root, f'op.cpp')
|
||||||
# handle cached .so file
|
# handle cached .so file
|
||||||
if os.path.exists(so) and os.stat(so).st_size > 0:
|
if os.path.exists(so) and os.stat(so).st_size > 0:
|
||||||
@@ -132,21 +132,7 @@ def _make_framework_op(arg_types):
|
|||||||
handle.writelines(src)
|
handle.writelines(src)
|
||||||
ccdir = os.path.join(libtriton.__file__, os.path.pardir)
|
ccdir = os.path.join(libtriton.__file__, os.path.pardir)
|
||||||
ccdir = os.path.realpath(ccdir)
|
ccdir = os.path.realpath(ccdir)
|
||||||
#include_dirs = [os.path.join(ccdir, 'include')]
|
_build(cpp, root, 'op')
|
||||||
#library_dirs = [ccdir]
|
|
||||||
#_build(cpp, root, 'op')
|
|
||||||
#libraries = ['triton']
|
|
||||||
machine = platform.machine()
|
|
||||||
torch.utils.cpp_extension._write_ninja_file_and_build(
|
|
||||||
name=name,
|
|
||||||
sources=[cpp],
|
|
||||||
extra_cflags=['-std=gnu++11'] if machine == 'ppc64le' else [],
|
|
||||||
extra_cuda_cflags=[],
|
|
||||||
extra_ldflags=[f'-L{ccdir}', '-ltriton'],
|
|
||||||
extra_include_paths=[os.path.join(ccdir, 'include')],
|
|
||||||
build_directory=root,
|
|
||||||
verbose=False,
|
|
||||||
with_cuda=True)
|
|
||||||
finally:
|
finally:
|
||||||
baton.release()
|
baton.release()
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user