Page 1 of 1

Problems building ATLAS lib

Posted: 2020/06/05 20:06:55
by PhillHS
Hi All,

I look after a Centos 7 cluster for the Department of statistics at Warwick university. I am currently trying to compile the ATLAS library** (we use the modules system so that we can have multiple versions of the same software on the machine).

**We want a machine optimized version which is why we are not using the pre-packaged one.

I have downloaded the sources for ATLAS and Lapack on which it depends unpacked them and followed all the configuration instructions. The make mostly works, but fails building the shared libraries, the static versions are built without problems. After spending some time investigating the cause of the failure it seems that the ATLAS build process modifies one of the lappack makefiles to insert the chosern compiler options, specifically -fPIC. It does this using a sed command however this does not seem to be working.....

The sed command is :

Code: Select all

cat /storage/stsxab/CentosBuild-2020/ATLAS/build/src/lapack/reference/make.inc.example | sed -e 's@PLAT *=.*@PLAT = _Corei264AVX@' \
         -e 's@^FORTRAN *=.*@FORTRAN = /usr/bin/gfortran@' \
         -e 's@^OPTS *=.*@OPTS = -fPIC -fPIC -m64 -fPIC@' \
         -e 's@^NOOPT *=.*@NOOPT = -fPIC -fPIC -m64 -fPIC -fPIC -fPIC -m64 -fPIC -O0   @' \
         -e 's@^LOADER *=.*@LOADER = /usr/bin/gfortran@' \
         -e 's@^LOADOPTS *=.*@LOADOPTS = -fPIC -fPIC -m64 -fPIC@' \
         -e 's@^TIMER *=.*@TIMER = NONE@' \
         > /storage/stsxab/CentosBuild-2020/ATLAS/build/src/lapack/reference/make.inc
make.inc.example contains :

Code: Select all

####################################################################
#  LAPACK make include file.                                       #
#  LAPACK, Version 3.8.0                                           #
#  November 2017                                                   #
####################################################################

SHELL = /bin/sh

#  CC is the C compiler, normally invoked with options CFLAGS.
#
CC = gcc
CFLAGS = -O3

#  Modify the FC and FFLAGS definitions to the desired compiler
#  and desired compiler options for your machine.  NOOPT refers to
#  the compiler options desired when NO OPTIMIZATION is selected.
#
#  Note: During a regular execution, LAPACK might create NaN and Inf
#  and handle these quantities appropriately. As a consequence, one
#  should not compile LAPACK with flags such as -ffpe-trap=overflow.
#
FC = gfortran
FFLAGS = -O2 -frecursive
FFLAGS_DRV = $(FFLAGS)
FFLAGS_NOOPT = -O0 -frecursive

#  Define LDFLAGS to the desired linker options for your machine.
#
LDFLAGS =

#  The archiver and the flag(s) to use when building an archive
#  (library).  If your system has no ranlib, set RANLIB = echo.
#
AR = ar
ARFLAGS = cr
RANLIB = ranlib

#  Timer for the SECOND and DSECND routines
#
#  Default:  SECOND and DSECND will use a call to the
#  EXTERNAL FUNCTION ETIME
#TIMER = EXT_ETIME
#  For RS6K:  SECOND and DSECND will use a call to the
#  EXTERNAL FUNCTION ETIME_
#TIMER = EXT_ETIME_
#  For gfortran compiler:  SECOND and DSECND will use a call to the
#  INTERNAL FUNCTION ETIME
TIMER = INT_ETIME
#  If your Fortran compiler does not provide etime (like Nag Fortran
#  Compiler, etc...) SECOND and DSECND will use a call to the
#  INTERNAL FUNCTION CPU_TIME
#TIMER = INT_CPU_TIME
#  If none of these work, you can use the NONE value.
#  In that case, SECOND and DSECND will always return 0.
#TIMER = NONE

#  Uncomment the following line to include deprecated routines in
#  the LAPACK library.
#
#BUILD_DEPRECATED = Yes

#  LAPACKE has the interface to some routines from tmglib.
#  If LAPACKE_WITH_TMG is defined, add those routines to LAPACKE.
#
#LAPACKE_WITH_TMG = Yes

#  Location of the extended-precision BLAS (XBLAS) Fortran library
#  used for building and testing extended-precision routines.  The
#  relevant routines will be compiled and XBLAS will be linked only
#  if USEXBLAS is defined.
#
#USEXBLAS = Yes
#XBLASLIB = -lxblas

#  The location of the libraries to which you will link.  (The
#  machine-specific, optimized BLAS library should be used whenever
#  possible.)
#
BLASLIB      = $(TOPSRCDIR)/librefblas.a
CBLASLIB     = $(TOPSRCDIR)/libcblas.a
LAPACKLIB    = $(TOPSRCDIR)/liblapack.a
TMGLIB       = $(TOPSRCDIR)/libtmglib.a
LAPACKELIB   = $(TOPSRCDIR)/liblapacke.a
I presume the sed is supposed to do things like replace FFLAGS_NOOPT = -O0 -frecursive with FFLAGS_NOOPT = -fPIC -fPIC -m64 -fPIC -fPIC -fPIC -m64 -fPIC -O0

Anyone know why this is failing. I also tried cutting and pasting the cat | sed pipeline to the shell prompt and executing it from there but it doesn't work there either :(

Cheers.

Phill.

Re: Problems building ATLAS lib

Posted: 2020/06/05 20:38:35
by chemal
PhillHS wrote:
2020/06/05 20:06:55
**We want a machine optimized version which is why we are not using the pre-packaged one.
If you look at the source rpm of the pre-packaged version, you will find a switch in very the first line of the spec file. If you flip it and rebuild, you get rpms that are optimized for the machine that did the rebuild. That worked for me.

Re: Problems building ATLAS lib

Posted: 2020/06/07 19:54:02
by PhillHS
Just to follow up my own post, it turns out that the lapack library changed the labels they used in their make.inc.example in a way that broke
compiling with ATLAS. Drpping back to the previous version (v3.8.0) solved the problem and allowed it to build.

Cheers.

Phill.