Installing Elmer in Ubuntu 14.04 using Cmake

Discussion about building and installing Elmer
annier
Posts: 1099
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by annier » 18 Dec 2014, 22:44

Hi Zhang Liangfu,
You have clicked all the (WITH_...) options in the cmake-gui.
In my context(Please see in the figures),
A.. I have only chosen:
  • 1. WITH_MPI(default)
    2. WITH_ELMERGUI(and in its further option after clicking configure, I did not chose all options. I only chose MATC,Paraview and PythonQT)
    3. WITH_ELMERGUILOGGER
    4 WITH_ELMERGUITESTER
    5. WITH_Elmerice

B. For some libraries,cmake may need more specific path in the corresponding "Value" column of the library.
  • For examples,
    (i)The option, WITH_Trilinos requires the ML_DIR and its specific path should be supplied in
    place of ML_DIR-NOTFOUND and again update the configuration by proceeding towards "configure".
    [ if we unselect (remove the tick mark in) the "WITH_Trilinos" option that means not using this option, and update the "configure" by clicking configure, the ML_DIR-NOTFOUND message will disappear]. If we want to use "WITH_Trilinos", we need to specify the cmake path of ML_DIR.


    (ii) The option, WITH_VTK requires VTK_DIR to be specified. VTK has to be built outside Elmer using cmake and /path/to/VTK_BUILD has to replace the "VTK_DIR-NOTFOUND" space (This is described in this thread ).
Note:
When the configure from Cmake shows these messages, don't take them as errors. It is just asking you to specify detail path of some specific libraries if you want to use them in your Elmer installation.


Yours
Anil Kunwar
Last edited by annier on 30 Dec 2014, 23:59, edited 4 times in total.

annier
Posts: 1099
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by annier » 21 Dec 2014, 17:25

Juhani wrote: that problem has now been fixed and the tests should be enabled for all build types.
Hi Juhani,
Thank you for informing us about enabling elmer tests to be used with all types of CMAKE_BUILD_TYPE .

Yours
Anil Kunwar
Last edited by annier on 22 Dec 2014, 20:53, edited 1 time in total.

annier
Posts: 1099
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by annier » 22 Dec 2014, 19:51

HI Zhang Liangfu,
Since, the Elmer team has made some updates, i have installed Elmer from the beginning (as the latest elmerfem/ directory has to be downloaded) with the steps described in the first post but with the following variations:

Code: Select all

CMAKE_BUILD_TYPE                              RelWithDebInfo
and the following features(including WITH_HYPRE):
cmake-configure_and_generate.png
cmake:configure_and_generate
cmake-configure_and_generate.png (63.74 KiB) Viewed 4202 times
and the following error (during build) occurred:

Code: Select all

libelmersolver.so: undefined reference to `HYPRE_IJVectorSetValues'
libelmersolver.so: undefined reference to `HYPRE_BoomerAMGSetInterpType'
libelmersolver.so: undefined reference to `HYPRE_BoomerAMGCreate'
libelmersolver.so: undefined reference to `HYPRE_BoomerAMGSetStrongThreshold'
libelmersolver.so: undefined reference to `HYPRE_BoomerAMGSetTol'
libelmersolver.so: undefined reference to `HYPRE_BoomerAMGSetNumSweeps'
libelmersolver.so: undefined reference to `HYPRE_IJVectorAddToValues'
libelmersolver.so: undefined reference to `HYPRE_ParCSRLGMRESSetup'
collect2: error: ld returned 1 exit status
make[2]: *** [fem/src/ViewFactors] Error 1
make[1]: *** [fem/src/CMakeFiles/ViewFactors.dir/all] Error 2
Linking Fortran shared library Acoustics.so
[ 86%] Built target Acoustics
make: *** [all] Error 2
Then, i opened the cmake-gui by typing

Code: Select all

$cmake-gui
within the ~/elmer/build/ directory and unselected the WITH_HYPRE option.
as shown below:
cmake-gui(configure and generate).png
set up without the WITH_Hypre option
cmake-gui(configure and generate).png (73.87 KiB) Viewed 4201 times
.
After this, i clicked configure to update and generate to generate the updated Makefile.
Then, I typed

Code: Select all

$make -j4 install
And, the build and install process has completed successfully.

Conclusion:
If Elmer build is aborted due to some libraries path not available for as required by Cmake, we can either make its path available to Cmake or we can unselect that feature. Then, we can update configure and generate, in order to proceed.


Yours
Anil Kunwar

annier
Posts: 1099
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by annier » 30 Dec 2014, 22:54

VTK build for Elmer WITH_ELMERGUI< WITH_VTK option>
Since VTK needs to be externally built with cmake, this has to be done outside Elmer using cmake. Then the path to its Makefile and other necessary files can be specified during the configuration proccess of Elmer.

The process of building VTK using cmake is described via following steps:
  • 1, Download the version of VTK from http://www.vtk.org/VTK/resources/software.html.
    2. Extract the VTK-5.8.0.tar.gz file and keep it in the $HOME directory.
    So, its location will be /home/username/VTK.
    3. create a VTK_build directory(also in $HOME) and jump into the directory.

    Code: Select all

    $mkdir build_VTK
    $cd build_VTK
    4. Run cmake-gui

    Code: Select all

    $cmake-gui
    5. Configure and generate the VTK Makefile using cmake.
    a. Locate the source and build paths of VTK as shown in the figure.
    VTK_build_using_cmake-gui.png
    the source and build folders for VTK build using cmake-gui
    VTK_build_using_cmake-gui.png (56.08 KiB) Viewed 4176 times
    b. Click configure.
    c. Click generate (Makefile will be generated with other necessary files)
    6. Now start the Elmer configuration and generate process including WITH_VTK option for WITH_ELMERGUI option till the following error message appears.

    Code: Select all

    VTK_DIR                                    VTK_DIR-NOTFOUND
    Then, browse the path exactly at the place where this VTK_DIR-NOTFOUND is written and define this path where the Makefiles and other files/folders of previously built VTK are located. So, the path for VTK_DIR will be written as:

    Code: Select all

    VTK_DIR                                    /home/username/build_VTK
    6. Click configure for update of "Elmer build configuration" and then click generate.
    7. The Makefile for Elmerbuild is generate along with WITH_VTK option for ELMER_GUI.

Yours
Anil Kunwar

annier
Posts: 1099
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by annier » 17 Jan 2015, 21:19

Hi,
These threads (thread a and thread b), started by Stevemi, discuss about the installation issue for Elmer in Ubuntu 14.10 using Cmake and come up with the conclusion related to "Tetgen functionality".


Yours
Anil Kunwar

xborras7
Posts: 37
Joined: 02 Sep 2013, 21:44
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by xborras7 » 06 Feb 2015, 12:47

Heej!

I am also using "cmake" procedure in a CentOS machine. I have been using Elmer for a while and updates have always been tough. It seems the new "cmake" procedure makes things easier however I am stuck with an error message. I exaplin:

I followed the steps you describe in the previous post:

1) Create directory Elmer
2) Get files from gib
3) I did the following:

Code: Select all

$ cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=~/xavier/Downloads/Software/Elmer_CMAKE/elmerfem

4) I found the following error when doing:

$ make -j4 install

Code: Select all

[xavier@CE-CLYX01 elmerfem]$ make -j4 install
[ 0%] Built target amdf77
[ 0%] [ 2%] Built target umfpack_srcs
Built target matc
[ 6%] Built target amd
[ 7%] Built target binio
[ 9%] Built target Mesh2D
[ 15%] [ 15%] [ 16%] Built target arpack
Built target mpi_stubs
Built target fhuti
[ 17%] Built target view3d
[ 18%] [ 18%] Built target viewaxis
Built target Matc_bin
[ 22%] Built target metis
[ 23%] Built target ElmerGrid
[ 71%] Built target umfpack
[ 71%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/LoadMod.F90.o
[ 71%] [ 71%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/SParIterGlobals.F90.o
Building Fortran object fem/src/CMakeFiles/elmersolver.dir/PElementBase.F90.o
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:509.22:

intval = pptr(model, solver, mtr, b, x, n, DOFs, nrm)
1
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:572.54:

M, D, S, F, element, nrow, ncol)
2
Error: Global name 'pptr' at (1) is already being used as a SUBROUTINE at (2)
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:458.22:

realval = pptr(model, element, nodes, n, nd, &
1
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:572.54:

M, D, S, F, element, nrow, ncol)
2
Error: Global name 'pptr' at (1) is already being used as a SUBROUTINE at (2)
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:371.22:

realval = pptr(model, node, val)
1
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:572.54:

M, D, S, F, element, nrow, ncol)
2
Error: Global name 'pptr' at (1) is already being used as a SUBROUTINE at (2)
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:345.22:

realval = pptr(model, x, y, z)
1
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:572.54:

M, D, S, F, element, nrow, ncol)
2
Error: Global name 'pptr' at (1) is already being used as a SUBROUTINE at (2)
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:321.21:

intval = pptr(model)
1
/home/xavier/Downloads/Software/Elmer_CMAKE/elmerfem/fem/src/LoadMod.F90:572.54:

M, D, S, F, element, nrow, ncol)
2
Error: Global name 'pptr' at (1) is already being used as a SUBROUTINE at (2)
make[3]: *** [fem/src/CMakeFiles/elmersolver.dir/LoadMod.F90.o] Error 1
make[2]: *** [fem/src/CMakeFiles/elmersolver.dir/LoadMod.F90.o.provides] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [fem/src/CMakeFiles/elmersolver.dir/all] Error 2
make: *** [all] Error 2

Any idea? What I am doing wrong?

6) It fails to pass the test:

$ -ctest -j4

Code: Select all

0% tests passed, 293 tests failed out of 293
Thanks in advance! Big fan of Elmer Multiphisics!

/Xavier

annier
Posts: 1099
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by annier » 06 Feb 2015, 16:53

Hi Xavier,
I am not clear whether you successfully "configured and generated" the makefile via cmake. The

Code: Select all

$make -j 4 install
command should be used after verifying that the "configure" and "generate" procedures succeed.
Can you post your results after the

Code: Select all

$ cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=~/xavier/Downloads/Software/Elmer_CMAKE/elmerfem
command?

Notes:
1.The installation procedure has resulted with the error in installing the fem module. So the build process(configure + generate procedures) should check about the possible workout in the fem module requirements.
2. Using the Cmake-gui can help you deal with each parts of the procedure quite easily.


Yours
Anil Kunwar

david_coe
Posts: 7
Joined: 13 Feb 2014, 11:08
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by david_coe » 09 Feb 2015, 13:31

Maximum respect guys! I'm just back from a long break from Elmer to find not only is the Cmake / GitHub development environment up and running but also SourceForge has a 64bit Windows nightly-build. YES!!

I've just been checking out the native Windows package and also running Cmake on a VMware-hosted Mint Linux 17.1 (Ubuntu 14.04 in a pretty shirt) and noticed a couple of minor issues. The first is with ElmerGUItester: now that ELMERGUI_HOME has been relocated to from $ELMER_HOME/bin to $ELMER_HOME/share/ElmerGUI, the test for the executable needs still to look in the former directory. The following tiny patch fixes both platforms:

Code: Select all

--- elmerfem/ElmerGUItester/src/tester.cpp.orig 2015-02-09 06:34:23.286016996 +0000
+++ elmerfem/ElmerGUItester/src/tester.cpp      2015-02-09 08:18:54.633934718 +0000
@@ -139,12 +139,12 @@
 {
 #ifdef Q_WS_WIN
   ok &= testFile(elmerHome + "\\bin\\ElmerSolver.exe", ui.elmerSolverResult);
-  ok &= testFile(elmerGuiHome + "\\ElmerGUI.exe", ui.elmerGuiResult);
+  ok &= testFile(elmerHome + "\\bin\\ElmerGUI.exe", ui.elmerGuiResult);
   ok &= testFile(elmerHome + "\\bin\\ElmerPost.exe", ui.elmerPostResult);
   ok &= testFile(elmerHome + "\\bin\\ElmerGrid.exe", ui.elmerGridResult);
 #else
   ok &= testFile(elmerHome + "/bin/ElmerSolver", ui.elmerSolverResult);
-  ok &= testFile(elmerGuiHome + "/ElmerGUI", ui.elmerGuiResult);
+  ok &= testFile(elmerHome + "/bin/ElmerGUI", ui.elmerGuiResult);
   ok &= testFile(elmerHome + "/bin/ElmerPost", ui.elmerPostResult);
   ok &= testFile(elmerHome + "/bin/ElmerGrid", ui.elmerGridResult);
 #endif
The second is with ElmerClips (not in the Cmake, I know) where there's been a change some while ago I think between FFmpeg and AVconv libraries. Again the following tiny patch should fix things:

Code: Select all

--- elmerfem/utils/ElmerClips/src/encoder.cpp.orig      2015-02-09 06:34:25.242016970 +0000
+++ elmerfem/utils/ElmerClips/src/encoder.cpp   2015-02-09 08:06:01.781944857 +0000
@@ -39,6 +39,10 @@
  *****************************************************************************/
 #include "encoder.h"
 
+extern "C" {
+  #include <libavutil/mem.h>
+}
+
 Encoder::Encoder(QObject *parent) : QThread(parent), quality(2)
 {
   frameRGB = avcodec_alloc_frame();
--- elmerfem/ElmerGUItester/src/tester.cpp.orig 2015-02-09 06:34:23.286016996 +0000
Hope these help - once again, congratulations!

urb4nm
Posts: 5
Joined: 09 Feb 2015, 18:31
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by urb4nm » 09 Feb 2015, 19:04

I have encountered similar problem that Xavier posted while trying to compile Elmer from GIT repo under CentOS6. However, updating gcc to 4.8 solved presented issue, another one occured. After 'make install', I get:

Code: Select all

[ 74%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/ElmerSolver.F90.o
Linking Fortran shared library libelmersolver.so
[ 74%] Built target elmersolver
[ 74%] Generating GebhardtFactors.F90
Scanning dependencies of target GebhardtFactors
[ 75%] Building Fortran object fem/src/CMakeFiles/GebhardtFactors.dir/GebhardtFactors.F90.o
Linking Fortran executable GebhardtFactors
libelmersolver.so: undefined reference to `_gfortran_execute_command_line_i4'
collect2: error: ld returned 1 exit status
fem/src/CMakeFiles/GebhardtFactors.dir/build.make:108: recipe for target 'fem/src/GebhardtFactors' failed
make[2]: *** [fem/src/GebhardtFactors] Error 1
CMakeFiles/Makefile2:590: recipe for target 'fem/src/CMakeFiles/GebhardtFactors.dir/all' failed
make[1]: *** [fem/src/CMakeFiles/GebhardtFactors.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
make: *** [all] Error 2
Configure and generate steps seem to be ok:

Code: Select all

[root@rs build]# cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=/opt/elmer_wave/ ../elmerfem
-- A library with BLAS API found.
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Checking whether /usr/bin/f95 supports CONTIGUOUS
-- Checking whether /usr/bin/f95 supports CONTIGUOUS -- yes
-- Checking whether /usr/bin/f95 supports EXECUTE_COMMAND_LINE
-- Checking whether /usr/bin/f95 supports EXECUTE_COMMAND_LINE -- yes
-- ------------------------------------------------
--   BLAS library:   /usr/lib64/libblas.so
--   LAPACK library: /usr/lib64/liblapack.so;/usr/lib64/libblas.so
-- ------------------------------------------------
--   Fortran compiler:        /usr/bin/f95
--   Fortran flags:
-- ------------------------------------------------
--   C compiler:              /usr/bin/cc
--   C flags:
-- ------------------------------------------------
--   Fortran compiler:  /usr/bin/f95
-- ------------------------------------------------
--   C compiler:        /usr/bin/cc
-- ------------------------------------------------
--   C++ compiler:      /usr/bin/c++
-- ------------------------------------------------
-- ------------------------------------------------
--   Package filename: elmerfem-7.0-2b4689f-20150209_Linux-x86_64
--   Patch version: 7.0-2b4689f
-- Configuring done
-- Generating done
I would appreciate any help with this problem.

Regards
Michal Urbanski

annier
Posts: 1099
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Post by annier » 09 Feb 2015, 20:37

Hi Michal,
What is the version of gfortran in CentOS6?
In the Ubuntu computer here, it is gfortran 4.8.2.

Code: Select all

 $gfortran --version
GNU Fortran (Ubuntu 4.8.2-19ubuntu1) 4.8.2
and/or

Code: Select all

$f95 --version
GNU Fortran (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Yours
Anil Kunwar
Last edited by annier on 09 Feb 2015, 20:58, edited 2 times in total.

Post Reply