Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Apr 1, 2024
1 parent 8f963b8 commit d018a15
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 21 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/visionos-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ on:
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
pull_request:
branches: [master]
paths:
- '.github/workflows/visionos-cpu.yml'
- 'toolchains/ios.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
# pull_request:
# branches: [master]
# paths:
# - '.github/workflows/visionos-cpu.yml'
# - 'toolchains/ios.toolchain.cmake'
# - 'CMakeLists.txt'
# - 'cmake/**'
# - 'src/*'
# - 'src/layer/*'
# - 'src/layer/arm/**'
concurrency:
group: visionos-cpu-${{ github.ref }}
cancel-in-progress: true
Expand Down
107 changes: 96 additions & 11 deletions .github/workflows/watchos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,127 @@ jobs:
build:
runs-on: macos-13
env:
COMMON_CMAKE_OPTIONS: |
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
steps:
- uses: actions/checkout@v4

- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-watchos-install-20240401
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.2/openmp-18.1.2.src.tar.xz
tar -xf openmp-18.1.2.src.tar.xz
cd openmp-18.1.2.src
sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S
sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S
- name: openmp-armv7k
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-18.1.2.src
mkdir -p build-armv7k && cd build-armv7k
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" ..
cmake --build . -j 4
cmake --build . --target install
- name: openmp-arm64_32
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-18.1.2.src
mkdir -p build-arm64_32 && cd build-arm64_32
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" ..
cmake --build . -j 4
cmake --build . --target install
- name: openmp-simulator-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-18.1.2.src
mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install
- name: openmp-simulator-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-18.1.2.src
mkdir -p build-simulator-arm64 && cd build-simulator-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install
- name: openmp-merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
mkdir -p $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos
mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator
cp -a openmp-18.1.2.src/build-arm64_32/install/include $GITHUB_WORKSPACE/openmp-install/watchos
mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos/lib
lipo -create \
openmp-18.1.2.src/build-armv7k/install/lib/libomp.a \
openmp-18.1.2.src/build-arm64_32/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a
cp -a openmp-18.1.2.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/watchos-simulator
mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib
lipo -create \
openmp-18.1.2.src/build-simulator-x86_64/install/lib/libomp.a \
openmp-18.1.2.src/build-simulator-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a
- name: install-openmp
run: |
sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/include/* $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib
sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/include/* $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/lib
- name: armv7k
run: |
mkdir build-armv7k && cd build-armv7k
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" ..
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" ..
cmake --build . -j 4
- name: arm64_32
run: |
mkdir build-arm64_32 && cd build-arm64_32
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" ..
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" ..
cmake --build . -j 4
- name: simulator-i386
run: |
mkdir build-simulator-i386 && cd build-simulator-i386
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="i386" ..
cmake --build . -j 4
- name: simulator-x86_64
run: |
mkdir build-simulator-x86_64 && cd build-simulator-x86_64
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" ..
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" ..
cmake --build . -j 4
- name: simulator-arm64
run: |
mkdir build-simulator-arm64 && cd build-simulator-arm64
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" ..
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" ..
cmake --build . -j 4

0 comments on commit d018a15

Please sign in to comment.