Skip to content

Commit

Permalink
Branch around parallel tasks in assembly if num_partitions is 1
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Jul 18, 2024
1 parent efced03 commit 0e5f741
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "VoronoiFVM"
uuid = "82b139dc-5afc-11e9-35da-9b9bdfd336f3"
authors = ["Jürgen Fuhrmann <[email protected]>", "Dilara Abdel", "Jan Weidner", "Alexander Seiler", "Patricio Farrell", "Matthias Liero"]
version = "1.22.0"
version = "1.22.1"

[deps]
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
Expand Down
38 changes: 24 additions & 14 deletions src/vfvm_assembly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,23 +476,33 @@ function eval_and_assemble(system::System{Tv, Tc, Ti, Tm, TSpecMat, TSolArray},
tstepinv = 1.0 / tstep
ncallocs = zeros(Int, num_partitions(system.assembly_data))
nballocs = zeros(Int, num_partitions(system.assembly_data))
colpart = system.assembly_data.pcolor_partitions
for color in pcolors(system.assembly_data)
@tasks 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)
@tasks 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
if num_partitions(system.assembly_data) > 1
for color in pcolors(system.assembly_data)
@tasks 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)
@tasks 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
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
end

noallocs(m::AbstractExtendableSparseMatrixCSC)= iszero(nnznew(m))
noallocs(m::ExtendableSparseMatrix) = isnothing(m.lnkmatrix)
noallocs(m::AbstractMatrix) = false
Expand Down

2 comments on commit 0e5f741

@j-fu
Copy link
Member Author

@j-fu j-fu commented on 0e5f741 Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/111306

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.22.1 -m "<description of version>" 0e5f741e3f4db1543cb240686fcfa1acee4c22e0
git push origin v1.22.1

Please sign in to comment.