-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix in JLD2 to avoid MmapIO failed error
- Loading branch information
Showing
6 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,5 @@ LocalPreferences.toml | |
GridapTopOpt.so | ||
|
||
# Ensure never to write results to git | ||
results/* | ||
results/* | ||
tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module JLD2SaveLoadMPI | ||
using Test | ||
|
||
using Gridap, Gridap.MultiField, GridapDistributed, GridapPETSc, GridapSolvers, | ||
PartitionedArrays, GridapTopOpt, SparseMatricesCSR | ||
|
||
function main(distribute,mesh_partition) | ||
ranks = distribute(LinearIndices((prod(mesh_partition),))) | ||
path = joinpath("tmp","test") | ||
i_am_main(ranks) && mkpath(path) | ||
# setup | ||
model = CartesianDiscreteModel(ranks,mesh_partition,(0,1,0,1),(20,20)) | ||
V_φ = TestFESpace(model,ReferenceFE(lagrangian,Float64,1)) | ||
φh = interpolate(initial_lsf(4,0.2),V_φ) | ||
|
||
psave(path,get_free_dof_values(φh)) | ||
x = pload(path,ranks) | ||
@assert x == get_free_dof_values(φh) | ||
pload!(path,x) | ||
@assert x == get_free_dof_values(φh) | ||
true | ||
end | ||
|
||
with_mpi() do distribute | ||
@test main(distribute,(2,2)) | ||
end | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module JLD2SaveLoad | ||
using Test | ||
|
||
using Gridap, GridapTopOpt | ||
|
||
function main() | ||
path = joinpath(mktempdir(), "test.jld2") | ||
# setup | ||
model = CartesianDiscreteModel((0,1,0,1),(20,20)) | ||
V_φ = TestFESpace(model,ReferenceFE(lagrangian,Float64,1)) | ||
φh = interpolate(initial_lsf(4,0.2),V_φ) | ||
|
||
save(path,get_free_dof_values(φh)) | ||
x = load(path) | ||
@test x == get_free_dof_values(φh) | ||
load!(path,x) | ||
@test x == get_free_dof_values(φh) | ||
end | ||
|
||
main() | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters