Menu

Help request: Library management to install elk on Linux Sub-system for Windows

Elk Users
2020-02-17
2020-02-23
  • Oscar Xavier Guerrero Gutierrez

    Hi all,

    I would like to install elk on Window's Ubuntu sub-system and I would like to use it in parallel. The problem is I don't completely understand the library management. Can you help me figure this out? Please correct me if I did something wrong and tell me if I need to provide more details.

    This is what I added to the make.inc apart from copying the libxc.a and libxcf90.a files to elk/src:

    F90 = mpifort
    F77 = mpifort
    SRC_MPI = /usr/lib/x86_64-linux-gnu/libmpi.so /usr/lib/x86_64-linux-gnu/libmpi.so.20
    SRC_OBLAS = /usr/lib/x86_64-linux-gnu/openblas/libblas.so /usr/lib/x86_64-linux-gnu/openblas/libblas.so /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
    LIB_libxc = libxcf90.a libxc.a
    SRC_libxc = libxc_funcs.f90 libxc.f90 libxcifc.f90
    

    I didn't change the LIB_LPK variable that says is for LAPACK and BLAS.

    This is the error I had:

    ...
    libxcifc.o: In function `__libxcifc_MOD_xcifc_libxc':
    libxcifc.f90:(.text+0x2a55): undefined reference to `xc_f90_func_set_ext_params_'
    libxcifc.f90:(.text+0x2cae): undefined reference to `xc_f90_func_set_ext_params_'
    oblas_init.o: In function `oblas_init_':
    oblas_init.f90:(.text+0xa): undefined reference to `openblas_set_num_threads_'
    collect2: error: ld returned 1 exit status
    Makefile:200: recipe for target 'elk' failed
    make[1]: *** [elk] Error 1
    make[1]: Leaving directory '/home/oscar/elk-6.3.2/src'
    Makefile:7: recipe for target 'all' failed
    make: *** [all] Error 2
    

    I also include sone ldconfig information:

    $ ldconfig -p | grep openblas
        libopenblas.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libopenblas.so.0
        libopenblas.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libopenblas.so
        liblapack.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/liblapack.so.3
        liblapack.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/liblapack.so
        libblas.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
        libblas.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/libblas.so
    $ ldconfig -p | grep lapack
        libscalapack-openmpi.so.2.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libscalapack-openmpi.so.2.0
        libscalapack-mpich.so.2.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libscalapack-mpich.so.2.0
        libscalapack-mpich.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libscalapack-mpich.so
        liblapack.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/liblapack.so.3
        liblapack.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/liblapack.so.3
        liblapack.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/liblapack.so
        liblapack.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/liblapack.so
    $ ldconfig -p | grep blacs
        libblacsF77init-openmpi.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libblacsF77init-openmpi.so.1
        libblacsF77init-openmpi.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libblacsF77init-openmpi.so
        libblacsCinit-openmpi.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libblacsCinit-openmpi.so.1
        libblacsCinit-openmpi.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libblacsCinit-openmpi.so
        libblacs-openmpi.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libblacs-openmpi.so.1
        libblacs-openmpi.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libblacs-openmpi.so
    $ ldconfig -p | grep libxc
    libxcf90.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcf90.so.4
        libxcf90.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcf90.so
        libxcf03.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcf03.so.4
        libxcf03.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcf03.so
        libxcb.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb.so.1
        libxcb-sync.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1
        libxcb-shape.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb-shape.so.0
        libxcb-present.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0
        libxcb-glx.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0
        libxcb-dri3.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0
        libxcb-dri2.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0
        libxc.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxc.so.4
        libxc.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libxc.so
    
     
  • Andrew Shyichuk

    Andrew Shyichuk - 2020-02-22

    Dear Oscar,

    Building make.inc can be tricky, I had some headackes with it.

    Do you have an Ubuntu in a virtual machine?
    If so, you just follow Ubuntu instructions for compilation, linking and stuff, in general.

    General note: gcc is better for elk, and MKL is better on Intel processors (surprisingly).

    SRC_MPI and SRC_OBLAS are source flags, they point to f90 files and are usually used with stubs (i.e. to disable the respective feature).

    Here is a pure gcc make.inc (without libwannier)

    MAKE = make
    F90 = mpifort
    CC = mpicc
    F90_OPTS = -O3 -ffast-math -funroll-loops -fopenmp 
    F77 = mpifort
    F77_OPTS = -O3 -ffast-math -funroll-loops -fopenmp 
    AR = ar
    LIB_SYS = 
    
    LIB_LPK = lapack.a blas.a
    SRC_OBLAS = oblas_stub.f90
    
    SRC_OMP = 
    
    SRC_MKL = mkl_stub.f90
    SRC_BLIS = blis_stub.f90
    
    SRC_W90S = w90_stub.f90
    
    SRC_MPI =
    
    LIB_libxc = libxcf90.a libxc.a
    SRC_libxc = libxc_funcs.f90 libxc.f90 libxcifc.f90
    
    SRC_FFT = zfftifc.f90
    LIB_FFT = fftlib.a
    

    Here is a make.inc of my workhorse with gcc 7.4 and MKL, openMP + MPI (note that I use libwannier):

    MAKE = make
    F90 = mpifort
    CC = mpicc
    
    F90_OPTS = -O3 -ffast-math -funroll-loops -fopenmp -L$(MKLROOT)lib/intel64 -Wl,-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl 
    
    F77 = mpifort
    F77_OPTS = -O3 -ffast-math -funroll-loops -fopenmp -L$(MKLROOT)/lib/intel64 -Wl,-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
    AR = ar
    LIB_SYS = 
    
    MKLROOT=/usr/local/intel/15.0.1.133/composer_xe_2015.1.133/mkl
    LIB_LPK = -L$(MKLROOT)/lib/intel64 -Wl,-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
    SRC_MKL =
    
    
    SRC_OMP = 
    SRC_OBLAS = oblas_stub.f90
    SRC_BLIS = blis_stub.f90
    
    SRC_W90S =
    LIB_W90 = libwannier.a
    
    SRC_MPI =
    
    LIB_libxc = libxcf90.a libxc.a
    SRC_libxc = libxc_funcs.f90 libxc.f90 libxcifc.f90
    
    LIB_FFT = -lfftw3
    SRC_FFT = zfftifc_fftw.f90
    

    Best regards.
    Andrew

     
  • Oscar Xavier Guerrero Gutierrez

    Hi Andrew,

    I don't have a virtual machine, I have Ubuntu as a Linux Sub-system for Windows. I followed the installation instructions from the manual, I only followed the linking instructions for libxc because it's the only one mentioned. Do I have to special file handlings for other libraries?

    I have AMD, so I am not using MKL. Here's more information on my computer:

    model name      : AMD FX(tm)-8320 Eight-Core Processor
    
    $ gcc --version
    gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
    

    And here's my make.inc, I deleted the BLAS and LAPACK stubs:

    MAKE = make
    F90 = mpifort
    CC = mpicc
    F90_OPTS = -O3 -ffast-math -funroll-loops -fopenmp
    F77 = mpifort
    F77_OPTS = -O3 -ffast-math -funroll-loops -fopenmp
    AR = ar
    LIB_SYS =
     # LAPACK and BLAS libraries
    LIB_LPK = -L/usr/lib/x86_64-linux-gnu/openblas -lblas -L/usr/lib/x86_64-linux-gnu/openblas -llapack
    LIB_FFT = fftlib.a
    SRC_OMP =
    
    SRC_MPI = /usr/lib/x86_64-linux-gnu/libmpi.so
    SRC_MKL = mkl_stub.f90
    SRC_OBLAS = /usr/lib/x86_64-linux-gnu/openblas/libblas.so
    SRC_BLIS = blis_stub.f90
    SRC_libxc = libxcifc_stub.f90
    LIB_libxc = libxcf90.a libxc.a
    SRC_libxc = libxc_funcs.f90 libxc.f90 libxcifc.f90
    SRC_FFT = zfftifc.f90
    SRC_W90S = w90_stub.f90
    

    And here's te error I got:

    ... 
     /usr/bin/ld: oblas_init.o: undefined reference to symbol 'openblas_set_num_threads_'    
    //usr/lib/x86_64-linux-gnu/libopenblas.so.0: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    Makefile:200: recipe for target 'elk' failed
    make[1]: *** [elk] Error 1
    make[1]: Leaving directory '/home/izxle/elk-6.3.2/src'
    Makefile:7: recipe for target 'all' failed
    make: *** [all] Error 2
    

    Thank you for your help

    Best regards,

    Oscar X. Guerrero

     
  • Anton F.

    Anton F. - 2020-02-22

    Hi, Oscar,
    If you have a single machine, you don't have to use MPI, just OpenMP parallelism, as far as I know, is required.
    Best regards,
    Anton.

     
  • Andrew Shyichuk

    Andrew Shyichuk - 2020-02-23

    Dear Oscar,

    SRC_MPI should point to a stub or be empty:

    SRC_MPI = 
    

    Same goes for SRC_OBLAS. Youl LIB_LPK line should be enouch to link OBLAS.

    Generally, I do not think you should link .so like that.

    As Anton F. correctly said, you do not need MPI on a single machine.

    And, gcc is definitely better on an AMD machine.

    Finally, try compiling elk with the included LAPACK and BLAS, with mpicc, just to get it running. Once that is done, you may consider adding external linear algebra libs and check the performance gain.

    Best regards.
    Andrew

     

Log in to post a comment.