Skip to content

Fix weights on GPU #41

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

Merged
merged 10 commits into from
Feb 15, 2021
4 changes: 2 additions & 2 deletions src/FixedEffectSolvers/FixedEffectSolverGPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ function AbstractFixedEffectSolver{T}(fes::Vector{<:FixedEffect}, weights::Abstr
h = FixedEffectCoefficients([cuzeros(T, fe.n) for fe in fes])
hbar = FixedEffectCoefficients([cuzeros(T, fe.n) for fe in fes])
tmp = zeros(T, length(weights))
update_weights!(FixedEffectSolverGPU{T}(m, weights, b, r, x, v, h, hbar, tmp, fes), weights)
update_weights!(FixedEffectSolverGPU{T}(m, cuzeros(T, length(weights)), b, r, x, v, h, hbar, tmp, fes), weights)
end


function update_weights!(feM::FixedEffectSolverGPU{T}, weights::AbstractWeights) where {T}
weights = cu(T, collect(weights))
weights = cu(T, weights)
nthreads = feM.m.nthreads
for (scale, fe) in zip(feM.m.scales, feM.m.fes)
scale!(scale, fe.refs, fe.interaction, weights, nthreads)
Expand Down