3 Commits

Author SHA1 Message Date
8a5e49429b Don't eval in generated function return
Some checks failed
MetagraphOptimization_CI / test (push) Failing after 6m58s
MetagraphOptimization_CI / docs (push) Successful in 7m27s
2024-08-09 12:21:49 +02:00
5be7ca99e7 Add results and evaluation
Some checks failed
MetagraphOptimization_CI / test (push) Failing after 1m33s
MetagraphOptimization_CI / docs (push) Failing after 1m33s
2024-07-10 14:21:26 +02:00
1ae39a8caa Congruent in photons example (#12)
Some checks failed
MetagraphOptimization_CI / docs (push) Failing after 1m50s
MetagraphOptimization_CI / test (push) Failing after 1m53s
Now targeting the correct branches

Co-authored-by: Rubydragon <anton.reinhard@proton.me>
Reviewed-on: #12
2024-07-10 14:17:39 +02:00
10 changed files with 185 additions and 37 deletions

4
.gitattributes vendored
View File

@ -1,3 +1,5 @@
input/AB->ABBBBBBBBB.txt filter=lfs diff=lfs merge=lfs -text
input/AB->ABBBBBBB.txt filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs
*.gif filter=lfs diff=lfs merge=lfs
*.jld2 filter=lfs diff=lfs merge=lfs

BIN
images/contour_plot_congruent_in_photons.gif (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

BIN
results/1_congruent_photons_grid.jld2 (Stored with Git LFS) Normal file

Binary file not shown.

BIN
results/2_congruent_photons_grid.jld2 (Stored with Git LFS) Normal file

Binary file not shown.

BIN
results/3_congruent_photons_grid.jld2 (Stored with Git LFS) Normal file

Binary file not shown.

BIN
results/4_congruent_photons_grid.jld2 (Stored with Git LFS) Normal file

Binary file not shown.

BIN
results/5_congruent_photons_grid.jld2 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,25 +1,12 @@
# patch QEDprocesses
# see issue https://github.com/QEDjl-project/QEDprocesses.jl/issues/77
@inline function QEDprocesses.number_particles(
proc_def::QEDbase.AbstractProcessDefinition,
::Type{PS},
proc_def::QEDbase.AbstractProcessDefinition, ::Type{PS}
) where {
DIR <: QEDbase.ParticleDirection,
PT <: QEDbase.AbstractParticleType,
EL <: AbstractFourMomentum,
PS <: ParticleStateful{DIR, PT, EL},
DIR<:QEDbase.ParticleDirection,
PT<:QEDbase.AbstractParticleType,
EL<:AbstractFourMomentum,
PS<:ParticleStateful{DIR,PT,EL},
}
return QEDprocesses.number_particles(proc_def, DIR(), PT())
end
@inline function QEDcore.ParticleStateful{DIR, SPECIES}(
mom::AbstractFourMomentum,
) where {DIR <: ParticleDirection, SPECIES <: AbstractParticleType}
return ParticleStateful(DIR(), SPECIES(), mom)
end
@inline function QEDcore.ParticleStateful{DIR, SPECIES, EL}(
mom::EL,
) where {DIR <: ParticleDirection, SPECIES <: AbstractParticleType, EL <: AbstractFourMomentum}
return ParticleStateful(DIR(), SPECIES(), mom)
end

View File

@ -16,9 +16,7 @@ function get_compute_function(graph::DAG, instance, machine::Machine)
"function compute_$(functionId)(data_input::$(input_type(instance))) $(initCaches); $(assignInputs); $code; return $resSym; end",
)
func = eval(expr)
return func
return expr
end
"""
@ -35,22 +33,22 @@ function get_cuda_kernel(graph::DAG, instance, machine::Machine)
functionId = to_var_name(UUIDs.uuid1(rng[1]))
resSym = eval(gen_access_expr(entry_device(tape.machine), tape.outputSymbol))
expr = Meta.parse("function compute_$(functionId)(input_vector, output_vector, n::Int64)
id = (blockIdx().x - 1) * blockDim().x + threadIdx().x
if (id > n)
return
end
@inline data_input = input_vector[id]
$(initCaches)
$(assignInputs)
$code
@inline output_vector[id] = $resSym
return nothing
end")
expr = Meta.parse(
"function compute_$(functionId)(input_vector, output_vector, n::Int64)
id = (blockIdx().x - 1) * blockDim().x + threadIdx().x
if (id > n)
return
end
@inline data_input = input_vector[id]
$(initCaches)
$(assignInputs)
$code
@inline output_vector[id] = $resSym
return nothing
end"
)
func = eval(expr)
return func
return expr
end
"""