jorgensd / mesh_converter

A mesh converter from EXODUS 2 to XDMF
MIT License
4 stars 0 forks source link

Can't run MWE #1

Closed RemDelaporteMathurin closed 6 months ago

RemDelaporteMathurin commented 6 months ago

Hi @jorgensd

I'm finally trying this out.

I installed the package inside a conda environment.

I ran into this error:

Traceback (most recent call last):
  File "/home/remidm/Fusion-TES-Modeling/convert_mesh.py", line 4, in <module>
    write_mesh(mesh, "out_mesh.xdmf")
  File "/home/remidm/miniconda3/envs/tes-model-env/lib/python3.12/site-packages/mesh_converter/writer.py", line 123, in write_mesh
    adios = adios2.ADIOS(MPI.COMM_WORLD)
            ^^^^^^^^^^^^
AttributeError: module 'adios2' has no attribute 'ADIOS'. Did you mean: 'Adios'?

When running:

from mesh_converter import read_exodus2_data, write_mesh

mesh = read_exodus2_data("test_mesh.e")
write_mesh(mesh, "out_mesh.xdmf")

Should I be installing a specific version of Adios2?

jorgensd commented 6 months ago

It is because adios has updated its Python API. You could try to add:

import adios2

def resolve_adios_scope(adios2):
    return adios2.bindings if hasattr(adios2, "bindings") else adios2

adios2 = resolve_adios_scope(adios2)

which is what I use in adios4dolfinx (thanks to @nate-sime for this fix).

I will add this once I get to working with the cell data implementation as well.

Currently trying to patch together some more checkpointing things which takes priority.

RemDelaporteMathurin commented 6 months ago

Thanks for the tip.

I added those lines to writer.py but now have this error:

Traceback (most recent call last):
  File "/home/remidm/Fusion-TES-Modeling/convert_mesh.py", line 6, in <module>
    write_mesh(mesh, "out_mesh.xdmf")
  File "/home/remidm/miniconda3/envs/tes-model-env/lib/python3.12/site-packages/mesh_converter/writer.py", line 128, in write_mesh
    adios = adios2.ADIOS(MPI.COMM_WORLD)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. adios2.bindings.adios2_bindings.ADIOS()
    2. adios2.bindings.adios2_bindings.ADIOS(configFile: str)

Invoked with: <mpi4py.MPI.Intracomm object at 0x7f13f2263ba0>

Currently trying to patch together some more checkpointing things which takes priority.

YES! checkpointing takes precedence 🎉

jorgensd commented 6 months ago

@RemDelaporteMathurin I've now pushed a new commit that should fix this

RemDelaporteMathurin commented 6 months ago

@RemDelaporteMathurin I've now pushed a new commit that should fix this

Thanks! I will have a look asap

jorgensd commented 6 months ago

@RemDelaporteMathurin Currently working on the cell tag code. Give me an hour or so for that.

jorgensd commented 6 months ago

@RemDelaporteMathurin Code for second mesh example pushed

RemDelaporteMathurin commented 6 months ago

@jorgensd I still have this error message:

Traceback (most recent call last):
  File "/home/remidm/Fusion-TES-Modeling/convert_mesh.py", line 4, in <module>
    write_mesh(in_mesh, "out.xdmf")
  File "/home/remidm/miniconda3/envs/exodus-converter-env/lib/python3.12/site-packages/mesh_converter/writer.py", line 148, in write_mesh
    adios = adios2.ADIOS(MPI.COMM_WORLD)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. adios2.bindings.adios2_bindings.ADIOS()
    2. adios2.bindings.adios2_bindings.ADIOS(configFile: str)

Invoked with: <mpi4py.MPI.Intracomm object at 0x7f7e61df47d0>

I installed everything with:

conda create -n converter-env -c conda-forge adios2 mpi4py pip
conda activate converter-env
python -m pip install git+https://github.com/jorgensd/mesh_converter.git

Am I missing something?

jorgensd commented 5 months ago

Adios2 has to be configured with mpi. See the readme in the root of the repo for detailed instructions.