FreeCAD / FreeCAD-snap

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

Symlink Elmer `mpirun` to `orterun` #101

Closed luzpaz closed 1 year ago

luzpaz commented 1 year ago

Fixes #100

luzpaz commented 1 year ago

According to https://snapcraft.io/docs/snap-layouts

Some applications, however, might treat symlinks differently than regular files or directories so you may need to use a bind mount in those cases.

Elmer might not like a symlink and if that's the case we'd need to change symlink: to bind: or bind-file: even though:

Layouts using bind* and tmpfs significantly increase the startup time of your snap. We recommend using symlink instead, because it has the least amount of overhead.

luzpaz commented 1 year ago

CC @tecodrive

tecodrive commented 1 year ago

in snap package mpirun.openmpi is a symlink to orterun lrwxrwxrwx 1 root root 7 Apr 15 2020 mpirun.openmpi -> orterun

no need to use bind

luzpaz commented 1 year ago

hmm.. then we should link directly to orterun* or else we have a double symlink? (btw, why is there a * at the end of orterun) ?

tecodrive commented 1 year ago

marked "*" as executable under Linux (ext4) orterun*

additional symlink from mpirun to orterun should be ok

luzpaz commented 1 year ago

Per snap documentation:

Incompatible existing file, directory or symbolic link

Layouts cannot replace an existing but incompatible filesystem object. This means, for example, that files cannot replace directories or symbolic links, files cannot replace a directory, and existing symbolic links cannot be redirected to a new target. You can, however, replace a directory with another directory.

luzpaz commented 1 year ago

@tecodrive please test on Snap edge when build completes (https://github.com/FreeCAD/FreeCAD-snap/actions/runs/5872799602/job/15924976406) ? TIA

luzpaz commented 1 year ago

@tecodrive please run snap edge to test and report back. TIA!

tecodrive commented 1 year ago

Problem with Multi-CPU core support in FreeCAD snap package solved! @luzpaz Many thanks, for your quick help!

Installation:

sudo snap info freecad latest/edge: 0.22-ga49e1049 2023-08-16 sudo snap install freecad --edge

Instructions to run Multi-CPU core support in FreeCAD:

First open FEM Workbench (Mod) to get access to FEM settings in preferences Open: Edit -> Preferences -> FEM -> Elmer Uncheck: Search in known binary directories Set: Elmer Solver binary path: /snap/freecad/current/usr/bin/ElmerSolver_mpi

grafik

tecodrive commented 1 year ago

problem is solved, but it's crazy, there are no file mpirun in snap/freecad/current/usr/bin/

i see only

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

how can /snap/freecad/current/usr/Mod/Fem/femsolver/elmer/task.py find mpirun?

                if system() != "Windows":
                    args.extend(["mpirun"])
                else:
                    args.extend(["mpiexec"])
luzpaz commented 1 year ago

@chennes sorry, tried to solve this without you but no joy. Can you weigh-in ?

chennes commented 1 year ago

I'm having a hard time following the above discussion: what is the problem we are trying to solve?

luzpaz commented 1 year ago

@chennes see #100

Essentially the snap is looking for a missing Elmer file (which is actually a symlink which adds to further confusion). I edited the snapcraft.yml in d783438342330ceef094f13ae72373b582660054 but the issue isn't solved.

luzpaz commented 1 year ago

I'm going to change the symlink to see what happens

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

Edit: Done in 6eb4d24a1cbc52fb9b1e5368daabb929538eee14

Triggered a new Snap edge build https://github.com/FreeCAD/FreeCAD-snap/actions/runs/5879743555/job/15944502206
Should be ready in 1.5hrs

tecodrive commented 1 year ago

sorry, but this was a step backwards. The bug is back, too bad.

luzpaz commented 1 year ago

Reverted in 18bb6623d0b456a0c1f44b03ae2dc0c359ec5ae6

luzpaz commented 1 year ago

problem is solved, but it's crazy, there are no file mpirun in snap/freecad/current/usr/bin/

i see only

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

how can /snap/freecad/current/usr/Mod/Fem/femsolver/elmer/task.py find mpirun?

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

@berndhahnebach any idea ?

See https://github.com/FreeCAD/FreeCAD-snap/issues/100#issuecomment-1679693842

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

tecodrive commented 1 year ago

@berndhahnebach.

There are two MPI variants from different developers. Both are included in the SNAP package.

/snap/freecad/current/usr/bin$
lrwxrwxrwx 1 root root     13 Feb 22  2022 mpirun.mpich -> mpiexec.hydra*
lrwxrwxrwx 1 root root      7 Mär  4  2022 mpirun.openmpi -> orterun*

MPICH is developed and maintained by a consortium of researchers from several universities and research centers around the world. It is considered to be one of the most widely used MPI implementations, and is known for its robustness and portability.

OpenMPI, on the other hand, is developed and maintained by a group of researchers from several organizations, including the Argonne National Laboratory, the University of Tennessee, and the Indiana University. It is considered to be one of the most flexible and configurable MPI implementations available, and is known for its support for a wide variety of interconnects and architectures.

Users who use other packages like apt, appimage etc., calling 'mpirun' in task.py is correct because these packages do not include gmesh and elmer and must be installed separately.

tecodrive commented 1 year ago

@luzpaz Reverted thanks, now problem is solved again.