Compile Elmer solver on Debian Buster and run without installation

Discussion about building and installing Elmer
Post Reply
bernd
Posts: 22
Joined: 29 Nov 2016, 15:03
Antispam: Yes

Compile Elmer solver on Debian Buster and run without installation

Post by bernd »

Hi all,

the FreeCAD elmer solver implementation gains some love ATM. For this I need to run Elmer solver. Years ago I did this on older Debian ...

ATM on a Debian Buster. Compilation of devel HEAD runs without any hassle. But I would like to run the binary without installation. Back in 2016 I would have to export two variables to get it to run without installation. viewtopic.php?f=2&t=4408&p=15923#p15960

Code: Select all

cd /the/dir/where/the/sif/file/is
export ELMER_HOME=/home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src/modules
mpirun -n 1   /home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src/ElmerSolver_mpi   case.sif
I still need to export these two varibles to get the solver to run. Is there any reason why elmer does not run out of the box from build directory of the compiled binary without installation.

cheers bernd
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Compile Elmer solver on Debian Buster and run without installation

Post by kevinarden »

Operating systems look in a defined PATH variable to find executables. in linux
echo $PATH shows what directories are defined in your PATH, you can redifine the path or put the compiled binaries in your existing path such as
/usr/bin

without Elmer being in the defined path you have set ELMER_HOME so it knows where to look.

You can set your path or ELMER_HOME automatically when you log on by adding it to your .profile
which should be in /home/hugo
bernd
Posts: 22
Joined: 29 Nov 2016, 15:03
Antispam: Yes

Re: Compile Elmer solver on Debian Buster and run without installation

Post by bernd »

I am not a Linux professional, but I do compile around twenty different programme, whereas elmer solver is the only one of them which does not run from the build directory out of the box.

May be we miss unterstood. I am able to run the binary but it gives thes errors if I do not export the variables.

Code: Select all

$
$ /home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src/ElmerSolver_mpi   case.sif
ELMER SOLVER (v 8.4) STARTED AT: 2020/07/15 22:22:31
ParCommInit:  Initialize #PEs:            1
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 8.4 (Rev: 0e57b6e2, Compiled: 2020-07-14)
MAIN:  Running one task without MPI parallelization.
MAIN:  Running with just one thread per task.
MAIN: =============================================================
ERROR:: InitializeElementDescriptions: elements.def not found
STOP 1
$ 
$ 


than to get around this error:

Code: Select all

export ELMER_HOME=/home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src

Code: Select all

$ 
$ /home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src/ElmerSolver_mpi   case.sif
ELMER SOLVER (v 8.4) STARTED AT: 2020/07/15 22:25:13
ParCommInit:  Initialize #PEs:            1
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 8.4 (Rev: 0e57b6e2, Compiled: 2020-07-14)
MAIN:  Running one task without MPI parallelization.
MAIN:  Running with just one thread per task.
MAIN: =============================================================
LoadInputFile: Reading only "Run Control" section
MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
LoadInputFile: Scanning input file: case.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file
LoadInputFile: Loading input file: case.sif
LoadInputFile: Reading base load of sif file
LoadInputFile: Number of BCs: 2
LoadInputFile: Number of Body Forces: 0
LoadInputFile: Number of Initial Conditions: 0
LoadInputFile: Number of Materials: 1
LoadInputFile: Number of Equations: 1
LoadInputFile: Number of Solvers: 2
LoadInputFile: Number of Bodies: 1
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_Init0]
ResultOutputSolve: cannot open shared object file: No such file or directory
ResultOutputSolve.so: cannot open shared object file: No such file or directory
./ResultOutputSolve: cannot open shared object file: No such file or directory
./ResultOutputSolve.so: cannot open shared object file: No such file or directory
/home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src/share/elmersolver/lib/ResultOutputSolve: cannot open shared object file: No such file or directory
/home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src/share/elmersolver/lib/ResultOutputSolve.so: cannot open shared object file: No such file or directory
$ 
$ 

than another one:

Code: Select all

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hugo/Documents/dev/elmerfem/elmerfem-dev/build/fem/src/modules

now elmer solver runs in that terminal as often as I would like to. Sure I could add these exports to my .profile, but usually if I need to do such export something is wrong or missing in cmake. But as I said I am neither a Linux professional nor a cmake one. I just come up with my experience from other programme.
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Compile Elmer solver on Debian Buster and run without installation

Post by kevinarden »

Many codes automatically install in /usr Elmer does not, it gives you a chioce of where to install. You choose to install in a directory that is not in your $PATH, You could choose to install in a directory in your path if you wanted to.

Elmer compile instructions has the following.
Setting environmental variables
For convinience you may set some environmental variables in order to be able to run Elmer anywhere. The following definitions work for bash (and should be written to file ~/.bashrc).

export ELMER_HOME=$HOME/elmer/install/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ELMER_HOME/lib
export PATH=$PATH:$ELMER_HOME/bin
bernd
Posts: 22
Joined: 29 Nov 2016, 15:03
Antispam: Yes

Re: Compile Elmer solver on Debian Buster and run without installation

Post by bernd »

works great here!

BTW I did not do any install at all! I just compiled elmer and run it from build directory!
Post Reply