build problem with petsc slepc trilinos on ubuntu

Asked by Chaffra Affouda

I am having some problems building with TRILINOS and SLEPC on ubuntu oneiric. My CmakeError.log is posted below. I think it's having a hard time finding libpthreads. I am using the trunk version.

******
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: dolfin/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
make[1]: Entering directory `dolfin/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report dolfin/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o
/usr/bin/gcc -DCHECK_FUNCTION_EXISTS=pthread_create -fopenmp -o CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o -c /usr/share/cmake-2.8/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/usr/bin/gcc -DCHECK_FUNCTION_EXISTS=pthread_create -fopenmp CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o -o cmTryCompileExec -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: ld returned 1 exit status
make[1]: *** [cmTryCompileExec] Error 1
make[1]: Leaving directory `dolfin/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec/fast] Error 2

Performing C++ SOURCE FILE Test ARMADILLO_TEST_RUNS failed with the following output:
Change Dir: dolfin/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
make[1]: Entering directory `dolfin/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report dolfin/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec.dir/src.cxx.o
/usr/bin/c++ -DARMADILLO_TEST_RUNS -fopenmp -o CMakeFiles/cmTryCompileExec.dir/src.cxx.o -c dolfin/build/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTryCompileExec
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/usr/bin/c++ -DARMADILLO_TEST_RUNS -fopenmp CMakeFiles/cmTryCompileExec.dir/src.cxx.o -o cmTryCompileExec -rdynamic -larmadillo
CMakeFiles/cmTryCompileExec.dir/src.cxx.o: In function `void arma::lapack::gesv<double>(int*, int*, double*, int*, int*, double*, int*, int*)':
src.cxx:(.text._ZN4arma6lapack4gesvIdEEvPiS2_PT_S2_S2_S4_S2_S2_[void arma::lapack::gesv<double>(int*, int*, double*, int*, int*, double*, int*, int*)]+0x4d): undefined reference to `dgesv_'
CMakeFiles/cmTryCompileExec.dir/src.cxx.o: In function `void arma::lapack::gels<double>(char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, int*)':
src.cxx:(.text._ZN4arma6lapack4gelsIdEEvPcPiS3_S3_PT_S3_S5_S3_S5_S3_S3_[void arma::lapack::gels<double>(char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, int*)]+0x68): undefined reference to `dgels_'
CMakeFiles/cmTryCompileExec.dir/src.cxx.o: In function `void arma::lapack::getrf<double>(int*, int*, double*, int*, int*, int*)':
src.cxx:(.text._ZN4arma6lapack5getrfIdEEvPiS2_PT_S2_S2_S2_[void arma::lapack::getrf<double>(int*, int*, double*, int*, int*, int*)]+0x42): undefined reference to `dgetrf_'
collect2: ld returned 1 exit status
make[1]: *** [cmTryCompileExec] Error 1
make[1]: Leaving directory `dolfin/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec/fast] Error 2

Return value: 1
Source file was:

#include <armadillo>

using namespace arma;

int main()
{
  int n = 20;
  double h = 1.0/(n-1);
  mat A(n, n);
  vec b(n);
  vec u(n);
  double beta = 0.2;
  double gamma = 1000;

  A.fill(0.0);
  b.fill(0.0);
  double x; int i;

  i = 0;
  A(i, i) = 1;
  b(i) = 0;
  for (i=1; i<n-1; i++) {
    x = (i-1)*h;
    A(i, i-1) = 1; A(i, i) = -2; A(i, i+1) = 1;
    b(i) = - h*h*gamma*exp(-beta*x);
  }
  i = n-1; x = (i-1)*h;
  A(i, i-1) = 2; A(i, i) = -2;

  u = solve(A, b);

  return 0;
}

Performing C++ SOURCE FILE Test SLEPC_TEST_RUNS failed with the following output:
Change Dir: dolfin/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
make[1]: Entering directory `dolfin/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report dolfin/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec.dir/src.cxx.o
/usr/bin/c++ -DSLEPC_TEST_RUNS -fopenmp -I/usr/lib/slepcdir/3.1 -I/usr/lib/slepcdir/3.1/linux-gnu-c-opt/include -I/usr/lib/slepcdir/3.1/include -I/usr/lib/petscdir/3.1/linux-gnu-c-opt/include -I/usr/lib/petscdir/3.1/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/include/spooles -I/usr/include/scotch -I/usr/lib -I/usr/include/suitesparse -I/usr/include/mpich2 -o CMakeFiles/cmTryCompileExec.dir/src.cxx.o -c dolfin/build/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTryCompileExec
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/usr/bin/c++ -DSLEPC_TEST_RUNS -fopenmp CMakeFiles/cmTryCompileExec.dir/src.cxx.o -o cmTryCompileExec -rdynamic -lslepc -lparpack -larpack /usr/lib/petscdir/3.1/linux-gnu-c-opt/lib/libpetsc.so -lmpichcxx -lmpich -lopa -lmpl -lrt -lcr -lpthread -Wl,-rpath,/usr/lib/petscdir/3.1/linux-gnu-c-opt/lib
/usr/bin/ld: CMakeFiles/cmTryCompileExec.dir/src.cxx.o: undefined reference to symbol 'ompi_mpi_comm_self'
/usr/bin/ld: note: 'ompi_mpi_comm_self' is defined in DSO /usr/lib/libmpi.so.0 so try adding it to the linker command line
/usr/lib/libmpi.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[1]: Leaving directory `dolfin/build/CMakeFiles/CMakeTmp'
make[1]: *** [cmTryCompileExec] Error 1
make: *** [cmTryCompileExec/fast] Error 2

Return value: 1
Source file was:

#include "petsc.h"
#include "slepceps.h"
int main()
{
  PetscErrorCode ierr;
  int argc = 0;
  char** argv = NULL;
  ierr = SlepcInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
  EPS eps;
  ierr = EPSCreate(PETSC_COMM_SELF, &eps); CHKERRQ(ierr);
  //ierr = EPSSetFromOptions(eps); CHKERRQ(ierr);
#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 1
  ierr = EPSDestroy(eps); CHKERRQ(ierr);
#else
  ierr = EPSDestroy(&eps); CHKERRQ(ierr);
#endif
  ierr = SlepcFinalize(); CHKERRQ(ierr);
  return 0;
}

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johannes Ring
Solved:
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :
#1

Do you have both OpenMPI and MPICH installed? What is the output of the following command?

  update-alternatives --display mpi

If it is set to mpich, run

  sudo update-alternatives --config mpi

and set it to openmpi.

Revision history for this message
Chaffra Affouda (chaffra) said :
#2

I set mpi to openmpi and it now finds slepc and others. But it still does not find trilinos. I have version 10.4 installed from ubuntu repo (libtrilinos, libtrilinos-dev).

-- The following optional packages were found:
-- -------------------------------------------
-- (OK) OPENMP
-- (OK) MPI
-- (OK) PETSC
-- (OK) SLEPC
-- (OK) MTL4
-- (OK) UMFPACK
-- (OK) CHOLMOD
-- (OK) SCOTCH
-- (OK) PARMETIS
-- (OK) CGAL
-- (OK) ZLIB
-- (OK) PYTHON
-- (OK) SPHINX
--
-- The following optional packages could not be found:
-- ---------------------------------------------------
-- (**) TRILINOS
-- (**) PASTIX

Revision history for this message
Best Johannes Ring (johannr) said :
#3

Trilinos 10.4 is too old for DOLFIN.

I have packaged Trilinos 10.8.5 in the FEniCS PPA (ppa:fenics-packages/fenics) that you may use.

Revision history for this message
Chaffra Affouda (chaffra) said :
#4

Thanks Johannes Ring, that solved my question.