Merge pull request #5348 from hideaki-motoki/issue5343_prefered_size_… #2475
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: c910v qemu test | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
TEST: | |
if: "github.repository == 'OpenMathLib/OpenBLAS'" | |
runs-on: ubuntu-latest | |
env: | |
xuetie_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1698113812618 | |
toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.0-20231018.tar.gz | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: RISCV64_GENERIC | |
triple: riscv64-linux-gnu | |
apt_triple: riscv64-linux-gnu | |
opts: NO_SHARED=1 TARGET=RISCV64_GENERIC | |
- target: C910V | |
triple: riscv64-unknown-linux-gnu | |
apt_triple: riscv64-linux-gnu | |
opts: NO_SHARED=1 TARGET=C910V | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: install build deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install autoconf automake autotools-dev ninja-build make ccache \ | |
gcc-${{ matrix.apt_triple }} gfortran-${{ matrix.apt_triple }} libgomp1-riscv64-cross libglib2.0-dev | |
- name: checkout qemu | |
uses: actions/checkout@v4 | |
with: | |
repository: XUANTIE-RV/qemu | |
path: qemu | |
ref: e0ace167effcd36d1f82c7ccb4522b3126011479 # xuantie-qemu-9.0 | |
- name: build qemu | |
run: | | |
# Force use c910v qemu-user | |
wget https://github.com/revyos/qemu/commit/222729c7455784dd855216d7a2bec4bd8f2a6800.patch | |
cd qemu | |
patch -p1 < ../222729c7455784dd855216d7a2bec4bd8f2a6800.patch | |
export CXXFLAGS="-Wno-error"; export CFLAGS="-Wno-error" | |
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=riscv64-linux-user --disable-system | |
make -j$(nproc) | |
make install | |
- name: Compilation cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.ccache | |
key: ccache-${{ runner.os }}-${{ matrix.target }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: | | |
ccache-${{ runner.os }}-${{ matrix.target }}-${{ github.ref }} | |
ccache-${{ runner.os }}-${{ matrix.target }} | |
- name: Configure ccache | |
run: | | |
test -d ~/.ccache || mkdir -p ~/.ccache | |
echo "max_size = 300M" > ~/.ccache/ccache.conf | |
echo "compression = true" >> ~/.ccache/ccache.conf | |
ccache -s | |
- name: build OpenBLAS | |
run: | | |
wget ${xuetie_toolchain}/${toolchain_file_name} | |
tar -xvf ${toolchain_file_name} -C /opt | |
export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.0/bin:$PATH" | |
make CC='ccache ${{ matrix.triple }}-gcc -static' FC='ccache ${{ matrix.triple }}-gfortran -static' ${{ matrix.opts }} HOSTCC='ccache gcc' -j$(nproc) | |
- name: test | |
run: | | |
run_with_retry() { | |
local cmd="$1" | |
local time_out=10 | |
local retries=10 | |
local attempt=0 | |
for ((i=1; i<=retries; i++)); do | |
attempt=$((i)) | |
if timeout -s 12 --preserve-status $time_out $cmd; then | |
echo "Command succeeded on attempt $i." | |
return 0 | |
else | |
local exit_code=$? | |
if [ $exit_code -eq 140 ]; then | |
echo "Attempt $i timed out (retrying...)" | |
time_out=$((time_out + 5)) | |
else | |
echo "Attempt $i failed with exit code $exit_code. Aborting workflow." | |
exit $exit_code | |
fi | |
fi | |
done | |
echo "All $retries attempts failed, giving up." | |
echo "Final failure was due to timeout." | |
echo "Aborting workflow." | |
exit $exit_code | |
} | |
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH | |
which qemu-riscv64 | |
export QEMU_BIN=$(which qemu-riscv64) | |
run_with_retry "$QEMU_BIN ./utest/openblas_utest" | |
run_with_retry "$QEMU_BIN ./utest/openblas_utest_ext" | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xscblat1 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xdcblat1 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xccblat1 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xzcblat1 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xscblat2 < ./ctest/sin2 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xdcblat2 < ./ctest/din2 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xccblat2 < ./ctest/cin2 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xzcblat2 < ./ctest/zin2 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xscblat3 < ./ctest/sin3 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xdcblat3 < ./ctest/din3 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xccblat3 < ./ctest/cin3 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xzcblat3 < ./ctest/zin3 | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/sblat1 | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/dblat1 | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/cblat1 | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/zblat1 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/sblat1 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/dblat1 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/cblat1 | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/zblat1 | |
rm -f ./test/?BLAT2.SUMM | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/sblat2 < ./test/sblat2.dat | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/dblat2 < ./test/dblat2.dat | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/cblat2 < ./test/cblat2.dat | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/zblat2 < ./test/zblat2.dat | |
rm -f ./test/?BLAT2.SUMM | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/sblat2 < ./test/sblat2.dat | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/dblat2 < ./test/dblat2.dat | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/cblat2 < ./test/cblat2.dat | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/zblat2 < ./test/zblat2.dat | |
rm -f ./test/?BLAT3.SUMM | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/sblat3 < ./test/sblat3.dat | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/dblat3 < ./test/dblat3.dat | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/cblat3 < ./test/cblat3.dat | |
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-riscv64 ./test/zblat3 < ./test/zblat3.dat | |
rm -f ./test/?BLAT3.SUMM | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/sblat3 < ./test/sblat3.dat | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/dblat3 < ./test/dblat3.dat | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/cblat3 < ./test/cblat3.dat | |
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./test/zblat3 < ./test/zblat3.dat |