Unverified Commit 701c6fe7 authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

[Readability] Auto fix setup.py and update-version.py (#4446)



* Auto fix update-version

* Auto fix setup.py

* Auto fix update-version

* Auto fix setup.py

* [Doc] Change random.py to random_partition.py in guide on distributed partition pipeline (#4438)

* Update distributed-preprocessing.rst

* Update
Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-9-26.ap-northeast-1.compute.internal>

* fix unpinning when tensoradaptor is not available (#4450)

* [Doc] fix print issue in tutorial (#4459)

* [Example][Refactor] Refactor RGCN example (#4327)

* Refactor full graph entity classification

* Refactor rgcn with sampling

* README update

* Update

* Results update

* Respect default setting of self_loop=false in entity.py

* Update

* Update README

* Update for multi-gpu

* Update

* [doc] fix invalid link in user guide (#4468)

* [Example] directional_GSN for ogbg-molpcba (#4405)

* version-1

* version-2

* version-3

* update examples/README

* Update .gitignore

* update performance in README, delete scripts

* 1st approving review

* 2nd approving review
Co-authored-by: default avatarMufei Li <mufeili1996@gmail.com>

* Clarify the message name, which is 'm'. (#4462)
Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
Co-authored-by: default avatarRhett Ying <85214957+Rhett-Ying@users.noreply.github.com>

* [Refactor] Auto fix view.py. (#4461)
Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>

* [Example] SEAL for OGBL (#4291)

* [Example] SEAL for OGBL

* update index

* update

* fix readme typo

* add seal sampler

* modify set ops

* prefetch

* efficiency test

* update

* optimize

* fix ScatterAdd dtype issue

* update sampler style

* update
Co-authored-by: default avatarQuan Gan <coin2028@hotmail.com>

* [CI] use https instead of http (#4488)

* [BugFix] fix crash due to incorrect dtype in dgl.to_block() (#4487)

* [BugFix] fix crash due to incorrect dtype in dgl.to_block()

* fix test failure in TF

* [Feature] Make TensorAdapter Stream Aware (#4472)

* Allocate tensors in DGL's current stream

* make tensoradaptor stream-aware

* replace TAemtpy with cpu allocator

* fix typo

* try fix cpu allocation

* clean header

* redirect AllocDataSpace as well

* resolve comments

* [Build][Doc] Specify the sphinx version (#4465)
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>

* reformat

* reformat

* Auto fix update-version

* Auto fix setup.py

* reformat

* reformat
Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
Co-authored-by: default avatarRhett Ying <85214957+Rhett-Ying@users.noreply.github.com>
Co-authored-by: default avatarMufei Li <mufeili1996@gmail.com>
Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-9-26.ap-northeast-1.compute.internal>
Co-authored-by: default avatarXin Yao <xiny@nvidia.com>
Co-authored-by: default avatarChang Liu <chang.liu@utexas.edu>
Co-authored-by: default avatarZhiteng Li <55398076+ZHITENGLI@users.noreply.github.com>
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
Co-authored-by: default avatarrudongyu <ru_dongyu@outlook.com>
Co-authored-by: default avatarQuan Gan <coin2028@hotmail.com>
parent 11532198
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, platform, sysconfig
import sys
import os
import platform
import sysconfig
import shutil
import glob
......@@ -15,19 +18,25 @@ else:
from setuptools import setup
from setuptools.extension import Extension
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True
CURRENT_DIR = os.path.dirname(__file__)
def get_lib_path():
"""Get library path, name and version"""
# We can not import `libinfo.py` in setup.py directly since __init__.py
# We can not import `libinfo.py` in setup.py directly since __init__.py
# Will be invoked which introduces dependences
libinfo_py = os.path.join(CURRENT_DIR, './dgl/_ffi/libinfo.py')
libinfo = {'__file__': libinfo_py}
exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo)
exec(
compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'),
libinfo,
libinfo)
version = libinfo['__version__']
lib_path = libinfo['find_lib_path']()
......@@ -35,6 +44,7 @@ def get_lib_path():
return libs, version
def get_ta_lib_pattern():
if sys.platform.startswith('linux'):
ta_lib_pattern = 'libtensoradapter_*.so'
......@@ -46,31 +56,39 @@ def get_ta_lib_pattern():
raise NotImplementedError('Unsupported system: %s' % sys.platform)
return ta_lib_pattern
LIBS, VERSION = get_lib_path()
BACKENDS = ['pytorch']
TA_LIB_PATTERN = get_ta_lib_pattern()
def cleanup():
# Wheel cleanup
try:
os.remove("MANIFEST.in")
except:
except BaseException:
pass
for path in LIBS:
_, libname = os.path.split(path)
try:
os.remove(os.path.join("dgl", libname))
except:
except BaseException:
pass
for backend in BACKENDS:
for ta_path in glob.glob(
os.path.join(CURRENT_DIR, "dgl", "tensoradapter", backend, TA_LIB_PATTERN)):
os.path.join(
CURRENT_DIR,
"dgl",
"tensoradapter",
backend,
TA_LIB_PATTERN)):
try:
os.remove(ta_path)
except:
except BaseException:
pass
def config_cython():
"""Try to configure cython and return cython configuration"""
if sys.platform.startswith('win'):
......@@ -79,7 +97,8 @@ def config_cython():
sys_cflags = sysconfig.get_config_var("CFLAGS")
if "i386" in sys_cflags and "x86_64" in sys_cflags:
print("WARNING: Cython library may not be compiled correctly with both i386 and x64")
print(
"WARNING: Cython library may not be compiled correctly with both i386 and x64")
return []
try:
from Cython.Build import cythonize
......@@ -101,7 +120,7 @@ def config_cython():
include_dirs=["../include/",
"../third_party/dmlc-core/include",
"../third_party/dlpack/include",
],
],
library_dirs=library_dirs,
libraries=libraries,
language="c++"))
......@@ -110,6 +129,7 @@ def config_cython():
print("WARNING: Cython is not installed, will compile without cython module")
return []
include_libs = False
wheel_include_libs = False
if "bdist_wheel" in sys.argv or os.getenv('CONDA_BUILD'):
......@@ -130,13 +150,26 @@ if wheel_include_libs:
fo.write("include dgl/%s\n" % libname)
for backend in BACKENDS:
for ta_path in glob.glob(os.path.join(dir_, "tensoradapter", backend, TA_LIB_PATTERN)):
for ta_path in glob.glob(
os.path.join(
dir_,
"tensoradapter",
backend,
TA_LIB_PATTERN)):
ta_name = os.path.basename(ta_path)
os.makedirs(os.path.join(CURRENT_DIR, 'dgl', 'tensoradapter', backend), exist_ok=True)
os.makedirs(
os.path.join(
CURRENT_DIR,
'dgl',
'tensoradapter',
backend),
exist_ok=True)
shutil.copy(
os.path.join(dir_, 'tensoradapter', backend, ta_name),
os.path.join(CURRENT_DIR, 'dgl', 'tensoradapter', backend))
fo.write("include dgl/tensoradapter/%s/%s\n" % (backend, ta_name))
fo.write(
"include dgl/tensoradapter/%s/%s\n" %
(backend, ta_name))
setup_kwargs = {
"include_package_data": True
......
......@@ -15,6 +15,8 @@ __version__ = "0.9" + os.getenv('DGL_PRERELEASE', '')
print(__version__)
# Implementations
def update(file_name, pattern, repl):
update = []
hit_counter = 0
......@@ -48,12 +50,20 @@ def main():
update(os.path.join(proj_root, "python", "dgl", "_ffi", "libinfo.py"),
r"(?<=__version__ = \")[.0-9a-z]+", __version__)
# C++ header
update(os.path.join(proj_root, "include", "dgl", "runtime", "c_runtime_api.h"),
"(?<=DGL_VERSION \")[.0-9a-z]+", __version__)
update(
os.path.join(
proj_root,
"include",
"dgl",
"runtime",
"c_runtime_api.h"),
"(?<=DGL_VERSION \")[.0-9a-z]+",
__version__)
# conda
for path in ["dgl"]:
update(os.path.join(proj_root, "conda", path, "meta.yaml"),
"(?<=version: \")[.0-9a-z]+", __version__)
if __name__ == "__main__":
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment