Skip to content

Commit

Permalink
precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
islent committed Jan 22, 2024
1 parent b5e4199 commit 164eed9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
PhysicalParticles = "78724250-4eb2-11e9-0f34-13a7aab864c5"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Expand All @@ -29,10 +30,11 @@ CSV = "0.9, 0.10"
Combinatorics = "1"
ConfParser = "0.1"
FileIO = "1"
HDF5 = "0.15, 0.16"
HDF5 = "0.15, 0.16, 0.17"
IterTools = "1.3"
JLD2 = "0.4"
PhysicalParticles = "1"
PrecompileTools = "1"
ProgressMeter = "1"
Reexport = "1"
StaticArrays = "1"
Expand Down
2 changes: 2 additions & 0 deletions src/AstroIO.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module AstroIO

using PrecompileTools
using Reexport
using Unitful, UnitfulAstro
using FileIO, JLD2, HDF5
Expand Down Expand Up @@ -90,4 +91,5 @@ include("PrettyPrint.jl")
include("Tools.jl")
include("ConfParser.jl")

include("precompile.jl")
end # module
31 changes: 31 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@setup_workload begin
@compile_workload begin
foldertest = joinpath(@__DIR__, "../test")

h, d = read_gadget2(joinpath(foldertest, "gassphere_littleendian.gadget2"), uAstro)
write_gadget2(joinpath(foldertest, "testGadget.gadget2"), h, d)
write_gadget2(joinpath(foldertest, "testGadgetHeaderGeneration.gadget2"), d)
pos = read_gadget2_pos(joinpath(foldertest, "gassphere_littleendian.gadget2"), uAstro, uGadget2)
h, d = read_gadget2(joinpath(foldertest, "pot_acc.format2.gadget2"), uAstro, uGadget2)
h, d = read_gadget2(joinpath(foldertest, "pot_acc.format2.gadget2"), nothing, uGadget2)
h, d = read_gadget2(joinpath(foldertest, "pot_acc.format2.gadget2"), nothing, nothing)
pos = read_gadget2_pos(joinpath(foldertest, "pot_acc.format2.gadget2"), uGadget2)

h, d = read_gadget2(joinpath(foldertest, "pot_acc.format2.gadget2"), uAstro, uGadget2)
write_gadget2_format2(joinpath(foldertest, "pot_acc.format2.test.gadget2"), h, d, acc = true, pot = true)
# h, d = load(joinpath(foldertest, "gassphere_littleendian.gadget2"), uAstro)
stars2d = [Star2D() for i = 1:10]
write_csv(joinpath(foldertest, "testcsvStar2D"), stars2d, nothing)
stars = [Star(uAstro) for i = 1:10]
write_csv(joinpath(foldertest, "testcsvStar"), stars, uAstro)
data = [[Star() for i = 1:10]; [Ball() for i = 1:10]]
write_csv(joinpath(foldertest, "testcsvGeneral"), data, nothing)
write_ramses(joinpath(foldertest, "ramses.csv"), stars)
header, data = read_gadget2(joinpath(foldertest, "gassphere_littleendian.gadget2"), uAstro)
d = [Star2D() for i = 1:10]
write_gadget2_jld(joinpath(foldertest, "testjldGadget.jld2"), header, d)
h, d = read_gadget2_jld(joinpath(foldertest, "testjldGadget.jld2"))
write_jld(joinpath(foldertest, "testjldGeneral.jld2"), d)
d = read_jld(joinpath(foldertest, "testjldGadget.jld2"))
end
end

0 comments on commit 164eed9

Please sign in to comment.