Skip to content
Open
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
25 changes: 8 additions & 17 deletions benchmark/test/conversion.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/usr/bin/env python3
import test_framework

stencil_input = '[{"operator": {"stencil": {"kind": "7pt", "size": 100}}}]'


# check that all input modes work:
# parameter
test_framework.compare_output(
["-input", '[{"size": 100, "stencil": "7pt"}]', "-formats", "coo,csr"],
["-input", stencil_input],
expected_stdout="conversion.simple.stdout",
expected_stderr="conversion.simple.stderr",
)
Expand All @@ -14,7 +17,7 @@
["-formats", "coo,csr"],
expected_stdout="conversion.simple.stdout",
expected_stderr="conversion.simple.stderr",
stdin='[{"size": 100, "stencil": "7pt"}]',
stdin=stencil_input,
)

# input file
Expand All @@ -29,23 +32,11 @@
expected_stderr="conversion.simple.stderr",
)

# input matrixfile
test_framework.compare_output(
[
"-input_matrix",
str(test_framework.matrixpath),
"-formats",
"coo,csr",
],
expected_stdout="conversion.matrix.stdout",
expected_stderr="conversion.matrix.stderr",
)

# check that all conversions work
test_framework.compare_output(
[
"-input",
'[{"size": 100, "stencil": "7pt"}]',
stencil_input,
"-formats",
"coo,csr,ell,sellp,hybrid",
],
Expand All @@ -57,7 +48,7 @@
test_framework.compare_output(
[
"-input",
'[{"size": 100, "stencil": "7pt"}]',
stencil_input,
"-formats",
"coo,csr",
"-profile",
Expand All @@ -70,7 +61,7 @@

# complex
test_framework.compare_output(
["-input", '[{"size": 100, "stencil": "7pt"}]', "-formats", "coo,csr"],
["-input", stencil_input, "-formats", "coo,csr"],
expected_stdout="conversion_dcomplex.simple.stdout",
expected_stderr="conversion_dcomplex.simple.stderr",
use_complex=True
Expand Down
14 changes: 9 additions & 5 deletions benchmark/test/input.distributed_mtx.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[
{
"size": 100,
"stencil": "7pt",
"comm_pattern": "stencil"
}
{
"operator": {
"stencil": {
"local_size": 100,
"kind": "7pt"
}
},
"format": "csr-csr"
}
]
22 changes: 15 additions & 7 deletions benchmark/test/input.distributed_solver.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
[
{
"size": 100,
"stencil": "7pt",
"comm_pattern": "stencil",
"optimal": {
"spmv": "csr-csr"
}
{
"operator": {
"stencil": {
"local_size": 100,
"kind": "7pt"
}
},
"solver": {
"type": "solver::Cg"
},
"optimal": {
"spmv": {
"format": "csr-csr"
}
}
}
]
11 changes: 8 additions & 3 deletions benchmark/test/input.mtx.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[
{
{
"operator": {
"stencil": {
"size": 100,
"stencil": "7pt"
}
"kind": "7pt"
}
},
"format": "coo"
}
]
14 changes: 14 additions & 0 deletions benchmark/test/input.preconditioner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"operator": {
"stencil": {
"size": 100,
"kind": "7pt"
}
},
"preconditioner": {
"type": "matrix::Identity"
},
"format": "csr"
}
]
19 changes: 14 additions & 5 deletions benchmark/test/input.solver.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
[
{
{
"operator": {
"stencil": {
"size": 100,
"stencil": "7pt",
"optimal": {
"spmv": "csr"
}
"kind": "7pt"
}
},
"solver": {
"type": "solver::Cg"
},
"optimal": {
"spmv": {
"format": "csr"
}
}
}
]
10 changes: 10 additions & 0 deletions benchmark/test/input.sparse_blas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"operator": {
"stencil": {
"size": 100,
"kind": "7pt"
}
}
}
]
11 changes: 2 additions & 9 deletions benchmark/test/matrix_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# check that all input modes work:
# parameter
test_framework.compare_output(
["-input", '[{"size": 100, "stencil": "7pt"}]'],
["-input", '[{"operator": {"stencil": {"kind": "7pt", "size": 100}}}]'],
expected_stdout="matrix_statistics.simple.stdout",
expected_stderr="matrix_statistics.simple.stderr",
)
Expand All @@ -14,7 +14,7 @@
[],
expected_stdout="matrix_statistics.simple.stdout",
expected_stderr="matrix_statistics.simple.stderr",
stdin='[{"size": 100, "stencil": "7pt"}]',
stdin='[{"operator": {"stencil": {"kind": "7pt", "size": 100}}}]',
)

# input file
Expand All @@ -23,10 +23,3 @@
expected_stdout="matrix_statistics.simple.stdout",
expected_stderr="matrix_statistics.simple.stderr",
)

# input matrix file
test_framework.compare_output(
["-input_matrix", str(test_framework.matrixpath)],
expected_stdout="matrix_statistics.matrix.stdout",
expected_stderr="matrix_statistics.matrix.stderr",
)
36 changes: 15 additions & 21 deletions benchmark/test/preconditioner.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/env python3
import test_framework
import json

