FreeCAD / FreeCAD-snap

The official Snap package of the FreeCAD project
https://snapcraft.io/freecad
10 stars 10 forks source link

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

Open tecodrive opened 1 year ago

tecodrive commented 1 year ago

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 commented 1 year ago

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

luzpaz commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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:

https://github.com/FreeCAD/FreeCAD-snap/blob/0e20f526da108e538a004719d3fbed26d33658db/snap/snapcraft.yaml#L124-L134

Edit2: Looks like we should use Snap Layouts https://snapcraft.io/docs/snap-layouts in snapcraft.yaml:
https://github.com/FreeCAD/FreeCAD-snap/blob/0e20f526da108e538a004719d3fbed26d33658db/snap/snapcraft.yaml#L33-L61

tecodrive commented 1 year ago

yes, Edit2, use Snap Layouts and add a symlink

usr/bin/mpirun.openmpi: # ElmerSolver_mpi
     symlink: $SNAP/usr/bin/mpirun
luzpaz commented 1 year ago

@tecodrive can you review #101 please ?

luzpaz commented 1 year ago

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

tecodrive commented 1 year ago

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 commented 1 year ago

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

tecodrive commented 1 year ago

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