diff --git a/.github/workflows/Publish.yml b/.github/workflows/Publish.yml index bb71c30..fcd1c4c 100644 --- a/.github/workflows/Publish.yml +++ b/.github/workflows/Publish.yml @@ -14,8 +14,8 @@ on: required: false jobs: # Define test jobs as part of the publish workflow - test_linux: - name: Test on Linux + test_linux_cpu: + name: Test on Linux(CPU) runs-on: ubuntu-latest strategy: fail-fast: false @@ -40,10 +40,11 @@ jobs: run: | pip install dist/*.whl pytest tests/ - build_linux_cpu: + + build_linux: name: Build on Linux(CPU) runs-on: ubuntu-latest - needs: [test_linux] + needs: [test_linux_cpu] steps: - name: Checkout uses: actions/checkout@v4 @@ -63,41 +64,10 @@ jobs: - name: Archive Wheel Artifacts uses: actions/upload-artifact@v3 with: - name: dist-linux-cpu + name: dist-linux path: dist/*.whl retention-days: 20 - - # build_linux_gpu: - # name: Build on Linux(GPU) - # runs-on: ubuntu-latest - # needs: [test_linux] - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # - name: Set up Python 3.9 - # uses: actions/setup-python@v5 - # with: - # python-version: 3.9 - # - name: Install dependencies - # run: | - # python -m pip cache purge - # python -m pip install --upgrade pip setuptools --no-cache-dir - # python -m pip install -r requirements-dev.txt --no-cache-dir - # python -m pip install setuptools==68.2.0 - # pip install cibuildwheel - # - name: Build Wheel - # run: | - # rm -rf setup.py - # cp setup_cuda.py setup.py - # cibuildwheel --platform linux - # mkdir dist - # cp wheelhouse/*.whl dist/ - # - name: Archive Wheel Artifacts - # uses: actions/upload-artifact@v3 - # with: - # name: dist-linux-gpu - # path: dist/*.whl - # retention-days: 20 + build_and_test_macos_arm: name: Build and Test on macOS(ARM) runs-on: macos-latest @@ -206,7 +176,7 @@ jobs: publish_pypi: name: Upload release to PyPI runs-on: ubuntu-latest - needs: [build_linux_cpu, build_and_test_macos_arm, build_and_test_windows] + needs: [build_linux, build_and_test_macos_arm, build_and_test_windows] permissions: id-token: write contents: write @@ -217,14 +187,8 @@ jobs: - name: Download linux(CPU) Artifacts uses: actions/download-artifact@v3 with: - name: dist-linux-cpu + name: dist-linux path: dist/ - - # - name: Download linux(GPU) Artifacts - # uses: actions/download-artifact@v3 - # with: - # name: dist-linux-gpu - # path: dist/ - name: Download macOS(ARM) Artifacts uses: actions/download-artifact@v3 diff --git a/CMakeLists.txt b/CMakeLists.txt index b20a6ae..86efba0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,6 @@ include_directories(${CMAKE_CURRENT_LIST_DIR}/lib) if (BRAINPY_CUDA) find_package(CUDAToolkit REQUIRED) - find_library(CUDA_DRIVER_LIBRARY cuda PATHS /usr/lib/x86_64-linux-gnu /usr/lib64) enable_language(CUDA) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) pybind11_add_module( @@ -55,7 +54,6 @@ if (BRAINPY_CUDA) ) target_link_libraries(gpu_ops PRIVATE Taichi::Runtime) # target_link_libraries(gpu_ops PRIVATE ${PYTHON_LIBRARIES}) - target_link_libraries(gpu_ops PRIVATE ${CUDA_DRIVER_LIBRARY}) install(TARGETS gpu_ops DESTINATION braintaichi) else() message(STATUS "Building without CUDA") diff --git a/braintaichi/__init__.py b/braintaichi/__init__.py index a6b05fd..5164542 100644 --- a/braintaichi/__init__.py +++ b/braintaichi/__init__.py @@ -21,7 +21,7 @@ '__minimal_taichi_version__', ] -__version__ = "0.0.1" +__version__ = "0.0.1.post20240912" __minimal_taichi_version__ = (1, 7, 2) import ctypes diff --git a/ci/linux/gpu/prepare_build_wheel_on_cuda.sh b/ci/linux/gpu/prepare_build_wheel_on_cuda.sh index bf42882..0a2f3fe 100644 --- a/ci/linux/gpu/prepare_build_wheel_on_cuda.sh +++ b/ci/linux/gpu/prepare_build_wheel_on_cuda.sh @@ -8,71 +8,20 @@ rm setup.py mv setup_cuda.py setup.py # mv setup_cpu.py setup.py -# https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/ - -# Install CUDA 11.2, see: -# * https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.2.2/centos7-x86_64/base/Dockerfile -# * https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.2.2/centos7-x86_64/devel/Dockerfile -#yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo -#yum install --setopt=obsoletes=0 -y \ -# cuda-nvcc-11-2-11.2.152-1 \ -# cuda-cudart-devel-11-2-11.2.152-1 \ -# libcurand-devel-11-2-10.2.3.152-1 \ -# libcudnn8-devel-8.1.1.33-1.cuda11.2 \ -# libcublas-devel-11-2-11.4.1.1043-1 -#ln -s cuda-11.2 /usr/local/cuda -# -#yum install -y python3-devel.x86_64 - - -# Install CUDA 11.4 -#yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo -#yum install --setopt=obsoletes=0 -y \ -# cuda-nvcc-11-4-11.4.152-1 \ -# cuda-cudart-devel-11-4-11.4.148-1 \ -# libcurand-devel-11-4-10.2.5.120-1 \ -# libcudnn8-devel-8.2.4.15-1.cuda11.4 \ -# libcublas-devel-11-4-11.6.5.2-1 -#ln -s cuda-11.4 /usr/local/cuda -# -#yum install -y python3-devel.x86_64 - - -# Install CUDA 11.6 -# sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf -#yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo -#yum install --setopt=obsoletes=0 -y \ -# cuda-nvcc-11-6-11.6.124-1 \ -# cuda-cudart-devel-11-6-11.6.55-1 \ -# libcurand-devel-11-6-10.2.9.124-1 \ -# libcudnn8-devel-8.4.1.50-1.cuda11.6 \ -# libcublas-devel-11-6-11.9.2.110-1 -#ln -s cuda-11.6 /usr/local/cuda - - -# Install CUDA 11.8 -# yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo -# yum install --setopt=obsoletes=0 -y \ -# cuda-nvcc-11-8-11.8.89-1 \ -# cuda-cudart-devel-11-8-11.8.89-1 \ -# libcurand-devel-11-8-10.3.0.86-1\ -# libcudnn8-devel-8.8.0.121-1.cuda11.8 \ -# libcublas-devel-11-8-11.11.3.6-1 -# ln -s cuda-11.8 /usr/local/cuda - -# yum install -y python3-devel.x86_64 +yum -y install yum-utils # Install CUDA 12.0 yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo + yum install --setopt=obsoletes=0 -y \ - cuda-drivers-525.147.05-1.x86_64 \ - cuda-nvcc-12-0-12.0.140-1 \ - cuda-cudart-devel-12-0-12.0.146-1 -ln -s cuda-12.0 /usr/local/cuda + cuda-nvcc-12-4-12.4.131-1 \ + cuda-cudart-devel-12-4-12.4.127-1 \ + +ln -s cuda-12.4 /usr/local/cuda -yum install glibc-devel +# yum install glibc-devel -yum install --disableplugin=fastmirror -y python3-devel.x86_64 +yum install -y python3-devel pip_config_dir="${HOME}/.pip" pip_config_file="${pip_config_dir}/pip.conf" diff --git a/ci/linux/gpu/pyproject.toml b/ci/linux/gpu/pyproject.toml index cafb9c2..29364ff 100644 --- a/ci/linux/gpu/pyproject.toml +++ b/ci/linux/gpu/pyproject.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.8, <=3.12" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/ci/mac/arm64/pyproject3.10.toml b/ci/mac/arm64/pyproject3.10.toml index 03f51ab..fecbf0c 100644 --- a/ci/mac/arm64/pyproject3.10.toml +++ b/ci/mac/arm64/pyproject3.10.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.10, <3.11" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/ci/mac/arm64/pyproject3.11.toml b/ci/mac/arm64/pyproject3.11.toml index ec4297d..c6fae18 100644 --- a/ci/mac/arm64/pyproject3.11.toml +++ b/ci/mac/arm64/pyproject3.11.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.11, <3.12" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/ci/mac/arm64/pyproject3.12.toml b/ci/mac/arm64/pyproject3.12.toml index 3479c44..3803948 100644 --- a/ci/mac/arm64/pyproject3.12.toml +++ b/ci/mac/arm64/pyproject3.12.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.12, <3.13" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/ci/mac/arm64/pyproject3.9.toml b/ci/mac/arm64/pyproject3.9.toml index 484bf27..1b60595 100644 --- a/ci/mac/arm64/pyproject3.9.toml +++ b/ci/mac/arm64/pyproject3.9.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.9, <3.10" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/ci/mac/x86_64/pyproject3.10.toml b/ci/mac/x86_64/pyproject3.10.toml index 422afd9..5f4e657 100644 --- a/ci/mac/x86_64/pyproject3.10.toml +++ b/ci/mac/x86_64/pyproject3.10.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.10, <3.11" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml index fc8d649..7a28370 100644 --- a/ci/mac/x86_64/pyproject3.11.toml +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.11, <3.12" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/ci/mac/x86_64/pyproject3.12.toml b/ci/mac/x86_64/pyproject3.12.toml index c5290e2..edb150f 100644 --- a/ci/mac/x86_64/pyproject3.12.toml +++ b/ci/mac/x86_64/pyproject3.12.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.12, <3.13" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/ci/mac/x86_64/pyproject3.9.toml b/ci/mac/x86_64/pyproject3.9.toml index 5bacf9f..bd42dc1 100644 --- a/ci/mac/x86_64/pyproject3.9.toml +++ b/ci/mac/x86_64/pyproject3.9.toml @@ -39,7 +39,7 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.9, <3.10" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" diff --git a/pyproject.toml b/pyproject.toml index e9f4a8a..d565634 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,10 +39,10 @@ build-backend = "setuptools.build_meta" [project] requires-python = ">=3.8, <=3.12" name = "braintaichi" -version = "0.0.1" +version = "0.0.1.post20240912" [tool.cibuildwheel.linux] -# before-all = "sh prepare_build_wheel_on_cuda.sh" +before-all = "sh ci/linux/gpu/prepare_build_wheel_on_cuda.sh" before-build = "sh copy_so_linux.sh" #before-build = "pip install -r requirements-test.txt" archs = ["x86_64"] diff --git a/setup_cuda.py b/setup_cuda.py index 4680e8f..17996bb 100644 --- a/setup_cuda.py +++ b/setup_cuda.py @@ -3,6 +3,7 @@ import glob import os +import io import platform import re import subprocess @@ -62,6 +63,10 @@ HERE = os.path.dirname(os.path.realpath(__file__)) +# obtain long description from README +here = os.path.abspath(os.path.dirname(__file__)) +with io.open(os.path.join(here, 'README.md'), 'r', encoding='utf-8') as f: + README = f.read() # This custom class for building the extensions uses CMake to compile. You # don't have to use CMake for this task, but I found it to be the easiest when @@ -156,6 +161,8 @@ def build_extension(self, ext): name='braintaichi', version=__version__, description='Leveraging Taichi Lang to customize brain dynamics operators', + long_description=README, + long_description_content_type="text/markdown", author='BrainTaichi Developers', author_email='chao.brain@qq.com', packages=find_namespace_packages(exclude=['lib*', 'docs*', 'tests*', 'win_dll*', 'out*', 'cmake*', 'scripts*']),