Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/minor #61

Merged
merged 20 commits into from
May 6, 2022
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions .github/SETUP.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Expected github runners setup

## Job configuration
A worflow job may be configured to run within a docker machine or directly in the host environment, in the latter case be aware that Bambu distributions coming from other jobs as artifacts may need the _APPDIR_ variable to be set to the new install location.
Github runners may be configured to run within a docker container or directly in the host environment. In the former case there may be some issues during the execution of external vendor tools which may not support a containerized environment.

## Runner labels
Runners may expose many different labels based on what tools are available on the host machine.
Runners may expose many different labels based on what tools are available on the host machine. Comments about docker volumes are intender for a containerized environment only.

- **altera**: Altera synthesis tools are available on the host machine and a docker volume named altera-tools exposes Altera tools install directories (e.g. Quartus, QuestaSim, ...)
- **intel**: Intel synthesis tools are available on the host machine and a docker volume named intel-tools exposes modern Intel FPGA tools install directories (e.g. Quartus Prime, QuestaSim, ...)
Expand All @@ -13,20 +12,28 @@ Runners may expose many different labels based on what tools are available on th
- **nanoxplore**: NanoXplore synthesis tools are available on the host machine and a docker volume named nanoxplore-tools exposes NanoXplore tools install directories
- **xilinx**: Xilinx synthesis tools are available on the host machine and a docker volume named xilinx-tools exposes Xilinx tools install directories (e.g. Vivado, Vitis HLS, ...)

Directories containing license files should be copied or linked in container user home. Volumes may be defined as read-only to avoid issues.
If working with docker containers, directories containing license files should be copied or linked in container user home. Volumes may be defined as read-only to avoid issues.

A **licenses-home** volume is always expected when at least one of the above is defined. It should contain all necessary license files for available tools. Workflow job is expected to copy the volume content into the home directory of current user when running a container.

To create such volumes the following may be useful:

```
docker volume create --driver local --opt o=bind,ro --opt type=none --opt device=/path/to/dir vendor-tools
```

## Runner environment
## Environment variables
Some environment variables are expected to be set by each runner host:

- **J**: number of maximum parallel jobs handled by the runner
- **LM_LICENSE_FILE**: license file path for simulation/synthesis tools
- **NXLMD_LICENSE_FILE**: NanoXplore license file path (needed only if different from LM_LICENSE_FILE)
- **NANOXPLORE_BYPASS**: NanoXplore bypass setting
- **LIBRARY_PATH**: necessary to support older gcc compilers (set to: /usr/lib/x86_64-linux-gnu)

## Python support
Current CI implementation requires Python 3.6.15 to be available in the runner environment. Pyenv is recommended to provide the support.
Furthermore pip packages from `etc/scripts/requirements.txt` are required to run python scripts correctly.

Use the following to install the required Python version through PyEnv and set it as global default.

```
CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.15
pyenv global 3.6.15
pip install -r /path/to/repo/et/scripts/requirements.txt
```

