-
-
Save jkozdon/430f937b9faae695d27fa21941affdd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Metis | |
using JLD | |
using UnicodePlots | |
using SparseArrays | |
function compute_flops2(A) | |
v = Metis.separator(A) | |
lf = findall(v .== 1) | |
rt = findall(v .== 2) | |
sep = findall(v .== 3) | |
# println((length(v), length(rt), length(lf), length(sep))) | |
if length(sep) > 0 | |
flops = length(sep)^3 | |
flops += length(rt) >= 1 ? compute_flops2(A[rt, rt]) : length(rt)^3 | |
flops += length(lf) >= 1 ? compute_flops2(A[lf, lf]) : length(lf)^3 | |
else | |
flops = length(v)^3 | |
end | |
return flops | |
end | |
function comp_perm(A) | |
v = Metis.separator(A) | |
lf = findall(v .== 1) | |
rt = findall(v .== 2) | |
sep = findall(v .== 3) | |
if length(lf) > 0 && length(rt) > 0 | |
lf = lf[comp_perm(A[lf, lf])] | |
rt = rt[comp_perm(A[rt, rt])] | |
end | |
ind = [lf; rt; sep] | |
return ind | |
end | |
M = try | |
load("matrices_1_17.jld") | |
catch | |
download("https://nps.box.com/shared/static/lokpepb39l3ysq2woj4q9neh97leyf9q.jld", "matrices_1_17.jld") | |
load("matrices_1_17.jld") | |
end | |
A2 = M["A2"]; A2 = A2 + A2' | |
B2 = M["B2"]; B2 = B2 + B2' | |
C2 = M["C2"]; C2 = C2 + C2' | |
G2 = M["G2"]; G2 = G2 + G2' | |
println("monolithic") | |
A_my_ind = comp_perm(A2) | |
A_ind, _ = Metis.permutation(A2) | |
println("original") | |
display(spy(A2)) | |
println("my permuted") | |
display(spy(A2[A_my_ind, A_my_ind])) | |
println("metris permutation") | |
display(spy(A2[A_ind, A_ind])) | |
println("") | |
println("---------------------------------------------") | |
println("") | |
println("displacement") | |
C_my_ind = comp_perm(C2) | |
C_ind, _ = Metis.permutation(C2) | |
println("original") | |
display(spy(C2)) | |
println("my permuted") | |
display(spy(C2[C_my_ind, C_my_ind])) | |
println("metris permutation") | |
display(spy(C2[C_ind, C_ind])) | |
println("") | |
println("---------------------------------------------") | |
println("") | |
println("trace") | |
B_my_ind = comp_perm(B2) | |
B_ind, _ = Metis.permutation(B2) | |
println("original") | |
display(spy(B2)) | |
println("my permuted") | |
display(spy(B2[B_my_ind, B_my_ind])) | |
println("metris permutation") | |
display(spy(B2[B_ind, B_ind])) | |
println("") | |
println("---------------------------------------------") | |
println("") | |
println("single block") | |
G_my_ind = comp_perm(G2) | |
G_ind, _ = Metis.permutation(G2) | |
println("original") | |
display(spy(G2)) | |
println("my permuted") | |
display(spy(G2[G_my_ind, G_my_ind])) | |
println("metris permutation") | |
display(spy(G2[G_ind, G_ind])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is machine-generated - editing it directly is not advised | |
[[ArnoldiMethod]] | |
deps = ["LinearAlgebra", "Random", "StaticArrays"] | |
git-tree-sha1 = "f87e559f87a45bece9c9ed97458d3afe98b1ebb9" | |
uuid = "ec485272-7323-5ecc-a04f-4719b315124d" | |
version = "0.1.0" | |
[[Artifacts]] | |
deps = ["Pkg"] | |
git-tree-sha1 = "c30985d8821e0cd73870b17b0ed0ce6dc44cb744" | |
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" | |
version = "1.3.0" | |
[[Base64]] | |
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" | |
[[Blosc]] | |
deps = ["Blosc_jll"] | |
git-tree-sha1 = "84cf7d0f8fd46ca6f1b3e0305b4b4a37afe50fd6" | |
uuid = "a74b3585-a348-5f62-a45c-50e91977d574" | |
version = "0.7.0" | |
[[Blosc_jll]] | |
deps = ["Libdl", "Lz4_jll", "Pkg", "Zlib_jll", "Zstd_jll"] | |
git-tree-sha1 = "aa9ef39b54a168c3df1b2911e7797e4feee50fbe" | |
uuid = "0b7ba130-8d10-5ba8-a3d6-c5182647fed9" | |
version = "1.14.3+1" | |
[[Compat]] | |
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] | |
git-tree-sha1 = "919c7f3151e79ff196add81d7f4e45d91bbf420b" | |
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" | |
version = "3.25.0" | |
[[Crayons]] | |
git-tree-sha1 = "3f71217b538d7aaee0b69ab47d9b7724ca8afa0d" | |
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" | |
version = "4.0.4" | |
[[DataAPI]] | |
git-tree-sha1 = "ad84f52c0b8f05aa20839484dbaf01690b41ff84" | |
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" | |
version = "1.4.0" | |
[[DataStructures]] | |
deps = ["Compat", "InteractiveUtils", "OrderedCollections"] | |
git-tree-sha1 = "4437b64df1e0adccc3e5d1adbc3ac741095e4677" | |
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" | |
version = "0.18.9" | |
[[Dates]] | |
deps = ["Printf"] | |
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" | |
[[DelimitedFiles]] | |
deps = ["Mmap"] | |
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" | |
[[Distributed]] | |
deps = ["Random", "Serialization", "Sockets"] | |
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" | |
[[FileIO]] | |
deps = ["Pkg"] | |
git-tree-sha1 = "fee8955b9dfa7bec67117ef48085fb2b559b9c22" | |
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" | |
version = "1.4.5" | |
[[HDF5]] | |
deps = ["Blosc", "Compat", "HDF5_jll", "Libdl", "Mmap", "Random", "Requires"] | |
git-tree-sha1 = "947d696a6b6dbc14018a1668c4724fdc6236a3d3" | |
uuid = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" | |
version = "0.15.2" | |
[[HDF5_jll]] | |
deps = ["Artifacts", "JLLWrappers", "LibCURL_jll", "Libdl", "OpenSSL_jll", "Pkg", "Zlib_jll"] | |
git-tree-sha1 = "fd83fa0bde42e01952757f01149dd968c06c4dba" | |
uuid = "0234f1f7-429e-5d53-9886-15a909be8d59" | |
version = "1.12.0+1" | |
[[Inflate]] | |
git-tree-sha1 = "f5fc07d4e706b84f72d54eedcc1c13d92fb0871c" | |
uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" | |
version = "0.1.2" | |
[[InteractiveUtils]] | |
deps = ["Markdown"] | |
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" | |
[[JLD]] | |
deps = ["FileIO", "HDF5", "Printf"] | |
git-tree-sha1 = "bb5606484571a52df34077bccc271e17a06ac2a9" | |
uuid = "4138dd39-2aa7-5051-a626-17a0bb65d9c8" | |
version = "0.12.1" | |
[[JLLWrappers]] | |
git-tree-sha1 = "a431f5f2ca3f4feef3bd7a5e94b8b8d4f2f647a0" | |
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" | |
version = "1.2.0" | |
[[LibCURL_jll]] | |
deps = ["LibSSH2_jll", "Libdl", "MbedTLS_jll", "Pkg", "Zlib_jll", "nghttp2_jll"] | |
git-tree-sha1 = "897d962c20031e6012bba7b3dcb7a667170dad17" | |
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" | |
version = "7.70.0+2" | |
[[LibGit2]] | |
deps = ["Printf"] | |
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" | |
[[LibSSH2_jll]] | |
deps = ["Libdl", "MbedTLS_jll", "Pkg"] | |
git-tree-sha1 = "717705533148132e5466f2924b9a3657b16158e8" | |
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" | |
version = "1.9.0+3" | |
[[Libdl]] | |
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" | |
[[LightGraphs]] | |
deps = ["ArnoldiMethod", "DataStructures", "Distributed", "Inflate", "LinearAlgebra", "Random", "SharedArrays", "SimpleTraits", "SparseArrays", "Statistics"] | |
git-tree-sha1 = "432428df5f360964040ed60418dd5601ecd240b6" | |
uuid = "093fc24a-ae57-5d10-9952-331d41423f4d" | |
version = "1.3.5" | |
[[LinearAlgebra]] | |
deps = ["Libdl"] | |
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | |
[[Logging]] | |
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" | |
[[Lz4_jll]] | |
deps = ["Libdl", "Pkg"] | |
git-tree-sha1 = "51b1db0732bbdcfabb60e36095cc3ed9c0016932" | |
uuid = "5ced341a-0733-55b8-9ab6-a4889d929147" | |
version = "1.9.2+2" | |
[[METIS_jll]] | |
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] | |
git-tree-sha1 = "2dc1a9fc87e57e32b1fc186db78811157b30c118" | |
uuid = "d00139f3-1899-568f-a2f0-47f597d42d70" | |
version = "5.1.0+5" | |
[[MacroTools]] | |
deps = ["Markdown", "Random"] | |
git-tree-sha1 = "6a8a2a625ab0dea913aba95c11370589e0239ff0" | |
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" | |
version = "0.5.6" | |
[[Markdown]] | |
deps = ["Base64"] | |
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" | |
[[MbedTLS_jll]] | |
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] | |
git-tree-sha1 = "0eef589dd1c26a3ac9d753fe1a8bcad63f956fa6" | |
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" | |
version = "2.16.8+1" | |
[[Metis]] | |
deps = ["LightGraphs", "LinearAlgebra", "METIS_jll", "SparseArrays"] | |
git-tree-sha1 = "c2fbb518580d5e9efd0c2601fc8116b2c76d945e" | |
uuid = "2679e427-3c69-5b7f-982b-ece356f1e94b" | |
version = "1.0.0" | |
[[Missings]] | |
deps = ["DataAPI"] | |
git-tree-sha1 = "ed61674a0864832495ffe0a7e889c0da76b0f4c8" | |
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" | |
version = "0.4.4" | |
[[Mmap]] | |
uuid = "a63ad114-7e13-5084-954f-fe012c677804" | |
[[OpenSSL_jll]] | |
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] | |
git-tree-sha1 = "71bbbc616a1d710879f5a1021bcba65ffba6ce58" | |
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" | |
version = "1.1.1+6" | |
[[OrderedCollections]] | |
git-tree-sha1 = "cf59cfed2e2c12e8a2ff0a4f1e9b2cd8650da6db" | |
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" | |
version = "1.3.2" | |
[[Pkg]] | |
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] | |
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | |
[[Printf]] | |
deps = ["Unicode"] | |
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" | |
[[REPL]] | |
deps = ["InteractiveUtils", "Markdown", "Sockets"] | |
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" | |
[[Random]] | |
deps = ["Serialization"] | |
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | |
[[Requires]] | |
deps = ["UUIDs"] | |
git-tree-sha1 = "cfbac6c1ed70c002ec6361e7fd334f02820d6419" | |
uuid = "ae029012-a4dd-5104-9daa-d747884805df" | |
version = "1.1.2" | |
[[SHA]] | |
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" | |
[[Serialization]] | |
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" | |
[[SharedArrays]] | |
deps = ["Distributed", "Mmap", "Random", "Serialization"] | |
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" | |
[[SimpleTraits]] | |
deps = ["InteractiveUtils", "MacroTools"] | |
git-tree-sha1 = "daf7aec3fe3acb2131388f93a4c409b8c7f62226" | |
uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" | |
version = "0.9.3" | |
[[Sockets]] | |
uuid = "6462fe0b-24de-5631-8697-dd941f90decc" | |
[[SortingAlgorithms]] | |
deps = ["DataStructures", "Random", "Test"] | |
git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd" | |
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" | |
version = "0.3.1" | |
[[SparseArrays]] | |
deps = ["LinearAlgebra", "Random"] | |
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | |
[[StaticArrays]] | |
deps = ["LinearAlgebra", "Random", "Statistics"] | |
git-tree-sha1 = "9da72ed50e94dbff92036da395275ed114e04d49" | |
uuid = "90137ffa-7385-5640-81b9-e52037218182" | |
version = "1.0.1" | |
[[Statistics]] | |
deps = ["LinearAlgebra", "SparseArrays"] | |
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | |
[[StatsBase]] | |
deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"] | |
git-tree-sha1 = "7bab7d4eb46b225b35179632852b595a3162cb61" | |
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" | |
version = "0.33.2" | |
[[Test]] | |
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] | |
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | |
[[UUIDs]] | |
deps = ["Random", "SHA"] | |
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" | |
[[Unicode]] | |
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" | |
[[UnicodePlots]] | |
deps = ["Crayons", "Dates", "SparseArrays", "StatsBase"] | |
git-tree-sha1 = "1a63e6eea76b291378ff9f95801f8b6d96213208" | |
uuid = "b8865327-cd53-5732-bb35-84acbb429228" | |
version = "1.3.0" | |
[[Zlib_jll]] | |
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] | |
git-tree-sha1 = "320228915c8debb12cb434c59057290f0834dbf6" | |
uuid = "83775a58-1f1d-513f-b197-d71354ab007a" | |
version = "1.2.11+18" | |
[[Zstd_jll]] | |
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] | |
git-tree-sha1 = "6f1abcb0c44f184690912aa4b0ba861dd64f11b9" | |
uuid = "3161d3a3-bdf6-5164-811a-617609db77b4" | |
version = "1.4.5+2" | |
[[nghttp2_jll]] | |
deps = ["Libdl", "Pkg"] | |
git-tree-sha1 = "8e2c44ab4d49ad9518f359ed8b62f83ba8beede4" | |
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" | |
version = "1.40.0+2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[deps] | |
JLD = "4138dd39-2aa7-5051-a626-17a0bb65d9c8" | |
Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b" | |
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | |
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" |
Author
jkozdon
commented
Jan 23, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment