Skip to content
Snippets Groups Projects
Commit d5b71d4b authored by Jan Hönig's avatar Jan Hönig
Browse files

Added test for vectorized benchmarks

parent d20cc1b8
No related branches found
No related tags found
No related merge requests found
Pipeline #35566 failed
import subprocess
import numpy as np
import sympy as sp
import pystencils as ps
from pystencils_benchmark import generate_benchmark, Compiler
from pathlib import Path
def test_generate():
path = Path.cwd() / 'test'
path.mkdir(parents=True, exist_ok=True)
a, b, c = ps.fields(a=np.ones(4000000), b=np.ones(4000000), c=np.ones(4000000))
alpha = sp.symbols('alpha')
@ps.kernel_config(ps.CreateKernelConfig(cpu_vectorize_info={'instruction_set': 'best'}))
def vadd():
a[0] @= b[0] + c[0]
kernel_vadd = ps.create_kernel(**vadd)
@ps.kernel_config(ps.CreateKernelConfig(cpu_vectorize_info={'instruction_set': 'best'}))
def daxpy():
b[0] @= alpha * a[0] + b[0]
kernel_daxpy = ps.create_kernel(**daxpy)
for compiler in [Compiler.GCC, Compiler.GCCdebug, Compiler.Clang]:
generate_benchmark([kernel_vadd, kernel_daxpy], path, compiler=compiler)
subprocess.run(['make', '-C', f'{path}'], check=True)
subprocess.run([f'{path}/benchmark-{compiler.name}', '10'], check=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment