| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # 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. |
| # |
| |
| name: Native-MacOS |
| |
| on: |
| push: |
| pull_request: |
| |
| jobs: |
| build-cpptest-cpu: |
| runs-on: macos-latest |
| |
| steps: |
| - uses: actions/checkout@v1 |
| - uses: actions/setup-python@v2 |
| with: |
| python-version: "3.7" |
| - name: install-build-dependencies |
| run: | |
| brew install protobuf swig opencv glog lmdb numpy |
| wget https://github.com/oneapi-src/oneTBB/releases/download/v2020.1/tbb-2020.1-mac.tgz |
| mkdir /tmp/tbb |
| tar zxvf tbb-2020.1-mac.tgz -C /tmp/tbb --strip-components=1 |
| mv /tmp/tbb/lib/lib* /usr/local/lib/ |
| pip3 install numpy && wget https://github.com/oneapi-src/oneDNN/releases/download/v1.2/dnnl_mac_1.2.0_cpu_tbb.tgz -P /tmp |
| tar zxf /tmp/dnnl_mac_1.2.0_cpu_tbb.tgz -C /tmp |
| - name: configure |
| run: mkdir build && cd build && cmake -DUSE_PYTHON3=YES -DENABLE_TEST=YES -DUSE_DNNL=YES .. |
| env: |
| CMAKE_INCLUDE_PATH: /usr/local/opt/openblas/include:$CMAKE_INCLUDE_PATH |
| CMAKE_LIBRARY_PATH: /usr/local/opt/openblas/lib:$CMAKE_LIBRARY_PATH |
| DNNL_ROOT: /tmp/dnnl_mac_1.2.0_cpu_tbb/ |
| - name: build |
| run: cd build && make |
| env: |
| CXXFLAGS: -I /Users/runner/hostedtoolcache/Python/3.7.8/x64/lib/python3.7/site-packages/numpy/core/include $CXXFLAGS |
| LD_LIBRARY_PATH: /usr/local/opt/openblas/lib:/tmp/dnnl_mac_1.2.0_cpu_tbb/lib:$LD_LIBRARY_PATH |
| - name: C++ test |
| run: | |
| install_name_tool -change libdnnl.1.dylib /tmp/dnnl_mac_1.2.0_cpu_tbb/lib/libdnnl.1.dylib /Users/runner/work/singa/singa/build/lib/libsinga.dylib |
| install_name_tool -change libdnnl.1.dylib /tmp/dnnl_mac_1.2.0_cpu_tbb/lib/libdnnl.1.dylib build/bin/test_singa |
| build/bin/test_singa |
| env: |
| LD_LIBRARY_PATH: /usr/local/opt/openblas/lib:/tmp/dnnl_mac_1.2.0_cpu_tbb/lib:$LD_LIBRARY_PATH |