Issue with Loading the Mesh
Hi UW2 team,
Hope you’ve been well!
I’m having some nasty issues with the loading of my mesh. This becomes particularly problematic because prevents the restart of my 3D simulations on HPC (and locally).
I’ve created a simple Jupyter Notebook example to reproduce the issue and the example in the documentation (https://underworld2.readthedocs.io/en/latest/build/underworld.mesh.html?highlight=load#underworld.mesh.MeshVariable.load).
The issue can be reproduced by launching Binder. I’ve tested this using the latest version of uw v2.13.0b, although when launching Binder the uw version is still shown as 2.12.2b.
The issue can also be reproduced by downloading the uw 2.12.2b container and running the image:
docker run -it -v pwd:/home/jovyan/workspace -p 8888:8888 underworldcode/underworld2
The example shows an Unspecified error in H5Aopen_by_name (return value <0), although later in the example I show that the file can be open and the coordinates are there.
--
I’ve tried to run the same script with underworld version '2.8.1b', in this case, the script runs smoothly and the mesh can be loaded. This image can be run with (on both Apple Silicon or Intel) docker run -it -v pwd:/home/jovyan/workspace -p 127.0.0.1:8888:8888 rcarluccio/uw_rc:firsttry
Even if the name may sound misleading "firsttry", I’ve been running the above container over the years, and it is fairly robust. It requires Docker Desktop running in the background on a Mac.
Would you have any suggestions to circumnavigate this problem or fix it? I am happy to work together on this.
The code is as below:
Please note that after loading the mesh you may get the error above, just break down the code in two when you get there so you can run the remaining part.
# Import libraries
import underworld as uw
import numpy as np
import os
import h5py as h5
uw.__version__
current_dir=os.getcwd()
print ("my curr dir is",current_dir)
# mesh load example from https://underworld2.readthedocs.io/en/latest/build/underworld.mesh.html?highlight=load#underworld.mesh.MeshVariable.load
#changed second mesh coord to be the same as first
# Create a mesh
mesh = uw.mesh.FeMesh_Cartesian( elementType='Q1/dQ0', elementRes=(16,16), minCoord=(0.,0.), maxCoord=(1.,1.) )
# Save this mesh
ignoreMe = mesh.save(current_dir+"/saved_mesh.h5")
# Create a mesh clone
clone_mesh = uw.mesh.FeMesh_Cartesian( elementType='Q1/dQ0', elementRes=(16,16), minCoord=(0.,0.), maxCoord=(1.,1.) )
np.allclose(mesh.data,clone_mesh.data)
# Load the previois mesh into this one
clone_mesh.load(current_dir+"/saved_mesh.h5") # with uw 2.12 the code will break here but you can still open the h5 below
np.allclose(mesh.data,clone_mesh.data)
# Alternatively let's try to open the h5 file
f = h5.File(current_dir+"/saved_mesh.h5", "r")
if f:
print ("found it")
# Get and print list of datasets within the H5 file
datasetNames = [n for n in f.keys()]
for n in datasetNames:
print(n)
# My coords are indeed there!
coords=f['vertices']
print ("my coord are there",coords)
print ("these are my x coords!!",coords[:,0],("and these are my z coords",coords[:,1]))
# why can I not load the mesh?!
Hi @rcarluccio, Thanks for the report. This is addressed with v2.13.1. The bug was due to a change in h5py that caused an unexpected error. Unfortunately I haven't made a v2.13.1 docker yet - I'll be making it later this week. If you can't wait feel free to compile the code from source ;)
Hi Julian,
Thank you for your feedback.
I'm testing the same script on GADI (/scratch/q97/rrc563/uw_tests/simpletry) with underworld version 2.13.1b located /g/data/m18/modulefiles/underworld. However, my log file doesn't show any difference compared to 2.12 and it doesn't seem to load the mesh as it prints "None" values.
I've doubled check the above with my subduction script and I still run into issues.
Has the syntax to load the mesh changed in v2.13.1 from clone_mesh.load(current_dir+"/saved_mesh.h5") ? and is this version available on GADI?
Could you perhaps share how you fixed the bug?
Thanks a lot for your help and support!
Hi julesghub,
Sorry, I need to make a correction to what I wrote above. The vanilla sample running on GADI finds the loaded cloned mesh data with both 2.12.2b and 2.13.1b, so all seems fine there. I only experienced the problem above with the related Docker version.
I still have issues with my own python subduction model but I'll investigate this on my end.
Thanks!
Hi julesghub,
All is good! I've also compared my log files from the 3D models I was running with 2.5.1b on Magnus years back (with shifter) to the newest version of Underworld on Gadi and the simulation are faster! Solver times are lower but very similar, but reduction operations seem twice as faster and the checkpoint saving time is also incredibly fast. Great work!!
Wonderful news @rcarluccio - thanks for the detailed feedback. That's really encouraging :partying_face:
I'm still finalising the new docker (v2.13.1) which will have the h5py fix for the original bug you came across. I'm just testing the docker on Setonix (magnus's replacement).... running ~2700 procs now!
Hi julesghub,
That's fantastic, Underworld is skyrocketing! and thank you for following up on this one. Would it be possible to include the Pandas library in the new Docker? It'll help to have it already there for data processing! I think it wasn't included in the previous Docker version.
Hi @rcarluccio, to be honest I would rather not put data (post) processing tools in the underworld docker. Why?
- It doesn't get used in the UW runtime, no feedback to the model.
- It increases the potential for dependency/security issues and the overall size of the docker.
That said I understand pandas could help in showcases and workshops, much like lavavu.
Do you have a workflow example where processing the data outside the docker container doesn't work well?
Hi julesghub,
Sorry, I'm not sure I'm following it. Pandas is just another library like SciPy and NumPy. I think these two are both included now.
I use pandas for plotting and analysing the underworld outputs. I rely on underworld functions to do some post-processing operations and then use pandas to improve visualisation, I need them both. Other researchers can't duplicate my workflow easily because Pandas is not included in the Docker version and that's how I ended up making my own... However, I understand if it isn't possible to include it.
@julesghub, Roberta should be able to use the UW docker to build an enhanced version for herself with additional dependencies and still be able to use singularity. Why don't you write a blog post to explain how ? That way we can keep the base image stripped down, but allow people to modify it to suit their workflows.
Hi lmoresi,
This is a long due-to post on my end indeed! :) It'll test it on the new Docker version when it's realised.
hi! Did this issue get fixed in the new docker version or was a new docker released? I ask b/c I'm also running into the same issue despite a new pull of the docker image - I notice that it's also broken on the Blakenbach Benchmark example. Thanks!
Hi @drcoopa, I have addressed this error and I'm building a new version of Underworld presently. Lookout for a new version later this week.
thanks! I appreciate it!
@rcarluccio and @drcoopa
I have created a new version of underworld: uw-2.14. It fixes this error.
The new docker is available with - docker pull underworldcode/underworld2:2.14.0b
I'll be making the release official later today.
Wonderful thank you, Julian!
On Wed, Dec 14, 2022 at 3:22 PM Julian Giordani @.***> wrote:
@rcarluccio https://github.com/rcarluccio and @drcoopa https://github.com/drcoopa I have created a new version of underworld: uw-2.14. It fixes this error. The new docker is available with - docker pull underworldcode/underworld2:2.14.0b
I'll be making the release official later today.
— Reply to this email directly, view it on GitHub https://github.com/underworldcode/underworld2/issues/628#issuecomment-1350378361, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFMPHXIEIVQZIDUM7JDA53LWNFDPPANCNFSM6AAAAAAQA52RTA . You are receiving this because you were mentioned.Message ID: @.***>
--
Best,
R.
Dr Roberta Carluccio | Research Associate
Room 402 | Madsen Building F09 |
School of Geosciences | Faculty of Science THE UNIVERSITY OF SYDNEY | NSW 2006
E @.*** http://roberta.carlucciosydney.edu.au/
T +61 415899563