Note that Github Runners are launched as systemd services, thus `~/.bashrc` or `~/.profile` are not loaded.
A `.path` file should be added in the runner directory containing standard _PATH_ variable prepended with PyEnv shims and bin paths.
2 changes: 2 additions & 0 deletions .github/actions/generate-appimage/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ EOF
cat > $dist_dir/usr/bin/tool_select.sh << EOF
#!/bin/bash
export LC_ALL="C"
unset PYTHONHOME # Python is not bundled with this AppImage
unset PYTHONPATH
BINARY_NAME=\$(basename "\$ARGV0")
BINARY_PATH="\$APPDIR/usr/bin/\$BINARY_NAME"
if [ "\$BINARY_NAME" == "debug_terminal" ]; then
Expand Down
48 changes: 18 additions & 30 deletions .github/actions/perf-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ inputs:
outputs:
compare-csv:
description: "Compare output csv file"
value: ${{ steps.cmp.outputs.out-csv }}
is-better:
description: "True if new results are better than main, false else"
value: ${{ steps.cmp.outputs.better }}
value: ${{ steps.cmp.outputs.outcsv }}
runs:
using: "composite"
steps:
Expand All @@ -52,42 +49,33 @@ runs:
echo "Path '${{inputs.new-results}}' does not name a file or directory"
exit -1;
fi
- name: Download test results from main
id: download
- name: Compare against main
id: cmp
shell: bash
run: |
set -e
PKG_URL="${{inputs.storage-url}}/results/main/${{inputs.test-id}}.csv"
COMMIT_SHA="${{github.sha}}"
COMPARE_CSV="${{inputs.test-id}}.$(echo '${{github.ref}}' | sed 's/\//_/g')_${COMMIT_SHA:0:7}.csv"
score=""
outcsv=""
CURL_CMD=""
if [[ ! -z '${{inputs.username}}' ]]; then
CURL_CMD+='-u ${{inputs.username}}:${{inputs.password}} '
fi
mkdir -p main-reports
curl -s -L --fail $CURL_CMD $PKG_URL -o main-reports/${{inputs.test-id}}.csv
if [[ $? -eq 0 ]]; then
echo "::set-output name=found::1"
if curl -s -L --fail $CURL_CMD $PKG_URL -o main-reports/${{inputs.test-id}}.csv; then
if [[ ! -z "${{ inputs.score }}" ]]; then
score="-s ${{ inputs.score }}"
fi
worse_count="0"
python ./etc/scripts/perf_diff.py -d ${{inputs.datapoints}} $score -o $COMPARE_CSV --returnfail "main-reports/${{inputs.test-id}}.csv" "${{inputs.new-results}}" || worse_count=$?
if [[ "$worse_count" != "0" ]]; then
outcsv="$COMPARE_CSV"
echo "::warning:: Performance are worse than main for ${{inputs.test-id}}: $worse_count benchmarks have degraded performance"
fi
else
echo "::warning:: No previous benchmark result found to compare"
fi
exit 0
- name: Compare performance results
if: ${{steps.download.outputs.found}}
id: cmp
shell: bash
run: |
COMMIT_SHA="${{github.sha}}"
COMPARE_CSV="${{inputs.test-id}}.$(echo '${{github.ref}}' | sed 's/\//_/g')_${COMMIT_SHA:0:7}.csv"
score=""
if [[ ! -z "${{ inputs.score }}" ]]; then
score="-s ${{ inputs.score }}"
fi
worse_count="0"
./etc/scripts/perf_diff.py -d ${{inputs.datapoints}} $score -o $COMPARE_CSV --returnfail "main-reports/${{inputs.test-id}}.csv" "${{inputs.new-results}}" || worse_count=$?
if [[ "$worse_count" != "0" ]]; then
echo "::set-output name=out-csv::$COMPARE_CSV"
echo "::set-output name=better::0"
echo "::warning:: Performance are worse than main for ${{inputs.test-id}}: $worse_count benchmarks have degraded performance"
else
echo "::set-output name=better::1"
fi
echo "::set-output name=outcsv::$outcsv"
exit 0
20 changes: 11 additions & 9 deletions .github/workflows/minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand Down Expand Up @@ -283,7 +283,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand Down Expand Up @@ -395,7 +395,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand Down Expand Up @@ -487,7 +487,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand Down Expand Up @@ -541,7 +541,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand Down Expand Up @@ -714,7 +714,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand All @@ -739,6 +739,8 @@ jobs:
datapoints: PERIOD,AREA,REGISTERS,DSPS,BRAMS
- test: lattice
datapoints: CYCLES,PERIOD,AREA,REGISTERS,DSPS,BRAMS
- test: nanoxplore
datapoints: CYCLES,PERIOD,AREA,REGISTERS,DSPS,BRAMS
- test: sim
datapoints: CYCLES
- test: xilinx_ise
Expand Down Expand Up @@ -784,7 +786,7 @@ jobs:
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
- name: Add performance results
if: ${{ steps.perf-check.outputs.is-better == 0 }}
if: ${{ steps.perf-check.outputs.compare-csv != '' }}
shell: bash
run: |
mv ${{ steps.perf-check.outputs.compare-csv }} ${{env.report-dir}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
abs_script=$(readlink -e $0)
dir_script=$(dirname $abs_script)
$dir_script/../../test_panda.py --tool=bambu --bambu=bambu --spider=spider \
python3 $dir_script/../../test_panda.py --tool=bambu --bambu=bambu --spider=spider \
--args="--configuration-name=GCC49 --compiler=I386_GCC49" \
--args="--configuration-name=GCC7 --compiler=I386_GCC7" \
--args="--configuration-name=CLANG6 --compiler=I386_CLANG6" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
abs_script=$(readlink -e $0)
dir_script=$(dirname $abs_script)
$dir_script/../../test_panda.py --tool=bambu --bambu=bambu --spider=spider \
python3 $dir_script/../../test_panda.py --tool=bambu --bambu=bambu --spider=spider \
--args="--configuration-name=GCC49 --compiler=I386_GCC49" \
-c=--simulate -b$dir_script -l$dir_script/list "$@"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
abs_script=$(readlink -e $0)
dir_script=$(dirname $abs_script)
$dir_script/../../test_panda.py --tool=bambu --bambu=bambu --spider=spider \
python3 $dir_script/../../test_panda.py --tool=bambu --bambu=bambu --spider=spider \
--args="--configuration-name=pow_square " \
--args="--configuration-name=mult_square -DMULT_SQUARE" \
--args="--configuration-name=single_pow_square -DFP_SINGLE" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!python

import argparse
import datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
abs_script=$(readlink -e $0)
dir_script=$(dirname $abs_script)
rm -rf output
$dir_script/test_panda.py --tool=bambu \
python3 $dir_script/test_panda.py --tool=bambu \
--args="--configuration-name=pow --top-fname=formula_pow" \
--args="--configuration-name=mult --top-fname=formula_mult " \
--args="--configuration-name=double_pow --top-fname=double_formula_pow" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!python3

import argparse
import datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
abs_script=$(readlink -e $0)
dir_script=$(dirname $abs_script)
rm -rf output
$dir_script/test_panda.py --tool=bambu \
python3 $dir_script/test_panda.py --tool=bambu \
--args="--configuration-name=pow --top-fname=formula_pow" \
--args="--configuration-name=mult --top-fname=formula_mult " \
--args="--configuration-name=double_pow --top-fname=double_formula_pow" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!python3

import argparse
import datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
abs_script=$(readlink -e $0)
dir_script=$(dirname $abs_script)
rm -rf output
$dir_script/test_panda.py --tool=bambu --bambu=/opt/panda/bin/bambu --spider=/opt/panda/bin/spider \
python3 $dir_script/test_panda.py --tool=bambu --bambu=/opt/panda/bin/bambu --spider=/opt/panda/bin/spider \
--args="--configuration-name=pow --top-fname=formula_pow" \
--args="--configuration-name=mult --top-fname=formula_mult " \
--args="--configuration-name=double_pow --top-fname=double_formula_pow" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!python3

import argparse
import datetime
Expand Down
Loading