-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starting GPU version of track a quadrupole
- Loading branch information
1 parent
0d51bc7
commit 75c2e75
Showing
5 changed files
with
91 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using CUDA | ||
include("structures.jl") | ||
|
||
function fill_quadrupole(elements) | ||
"""filling intermediate calculation arrays for track | ||
a quadrupole with zeros to avoid dynamic memory allocation; | ||
change element count as needed.""" | ||
global x_ele_int, x_ele, y_ele, px_ele, py_ele, s, c, | ||
x_lab, y_lab, px_lab, py_lab, beta, beta0, e_tot, | ||
evaluation, dz, sqrt_k, sk_l, cx, sx, a11, a12, a21, | ||
a22, c1, c2, c3 = (CUDA.fill(0.0, elements) for item = 1:27) | ||
|
||
return nothing | ||
end | ||
|
||
fill_quadrupole(10_000) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using CUDA, Adapt | ||
include("low_level/structures.jl"); include("low_level/offset_particle.jl"); include("low_level/int_arrays.jl"); | ||
|
||
fill_quadrupole(10_000) | ||
|
||
function track_a_quadrupole(p_in, quad) | ||
"""Tracks the incoming Particle p_in though quad element and | ||
returns the outgoing particle. | ||
See Bmad manual section 24.15 | ||
""" | ||
l = quad.L | ||
k1 = quad.K1 | ||
n_step = quad.NUM_STEPS # number of divisions | ||
step_len = l / n_step # length of division | ||
|
||
x_off = quad.X_OFFSET | ||
y_off = quad.Y_OFFSET | ||
tilt = quad.TILT | ||
|
||
corrections = offset_and_tilt(x_off, y_off, tilt) | ||
int = int_set(x_ele_int, x_ele, y_ele, px_ele, py_ele, s, c) | ||
|
||
sec = p_in.sec | ||
p0c = p_in.p0c | ||
mc2 = p_in.mc2 | ||
|
||
# --- TRACKING --- : | ||
|
||
offset_particle_set(corrections, p_in, int) | ||
x, px, y, py, z, pz = x_ele, px_ele, y_ele, py_ele, p_in.z, p_in.pz | ||
|
||
return nothing | ||
end | ||
|