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

Snap Elmer dependency (mpirun.openmpi) file missing and needs symlink #100

Open
tecodrive opened this issue Aug 15, 2023 · 10 comments · Fixed by #101
Open

Snap Elmer dependency (mpirun.openmpi) file missing and needs symlink #100

tecodrive opened this issue Aug 15, 2023 · 10 comments · Fixed by #101
Labels
bug Something isn't working waiting for response

Comments

@tecodrive
Copy link

using ElmerSolver_mpi

/snap/freecad/current/usr/Mod/Fem/femsolver/elmer/tasks.py

line 135: args.extend(["mpirun"])

file not found because in snap package for linux only two files exist with wrong filenames

/snap/freecad/current/usr/bin/mpirun.mpich
/snap/freecad/current/usr/bin/mpirun.openmpi

solution would be rename or create a additional symlink

mpirun.openmpi => mpirun

@luzpaz
Copy link
Collaborator

luzpaz commented Aug 15, 2023

@tecodrive Thanks for reporting! Want to submit a PR ?

@luzpaz luzpaz added bug Something isn't working waiting for response labels Aug 15, 2023
@luzpaz luzpaz changed the title snap elmer mpirun.openmpi | Linux FreeCAD Modul FEM Snap elmer dependency (mpirun.openmpi & mpirun.mpich) files missing and needs rename/symlink Aug 15, 2023
@luzpaz luzpaz changed the title Snap elmer dependency (mpirun.openmpi & mpirun.mpich) files missing and needs rename/symlink Snap Elmer dependency (mpirun.openmpi & mpirun.mpich) files missing and needs rename/symlink Aug 15, 2023
@luzpaz luzpaz changed the title Snap Elmer dependency (mpirun.openmpi & mpirun.mpich) files missing and needs rename/symlink Snap Elmer dependency (mpirun.openmpi & mpirun.mpich) files missing and need rename/symlink Aug 15, 2023
@luzpaz
Copy link
Collaborator

luzpaz commented Aug 15, 2023

@tecodrive here is the source:

https://github.com/FreeCAD/FreeCAD/blob/a49e104993a02f651ae3c8f16530ba78196fa53b/src/Mod/Fem/femsolver/elmer/tasks.py#L114-L164

Specifically:

                if system() != "Windows":
                    args.extend(["mpirun"])
                else:
                    args.extend(["mpiexec"])

https://github.com/FreeCAD/FreeCAD/blob/a49e104993a02f651ae3c8f16530ba78196fa53b/src/Mod/Fem/femsolver/elmer/tasks.py#L134-L137

Edit: Why doesn't the FEM code reference the file extension?

Edit2: Maybe it has to do with the code comments in line 116

            # if ELMER_HOME is not set, set it.
            # Needed if elmer is compiled but not installed on Linux
            # http://www.elmerfem.org/forum/viewtopic.php?f=2&t=7119
            # https://stackoverflow.com/questions/1506010/how-to-use-export-with-python-on-linux
            # TODO move retrieving the param to solver settings module

@tecodrive
Copy link
Author

tecodrive commented Aug 15, 2023

mpirun without extension is a standard program in most distros. Snap package contain two files mpirun.mpich and mpirun.openmpi - conflict. FreeCAD (not snap) have not include elmer, mpi an other externals. People must install Elmer.

solution would be
not so good

# args.extend(["mpirun"])
args.extend(["mpirun.openmpi"])

or better
rename file in snap package mpirun.openmpi => mpirun

@luzpaz
Copy link
Collaborator

luzpaz commented Aug 15, 2023

Question is:
A) make the change in init.py per the documentation[1].
OR
B) make the change in snapcraft.yaml

Thoughts ?

[1] https://github.com/FreeCAD/FreeCAD-snap/blob/master/docs/index.md#how-to-add-snap-specific-workarounds-or-changes

Edit: snapcraft.yml shows:

package-repositories:
- type: apt
ppa: elmer-csc-ubuntu/elmer-csc-ppa
- type: apt
components:
- main
suites:
- jammy
key-id: 444DABCF3667D0283F894EDDE6D4736255751E5D
url: http://origin.archive.neon.kde.org/user
key-server: keyserver.ubuntu.com

Edit2: Looks like we should use Snap Layouts https://snapcraft.io/docs/snap-layouts in snapcraft.yaml:

layout:
/usr/share/X11:
symlink: $SNAP/kf5/usr/share/X11
/usr/share/libdrm/amdgpu.ids:
bind-file: $SNAP/kf5/usr/share/libdrm/amdgpu.ids
/usr/share/openmpi:
symlink: $SNAP/usr/share/openmpi
/etc/openmpi:
bind: $SNAP/etc/openmpi
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/openmpi:
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/openmpi
/usr/bin/orted:
symlink: $SNAP/usr/bin/orted
/usr/share/pmix:
symlink: $SNAP/usr/share/pmix
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pmix:
symlink: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pmix
/etc/matplotlibrc:
bind-file: $SNAP/etc/matplotlibrc
/usr/share/matplotlib:
symlink: $SNAP/usr/share/matplotlib
/usr/share/qt5:
symlink: $SNAP/kf5/usr/share/qt5
/usr/bin/dot: # Graphviz for dependency graph
symlink: $SNAP/usr/bin/dot
/usr/bin/unflatten: # Graphviz for dependency graph
symlink: $SNAP/usr/bin/unflatten
/usr/share/povray-3.7: # Raytracing
symlink: $SNAP/usr/share/povray-3.7

@tecodrive
Copy link
Author

tecodrive commented Aug 15, 2023

yes, Edit2, use Snap Layouts and add a symlink

usr/bin/mpirun.openmpi: # ElmerSolver_mpi
     symlink: $SNAP/usr/bin/mpirun

@luzpaz
Copy link
Collaborator

luzpaz commented Aug 15, 2023

@tecodrive can you review #101 please ?

@luzpaz
Copy link
Collaborator

luzpaz commented Aug 15, 2023

@tecodrive you mentioned 2 files missing, do i need to make one for /snap/freecad/current/usr/bin/mpirun.mpich as well ?

@tecodrive
Copy link
Author

tecodrive commented Aug 15, 2023

there are 2 files for the same thing

/snap/freecad/current/usr/bin/mpirun.mpich
/snap/freecad/current/usr/bin/mpirun.openmpi

i have change mpirun.openmpi to mpirun and check FreeCAD Modul FEM ElmerSolver_mpi run correct.

when i change mpirun.mpich -> mpirun the FEM Solution needs more time. I do not know why.

@luzpaz luzpaz changed the title Snap Elmer dependency (mpirun.openmpi & mpirun.mpich) files missing and need rename/symlink Snap Elmer dependency (mpirun.openmpi) file missing and needs symlink Aug 15, 2023
@luzpaz
Copy link
Collaborator

luzpaz commented Aug 15, 2023

Thanks for the feedback. Can you please review #101 ?

@tecodrive
Copy link
Author

tecodrive commented Aug 15, 2023

in snap package mpirun.openmpi is a symlink to orterun*

/snap/freecad/current/usr/bin
lrwxrwxrwx 1 root root 7 Apr 15 2020 mpirun.openmpi -> orterun*

i thing no need to use bind

luzpaz added a commit that referenced this issue Aug 15, 2023
luzpaz added a commit that referenced this issue Aug 15, 2023
@luzpaz luzpaz reopened this Aug 16, 2023
luzpaz added a commit that referenced this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for response
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants