From 001c438cd8acbbef8ab0e9655bbf1b10c58c9058 Mon Sep 17 00:00:00 2001 From: Yaoyao Ding Date: Thu, 5 Jan 2023 21:39:23 -0500 Subject: [PATCH] [Release] Prepare to release the first version of hidet to public (#59) * bump version & update doc * . * . --- CMakeLists.txt | 3 +++ README.md | 12 ++++----- .../hidet-script-dynamic-kernel.py | 10 +++++--- python/hidet/version.py | 2 +- scripts/build_wheel.sh | 9 +++++++ scripts/ci/build_wheel_manylinux1.sh | 16 ++++++++++++ scripts/ci/dockerfiles/manylinux1/Dockerfile | 7 ++++++ .../ci/dockerfiles/manylinux1/build_image.sh | 7 ++++++ scripts/update_version.py | 1 + scripts/upload_wheel.sh | 8 ++++++ setup.py | 25 ++++++------------- 11 files changed, 73 insertions(+), 27 deletions(-) create mode 100644 scripts/ci/build_wheel_manylinux1.sh create mode 100644 scripts/ci/dockerfiles/manylinux1/Dockerfile create mode 100644 scripts/ci/dockerfiles/manylinux1/build_image.sh mode change 100644 => 100755 scripts/update_version.py create mode 100644 scripts/upload_wheel.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f35cfcbb..b59d54b6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.19) project(hidet C CXX) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + # config hidet if(EXISTS "${CMAKE_BINARY_DIR}/config.cmake") include(${CMAKE_BINARY_DIR}/config.cmake) diff --git a/README.md b/README.md index 74c162c22..0a8820479 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Hidet: A compilation-based deep learning framework -[**Documentation**](http://docs.hidet.org:9000/) +[**Documentation**](http://docs.hidet.org/) Hidet is an open-source DNN inference framework based on compilation. It supports end-to-end compilation of DNN models from PyTorch and ONNX to efficient cuda kernels. @@ -11,7 +11,7 @@ A series of graph-level and operator-level optimizations are applied to optimize ```bash pip install hidet ``` -See [here](http://docs.hidet.org:9000/) for building from source. +See [here](http://docs.hidet.org/) for building from source. ### Usage @@ -34,9 +34,9 @@ model_opt = torch.compile(model, backend='hidet') y = model_opt(x) ``` See the following tutorials to learn other usgae: -- [Quick Start](http://docs.hidet.org:9000/gallery/getting-started/quick-start.html) -- [Optimize PyTorch models](http://docs.hidet.org:9000/gallery/tutorials/optimize-pytorch-model.html) -- [Optimize ONNX models](http://docs.hidet.org:9000/gallery/tutorials/run-onnx-model.html) +- [Quick Start](http://docs.hidet.org/gallery/getting-started/quick-start.html) +- [Optimize PyTorch models](http://docs.hidet.org/gallery/tutorials/optimize-pytorch-model.html) +- [Optimize ONNX models](http://docs.hidet.org/gallery/tutorials/run-onnx-model.html) ## Publication Hidet originates from the following research work. If you used **Hidet** in your research, welcome to cite our @@ -50,7 +50,7 @@ Hidet is currently under active development by a team at [CentML Inc](https://ce ## Contributing We welcome contributions from the community. Please see -[contribution guide](http://docs.hidet.org:9000/hidet/docs/build/html/developer-guides/contributing.html) +[contribution guide](http://docs.hidet.org/hidet/docs/build/html/developer-guides/contributing.html) for more details. ## License diff --git a/gallery/developer-guides/hidet-script-dynamic-kernel.py b/gallery/developer-guides/hidet-script-dynamic-kernel.py index d2844841d..e910f8fd0 100644 --- a/gallery/developer-guides/hidet-script-dynamic-kernel.py +++ b/gallery/developer-guides/hidet-script-dynamic-kernel.py @@ -2,7 +2,9 @@ Writing Dynamic kernel ====================== -In this article, we will show how to write a matrix multiplication kernel in Hidet Script. +.. todo:: + + More details about hidet script and how to write dynamic kernel are coming soon. """ import numpy.testing @@ -160,5 +162,7 @@ def main(): print(f'{m}x{k}x{n}: hidet takes {hidet_latency:.2f} ms') -if __name__ == '__main__': - main() +# %% +# + +main() diff --git a/python/hidet/version.py b/python/hidet/version.py index a4c01844e..d17752497 100644 --- a/python/hidet/version.py +++ b/python/hidet/version.py @@ -9,4 +9,4 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.1.dev0" +__version__ = "0.1" diff --git a/scripts/build_wheel.sh b/scripts/build_wheel.sh index 06e0f4413..044a8cf31 100644 --- a/scripts/build_wheel.sh +++ b/scripts/build_wheel.sh @@ -1,4 +1,11 @@ #!/bin/bash +# +# Build a wheel: +# +# $ bash scripts/build_wheel.sh +# +# would generate a .whl file in the scripts directory. +# set -e # exit immediately if a command exits with a non-zero status. @@ -19,6 +26,7 @@ cd build; cmake ../..; make -j4; cd .. # copy the built libraries and headers to python module cp ../setup.py ./setup.py cp ../MANIFEST.in ./MANIFEST.in +cp ../README.md ./README.md cp -r ../python ./ cp -r ./build/lib ./python/hidet cp -r ../include ./python/hidet @@ -31,3 +39,4 @@ rm -rf ./python rm -rf ./build rm ./setup.py rm ./MANIFEST.in +rm ./README.md diff --git a/scripts/ci/build_wheel_manylinux1.sh b/scripts/ci/build_wheel_manylinux1.sh new file mode 100644 index 000000000..13fff1306 --- /dev/null +++ b/scripts/ci/build_wheel_manylinux1.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# work in the same directory of this script +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) +cd $SCRIPT_DIR + +# get the root directory of the project +HIDET_DIR=$(cd -- "$SCRIPT_DIR/../.." &> /dev/null && pwd) + +# build the docker image +bash ./dockerfiles/manylinux1/build_image.sh + +echo $HIDET_DIR + +# run the docker image +docker run --rm -v $HIDET_DIR:/io hidet-manylinux1-build bash /io/scripts/build_wheel.sh diff --git a/scripts/ci/dockerfiles/manylinux1/Dockerfile b/scripts/ci/dockerfiles/manylinux1/Dockerfile new file mode 100644 index 000000000..5c57fb774 --- /dev/null +++ b/scripts/ci/dockerfiles/manylinux1/Dockerfile @@ -0,0 +1,7 @@ +FROM quay.io/pypa/manylinux1_x86_64 as base + +RUN yum install -y vim htop + +ENV PATH=$PATH:/opt/python/cp38-cp38/bin + +RUN PIP_ONLY_BINARY=cmake python3 -m pip install cmake diff --git a/scripts/ci/dockerfiles/manylinux1/build_image.sh b/scripts/ci/dockerfiles/manylinux1/build_image.sh new file mode 100644 index 000000000..2efa5b2b0 --- /dev/null +++ b/scripts/ci/dockerfiles/manylinux1/build_image.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# work in the same directory of this script +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) +cd $SCRIPT_DIR + +docker build -t hidet-manylinux1-build . diff --git a/scripts/update_version.py b/scripts/update_version.py old mode 100644 new mode 100755 index 27fb75939..eaa3f03e2 --- a/scripts/update_version.py +++ b/scripts/update_version.py @@ -1,3 +1,4 @@ +#!/usr/bin/python3 """ Update the version string in setup.py and python/hidet/version.py diff --git a/scripts/upload_wheel.sh b/scripts/upload_wheel.sh new file mode 100644 index 000000000..0543c56c2 --- /dev/null +++ b/scripts/upload_wheel.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +WHEEL=$1 + +set -e # exit immediately if a command exits with a non-zero status. + +twine upload --repository testpypi $WHEEL + diff --git a/setup.py b/setup.py index 352b84918..ca3d83089 100644 --- a/setup.py +++ b/setup.py @@ -9,21 +9,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from setuptools import setup, find_packages, Distribution - - -class BinaryDistribution(Distribution): - def has_ext_modules(self): - return True - - def is_pure(self): - return False +from setuptools import setup, find_packages setup( name="hidet", - version="0.1.dev0", + version="0.1", description="Hidet: a compilation-based DNN inference framework.", + long_description=open("README.md").read(), + long_description_content_type="text/markdown", python_requires='>=3.8', packages=find_packages(where='python'), package_dir={"": "python"}, @@ -36,15 +30,16 @@ def is_pure(self): "tabulate", "astunparse", "click", - "cuda-python" + "packaging", + "cuda-python", ], - distclass=BinaryDistribution, + platforms=["linux"], entry_points={ 'console_scripts': [ 'hidet = hidet.cli.main:main', ], }, - url="docs.hidet.org", + url="https://docs.hidet.org", classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', @@ -59,10 +54,6 @@ def is_pure(self): 'Topic :: Software Development :: Libraries :: Python Modules', 'Programming Language :: C++', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', ], license='Apache-2.0', keywords='deep learning, machine learning, neural network, inference, compiler',