Skip to content

Commit

Permalink
wrap interpolate in Array()
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Mar 12, 2024
1 parent 410307a commit 792c95d
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 93 deletions.
101 changes: 52 additions & 49 deletions experiments/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ manifest_format = "2.0"
project_hash = "960bdc0a1ed4b3f2aee66ed2e0c02065769614a9"

[[deps.ADTypes]]
git-tree-sha1 = "41c37aa88889c171f1300ceac1313c06e891d245"
git-tree-sha1 = "016833eb52ba2d6bea9fcb50ca295980e728ee24"
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
version = "0.2.6"
version = "0.2.7"

[[deps.AMD]]
deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse_jll"]
Expand Down Expand Up @@ -38,9 +38,9 @@ version = "0.4.5"

[[deps.Adapt]]
deps = ["LinearAlgebra", "Requires"]
git-tree-sha1 = "e2a9873379849ce2ac9f9fa34b0e37bde5d5fe0a"
git-tree-sha1 = "cea4ac3f5b4bc4b3000aa55afb6e5626518948fa"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "4.0.2"
version = "4.0.3"
weakdeps = ["StaticArrays"]

[deps.Adapt.extensions]
Expand All @@ -62,15 +62,16 @@ uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"

[[deps.ArrayInterface]]
deps = ["Adapt", "LinearAlgebra", "Requires", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "881e43f1aa014a6f75c8fc0847860e00a1500846"
deps = ["Adapt", "LinearAlgebra", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "44691067188f6bd1b2289552a23e4b7572f4528d"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "7.8.0"
version = "7.9.0"

[deps.ArrayInterface.extensions]
ArrayInterfaceBandedMatricesExt = "BandedMatrices"
ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices"
ArrayInterfaceCUDAExt = "CUDA"
ArrayInterfaceChainRulesExt = "ChainRules"
ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore"
ArrayInterfaceReverseDiffExt = "ReverseDiff"
ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore"
Expand All @@ -80,6 +81,7 @@ version = "7.8.0"
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Expand Down Expand Up @@ -136,9 +138,9 @@ version = "0.4.2"

[[deps.BandedMatrices]]
deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra", "PrecompileTools"]
git-tree-sha1 = "931f3f49902e9b6b527fd7cd02d1cd7b4a84264c"
git-tree-sha1 = "fe7ed7b33416db994f706f66e31bbd1b378f71b7"
uuid = "aae01518-5342-5314-be14-df237901396f"
version = "1.5.0"
version = "1.6.0"
weakdeps = ["SparseArrays"]

[deps.BandedMatrices.extensions]
Expand Down Expand Up @@ -293,10 +295,10 @@ uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
version = "0.11.9"

[[deps.Cairo_jll]]
deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "4b859a208b2397a7a623a03449e4636bdb17bcf2"
deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "a4c43f59baa34011e303e76f5c8c91bf58415aaf"
uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a"
version = "1.16.1+1"
version = "1.18.0+1"

[[deps.Calculus]]
deps = ["LinearAlgebra"]
Expand All @@ -312,9 +314,9 @@ version = "1.63.0"

[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra"]
git-tree-sha1 = "aef70bb349b20aa81a82a19704c3ef339d4ee494"
git-tree-sha1 = "575cd02e080939a33b6df6c5853d14924c08e35b"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "1.22.1"
version = "1.23.0"
weakdeps = ["SparseArrays"]

[deps.ChainRulesCore.extensions]
Expand All @@ -328,9 +330,9 @@ version = "0.5.7"

[[deps.ClimaCore]]
deps = ["Adapt", "BandedMatrices", "BlockArrays", "CUDA", "ClimaComms", "CubedSphere", "DataStructures", "DocStringExtensions", "ForwardDiff", "GaussQuadrature", "GilbertCurves", "HDF5", "InteractiveUtils", "IntervalSets", "KrylovKit", "LinearAlgebra", "PkgVersion", "RecursiveArrayTools", "RootSolvers", "SparseArrays", "Static", "StaticArrays", "Statistics", "Unrolled"]
git-tree-sha1 = "015898159f05bfa6075cbec6790fff4efea16aa5"
git-tree-sha1 = "844afbd6a7c4f112f974e0031ebf4fb13d0b4157"
uuid = "d414da3d-4745-48bb-8d80-42e94e092884"
version = "0.13.0"
version = "0.13.1"
weakdeps = ["Krylov"]

[deps.ClimaCore.extensions]
Expand All @@ -354,9 +356,9 @@ weakdeps = ["ClimaParams"]

[[deps.ClimaParams]]
deps = ["DocStringExtensions", "TOML", "Test"]
git-tree-sha1 = "323dd6c5423caf31f0da81bb9c288683cbdafb01"
git-tree-sha1 = "ec67949db856e01df4cbf7d6ddafefeda02f93ee"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.2"
version = "0.10.3"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down Expand Up @@ -466,9 +468,9 @@ version = "0.1.2"

[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "9c4708e3ed2b799e6124b5673a712dda0b596a9b"
git-tree-sha1 = "6cbbd4d241d7e6579ab354737f4dd95ca43946e1"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.3.1"
version = "2.4.1"

[[deps.ConstructionBase]]
deps = ["LinearAlgebra"]
Expand Down Expand Up @@ -810,9 +812,9 @@ weakdeps = ["PDMats", "SparseArrays", "Statistics"]

[[deps.FiniteDiff]]
deps = ["ArrayInterface", "LinearAlgebra", "Requires", "Setfield", "SparseArrays"]
git-tree-sha1 = "73d1214fec245096717847c62d389a5d2ac86504"
git-tree-sha1 = "bc0c5092d6caaea112d3c8e3b238d61563c58d5f"
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
version = "2.22.0"
version = "2.23.0"

[deps.FiniteDiff.extensions]
FiniteDiffBandedMatricesExt = "BandedMatrices"
Expand Down Expand Up @@ -912,9 +914,9 @@ version = "0.1.3"

[[deps.Functors]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "166c544477f97bbadc7179ede1c1868e0e9b426b"
git-tree-sha1 = "8ae30e786837ce0a24f5e2186938bf3251ab94b2"
uuid = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
version = "0.4.7"
version = "0.4.8"

[[deps.Future]]
deps = ["Random"]
Expand Down Expand Up @@ -951,15 +953,15 @@ version = "0.25.0"

[[deps.GR]]
deps = ["Artifacts", "Base64", "DelimitedFiles", "Downloads", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Pkg", "Preferences", "Printf", "Random", "Serialization", "Sockets", "TOML", "Tar", "Test", "UUIDs", "p7zip_jll"]
git-tree-sha1 = "3458564589be207fa6a77dbbf8b97674c9836aab"
git-tree-sha1 = "3437ade7073682993e092ca570ad68a2aba26983"
uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
version = "0.73.2"
version = "0.73.3"

[[deps.GR_jll]]
deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "FreeType2_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Qt6Base_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "77f81da2964cc9fa7c0127f941e8bce37f7f1d70"
git-tree-sha1 = "a96d5c713e6aa28c242b0d25c1347e258d6541ab"
uuid = "d2c73de3-f751-5644-a686-071e5b155ba9"
version = "0.73.2+0"
version = "0.73.3+0"

[[deps.GaussQuadrature]]
deps = ["SpecialFunctions"]
Expand Down Expand Up @@ -992,9 +994,9 @@ version = "0.1.0"

[[deps.Glib_jll]]
deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"]
git-tree-sha1 = "e94c92c7bf4819685eb80186d51c43e71d4afa17"
git-tree-sha1 = "359a1ba2e320790ddbe4ee8b4d54a305c0ea2aff"
uuid = "7746bdde-850d-59dc-9ae8-88ece973131d"
version = "2.76.5+0"
version = "2.80.0+0"

[[deps.GnuTLS_jll]]
deps = ["Artifacts", "GMP_jll", "JLLWrappers", "Libdl", "Nettle_jll", "P11Kit_jll", "Zlib_jll"]
Expand Down Expand Up @@ -1433,10 +1435,10 @@ uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
version = "1.17.0+0"

[[deps.Libmount_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "9c30530bf0effd46e15e0fdcf2b8636e78cbbd73"
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "dae976433497a2f841baadea93d27e68f1a12a97"
uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9"
version = "2.35.0+0"
version = "2.39.3+0"

[[deps.Libtiff_jll]]
deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "LERC_jll", "Libdl", "XZ_jll", "Zlib_jll", "Zstd_jll"]
Expand All @@ -1446,9 +1448,9 @@ version = "4.5.1+1"

[[deps.Libuuid_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "e5edc369a598dfde567269dc6add5812cfa10cd5"
git-tree-sha1 = "0a04a1318df1bf510beb2562cf90fb0c386f58c4"
uuid = "38a345b3-de98-5d2b-a5d3-14cd9215e700"
version = "2.39.3+0"
version = "2.39.3+1"

[[deps.LightXML]]
deps = ["Libdl", "XML2_jll"]
Expand Down Expand Up @@ -1894,9 +1896,9 @@ version = "0.5.12"

[[deps.Pango_jll]]
deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "FriBidi_jll", "Glib_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl"]
git-tree-sha1 = "4745216e94f71cb768d58330b059c9b76f32cb66"
git-tree-sha1 = "526f5a03792669e4187e584e8ec9d534248ca765"
uuid = "36c8627f-9965-5494-a995-c6b170f724f3"
version = "1.50.14+0"
version = "1.52.1+0"

[[deps.Parameters]]
deps = ["OrderedCollections", "UnPack"]
Expand Down Expand Up @@ -1958,9 +1960,9 @@ version = "1.4.1"

[[deps.Plots]]
deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs", "UnicodeFun", "UnitfulLatexify", "Unzip"]
git-tree-sha1 = "c4fa93d7d66acad8f6f4ff439576da9d2e890ee0"
git-tree-sha1 = "3c403c6590dd93b36752634115e20137e79ab4df"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
version = "1.40.1"
version = "1.40.2"

[deps.Plots.extensions]
FileIOExt = "FileIO"
Expand Down Expand Up @@ -2032,9 +2034,9 @@ version = "0.4.20"

[[deps.PrecompileTools]]
deps = ["Preferences"]
git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f"
git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f"
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
version = "1.2.0"
version = "1.2.1"

[[deps.Preferences]]
deps = ["TOML"]
Expand Down Expand Up @@ -2158,9 +2160,9 @@ version = "0.6.12"

[[deps.RecursiveArrayTools]]
deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "SparseArrays", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"]
git-tree-sha1 = "dc428bb59c20dafd1ec500c3432b9e3d7e78e7f3"
git-tree-sha1 = "a94d22ca9ad49a7a169ecbc5419c59b9793937cc"
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
version = "3.10.1"
version = "3.12.0"

[deps.RecursiveArrayTools.extensions]
RecursiveArrayToolsFastBroadcastExt = "FastBroadcast"
Expand Down Expand Up @@ -2523,9 +2525,10 @@ weakdeps = ["ClimaParams"]
CreateParametersExt = "ClimaParams"

[[deps.SymbolicIndexingInterface]]
git-tree-sha1 = "251bb311585143931a306175c3b7ced220300578"
deps = ["MacroTools", "RuntimeGeneratedFunctions"]
git-tree-sha1 = "f7b1fc9fc2bc938436b7684c243be7d317919056"
uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
version = "0.3.8"
version = "0.3.11"

[[deps.TOML]]
deps = ["Dates"]
Expand Down Expand Up @@ -2767,9 +2770,9 @@ version = "1.1.34+0"

[[deps.XZ_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "37195dcb94a5970397ad425b95a9a26d0befce3a"
git-tree-sha1 = "31c421e5516a6248dfb22c194519e37effbf1f30"
uuid = "ffd25f8a-64ca-5728-b0f7-c24cf3aae800"
version = "5.6.0+0"
version = "5.6.1+0"

[[deps.Xorg_libICE_jll]]
deps = ["Libdl", "Pkg"]
Expand Down Expand Up @@ -3021,9 +3024,9 @@ version = "1.18.0+0"

[[deps.libpng_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"]
git-tree-sha1 = "1ea2ebe8ffa31f9c324e8c1d6e86b4165b84a024"
git-tree-sha1 = "d7015d2e18a5fd9a4f47de711837e980519781a4"
uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f"
version = "1.6.43+0"
version = "1.6.43+1"

[[deps.libsixel_jll]]
deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Pkg", "libpng_jll"]
Expand Down
2 changes: 1 addition & 1 deletion experiments/standalone/Bucket/compare_gpu_cpu_output.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ cpu_state = readdlm(joinpath(outdir, "tf_state_cpu.txt"), ',')
gpu_state = readdlm(joinpath(outdir, "tf_state_gpu.txt"), ',')
@show mean(cpu_state .- gpu_state)
@show eps(Float64)
@assert mean(cpu_state .- gpu_state) < eps(Float64) * 5e2
@assert abs(mean(cpu_state .- gpu_state)) < eps(Float64) * 5e2
24 changes: 12 additions & 12 deletions experiments/standalone/Bucket/global_bucket_function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,33 +169,33 @@ latpts = range(-90.0, 90.0, 21)
hcoords = [Geometry.LatLongPoint(lat, long) for long in longpts, lat in latpts]
remapper = Remapping.Remapper(space, hcoords)

W = [
W = Array([
Remapping.interpolate(remapper, sol.u[k].bucket.W) for k in 1:length(sol.t)
];
Ws = [
]);
Ws = Array([
Remapping.interpolate(remapper, sol.u[k].bucket.Ws) for k in 1:length(sol.t)
];
σS = [
]);
σS = Array([
Remapping.interpolate(remapper, sol.u[k].bucket.σS) for k in 1:length(sol.t)
];
T_sfc = [
]);
T_sfc = Array([
Remapping.interpolate(remapper, saved_values.saveval[k].bucket.T_sfc)
for k in 1:length(sol.t)
];
evaporation = [
]);
evaporation = Array([
Remapping.interpolate(
remapper,
saved_values.saveval[k].bucket.turbulent_fluxes.vapor_flux,
) for k in 1:length(sol.t)
];
F_sfc = [
]);
F_sfc = Array([
Remapping.interpolate(
remapper,
saved_values.saveval[k].bucket.R_n .+
saved_values.saveval[k].bucket.turbulent_fluxes.lhf .+
saved_values.saveval[k].bucket.turbulent_fluxes.shf,
) for k in 1:length(sol.t)
];
]);

# save prognostic state to CSV - for comparison between
# GPU and CPU output
Expand Down
24 changes: 12 additions & 12 deletions experiments/standalone/Bucket/global_bucket_staticmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,33 +184,33 @@ latpts = range(-90.0, 90.0, 21)
hcoords = [Geometry.LatLongPoint(lat, long) for long in longpts, lat in latpts]
remapper = Remapping.Remapper(space, hcoords)

W = [
W = Array([
Remapping.interpolate(remapper, sol.u[k].bucket.W) for k in 1:length(sol.t)
];
Ws = [
]);
Ws = Array([
Remapping.interpolate(remapper, sol.u[k].bucket.Ws) for k in 1:length(sol.t)
];
σS = [
]);
σS = Array([
Remapping.interpolate(remapper, sol.u[k].bucket.σS) for k in 1:length(sol.t)
];
T_sfc = [
]);
T_sfc = Array([
Remapping.interpolate(remapper, saved_values.saveval[k].bucket.T_sfc)
for k in 1:length(sol.t)
];
evaporation = [
]);
evaporation = Array([
Remapping.interpolate(
remapper,
saved_values.saveval[k].bucket.turbulent_fluxes.vapor_flux,
) for k in 1:length(sol.t)
];
F_sfc = [
]);
F_sfc = Array([
Remapping.interpolate(
remapper,
saved_values.saveval[k].bucket.R_n .+
saved_values.saveval[k].bucket.turbulent_fluxes.lhf .+
saved_values.saveval[k].bucket.turbulent_fluxes.shf,
) for k in 1:length(sol.t)
];
]);

# save prognostic state to CSV - for comparison between GPU and CPU output
open(joinpath(outdir, "tf_state_$device_suffix.txt"), "w") do io
Expand Down
Loading

0 comments on commit 792c95d

Please sign in to comment.