Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Type of Change

feature or bug fix or documentation or others
API changed or not

## Description

detail description
Issues: xxx

## Expected Behavior & Potential Risk

the expected behavior that triggered by this PR

## How has this PR been tested?

how to reproduce the test (including hardware information)

## Dependency Change?

any library dependency introduced or removed
72 changes: 72 additions & 0 deletions .github/workflows/copyright_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Copyright Check

on:
pull_request:
branches: [main]
paths:
- neural_speed/**
- setup.py
- .github/workflows/format_scan.yml
workflow_dispatch:

# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CODE_SCAN_LOG_PATH: "${{ github.workspace }}/log"
CONTAINER_NAME: "codeScan"

jobs:
format-scan:
runs-on: ubuntu-latest
strategy:
matrix:
job_name: ["copyright"]
fail-fast: false
steps:

- name: Checkout out Repo
uses: actions/checkout@v3

- name: CopyRight check
run: |
source ${{ github.workspace }}/.github/workflows/scripts/change_color.sh
set -e
mkdir -p ${{ env.CODE_SCAN_LOG_PATH }}
supported_extensions=(py, sh, yaml)
git fetch
git --no-pager diff --name-only remotes/origin/${{ github.base_ref }} ${{ github.workspace }}/neural_speed> ${{ env.CODE_SCAN_LOG_PATH }}/diff.log
files=$(cat ${{ env.CODE_SCAN_LOG_PATH }}/diff.log | awk '!a[$0]++')
$LIGHT_PURPLE && echo " ----------------- checking ... --------------------------" && $RESET
if [[ -f ${{ env.CODE_SCAN_LOG_PATH }}/copyright_issue_summary.log ]]; then
rm -f ${{ env.CODE_SCAN_LOG_PATH }}/copyright_issue_summary.log
fi
for file in ${files}
do
if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then
if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then
echo ${file} >> ${{ env.CODE_SCAN_LOG_PATH }}/copyright_issue_summary.log
$BOLD_YELLOW && echo " ----------------- Current log file output start --------------------------"
cat ${{ env.CODE_SCAN_LOG_PATH }}/copyright_issue_summary.log
$BOLD_YELLOW && echo " ----------------- Current log file output end --------------------------" && $RESET
$BOLD_RED && echo "CopyRight has something wrong! Please click on the artifact button to download and view the error log!" && $RESET
fi
else
$LIGHT_PURPLE && echo "Skipping ${file}" && $RESET
fi
done
if [[ -f ${{ env.CODE_SCAN_LOG_PATH }}/copyright_issue_summary.log ]]; then
$BOLD_YELLOW && echo " ----------------- Current log file output start --------------------------"
cat ${{ env.CODE_SCAN_LOG_PATH }}/copyright_issue_summary.log
$BOLD_YELLOW && echo " ----------------- Current log file output end --------------------------" && $RESET
$BOLD_RED && echo "CopyRight has something wrong! Please click on the artifact button to download and view the error log!" && $RESET && exit 1
fi

- name: Publish pipeline artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.job_name }}
path: ${{ env.CODE_SCAN_LOG_PATH }}.*
156 changes: 156 additions & 0 deletions .github/workflows/cpp-graph-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: CPP Graph Test

on:
pull_request:
branches: [main]
paths:
- '.github/workflows/cpp-graph-test.yml'
- '.github/workflows/scripts/models/cpp_graph_inference.sh'
- 'neural_speed/**'
- 'bestla/**'
workflow_dispatch:
inputs:
compiler_version:
description: 'compiler_version'
required: false
type: string
default: '13.1.0'
models:
description: 'models (in json)'
required: false
type: string
default: '["llama-2-7b-chat", "gptj-6b"]'
runner:
description: 'runner'
required: false
type: string
default: 'spr'

# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
OUT_SCRIPT_PATH: ${{ github.workspace }}/.github/workflows/scripts/models
SCRIPT_PATH: ${{ github.workspace }}/.github/workflows/scripts
WORKING_DIR: ${{ github.workspace }}
CONTAINER_NAME: "codeScan"
INPUT_COMPILER_VERSION: ${{ inputs.compiler_version || '13.1.0' }}

jobs:
CPP-Graph-Workflow:
runs-on: ${{inputs.runner || 'spr'}}
strategy:
matrix:
modelName: ${{fromJson(inputs.models || '["llama-2-7b-chat", "gptj-6b"]')}}
steps:
- name: Checkout out Repo
uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-tags: true

- name: Env build
run: |
bash ${{ github.workspace }}/.github/workflows/scripts/prepare_env_with_conda.sh "cpp-graph-test" "3.8"

- name: Binary build
if: 0 == 1
run: |
cd ${{ github.workspace }}
conda activate cpp-graph-test || source activate cpp-graph-test
pip install build --upgrade
pip install -r requirements.txt
python setup.py sdist bdist_wheel
pip install dist/neuralspeed*.whl
pip list

- name: BF16 Benchmark
run: |
cd ${{ github.workspace }}/.github/workflows/scripts/models
bash cpp_graph_inference.sh cpp-graph-test ${{ matrix.modelName }} ${{ env.INPUT_COMPILER_VERSION }}

- name: Rename summary
run: |
cd ${{ github.workspace }}
cp cpp_graph_summary.log cpp_graph_summary_${{matrix.modelName}}.log

- name: Publish pipeline artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: cpp_graph
path: ${{ github.workspace }}/cpp_graph_summary_${{matrix.modelName}}.log
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`
retention-days: 60 # 1 <= retention-days <= 90

Genreate-Report:
runs-on: ubuntu-latest
needs: [CPP-Graph-Workflow]
steps:
- name: Docker Clean Up
run: |
docker ps -a
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}-${{ runner.name }}'$) ]]; then
docker start ${{ env.CONTAINER_NAME }}-${{ runner.name }}
echo "remove left files through container ..."
docker exec ${{ env.CONTAINER_NAME }}-${{ runner.name }} bash -c "ls -a /neural-speed && rm -fr /neural-speed/* && rm -fr /neural-speed/.* || true"
fi
- name: Checkout out Repo
uses: actions/checkout@v3

- name: Download Summary Log
uses: actions/download-artifact@v3
with:
path: ${{ env.OUT_SCRIPT_PATH }}/generated/log

- name: Merge CPP Graph Summary Log
run: |
cd ${{ env.OUT_SCRIPT_PATH }}/generated/log/cpp_graph
for summary in $(find . -name "cpp_graph_summary_*.log"); do cat $summary >> cpp_graph_summary.log; done

- name: Download Reference Artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: cpp-graph-test.yml
name: FinalReport
run_id: ${{ vars.GRAPH_REF_ID }}
path: ${{ env.OUT_SCRIPT_PATH }}
name_is_regexp: true
repo: ${{ github.repository }}
check_artifacts: false
search_artifacts: false
skip_unpack: false
if_no_artifact_found: warn

- name: Display structure of downloaded files
run: cd ${{ env.OUT_SCRIPT_PATH }} && ls -R

- name: Generate report
run: |
echo "------ Generating final report.html ------"
cd ${{ env.OUT_SCRIPT_PATH }}
/usr/bin/bash generate_report.sh --workflow=deploy
sed -n '/<body>/,/<\/body>/p' generated/report.html | sed -r '/^$/d' | sed -r 's/^ +//g' >> $GITHUB_STEP_SUMMARY
env:
RUN_DISPLAY_URL: https://github.com/neural-speed/actions/runs/${{ github.run_id }}
BUILD_NUMBER: ${{ github.run_id }}
JOB_STATUS: succeed
MR_source_branch: ${{ github.head_ref }}
ghprbActualCommit: ${{ github.event.pull_request.head.sha }}

- name: Publish Report
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: FinalReport
path: ${{ env.OUT_SCRIPT_PATH }}/generated

- name: Specify performance regression
run: |
if [ $(is_perf_reg) == 'true' ]; then
echo "[Performance Regression] Some model performance regression occurred, please check artifacts and reports."
exit 1
fi
41 changes: 41 additions & 0 deletions .github/workflows/docker/codeScan.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Copyright (c) 2022 Intel Corporation
#
# Licensed 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.

ARG UBUNTU_VER=22.04
FROM ubuntu:${UBUNTU_VER} as devel

# See http://bugs.python.org/issue19846
ENV LANG C.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
aspell \
aspell-en \
python3 \
python3-pip \
python3-dev \
python3-distutils \
build-essential \
cloc \
python3.10-venv \
git

RUN ln -sf $(which python3) /usr/bin/python

RUN python -m pip install --no-cache-dir pylint==2.17.5\
bandit==1.7.4\
pyspelling\
pydocstyle

WORKDIR /
48 changes: 48 additions & 0 deletions .github/workflows/docker/devel.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Copyright (c) 2022 Intel Corporation
#
# Licensed 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.
ARG UBUNTU_VER=22.04
FROM ubuntu:${UBUNTU_VER} as devel

# See http://bugs.python.org/issue19846
ENV LANG C.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
python3 \
python3-pip \
python3-dev \
python3-distutils \
autoconf \
build-essential \
git \
libgl1-mesa-glx \
libglib2.0-0 \
numactl \
time \
wget \
bc \
gawk \
jq \
python3.10-venv \
vim

RUN ln -sf $(which python3) /usr/bin/python

RUN python -m pip --no-cache-dir install --upgrade pip
RUN python -m pip install --no-cache-dir setuptools

RUN pip list

WORKDIR /

Loading