Skip to content

Commit 213ff21

Browse files
committed
[bench] add schema for json input
1 parent 02b84db commit 213ff21

19 files changed

Lines changed: 803 additions & 3 deletions

ABOUT-LICENSING.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ following license:
4949
> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5050
5151
When compiling Ginkgo with `-DGINKGO_BUILD_BENCHMARKS=ON` the build system will
52-
download, build, and link [gflags](https://github.com/gflags/gflags) and
53-
[nlohmann-json](https://github.com/nlohmann/json) with the
52+
download, build, and link [gflags](https://github.com/gflags/gflags),
53+
[nlohmann-json](https://github.com/nlohmann/json), and
54+
[json-schema-validator](https://github.com/pboettch/json-schema-validator) with the
5455
benchmark suites. gtest is available under the following license:
5556

5657
> Copyright (c) 2006, Google Inc.
@@ -106,6 +107,31 @@ nlohmann-json is available under the following license:
106107
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
107108
> SOFTWARE.
108109
110+
json-schema-validator is available under the following license:
111+
112+
> Modern C++ JSON schema validator is licensed under the MIT License
113+
> <http://opensource.org/licenses/MIT>:
114+
>
115+
> Copyright (c) 2016 Patrick Boettcher
116+
>
117+
> Permission is hereby granted, free of charge, to any person obtaining a copy of
118+
> this software and associated documentation files (the "Software"), to deal in
119+
> the Software without restriction, including without limitation the rights to
120+
> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
121+
> of the Software, and to permit persons to whom the Software is furnished to do
122+
> so, subject to the following conditions:
123+
>
124+
> The above copyright notice and this permission notice shall be included in all
125+
> copies or substantial portions of the Software.
126+
>
127+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
128+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
129+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
130+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
131+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
132+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
133+
> SOFTWARE.
134+
109135
For generating the documentation of Ginkgo, some scripts from the deal.II
110136
library are used. You can refer to the `doc/` folder to see which files are a
111137
modified version of deal.II's documentation generation scripts. Additionally,

benchmark/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ function(
101101
type
102102
)
103103
add_executable("${name}" ${ARGN})
104-
target_link_libraries("${name}" ginkgo gflags nlohmann_json::nlohmann_json)
104+
target_link_libraries(
105+
"${name}"
106+
ginkgo
107+
gflags
108+
nlohmann_json::nlohmann_json
109+
nlohmann_json_schema_validator
110+
)
105111
# always include the device timer
106112
if(GINKGO_BUILD_CUDA)
107113
target_compile_definitions("${name}" PRIVATE HAS_CUDA_TIMER=1)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Distributed BLAS",
4+
"description": "Input for a single BLAS operation with distributed vectors",
5+
"type": "object",
6+
"properties": {
7+
"n": {
8+
"type": "integer",
9+
"minimum": 1
10+
},
11+
"r": {
12+
"type": "integer",
13+
"minimum": 1
14+
},
15+
"stride": {
16+
"type": "integer",
17+
"minimum": 1
18+
},
19+
"stride_x": {
20+
"type": "integer",
21+
"minimum": 1
22+
},
23+
"stride_y": {
24+
"type": "integer",
25+
"minimum": 1
26+
}
27+
},
28+
"if": {
29+
"required": [
30+
"stride"
31+
]
32+
},
33+
"then": {
34+
"not": {
35+
"anyOf": [
36+
{
37+
"required": [
38+
"stride_x"
39+
]
40+
},
41+
{
42+
"required": [
43+
"stride_y"
44+
]
45+
}
46+
]
47+
}
48+
},
49+
"required": [
50+
"n"
51+
],
52+
"examples": [
53+
{
54+
"n": 1000
55+
},
56+
{
57+
"n": 1000,
58+
"r": 1000
59+
},
60+
{
61+
"n": 1000,
62+
"stride": 1024
63+
},
64+
{
65+
"n": 1000,
66+
"stride_x": 1024,
67+
"stride_y": 2048
68+
}
69+
]
70+
}

benchmark/schema/blas.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "BLAS",
4+
"description": "Input for a single BLAS operation",
5+
"type": "object",
6+
"properties": {
7+
"n": {
8+
"type": "integer",
9+
"minimum": 1
10+
},
11+
"r": {
12+
"type": "integer",
13+
"minimum": 1
14+
},
15+
"m": {
16+
"type": "integer",
17+
"minimum": 1
18+
},
19+
"k": {
20+
"type": "integer",
21+
"minimum": 1
22+
},
23+
"stride": {
24+
"type": "integer",
25+
"minimum": 1
26+
},
27+
"stride_x": {
28+
"type": "integer",
29+
"minimum": 1
30+
},
31+
"stride_y": {
32+
"type": "integer",
33+
"minimum": 1
34+
},
35+
"stride_A": {
36+
"type": "integer",
37+
"minimum": 1
38+
},
39+
"stride_B": {
40+
"type": "integer",
41+
"minimum": 1
42+
},
43+
"stride_C": {
44+
"type": "integer",
45+
"minimum": 1
46+
}
47+
},
48+
"if": {
49+
"required": [
50+
"stride"
51+
]
52+
},
53+
"then": {
54+
"not": {
55+
"anyOf": [
56+
{
57+
"required": [
58+
"stride_x"
59+
]
60+
},
61+
{
62+
"required": [
63+
"stride_y"
64+
]
65+
}
66+
]
67+
}
68+
},
69+
"required": [
70+
"n"
71+
],
72+
"examples": [
73+
{
74+
"n": 1000
75+
},
76+
{
77+
"n": 1000,
78+
"r": 1000,
79+
"m": 1000,
80+
"k": 1000
81+
},
82+
{
83+
"n": 1000,
84+
"stride": 1024
85+
},
86+
{
87+
"n": 1000,
88+
"stride_x": 1024,
89+
"stride_y": 2048
90+
}
91+
]
92+
}

benchmark/schema/conversion.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Conversion",
4+
"description": "Input for a single conversion operation",
5+
"type": "object",
6+
"properties": {
7+
"operator": {
8+
"$ref": "operator.reuse.json"
9+
}
10+
},
11+
"required": [
12+
"operator"
13+
],
14+
"not": {
15+
"required": [
16+
"format",
17+
"reorder"
18+
]
19+
},
20+
"examples": [
21+
{
22+
"operator": {
23+
"filename": "my_file.mtx"
24+
}
25+
},
26+
{
27+
"operator": {
28+
"stencil": {
29+
"name": "5pt",
30+
"size": 100
31+
}
32+
}
33+
}
34+
]
35+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Matrix Generator",
4+
"description": "Input for a single matrix generation operation",
5+
"type": "object",
6+
"properties": {
7+
"filename": {
8+
"type": "string"
9+
},
10+
"problem": {
11+
"type": "object",
12+
"properties": {
13+
"type": {
14+
"enum": [
15+
"block-diagonal"
16+
]
17+
},
18+
"num_blocks": {
19+
"type": "integer",
20+
"minimum": 1
21+
},
22+
"block_size": {
23+
"type": "integer",
24+
"minimum": 1
25+
}
26+
}
27+
}
28+
},
29+
"required": [
30+
"filename",
31+
"problem"
32+
],
33+
"examples": [
34+
{
35+
"$comment": "The generated matrix will have a dense block of size <block-size>, with random real values chosen uniformly in the interval [-1, 1], repeated <num-blocks> times on the diagonal"
36+
},
37+
{
38+
"filename": "output_matrix.mtx",
39+
"problem": {
40+
"type": "block-diagonal",
41+
"num_blocks": 2,
42+
"block_size": 2
43+
}
44+
}
45+
]
46+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Matrix Statistics",
4+
"description": "Input for a single matrix statistics operation",
5+
"type": "object",
6+
"properties": {
7+
"operator": {
8+
"$ref": "operator.reuse.json"
9+
}
10+
},
11+
"required": [
12+
"operator"
13+
],
14+
"examples": [
15+
{
16+
"operator": {
17+
"filename": "my_file.mtx"
18+
}
19+
},
20+
{
21+
"operator": {
22+
"stencil": {
23+
"name": "5pt",
24+
"size": 100
25+
}
26+
}
27+
}
28+
]
29+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "operator-distributed.reuse.json",
4+
"title": "Distributed Operator",
5+
"description": "Reusable distributed operator definition",
6+
"type": "object",
7+
"properties": {
8+
"filename": {
9+
"type": "string"
10+
},
11+
"stencil": {
12+
"type": "object",
13+
"properties": {
14+
"kind": {
15+
"enum": [
16+
"5pt",
17+
"7pt",
18+
"9pt",
19+
"27pt"
20+
]
21+
},
22+
"local_size": {
23+
"type": "integer",
24+
"exclusiveMinimum": 0
25+
},
26+
"comm_pattern": {
27+
"enum": [
28+
"stencil",
29+
"optimal"
30+
],
31+
"default": "stencil"
32+
}
33+
},
34+
"required": [
35+
"kind",
36+
"local_size"
37+
]
38+
}
39+
},
40+
"additionalProperties": false,
41+
"oneOf": [
42+
{
43+
"required": [
44+
"filename"
45+
]
46+
},
47+
{
48+
"required": [
49+
"stencil"
50+
]
51+
}
52+
]
53+
}

0 commit comments

Comments
 (0)