Skip to content

Commit

Permalink
modify assembly loop: separate cellwise and edgewise
Browse files Browse the repository at this point in the history
for the time being
  • Loading branch information
j-fu committed Jul 23, 2024
1 parent fb14aa2 commit 979c06c
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/vfvm_assembly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,15 @@ function eval_and_assemble(system::System{Tv, Tc, Ti, Tm, TSpecMat, TSolArray},
ncallocs = zeros(Int, num_partitions(system.assembly_data))
nballocs = zeros(Int, num_partitions(system.assembly_data))

if num_partitions(system.assembly_data) > 1
if num_partitions(system.assembly_data) == 1
part=1
ncalloc = assemble_nodes(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
ncalloc += assemble_edges(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
ncallocs[part] = ncalloc
nballoc = assemble_bnodes(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
nballoc += assemble_bedges(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
nballocs[part] = nballoc
elseif system.assembly_type==:edgewise
for color in pcolors(system.assembly_data)
Threads.@threads for part in pcolor_partitions(system.assembly_data,color)
ncalloc = assemble_nodes(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
Expand All @@ -499,13 +507,21 @@ function eval_and_assemble(system::System{Tv, Tc, Ti, Tm, TSpecMat, TSolArray},
end
end
else
part=1
ncalloc = assemble_nodes(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
ncalloc += assemble_edges(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
ncallocs[part] = ncalloc
nballoc = assemble_bnodes(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
nballoc += assemble_bedges(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
nballocs[part] = nballoc
for color in pcolors(system.assembly_data)
Threads.@threads for part in pcolor_partitions(system.assembly_data,color)
ncalloc = assemble_nodes(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
ncalloc+= assemble_edges(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
ncallocs[part]= ncalloc
end
end

for color in pcolors(system.boundary_assembly_data)
Threads.@threads for part in pcolor_partitions(system.boundary_assembly_data,color)
nballoc = assemble_bnodes(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
nballoc += assemble_bedges(system, matrix, time, tstepinv, λ, params, part, U, UOld, F)
nballocs[part] = nballoc
end
end
end

noallocs(m::AbstractExtendableSparseMatrixCSC)= iszero(nnznew(m))
Expand Down

0 comments on commit 979c06c

Please sign in to comment.