stencil_input = [{"operator": {"stencil": {"kind": "7pt", "size": 100}},
"preconditioner": {"type": "matrix::Identity"},
"format": "csr"}]

# check that all input modes work:
# parameter
test_framework.compare_output(
["-input", '[{"size": 100, "stencil": "7pt"}]'],
["-input", json.dumps(stencil_input)],
expected_stdout="preconditioner.simple.stdout",
expected_stderr="preconditioner.simple.stderr",
)
Expand All @@ -14,34 +19,23 @@
[],
expected_stdout="preconditioner.simple.stdout",
expected_stderr="preconditioner.simple.stderr",
stdin='[{"size": 100, "stencil": "7pt"}]',
stdin=json.dumps(stencil_input),
)

# input file
test_framework.compare_output(
["-input", str(test_framework.sourcepath / "input.mtx.json")],
["-input", str(test_framework.sourcepath / "input.preconditioner.json")],
expected_stdout="preconditioner.simple.stdout",
expected_stderr="preconditioner.simple.stderr",
)

# input matrix file
test_framework.compare_output(
["-input_matrix", str(test_framework.matrixpath)],
expected_stdout="preconditioner.matrix.stdout",
expected_stderr="preconditioner.matrix.stderr",
)

# set preconditioner works
precond_config = [stencil_input[0] | {
"preconditioner": {"type": "preconditioner::Jacobi", "max_block_size": 32, "storage_optimization": [0, 0]}}]
test_framework.compare_output(
[
"-preconditioners",
"jacobi",
"-jacobi_max_block_size",
"32",
"-jacobi_storage",
"0,0",
"-input",
'[{"size": 100, "stencil": "7pt"}]'],
json.dumps(precond_config)],
expected_stdout="preconditioner.precond.stdout",
expected_stderr="preconditioner.precond.stderr",
)
Expand All @@ -50,7 +44,7 @@
test_framework.compare_output(
[
"-input",
'[{"size": 100, "stencil": "7pt"}]',
json.dumps(stencil_input),
"-profile",
"-profiler_hook",
"debug",
Expand All @@ -61,15 +55,15 @@

# stdin
test_framework.compare_output(
["-reorder", "amd"],
[],
expected_stdout="preconditioner.reordered.stdout",
expected_stderr="preconditioner.reordered.stderr",
stdin='[{"size": 100, "stencil": "7pt"}]',
stdin=json.dumps([stencil_input[0] | {"reorder": "amd"}]),
)

# complex
test_framework.compare_output(
["-input", '[{"size": 100, "stencil": "7pt"}]'],
["-input", json.dumps(stencil_input)],
expected_stdout="preconditioner_dcomplex.simple.stdout",
expected_stderr="preconditioner_dcomplex.simple.stderr",
use_complex=True
Expand Down
16 changes: 4 additions & 12 deletions benchmark/test/reference/blas.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ Running on ReferenceExecutor
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The operations are copy,axpy,scal
Running test case n = 100
DEBUG: begin n = 100
Running blas: copy
DEBUG: begin copy
Running test case
{"n":100}
DEBUG: begin {"n":100}
DEBUG: begin dense::fill
DEBUG: end dense::fill
DEBUG: begin repetition
DEBUG: begin dense::copy
DEBUG: end dense::copy
DEBUG: end repetition
DEBUG: end copy
Running blas: axpy
DEBUG: begin axpy
DEBUG: begin dense::fill
DEBUG: end dense::fill
DEBUG: begin dense::fill
Expand All @@ -25,9 +21,6 @@ DEBUG: begin repetition
DEBUG: begin dense::add_scaled
DEBUG: end dense::add_scaled
DEBUG: end repetition
DEBUG: end axpy
Running blas: scal
DEBUG: begin scal
DEBUG: begin dense::fill
DEBUG: end dense::fill
DEBUG: begin dense::fill
Expand All @@ -36,5 +29,4 @@ DEBUG: begin repetition
DEBUG: begin dense::scale
DEBUG: end dense::scale
DEBUG: end repetition
DEBUG: end scal
DEBUG: end n = 100
DEBUG: end {"n":100}
22 changes: 14 additions & 8 deletions benchmark/test/reference/blas.profile.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,29 @@
"time": 1.0,
"flops": 1.0,
"bandwidth": 1.0,
"repetitions": 1,
"completed": true
"repetitions": 1
},
"axpy": {
"time": 1.0,
"flops": 1.0,
"bandwidth": 1.0,
"repetitions": 1,
"completed": true
"repetitions": 1
},
"scal": {
"time": 1.0,
"flops": 1.0,
"bandwidth": 1.0,
"repetitions": 1,
"completed": true
}
}
"repetitions": 1
},
"completed": true
},
"k": 100,
"m": 100,
"r": 1,
"stride_x": 1,
"stride_y": 1,
"stride_A": 100,
"stride_B": 100,
"stride_C": 100
}
]
6 changes: 2 additions & 4 deletions benchmark/test/reference/blas.simple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ Running on ReferenceExecutor
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The operations are copy,axpy,scal
Running test case n = 100
Running blas: copy
Running blas: axpy
Running blas: scal
Running test case
{"n":100}
Loading
Loading