Skip to content

Commit

Permalink
Merge pull request #72 from gridap/partitioned_arrays_v0.3
Browse files Browse the repository at this point in the history
Changes to accommodate PArrays 0.3
  • Loading branch information
amartinhuertas authored Aug 16, 2023
2 parents 6c40ddd + f0e2618 commit 9989338
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GridapGmsh"
uuid = "3025c34a-b394-11e9-2a55-3fee550c04c8"
authors = ["Francesc Verdugo <f.verdugo.rojano@vu.nl>"]
version = "0.6.1"
version = "0.7.0"

[deps]
Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e"
Expand All @@ -12,10 +12,10 @@ PartitionedArrays = "5a9dfac6-5c52-46f7-8278-5e2210713be9"
gmsh_jll = "630162c2-fc9b-58b3-9910-8442a8a132e6"

[compat]
Gridap = "0.17"
GridapDistributed = "0.2.4"
Gridap = "0.17.18"
GridapDistributed="0.3.0"
Metis = "1"
PartitionedArrays = "0.2"
PartitionedArrays = "0.3.3"
gmsh_jll = "4.7.1"
julia = "1.3"

Expand Down
5 changes: 3 additions & 2 deletions demo/demo_parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ using GridapPETSc
using GridapDistributed
using PartitionedArrays
n = 6
prun(mpi,n) do parts
with_mpi() do distribute
ranks=distribute(LinearIndices((n,)))
options = "-ksp_type cg -pc_type gamg -ksp_monitor"
GridapPETSc.with(args=split(options)) do
model = GmshDiscreteModel(parts,"demo/demo.msh")
model = GmshDiscreteModel(ranks,"demo/demo.msh")
order = 1
dirichlet_tags = ["boundary1","boundary2"]
u_boundary1(x) = 0.0
Expand Down
6 changes: 3 additions & 3 deletions src/GmshDiscreteModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ function _find_gface_to_face(

ngfaces = length(gface_to_nodes_ptrs) - 1
gface_to_face = fill(T(UNSET),ngfaces)
n = max_cells_arround_vertex(node_to_faces_ptrs)
n = max_cells_around_vertex(node_to_faces_ptrs)
faces_around = fill(UNSET,n)
faces_around_scratch = fill(UNSET,n)

Expand Down Expand Up @@ -940,7 +940,7 @@ end

## Parallel related

function GmshDiscreteModel(parts::PArrays.AbstractPData, args...;kwargs...)
function GmshDiscreteModel(parts::AbstractVector, args...;kwargs...)
GmshDiscreteModel(parts,args...;kwargs...) do g,np
if np == 1
fill(Int32(1),size(g,1))
Expand All @@ -952,7 +952,7 @@ end

function GmshDiscreteModel(
do_partition,
parts::PArrays.AbstractPData,
parts::AbstractVector,
args...;kwargs...)

smodel = GmshDiscreteModel(args...;kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/GridapGmsh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using Gridap.TensorValues
using Gridap.Fields
using Gridap.ReferenceFEs
using Gridap.Geometry
using Gridap.Geometry: max_cells_arround_vertex
using Gridap.Geometry: max_cells_around_vertex
using Gridap.Geometry: _fill_cells_around_scratch!
using Gridap.Geometry: _set_intersection!
using Gridap.Geometry: _generate_cell_to_vertices_from_grid
Expand Down
22 changes: 16 additions & 6 deletions test/DistributedTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ using GridapDistributed
using PartitionedArrays
using Test

function main(parts)
function main(distribute,n)
ranks=distribute(LinearIndices((n,)))
mshfile = joinpath(@__DIR__,"..","demo","demo.msh")
model = GmshDiscreteModel(parts,mshfile)
model = GmshDiscreteModel(ranks,mshfile)
k = 2
Ω = Interior(model)
reffe = ReferenceFE(lagrangian,Float64,k)
Expand All @@ -19,10 +20,19 @@ function main(parts)
= Measure(Ω,2*k)
@test sum(( eh*eh )dΩ) < 1.0e-9
writevtk(Ω,"Ω",cellfields=["uh"=>uh,"eh"=>eh])
end
end

prun(main,sequential,6)
prun(main,sequential,1)
prun(main,mpi,1)
with_debug() do distribute
main(distribute,6)
main(distribute,1)
end

with_mpi() do distribute
main(distribute,1)
end

#prun(main,sequential,6)
#prun(main,sequential,1)
#prun(main,mpi,1)

end # module

2 comments on commit 9989338

@amartinhuertas
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@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/89741

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 v0.7.0 -m "<description of version>" 9989338f12d93119ab387c3756d6db19453afc57
git push origin v0.7.0

Please sign in to comment.