Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python bindings having trouble with relative path (easi@master) #64

Closed
Thomas-Ulrich opened this issue Oct 1, 2024 · 4 comments · Fixed by #65
Closed

python bindings having trouble with relative path (easi@master) #64

Thomas-Ulrich opened this issue Oct 1, 2024 · 4 comments · Fixed by #65

Comments

@Thomas-Ulrich
Copy link
Contributor

Thomas-Ulrich commented Oct 1, 2024

Here are the files I m using to demonstrate the problem:

(base) ulrich@cachemiss:/export/dump/ulrich/new$ find . -name '*.yaml' -exec sh -c 'echo "#####{}" && cat "{}"' \;
#####./yaml_files/mud.yaml
!Switch
[mu_d]: !ConstantMap
    map:
      mu_d:        0.2
#####./yaml_files/a.yaml
!Switch

[mu_d]: !Include yaml_files/mud.yaml
#####./yaml_files/b.yaml
!Switch

[mu_d]: !Include mud.yaml

Then I get:

(base) ulrich@cachemiss:/export/dump/ulrich/new$ python3 ~/SeisSol/SeisSol/preprocessing/science/read_ini_fault_parameter.py dyn_B1.2_C0.15_R0.65_extracted-fault.xdmf yaml_files/a.yaml --param "mu_d"
yaml_files/mud.yaml: bad file
Traceback (most recent call last):
  File "/home/ulrich/SeisSol/SeisSol/preprocessing/science/read_ini_fault_parameter.py", line 123, in <module>
    out = easi.evaluate_model(centers, tags, parameters, args.yaml_filename)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error while parsing easi model file.

and the expected behaviour with:

(base) ulrich@cachemiss:/export/dump/ulrich/new$ python3 ~/SeisSol/SeisSol/preprocessing/science/read_ini_fault_parameter.py dyn_B1.2_C0.15_R0.65_extracted-fault.xdmf yaml_files/b.yaml --param "mu_d"
done writing initial-stress-fault.xdmf
full path: /export/dump/ulrich/new/initial-stress-fault.xdmf
done writing binary files in initial-stress-fault
@davschneller
Copy link
Contributor

davschneller commented Oct 1, 2024

Two questions regarding that: was that an issue before the relative paths were introduced? Otherwise, where is the file with !Include yaml_files/mud.yaml located?

(if the first question is true, then it's definitely a bug—easi should default to a pwd-relative path)

@Thomas-Ulrich
Copy link
Contributor Author

I've editing my first message, to answer the first question.
easi@1.3 works

(base) ulrich@cachemiss:/export/dump/ulrich/new$ python3 ~/SeisSol/SeisSol/preprocessing/science/read_ini_fault_parameter.py dyn_B1.2_C0.15_R0.65_extracted-fault.xdmf yaml_files/a.yaml --param "mu_d"
done writing initial-stress-fault.xdmf
full path: /export/dump/ulrich/new/initial-stress-fault.xdmf
done writing binary files in initial-stress-fault
(base) ulrich@cachemiss:/export/dump/ulrich/new$ module unload easi
Unloading easi/1.3.0-gcc-12.2.0-3kpbtcg
  Unloading useless requirement: yaml-cpp/0.6.2-gcc-12.2.0-lfacosk impalajit/main-gcc-12.2.0-5geanpq asagi/1.0.1-gcc-12.2.0-bsfspbq netcdf-c/4.7.4-gcc-12.2.0-rb6ipwb hdf5/1.12.2-gcc-12.2.0-xmvfngo openmpi/5.0.3-gcc-12.2.0-lnfmthz
    pmix/5.0.2-gcc-12.2.0-pmb2xg3 numactl/2.0.14-gcc-12.2.0-6tu2zh7 hwloc/2.9.3-gcc-12.2.0-3kk3kpd
(base) ulrich@cachemiss:/export/dump/ulrich/new$ module load easi/master-gcc-12.2.0-cuda-luz7dhb 
Loading easi/master-gcc-12.2.0-cuda-luz7dhb
  Loading requirement: impalajit/main-gcc-12.2.0-gv6qjw5 yaml-cpp/0.6.2-gcc-12.2.0-sqgjhyu
(base) ulrich@cachemiss:/export/dump/ulrich/new$ python3 ~/SeisSol/SeisSol/preprocessing/science/read_ini_fault_parameter.py dyn_B1.2_C0.15_R0.65_extracted-fault.xdmf yaml_files/a.yaml --param "mu_d"
yaml_files/mud.yaml: bad file
Traceback (most recent call last):
  File "/home/ulrich/SeisSol/SeisSol/preprocessing/science/read_ini_fault_parameter.py", line 123, in <module>
    out = easi.evaluate_model(centers, tags, parameters, args.yaml_filename)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error while parsing easi model file.

@davschneller
Copy link
Contributor

davschneller commented Oct 1, 2024

Ok, bug maybe found.

YAML::Node config = YAML::LoadFile(loadFileName);
should have m_currentFileName instead.

@Thomas-Ulrich
Copy link
Contributor Author

ok fixed.

(base) ulrich@cachemiss:/export/dump/ulrich/new$ module switch easi easi/fix-gcc-12.2.0-y4rfqu7 
Switching from easi/master-gcc-12.2.0-cuda-luz7dhb to easi/fix-gcc-12.2.0-y4rfqu7
  Unloading useless requirement: yaml-cpp/0.6.2-gcc-12.2.0-sqgjhyu impalajit/main-gcc-12.2.0-gv6qjw5
  Loading requirement: hwloc/2.9.3-gcc-12.2.0-3kk3kpd numactl/2.0.14-gcc-12.2.0-6tu2zh7 pmix/5.0.2-gcc-12.2.0-pmb2xg3 openmpi/5.0.3-gcc-12.2.0-lnfmthz hdf5/1.12.2-gcc-12.2.0-xmvfngo netcdf-c/4.7.4-gcc-12.2.0-rb6ipwb asagi/1.0.1-gcc-12.2.0-bsfspbq
(base) ulrich@cachemiss:/export/dump/ulrich/new$ python3 ~/SeisSol/SeisSol/preprocessing/science/read_ini_fault_parameter.py dyn_B1.2_C0.15_R0.65_extracted-fault.xdmf yaml_files/a.yaml --param "mu_d"
done writing initial-stress-fault.xdmf
full path: /export/dump/ulrich/new/initial-stress-fault.xdmf
done writing binary files in initial-stress-fault

@davschneller davschneller linked a pull request Oct 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants