Installing Elmer in Ubuntu 14.04 using Cmake

Discussion about building and installing Elmer

Installing Elmer in Ubuntu 14.04 using Cmake

Postby annier » 16 Dec 2014, 09:38

Recently, the Elmer team has introduced Elmer compilation using cmake. The installation of Elmer in Ubuntu 14.04 using cmake has been described here.
The methods described below are referred from these links
http://www.elmerfem.org/forum/viewtopic.php?f=11&t=3725&sid=de900ae982c68203c9933ccbc04446b8&sid=a8cc728defe256dcf0075cabadaa5d23#p12723
http://www.elmerfem.org/elmerwiki/index.php?title=Compilation_of_Elmer_on_Linux_using_Cmake

I am very thankful to Peter for instructing us a lucid way to compile and install elmer in Ubuntu.
For users of CentOS, the methods of installing Elmer (via Cmake) are described in this thread started by Xavier.

    i. For the context of here , the scripts with "$" in their front mean that they are to be typed in the terminal and if they are without it "they are to be written in places other than terminal".
Before we start installation, we need to do these steps
    i. Install cmake-qt-gui
    Code: Select all
    $sudo apt-get install cmake-qt-gui

    ii. Find the number of processors of CPU by typing
    Code: Select all
    $nproc

    in the terminal. For this context, it was 4.
    this number will used later as make -j 4 install


Steps for Building, Installing and Testing Elmer in Ubuntu 14.04
1. Create a directory to download elmer software and jump into the directory
Code: Select all
$mkdir elmer

Code: Select all
$cd elmer

2. Clone the git repository
Code: Select all
$git clone git://www.github.com/ElmerCSC/elmerfem

or
Code: Select all
$git clone https://www.github.com/ElmerCSC/elmerfem


3. Make buid directory within the elmer directory and jump into it
Code: Select all
$ mkdir build

Code: Select all
$ cd build


4. Building of elmer can be done using either cmake command or cmake-gui. Both are mentioned here . The user can use any one of these methods for building elmer.
#Method A: Using cmake-gui to build elmer
Open the cmake-gui
Code: Select all
$ cmake-gui

    a) Click the browse source in "where is the source code" and select it as
    Code: Select all
    HOME/username/elmer/elmerfem

    b)Click the browse build in "where to build the binaries" and select it as
    Code: Select all
    HOME/username/elmer/build

    cmake_illustration.png
    cmake gui
    cmake_illustration.png (53.94 KiB) Viewed 8740 times

    c) Configure

    d) Set the CMAKE_BUILD_TYPE in its default condition of None (empty value as shown in figure below) at the corresponding row in the "Value" column (can be studied from this reference.
    Code: Select all
    CMAKE_BUILD_TYPE= ..........(No value means None)

    [CMAKE_BUILD_TYPE=None implies that CMAKE_C_FLAGS or CMAKE_CXX_FLAGS are used.]
    or,
    The other options for values are Debug or Release or RelWithDebInfo or MinSizeRel
    i.e.For some specific requirements, one can select from any one of these build types
    Code: Select all
    CMAKE_BUILD_TYPE= ..........
    CMAKE_BUILD_TYPE= RelWithDebInfo
    CMAKE_BUILD_TYPE=Debug
    CMAKE_BUILD_TYPE=Release
    CMAKE_BUILD_TYPE=MinSizeRel
    ]

    Some user settings for destination install folder are:
    **Either : User setiings for installation path
    The prefix of install directory can be changed to the desired path by clicking at the corresponding rows of the "Value" column:
    Code: Select all
    CMAKE _INSTALL_PREFIX                   home/username/elmer/install
    ELMER_SOLVER_HOME                                 home/username/elmer/install/share/elmersolver


    **Or: Default settings (Has to be proceeded as root user during installation i.e. $sudo -s)
    By default, the install destination for Elmer will appear as following during the configuration process in the gui of cmake-gui:
    Code: Select all
    CMAKE_INSTALL_PREFIX                                  /usr/local
    ELMER_SOLVER_HOME                                     /usr/local/share/elmersolver



    e) Configure to update

    f) Select the required parameters one by one and click configure each time to update selection. ( For a minimal ElmerNonGUI version, the default options given in the cmake-gui is sufficient. In my context, the only selected option by default was WITH_MPI.)
    For more parameters, look at the contents of elmerfem directory and choose the parameters
    (e.g. WITH_ELMERGUI -->>Configure to Update, again the Cmake leads to additional features within ElmerGUI, have a look within the elmerfem/ElmerGUI/ directory and click the available libraries such as with matc, WITH_PYTHONQT, WITH_PARAVIEW ...and so on.Click configure to update. Libraries which are not within ElmerGUI directory of downloaded elmerfem, should be shown the path if cmake doesnot find them when searching. )
    a portion of cmake-gui screen.png
    using cmake:Configure process completed and getting ready for Generate process
    a portion of cmake-gui screen.png (70.87 KiB) Viewed 8727 times

    In the same way, select WITH_ELMERGUILOGGER -->> Configure, WITH_ELMERGUITESTER -->> Configure, ...WITH_Elmerice -->>Configure and so on.
    (Note: The selection or unselection of a parameter followed by "configure" clicking will update the change made in "Cmake configure procedure")

    g) Generate

or

#Method B Using cmake Command
    Code: Select all
    $cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=../install ../elmerfem

    Note: With each of these methods, Makefile will be generated along with other prerequisites for Elmer installataion.



5. Compile using the generated Makefile
Code: Select all
$ make -j4 install


6. Test the newly compiled Elmer Version
Code: Select all
$ ctest -j4


7. Setting Environment Variables
Code: Select all
$gedit  ~/.bashrc

In .bashrc fie, add the following lines and save the file
Code: Select all
export ELMER_HOME=$HOME/elmer/install/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ELMER_HOME/lib
export PATH=$PATH:$ELMER_HOME/bin


Note: In context of Ubuntu 16.04, the necessity of pointing the library path of shared libraries (dot_so files) to $ELMER_HOME/lib/elmersolver is highlighted and discussed in this post.

In this way, the building and installation of elmer in Ubuntu 14.04 is completed. This installation via cmake does not include Elmer Post and so users can use Paraview for post-processing(After the Elmer Post installation is available via cmake, this sentence will be removed from here).

Getting Started with Elmer Tests or Examples using Elmer NonGUI
Steps for Running of the ElmerNonGui Tutorial/ Elmer Test
It is assumed that the elmerfem and install folders are in the /home/elmer/ directory.
1. Make an elmer_project directory outside the elmer directory (i.e. elmer_project directory resides in home directory for running tutorials and other works of the user)
Code: Select all
$mkdir elmer_project

2. Copy a test from elmerfem directory (e.g.CavityLid) to the elmer_project directory.
Code: Select all
$cp -r $HOME/elmer/elmerfem/fem/tests/CavityLid/ $HOME/elmer_project/CavityLid

3. Jump into the CavityLid tutorial.
Code: Select all
$cd ~/elmer_project/CavityLid/

