-
Notifications
You must be signed in to change notification settings - Fork 5
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
Bug in assemble when using threads #47
Comments
Adding for future reference, this is the function ACEfit.feature_matrix(
data,
basis;
energy=true,
force=true,
virial=true,
energy_key=:energy,
force_key=:force,
virial_key=:virial,
kwargs...)
# Basis functions are on different collumns.
# Energy is on fist row.
# Force is flattened on several rows, so that each basis function is on same collumns.
# Virial is in practice triangular matrix, so first remove double values and then flatten.
# This is equal to only flattening lower triangular matrix.
blocks = []
if energy && haskey(data, energy_key)
e = ace_energy(basis, data; kwargs...)
push!(blocks, e')
end
if force && haskey(data, force_key)
f = ace_forces(basis, data; kwargs...)
tf = reinterpret.(Float64, f)
f_bock = reduce(hcat, tf)
push!(blocks, f_bock)
end
if virial && haskey(data, virial_key)
v = ace_virial(basis, data; kwargs...)
tv = map( v ) do m
m[SVector(1,5,9,6,3,2)]
end
v_block = reduce(hcat, tv)
push!(blocks, v_block)
end
return reduce(vcat, blocks)
end It will lead to to this for ace_method in [ :ace_energy, :ace_forces, :ace_virial]
@eval begin
function $ace_method(basis::ACE1.IPSuperBasis, data; executor=ThreadedEx(), kwargs...)
em = Folds.map( basis.BB, executor ) do b
$ace_method(b, data; executor=executor, kwargs...)
end
return reduce(vcat, em)
end
end
end and so on... |
I made some changes to One possible cause is that with this form, both |
@cortner Here is the bug with assemble. Basically you need to have PR #46 in use. Then this triggers the bug
When you try same input several times, it gives different results and some times the arrays have even different sizes
Here is a full working example:
The text was updated successfully, but these errors were encountered: