Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for Julia>=1.7 CUDA no longer exports @atomic #36

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/output/diagnostics_plankton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function gpu_diags_proc_kernel!(diags_proc, proc, ac, x, y, z)
index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
stride = blockDim().x * gridDim().x
for i = index:stride:size(ac,1)
@inbounds @atomic diags_proc[x[i], y[i], z[i]] += proc[i] * ac[i]
@inbounds CUDA.@atomic diags_proc[x[i], y[i], z[i]] += proc[i] * ac[i]
end
end
function diags_proc!(diags_proc, proc, ac, x, y, z, ::GPU)
Expand Down Expand Up @@ -53,4 +53,4 @@ function diags_spcs!(diags_sp, proc, plank, ac, x, y, z, arch::Architecture)
throw(ArgumentError("$(diag) is not one of the diagnostics"))
end
end
end
end
28 changes: 14 additions & 14 deletions src/plankton/physiology/counts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
stride = blockDim().x * gridDim().x
for i = index:stride:size(ac,1)
@inbounds @atomic ctschl[x[i], y[i], z[i]] += chl[i] * ac[i]
@inbounds @atomic ctspop[x[i], y[i], z[i]] += ac[i]
@inbounds CUDA.@atomic ctschl[x[i], y[i], z[i]] += chl[i] * ac[i]
@inbounds CUDA.@atomic ctspop[x[i], y[i], z[i]] += ac[i]
end
return nothing
end
Expand All @@ -25,11 +25,11 @@ function gpu_calc_consume_kernel!(ctsdic, ctsdoc, ctsnh4, ctsno3, ctspo4, proc,
index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
stride = blockDim().x * gridDim().x
for i = index:stride:size(ac,1)
@inbounds @atomic ctsdic[x[i], y[i], z[i]] += (proc.resp[i] - proc.PS[i]) * ΔT * ac[i]
@inbounds @atomic ctsdoc[x[i], y[i], z[i]] += (proc.exu[i] - proc.VDOC[i]) * ΔT * ac[i]
@inbounds @atomic ctsnh4[x[i], y[i], z[i]] -= proc.VNH4[i] * ΔT * ac[i]
@inbounds @atomic ctsno3[x[i], y[i], z[i]] -= proc.VNO3[i] * ΔT * ac[i]
@inbounds @atomic ctspo4[x[i], y[i], z[i]] -= proc.VPO4[i] * ΔT * ac[i]
@inbounds CUDA.@atomic ctsdic[x[i], y[i], z[i]] += (proc.resp[i] - proc.PS[i]) * ΔT * ac[i]
@inbounds CUDA.@atomic ctsdoc[x[i], y[i], z[i]] += (proc.exu[i] - proc.VDOC[i]) * ΔT * ac[i]
@inbounds CUDA.@atomic ctsnh4[x[i], y[i], z[i]] -= proc.VNH4[i] * ΔT * ac[i]
@inbounds CUDA.@atomic ctsno3[x[i], y[i], z[i]] -= proc.VNO3[i] * ΔT * ac[i]
@inbounds CUDA.@atomic ctspo4[x[i], y[i], z[i]] -= proc.VPO4[i] * ΔT * ac[i]
end
return nothing
end
Expand All @@ -55,12 +55,12 @@ function gpu_calc_loss_kernel!(ctsdoc, ctspoc, ctsdon, ctspon, ctsdop, ctspop, p
index = (blockIdx().x - 1) * blockDim().x + threadIdx().x
stride = blockDim().x * gridDim().x
for i = index:stride:size(ac,1)
@inbounds @atomic ctsdoc[x[i], y[i], z[i]] += (plank.Bm[i] + plank.Cq[i]) * lossFracC * ac[i] * loss[i]
@inbounds @atomic ctsdon[x[i], y[i], z[i]] += (plank.Bm[i]*R_NC + plank.Nq[i]) * lossFracN * ac[i] * loss[i]
@inbounds @atomic ctsdop[x[i], y[i], z[i]] += (plank.Bm[i]*R_PC + plank.Pq[i]) * lossFracP * ac[i] * loss[i]
@inbounds @atomic ctspoc[x[i], y[i], z[i]] += (plank.Bm[i] + plank.Cq[i]) * (1.0-lossFracC) * ac[i] * loss[i]
@inbounds @atomic ctspon[x[i], y[i], z[i]] += (plank.Bm[i]*R_NC + plank.Nq[i]) * (1.0-lossFracN) * ac[i] * loss[i]
@inbounds @atomic ctspop[x[i], y[i], z[i]] += (plank.Bm[i]*R_PC + plank.Pq[i]) * (1.0-lossFracP) * ac[i] * loss[i]
@inbounds CUDA.@atomic ctsdoc[x[i], y[i], z[i]] += (plank.Bm[i] + plank.Cq[i]) * lossFracC * ac[i] * loss[i]
@inbounds CUDA.@atomic ctsdon[x[i], y[i], z[i]] += (plank.Bm[i]*R_NC + plank.Nq[i]) * lossFracN * ac[i] * loss[i]
@inbounds CUDA.@atomic ctsdop[x[i], y[i], z[i]] += (plank.Bm[i]*R_PC + plank.Pq[i]) * lossFracP * ac[i] * loss[i]
@inbounds CUDA.@atomic ctspoc[x[i], y[i], z[i]] += (plank.Bm[i] + plank.Cq[i]) * (1.0-lossFracC) * ac[i] * loss[i]
@inbounds CUDA.@atomic ctspon[x[i], y[i], z[i]] += (plank.Bm[i]*R_NC + plank.Nq[i]) * (1.0-lossFracN) * ac[i] * loss[i]
@inbounds CUDA.@atomic ctspop[x[i], y[i], z[i]] += (plank.Bm[i]*R_PC + plank.Pq[i]) * (1.0-lossFracP) * ac[i] * loss[i]
end
return nothing
end
Expand Down Expand Up @@ -102,4 +102,4 @@ function calc_par!(par, arch::Architecture, chl, PARF, g::AbstractGrid, kc, kw)
event = kernel!(par, chl, PARF, g, kc, kw)
wait(device(arch), event)
return nothing
end
end