4.Convert mesh file in .grd format [1] to .mesh.*(ElmerSolver) format [2] [Please refer chapter 1 of Elmer Grid Manual (http://www.nic.funet.fi/pub/sci/physics/elmer/doc/ElmerGridManual.pdf) to find the corresponding number of Different File Formats]
Code: Select all
$ElmerGrid 1 2 square.grd

5. For users of Paraview, open the case.sif file via
Code: Select all
$gedit case.sif
and replace post file = case.ep (in simulation section) with
Code: Select all
Post File = case.vtu

Save the edited file.

6. Run the ElmerSolver command
Code: Select all
$ElmerSolver > anyname.log 2>&1


7.Open paraview by typing in terminal
Code: Select all
$paraview

Note: paraview can be installed in ubuntu by typing
Code: Select all
$sudo apt-get install paraview

The file>open>... can lead us to opening the case.vtu file located within the $HOME/emer_project/CavityLid/square/ directory.
velocity_profile.png
Velocity Profile for Cavity Lid test
velocity_profile.png (121.6 KiB) Viewed 8718 times


Getting Started with ElmerGUI Tutorials
1. At the ElmerGUI directory in ~/elmer/install/share/ directory,copy the contents(.xml files) of edf-extra folder to edf folder
Code: Select all
$ cp ~/elmer/install/share/ElmerGUI/edf-extra/*  ~/elmer/install/share/ElmerGUI/edf/


2. The sample tutorials of ElmerGUI are provided along with the installation in ~/elmer/install/share/ElmerGUI/samples/ in different file formats. These samples can be copied to the elmer_project directory.

3. Open the GUi of elmer
Code: Select all
$ElmerGUI


4. The steps for running the ElmerGUI tutorials are given in ElmerGUI_tutorial manual.




Yours
Anil Kunwar
Last edited by annier on 30 Aug 2016, 04:52, edited 66 times in total.
annier
 
Posts: 1043
Joined: 27 Aug 2013, 13:51

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby annier » 16 Dec 2014, 10:25

Hi Peter,
I installed Elmer in Ubuntu 14.04 (64 bits) using the procedure described above and using cmake command(Method B) as described in step 4. It could find the LAPACK libraries during building.

The result of the $ctest is
Code: Select all
95% tests passed, 15 tests failed out of 287

Total Test time (real) = 1097.08 sec

The following tests FAILED:
    10 - radiation3d (Failed)
    20 - ParticleAdvector2 (Failed)
    25 - mgdyn_lamstack_lowfreq_harmonic (Failed)
    46 - elasticity (Failed)
    50 - levelset3 (Failed)
    66 - CompressIdealGas (Failed)
   132 - radiation (Failed)
   147 - ParticleAdvector (Failed)
   154 - radiation2d (Failed)
   193 - mhd2 (Failed)
   200 - mgdyn_steady_periodic (Failed)
   223 - ArteryOutlet (Failed)
   230 - radiation2 (Failed)
   274 - InductionHeating2 (Failed)
   279 - TimeAdapt (Failed)
Errors while running CTest




Yours
Anil Kunwar
annier
 
Posts: 1043
Joined: 27 Aug 2013, 13:51

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby raback » 16 Dec 2014, 12:13

Hi annier,

Ok, thanx for testing. It seems that around 2% of tests fail. One should look at them one-by-one.

You can also run the tests with many cores by
Code: Select all
$ctest -j4

and use regular expressions etc. This makes the ctests more powerful than the old tests.

-Peter
raback
Site Admin
 
Posts: 3127
Joined: 22 Aug 2009, 11:57
Location: Espoo, Finland

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby annier » 16 Dec 2014, 20:33

Hi Peter,
In another test made in two computers (Ubuntu 14.04), i got the following results. Some options settings were varied for cmake in cmake-gui.
Computer -1
Code: Select all
97% tests passed, 10 tests failed out of 287

Total Test time (real) = 4374.52 sec

The following tests FAILED:
    24 - CompressIdealGas (Failed)
    25 - mgdyn_steady_periodic (Failed)
    59 - TimeAdapt (Failed)
    92 - mhd2 (Failed)
   105 - levelset3 (Failed)
   115 - ArteryOutlet (Failed)
   188 - elasticity (Failed)
   192 - ParticleAdvector2 (Failed)
   253 - mgdyn_lamstack_lowfreq_harmonic (Failed)
   287 - ParticleAdvector (Failed)
Errors while running CTest

Computer -2
Code: Select all
97% tests passed, 10 tests failed out of 287

Total Test time (real) = 323.55 sec

The following tests FAILED:
    20 - ParticleAdvector2 (Failed)
    25 - mgdyn_lamstack_lowfreq_harmonic (Failed)
    46 - elasticity (Failed)
    50 - levelset3 (Failed)
    66 - CompressIdealGas (Failed)
   147 - ParticleAdvector (Failed)
   193 - mhd2 (Failed)
   200 - mgdyn_steady_periodic (Failed)
   223 - ArteryOutlet (Failed)
   279 - TimeAdapt (Failed)
Errors while running CTest

Also, i am happy to run ctest in parallel ($ctest -j4) in both of these computers.
cmake is very wonderful.
Thank you.

Yours
Anil Kunwar
annier
 
Posts: 1043
Joined: 27 Aug 2013, 13:51

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby kataja » 17 Dec 2014, 14:15

Hi!

Just a quick note that one should set CMAKE_BUILD_TYPE=Release or RelWithDebInfo. This way cmake will set e.g. optimization flags for the compiler yielding much faster binaries.

-Juhani
kataja
 
Posts: 58
Joined: 09 May 2014, 16:06

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby annier » 17 Dec 2014, 16:13

Hi Juhani,
    1. I tried to compile using
    Code: Select all
    CMAKE_BUILD_TYPE=RelWithDebInfo

    When i tried the command,
    $ctest -j4, the test could not proceed.

    2. When i am using
    Code: Select all
    CMAKE_BUILD_TYPE=......(Empty_space meaning None)
    .
    the ctest could proceed.

Yours
Anil Kunwar
Last edited by annier on 21 Dec 2014, 17:37, edited 3 times in total.
annier
 
Posts: 1043
Joined: 27 Aug 2013, 13:51

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby kataja » 18 Dec 2014, 17:46

Hi Anil,

that problem has now been fixed and the tests should be enabled for all build types.

-Juhani
kataja
 
Posts: 58
Joined: 09 May 2014, 16:06

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby zhang liangfu » 18 Dec 2014, 19:08

Hi juhani,
I do it as this paper says, i encounter the same 10 errors,How I do next to solve these errors or i can ignore these errors.
I am interested in the Elmer/ice , i am trying my best to install the elmer and then to install the elmer/ice.
looking forwading to you





yours zhang liangfu
zhang liangfu
 
Posts: 22
Joined: 20 Nov 2014, 05:06

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby annier » 18 Dec 2014, 19:49

Hi Zhang Liangfu,
The result of ctest are not associated with the installation errors. This is the result of a search for whether the Elmer test cases pass the test. Your Elmer installation has been successfully completed. Out of 287 test examples coming along with the Elmer software, 97% have passed the cmake test. You don't need to worry about this result now.

If you have chosen the WITH_Elmerice as shown in the figure above, then Elmerice has already been installed along with the Elmer software.

Yours
Anil Kunwar
annier
 
Posts: 1043
Joined: 27 Aug 2013, 13:51

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Postby zhang liangfu » 18 Dec 2014, 22:00

Hi Anil Kunwar,
Thankyou for your replies, I followed your advice I choose the elmerice,but I encounter a new problem ,the problem as the attachment
I found it is doferent from the paper describe .I don't know where I go wrong.and the error log is

OpenMP C flag = [-fopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Success
Try OpenMP CXX flag = [-fopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Success
Try OpenMP Fortran flag = [-fopenmp]
Performing Test OpenMP_FLAG_DETECTED
Performing Test OpenMP_FLAG_DETECTED - Success
Found OpenMP: -fopenmp
Found MPI_C: /usr/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libhwloc.so
Found MPI_CXX: /usr/lib/libmpi_cxx.so;/usr/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libhwloc.so
Found MPI_Fortran: /usr/lib/libmpi_f90.so;/usr/lib/libmpi_f77.so;/usr/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libhwloc.so
CMake Error at CMakeLists.txt:108 (FIND_PACKAGE):
By not providing "FindML.cmake" in CMAKE_MODULE_PATH this project has asked
CMake to find a package configuration file provided by "ML", but CMake did
not find one.

Could not find a package configuration file provided by "ML" with any of
the following names:

MLConfig.cmake
ml-config.cmake

Add the installation prefix of "ML" to CMAKE_PREFIX_PATH or set "ML_DIR" to
a directory containing one of the above files. If "ML" provides a separate
development package or SDK, be sure it has been installed.


Configuring incomplete, errors occurred!
See also "/home/zlf/elmer/build/CMakeFiles/CMakeOutput.log".
See also "/home/zlf/elmer/build/CMakeFiles/CMakeError.log".
I am very sorry to ask your this noobish question.I am a beginner of elmer/ice.
what should I do next ,I see some one do the elmer/ice test as describes in viewtopic.php?f=21&t=3721 here
looking forward to you
yours sincerely
zhang liangfu
Attachments
Screenshot from 2014-12-20 02_47_46.png
error information
(220.07 KiB) Not downloaded yet
zhang liangfu
 
Posts: 22
Joined: 20 Nov 2014, 05:06

Next

Return to Installation & compilation

Who is online

Users browsing this forum: No registered users and 2 guests