Small fixes
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
ENV["UCX_ERROR_SIGNALS"] = "SIGILL,SIGBUS,SIGFPE"
|
||||
|
||||
using MetagraphOptimization
|
||||
using QEDbase
|
||||
using QEDcore
|
||||
@ -102,7 +104,8 @@ function build_psp(processDescription::GenericQEDProcess, momenta)
|
||||
)
|
||||
end
|
||||
|
||||
return 0
|
||||
# hack to fix stacksize for threading
|
||||
with_stacksize(f, n) = fetch(schedule(Task(f, n)))
|
||||
|
||||
# scenario 2
|
||||
N = 1000
|
||||
@ -111,7 +114,7 @@ M = 1000
|
||||
thetas = collect(LinRange(0, 2π, N))
|
||||
phis = collect(LinRange(0, 2π, M))
|
||||
|
||||
for photons in [6]
|
||||
for photons in 1:6
|
||||
# temp process to generate momenta
|
||||
for omega in [2e-3, 2e-6]
|
||||
println("Generating $(N*M) inputs for $photons photons (Scenario 2 grid walk)...")
|
||||
@ -121,7 +124,8 @@ for photons in [6]
|
||||
congruent_input_momenta_scenario_2(temp_process, omega, theta, phi) for
|
||||
(theta, phi) in Iterators.product(thetas, phis)
|
||||
]
|
||||
results = [0.0 for _ in 1:length(input_momenta)]
|
||||
results = Array{Float64}(undef, size(input_momenta))
|
||||
fill!(results, 0.0)
|
||||
|
||||
i = 1
|
||||
for (in_pol, in_spin, out_pol, out_spin) in
|
||||
@ -134,15 +138,17 @@ for photons in [6]
|
||||
inputs = build_psp.(Ref(process), input_momenta)
|
||||
|
||||
print("Preparing graph... ")
|
||||
# prepare function
|
||||
graph = gen_graph(process)
|
||||
optimize_to_fixpoint!(ReductionOptimizer(), graph)
|
||||
print("Preparing function... ")
|
||||
func = get_compute_function(graph, process, mock_machine())
|
||||
func(inputs[1])
|
||||
|
||||
print("Calculating... ")
|
||||
Threads.@threads for i in 1:length(inputs)
|
||||
results[i] += abs2(func(inputs[i]))
|
||||
Threads.@threads for i in 1:N
|
||||
Threads.@threads for j in 1:M
|
||||
return results[i, j] += abs2(func(inputs[i, j]))
|
||||
end
|
||||
end
|
||||
println("Done.")
|
||||
i += 1
|
||||
@ -157,20 +163,23 @@ for photons in [6]
|
||||
end
|
||||
end
|
||||
|
||||
# scenario
|
||||
exit(0)
|
||||
|
||||
# scenario 1 (disabled)
|
||||
n = 1000000
|
||||
|
||||
# n is the number of incoming photons
|
||||
# omega is the number
|
||||
|
||||
for photons in [6]
|
||||
for photons in 1:6
|
||||
# temp process to generate momenta
|
||||
for omega in [2e-3, 2e-6]
|
||||
println("Generating $n inputs for $photons photons...")
|
||||
temp_process = parse_process("k"^photons * "e->ke", QEDModel(), PolX(), SpinUp(), PolX(), SpinUp())
|
||||
|
||||
input_momenta = [congruent_input_momenta(temp_process, omega) for _ in 1:n]
|
||||
results = [0.0 for _ in 1:length(input_momenta)]
|
||||
results = Array{Float64}(undef, size(input_momenta))
|
||||
fill!(results, 0.0)
|
||||
|
||||
i = 1
|
||||
for (in_pol, in_spin, out_pol, out_spin) in
|
||||
|
Reference in New Issue
Block a user