Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add reference output #39

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Manifest.toml
9 changes: 9 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[deps]
Finch = "9177782c-1635-4eb9-9bfb-d9dfa25e6bce"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
MatrixMarket = "4d4711f2-db25-561a-b6b3-d35e7d4047d3"
TensorMarket = "8b7d4fe7-0b45-4d0d-9dd8-5cc9b23b4b77"

[compat]
Finch = "0.6.28"
53 changes: 53 additions & 0 deletions examples/generate_reference.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env julia
if abspath(PROGRAM_FILE) == @__FILE__
using Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()
end

using Finch
using MatrixMarket
using MatrixDepot
using TensorMarket
using HDF5
using JSON
using SparseArrays

for (vec_key, x) in [
"foo" => [11, 12, 13, 14],
"bar" => sparse([0, 0, 13, 0, 0, 16, 0, 0, 19]),
]
for (fmt_key, fmt) in [
"VEC" => Tensor(SparseList(Element(zero(eltype(x))))),
"DVEC" => Tensor(Dense(Element(zero(eltype(x))))),
]
fmt = dropdefaults!(fmt, x)
example_dir = joinpath(@__DIR__, "reference", "$(vec_key)_$(fmt_key)")
mkpath(example_dir)
fwrite(joinpath(example_dir, "$(vec_key).mtx"), x)
fwrite(joinpath(example_dir, "$(vec_key)_$(fmt_key).bsp.h5"), fmt)
end
end

