Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix GPU bug #73

Merged
merged 4 commits into from
May 2, 2022
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 Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BinomialSynapses"
uuid = "8a0f34ba-5679-4d46-87d2-b44c4b1cf105"
authors = ["Simone Carlo Surace", "Camille Gontier"]
version = "0.4.2"
version = "0.4.3"

[deps]
BinomialGPU = "c5bbfde1-2136-42cd-9b65-d5719df69ebf"
Expand All @@ -14,7 +14,7 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
BinomialGPU = "0.3, 0.4"
CUDA = "3"
CUDA = "3.8"
Distributions = "0.25"
LaTeXStrings = "1"
Plots = "1"
Expand Down
19 changes: 5 additions & 14 deletions src/myopic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,15 @@ function _temp_epsps(sim)
end

function _temp_epsps(times, N_star, p_star, q_star, τ_star, dts, ::AnyCuArray)
x = 1.
L = length(times)
if L > 1
for ii in 2:L
x = 1-(1-(1-p_star)*x)*exp(-(times[ii]-times[ii-1])/τ_star)
end
end

e_temp = zeros(Float32, length(dts))
for kk in 1:length(e_temp)
x_temp = 1-(1-(1-p_star)*x)*exp(-dts[kk]/τ_star)
e_temp[kk] = x_temp*N_star*p_star*q_star
end
return e_temp
return cu(_temp_epsps(times, N_star, p_star, q_star, τ_star, dts))
end

# CPU fallback:
function _temp_epsps(times, N_star, p_star, q_star, τ_star, dts, ::AbstractArray)
return _temp_epsps(times, N_star, p_star, q_star, τ_star, dts)
end

function _temp_epsps(times, N_star, p_star, q_star, τ_star, dts)
x = 1.
L = length(times)
if L > 1
Expand Down