Skip to content

implement simplemath #2903

implement simplemath

implement simplemath #2903

name: linux-x64-gpu-clang-python
on:
push:
branches: [master]
paths:
- '.github/workflows/linux-x64-gpu-clang-python.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
- 'python/**'
pull_request:
branches: [master]
paths:
- '.github/workflows/linux-x64-gpu-clang-python.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
- 'python/**'
concurrency:
group: linux-x64-gpu-clang-python-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
linux-clang-gpu:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.7, 3.9, 3.11]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v3
with:
path: "1.3.236.0"
key: vulkansdk-linux-x86_64-1.3.236.0
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
wget https://sdk.lunarg.com/sdk/download/1.3.236.0/linux/vulkansdk-linux-x86_64-1.3.236.0.tar.gz?Human=true -O vulkansdk-linux-x86_64-1.3.236.0.tar.gz
tar -xf vulkansdk-linux-x86_64-1.3.236.0.tar.gz
rm -rf 1.3.236.0/source 1.3.236.0/samples
find 1.3.236.0 -type f | grep -v -E 'vulkan|glslang' | xargs rm
- name: cache-swiftshader
id: cache-swiftshader
uses: actions/cache@v3
with:
path: swiftshader-install
key: swiftshader-linux-install-20230420
- name: checkout-swiftshader
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: google/swiftshader
path: swiftshader
ref: dd55e592406dc0bae219df11adec6363840aff4a
- name: checkout-swiftshader-submodules
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
run: |
cd swiftshader
git -c submodule."third_party/git-hooks".update=none submodule update --init --recursive
- name: swiftshader
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
run: |
cd swiftshader
mkdir -p build; cd build
cmake -DCMAKE_INSTALL_PREFIX=install -DSWIFTSHADER_BUILD_EGL=FALSE -DSWIFTSHADER_BUILD_GLESv2=FALSE -DSWIFTSHADER_BUILD_GLES_CM=FALSE -DSWIFTSHADER_BUILD_VULKAN=TRUE -DSWIFTSHADER_BUILD_PVR=FALSE -DSWIFTSHADER_BUILD_TESTS=FALSE -DSWIFTSHADER_ENABLE_ASTC=FALSE -DSWIFTSHADER_WARNINGS_AS_ERRORS=FALSE -DREACTOR_BACKEND=Subzero -DREACTOR_DEFAULT_OPT_LEVEL=Default -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j 2
mkdir $GITHUB_WORKSPACE/swiftshader-install
cp Linux/* $GITHUB_WORKSPACE/swiftshader-install
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest setuptools wheel twine
- name: build
env:
CC: clang
CXX: clang++
run: |
export VULKAN_SDK=`pwd`/1.3.236.0/x86_64
mkdir build && cd build
cmake -DNCNN_VULKAN=ON -DNCNN_PYTHON=ON -DNCNN_DISABLE_RTTI=OFF -DNCNN_DISABLE_EXCEPTION=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF ..
cmake --build . -j 2
- name: install python
run: cd python && pip install .
- name: test
run: |
export VK_ICD_FILENAMES="$GITHUB_WORKSPACE/swiftshader-install/vk_swiftshader_icd.json"
cd python && pytest tests
- name: build and publish
if: startsWith(github.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
TWINE_REPOSITORY_URL: "https://test.pypi.org/legacy/"
run: |
cd python
python setup.py bdist_wheel
twine upload dist/*