WIP Adding machine/device info and caching strategies

This commit is contained in:
2023-09-29 18:02:57 +02:00
parent afb6af44ca
commit 37d645cb4e
14 changed files with 469 additions and 293 deletions

View File

@ -5,6 +5,8 @@ using QEDbase
include("../examples/profiling_utilities.jl")
@testset "Unit Tests Execution" begin
machine = get_machine_info()
process_2_2 = ABCProcessDescription(
Dict{Type, Int64}(ParticleA => 1, ParticleB => 1),
Dict{Type, Int64}(ParticleA => 1, ParticleB => 1),
@ -26,9 +28,9 @@ include("../examples/profiling_utilities.jl")
@testset "AB->AB no optimization" begin
for _ in 1:10 # test in a loop because graph layout should not change the result
graph = parse_dag(joinpath(@__DIR__, "..", "input", "AB->AB.txt"), ABCModel())
@test isapprox(execute(graph, process_2_2, particles_2_2), expected_result; rtol = 0.001)
@test isapprox(execute(graph, process_2_2, machine, particles_2_2), expected_result; rtol = 0.001)
func = get_compute_function(graph, process_2_2)
func = get_compute_function(graph, process_2_2, machine)
@test isapprox(func(particles_2_2), expected_result; rtol = 0.001)
end
end
@ -39,7 +41,7 @@ include("../examples/profiling_utilities.jl")
random_walk!(graph, 50)
@test is_valid(graph)
@test isapprox(execute(graph, process_2_2, particles_2_2), expected_result; rtol = 0.001)
@test isapprox(execute(graph, process_2_2, machine, particles_2_2), expected_result; rtol = 0.001)
end
end
@ -49,14 +51,14 @@ include("../examples/profiling_utilities.jl")
)
particles_2_4 = gen_process_input(process_2_4)
graph = parse_dag(joinpath(@__DIR__, "..", "input", "AB->ABBB.txt"), ABCModel())
expected_result = execute(graph, process_2_4, particles_2_4)
expected_result = execute(graph, process_2_4, machine, particles_2_4)
@testset "AB->ABBB no optimization" begin
for _ in 1:5 # test in a loop because graph layout should not change the result
graph = parse_dag(joinpath(@__DIR__, "..", "input", "AB->ABBB.txt"), ABCModel())
@test isapprox(execute(graph, process_2_4, particles_2_4), expected_result; rtol = 0.001)
@test isapprox(execute(graph, process_2_4, machine, particles_2_4), expected_result; rtol = 0.001)
func = get_compute_function(graph, process_2_4)
func = get_compute_function(graph, process_2_4, machine)
@test isapprox(func(particles_2_4), expected_result; rtol = 0.001)
end
end
@ -67,7 +69,7 @@ include("../examples/profiling_utilities.jl")
random_walk!(graph, 100)
@test is_valid(graph)
@test isapprox(execute(graph, process_2_4, particles_2_4), expected_result; rtol = 0.001)
@test isapprox(execute(graph, process_2_4, machine, particles_2_4), expected_result; rtol = 0.001)
end
end