for (mtx_key, A) in [
#"mycielskian3" => SparseMatrixCSC(matrixdepot("Mycielski/mycielskian3")), #TODO this matrix is symmetric but Finch doesn't have a way to communicate that to binsparse.
"b1_ss" => SparseMatrixCSC(matrixdepot("Grund/b1_ss")),
"farm" => SparseMatrixCSC(matrixdepot("Meszaros/farm")),
]
for (fmt_key, fmt) in [
"CSR" => swizzle(Tensor(Dense(SparseList(Element(zero(eltype(A)))))), 2, 1),
"CSC" => Tensor(Dense(SparseList(Element(zero(eltype(A)))))),
"DMAT" => swizzle(Tensor(Dense(Dense(Element(zero(eltype(A)))))), 2, 1),
"DMATR" => Tensor(Dense(Dense(Element(zero(eltype(A)))))),
"DCSR" => swizzle(Tensor(SparseList(SparseList(Element(zero(eltype(A)))))), 2, 1),
"DCSC" => Tensor(SparseList(SparseList(Element(zero(eltype(A)))))),
"COO" => swizzle(Tensor(SparseCOO{2}(Element(zero(eltype(A))))), 2, 1),
"COOC" => Tensor(SparseCOO{2}(Element(zero(eltype(A))))),
]
fmt = copyto!(fmt, A)
example_dir = joinpath(@__DIR__, "reference", "$(mtx_key)_$(fmt_key)")
mkpath(example_dir)
fwrite(joinpath(example_dir, "$(mtx_key).mtx"), A)
fwrite(joinpath(example_dir, "$(mtx_key)_$(fmt_key).bsp.h5"), fmt)
end
end
17 changes: 17 additions & 0 deletions examples/reference/b1_ss_COO/b1_ss.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
7 7 15
5 1 -0.03599942
6 1 -0.0176371
7 1 -0.007721779
1 2 1.0
2 2 -1.0
1 3 1.0
3 3 -1.0
1 4 1.0
4 4 -1.0
2 5 0.45
5 5 1.0
3 6 0.1
6 6 1.0
4 7 0.45
7 7 1.0
Binary file added examples/reference/b1_ss_COO/b1_ss_COO.bsp.h5
Binary file not shown.
17 changes: 17 additions & 0 deletions examples/reference/b1_ss_COOC/b1_ss.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
7 7 15
5 1 -0.03599942
6 1 -0.0176371
7 1 -0.007721779
1 2 1.0
2 2 -1.0
1 3 1.0
3 3 -1.0
1 4 1.0
4 4 -1.0
2 5 0.45
5 5 1.0
3 6 0.1
6 6 1.0
4 7 0.45
7 7 1.0
Binary file added examples/reference/b1_ss_COOC/b1_ss_COOC.bsp.h5
Binary file not shown.
17 changes: 17 additions & 0 deletions examples/reference/b1_ss_CSC/b1_ss.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
7 7 15
5 1 -0.03599942
6 1 -0.0176371
7 1 -0.007721779
1 2 1.0
2 2 -1.0
1 3 1.0
3 3 -1.0
1 4 1.0
4 4 -1.0
2 5 0.45
5 5 1.0
3 6 0.1
6 6 1.0
4 7 0.45
7 7 1.0
Binary file added examples/reference/b1_ss_CSC/b1_ss_CSC.bsp.h5
Binary file not shown.
17 changes: 17 additions & 0 deletions examples/reference/b1_ss_CSR/b1_ss.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
7 7 15
5 1 -0.03599942
6 1 -0.0176371
7 1 -0.007721779
1 2 1.0
2 2 -1.0
1 3 1.0
3 3 -1.0
1 4 1.0
4 4 -1.0
2 5 0.45
5 5 1.0
3 6 0.1
6 6 1.0
4 7 0.45
7 7 1.0
Binary file added examples/reference/b1_ss_CSR/b1_ss_CSR.bsp.h5
Binary file not shown.
17 changes: 17 additions & 0 deletions examples/reference/b1_ss_DCSC/b1_ss.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
7 7 15
5 1 -0.03599942
6 1 -0.0176371
7 1 -0.007721779
1 2 1.0
2 2 -1.0
1 3 1.0
3 3 -1.0
1 4 1.0
4 4 -1.0
2 5 0.45
5 5 1.0
3 6 0.1
6 6 1.0
4 7 0.45
7 7 1.0
Binary file added examples/reference/b1_ss_DCSC/b1_ss_DCSC.bsp.h5
Binary file not shown.
17 changes: 17 additions & 0 deletions examples/reference/b1_ss_DCSR/b1_ss.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
7 7 15
5 1 -0.03599942
6 1 -0.0176371
7 1 -0.007721779
1 2 1.0
2 2 -1.0
1 3 1.0
3 3 -1.0
1 4 1.0
4 4 -1.0
2 5 0.45
5 5 1.0
3 6 0.1
6 6 1.0
4 7 0.45
7 7 1.0
Binary file added examples/reference/b1_ss_DCSR/b1_ss_DCSR.bsp.h5
Binary file not shown.
17 changes: 17 additions & 0 deletions examples/reference/b1_ss_DMAT/b1_ss.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
7 7 15
5 1 -0.03599942
6 1 -0.0176371
7 1 -0.007721779
1 2 1.0
2 2 -1.0
1 3 1.0
3 3 -1.0
1 4 1.0
4 4 -1.0
2 5 0.45
5 5 1.0
3 6 0.1
6 6 1.0
4 7 0.45
7 7 1.0
Binary file added examples/reference/b1_ss_DMAT/b1_ss_DMAT.bsp.h5
Binary file not shown.
17 changes: 17 additions & 0 deletions examples/reference/b1_ss_DMATR/b1_ss.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%%MatrixMarket matrix coordinate real general
7 7 15
5 1 -0.03599942
6 1 -0.0176371
7 1 -0.007721779
1 2 1.0
2 2 -1.0
1 3 1.0
3 3 -1.0
1 4 1.0
4 4 -1.0
2 5 0.45
5 5 1.0
3 6 0.1
6 6 1.0
4 7 0.45
7 7 1.0
Binary file added examples/reference/b1_ss_DMATR/b1_ss_DMATR.bsp.h5
Binary file not shown.
5 changes: 5 additions & 0 deletions examples/reference/bar_DVEC/bar.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%%MatrixMarket matrix coordinate integer general
9 3
3 13
6 16
9 19
Binary file added examples/reference/bar_DVEC/bar_DVEC.bsp.h5
Binary file not shown.
5 changes: 5 additions & 0 deletions examples/reference/bar_VEC/bar.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%%MatrixMarket matrix coordinate integer general
9 3
3 13
6 16
9 19
Binary file added examples/reference/bar_VEC/bar_VEC.bsp.h5
Binary file not shown.
43 changes: 43 additions & 0 deletions examples/reference/farm_COO/farm.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%%MatrixMarket matrix coordinate integer general
7 17 41
1 1 1
2 2 1
3 3 1
6 4 1
7 5 1
1 6 4
2 6 1
3 6 20
1 7 4
2 7 1
3 7 15
4 7 40
1 8 2
2 8 1
1 9 2
2 9 1
4 9 35
1 10 1
2 10 1
5 10 1
1 11 1
2 11 1
4 11 50
1 12 250
2 12 2
3 12 30
6 12 1
1 13 250
2 13 2
4 13 15
6 13 1
1 14 125
2 14 1
3 14 20
7 14 1
1 15 125
2 15 1
4 15 10
7 15 1
3 16 1
4 17 1
Binary file added examples/reference/farm_COO/farm_COO.bsp.h5
Binary file not shown.
43 changes: 43 additions & 0 deletions examples/reference/farm_COOC/farm.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%%MatrixMarket matrix coordinate integer general
7 17 41
1 1 1
2 2 1
3 3 1
6 4 1
7 5 1
1 6 4
2 6 1
3 6 20
1 7 4
2 7 1
3 7 15
4 7 40
1 8 2
2 8 1
1 9 2
2 9 1
4 9 35
1 10 1
2 10 1
5 10 1
1 11 1
2 11 1
4 11 50
1 12 250
2 12 2
3 12 30
6 12 1
1 13 250
2 13 2
4 13 15
6 13 1
1 14 125
2 14 1
3 14 20
7 14 1
1 15 125
2 15 1
4 15 10
7 15 1
3 16 1
4 17 1
Binary file added examples/reference/farm_COOC/farm_COOC.bsp.h5
Binary file not shown.
43 changes: 43 additions & 0 deletions examples/reference/farm_CSC/farm.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%%MatrixMarket matrix coordinate integer general
7 17 41
1 1 1
2 2 1
3 3 1
6 4 1
7 5 1
1 6 4
2 6 1
3 6 20
1 7 4
2 7 1
3 7 15
4 7 40
1 8 2
2 8 1
1 9 2
2 9 1
4 9 35
1 10 1
2 10 1
5 10 1
1 11 1
2 11 1
4 11 50
1 12 250
2 12 2
3 12 30
6 12 1
1 13 250
2 13 2
4 13 15
6 13 1
1 14 125
2 14 1
3 14 20
7 14 1
1 15 125
2 15 1
4 15 10
7 15 1
3 16 1
4 17 1
Binary file added examples/reference/farm_CSC/farm_CSC.bsp.h5
Binary file not shown.
43 changes: 43 additions & 0 deletions examples/reference/farm_CSR/farm.mtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%%MatrixMarket matrix coordinate integer general
7 17 41
1 1 1
2 2 1
3 3 1
6 4 1
7 5 1
1 6 4
2 6 1
3 6 20
1 7 4
2 7 1
3 7 15
4 7 40
1 8 2
2 8 1
1 9 2
2 9 1
4 9 35
1 10 1
2 10 1
5 10 1
1 11 1
2 11 1
4 11 50
1 12 250
2 12 2
3 12 30
6 12 1
1 13 250
2 13 2
4 13 15
6 13 1
1 14 125
2 14 1
3 14 20
7 14 1
1 15 125
2 15 1
4 15 10
7 15 1
3 16 1
4 17 1
Binary file added examples/reference/farm_CSR/farm_CSR.bsp.h5
Binary file not shown.
Loading
Loading