Enable gating & add simple gating test

Resolves: RHEL-52114
This commit is contained in:
Pavel Simovec 2024-09-30 12:21:55 +02:00
parent aeadd68cf5
commit a98ebdff7a
5 changed files with 58 additions and 0 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

7
gating/main.fmf Normal file
View File

@ -0,0 +1,7 @@
summary: Verify that FlexiBLAS swaps BLAS libraries by checking if OpenBLAS is considerably faster than Netlib
test: ./test.sh
require:
- python3-numpy
- flexiblas
duration: 5m

39
gating/test.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh -eux
# Test to verify that FlexiBLAS swaps BLAS libraries
# by checking if OpenBLAS is at least 3 times faster than Netlib BLAS
PYTHON_SCRIPT=$(cat <<EOF
import numpy as np
import time
size = 2000
a = np.random.rand(size, size)
b = np.random.rand(size, size)
start_time = time.time()
np.dot(a, b)
end_time = time.time()
print(end_time - start_time)
EOF
)
echo "Testing with NETLIB"
netlib_time=$(FLEXIBLAS="NETLIB" python3 -c "$PYTHON_SCRIPT")
echo "Time taken with NETLIB: $netlib_time seconds"
echo "-----------------------------------"
echo "Testing with OPENBLAS-OPENMP"
openblas_time=$(FLEXIBLAS="OPENBLAS-OPENMP" python3 -c "$PYTHON_SCRIPT")
echo "Time taken with OPENBLAS-OPENMP: $openblas_time seconds"
echo "-----------------------------------"
# Verify that OpenBLAS is at least 3 times faster than Netlib BLAS
if (( $(echo "$netlib_time >= 3 * $openblas_time" | bc -l) )); then
echo "Test passed: OpenBLAS is at least 3 times faster than Netlib BLAS."
exit 0
else
echo "Test failed: OpenBLAS is not at least 3 times faster than Netlib BLAS. Flexiblas might not have swapped the libraries."
exit 1
fi

4
plans/main.fmf Normal file
View File

@ -0,0 +1,4 @@
discover:
how: fmf
execute:
how: tmt