compilation of siesta code with Openmp

Asked by Maria on 2019-01-29

Dear all,

I am a bignner user of siesta code and I would like to install siesta code (version 4.1-b4) as parallel version in a computer Mac Os with Openmp and gfortran. But , always I have a problem in the compilation. Is my arch.make attached here is corrected or contain a fault. Please help me !
Thank you in advance,

My file arch.make is:

#
# Copyright (C) 1996-2016 The SIESTA group
# This file is distributed under the terms of the
# GNU General Public License: see COPYING in the top directory
# or http://www.gnu.org/copyleft/gpl.txt.
# See Docs/Contributors.txt for a list of contributors.
#
#-------------------------------------------------------------------
# arch.make file for gfortran compiler.
# To use this arch.make file you should rename it to
# arch.make
# or make a sym-link.
# For an explanation of the flags see DOCUMENTED-TEMPLATE.make

.SUFFIXES:
.SUFFIXES: .f .F .o .c .a .f90 .F90

SIESTA_ARCH = unknown

CC = gcc
FPP = $(FC) -E -P -x c
FC = gfortran
FC_SERIAL = gfortran

FFLAGS = -O2 -fPIC -ftree-vectorize

AR = ar
RANLIB = ranlib

SYS = nag

SP_KIND = 4
DP_KIND = 8
KINDS = $(SP_KIND) $(DP_KIND)

LDFLAGS =

COMP_LIBS = libsiestaLAPACK.a libsiestaBLAS.a

FPPFLAGS = $(DEFS_PREFIX)-DFC_HAVE_ABORT

# For GNU compiler
FFLAGS += -fopenmp
LIBS += -fopenmp

# OpenBLAS:
LIBS += -L/opt/openblas/lib -lopenblasp

LIBS =

# Dependency rules ---------

FFLAGS_DEBUG = -g -O1 # your appropriate flags here...

# The atom.f code is very vulnerable. Particularly the Intel compiler
# will make an erroneous compilation of atom.f with high optimization
# levels.
atom.o: atom.F
 $(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<

.c.o:
 $(CC) -c $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $<
.F.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<
.F90.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $<
.f.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f) $<
.f90.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90) $<

Question information

Language:
English Edit question
Status:
Answered
For:
Siesta Edit question
Assignee:
No assignee Edit question
Last query:
2019-01-31
Last reply:
2019-01-31
Nick Papior (nickpapior) said : #1

Please read the documentation.
It states that one should *only* use libsiestaBLAS/LAPACK.a if one does NOT have an optimized library.

Remove COMP_LIBS and try again.

Also, please carefully go through your arch.make, you have an empty "LIBS =" which nullified everything you've done.

Maria (maria11) said : #2

Thank your very much for reply. I read the documentation but I don't understand very well what I will do.

 I delete the COMP_LIBS and the empty "LIBS =" . In this case, the arch.make file becomes:

#
# Copyright (C) 1996-2016 The SIESTA group
# This file is distributed under the terms of the
# GNU General Public License: see COPYING in the top directory
# or http://www.gnu.org/copyleft/gpl.txt.
# See Docs/Contributors.txt for a list of contributors.
#
#-------------------------------------------------------------------
# arch.make file for gfortran compiler.
# To use this arch.make file you should rename it to
# arch.make
# or make a sym-link.
# For an explanation of the flags see DOCUMENTED-TEMPLATE.make

.SUFFIXES:
.SUFFIXES: .f .F .o .c .a .f90 .F90

SIESTA_ARCH = unknown

CC = gcc
FPP = $(FC) -E -P -x c
FC = gfortran
FC_SERIAL = gfortran

FFLAGS = -O2 -fPIC -ftree-vectorize

AR = ar
RANLIB = ranlib

SYS = nag

SP_KIND = 4
DP_KIND = 8
KINDS = $(SP_KIND) $(DP_KIND)

LDFLAGS =

FPPFLAGS = $(DEFS_PREFIX)-DFC_HAVE_ABORT

# For GNU compiler
FFLAGS += -fopenmp
LIBS += -fopenmp

# OpenBLAS:
LIBS += -L/opt/openblas/lib -lopenblasp

# Dependency rules ---------

FFLAGS_DEBUG = -g -O1 # your appropriate flags here...

# The atom.f code is very vulnerable. Particularly the Intel compiler
# will make an erroneous compilation of atom.f with high optimization
# levels.
atom.o: atom.F
 $(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<

.c.o:
 $(CC) -c $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $<
.F.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<
.F90.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $<
.f.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f) $<
.f90.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90) $<

Please, this new file of arch.make that I will use in the compilation? Is correct ?
Please reply me.

Maria (maria11) said : #3

Please answer me Professor Nick

Nick Papior (nickpapior) said : #4

Does it work? If not please share debug messages.

Maria (maria11) said : #5

Dear Prof. Nick,

1/ When I utilized this arch.make I obtained this debug message :
l.a libxmlparser.a \
                            libSiestaXC.a -fopenmp -L/opt/openblas/lib -lopenblasp/lib -lopenblasp
ld: warning: directory not found for option '-L/opt/openblas/lib '
ld: library not found for -lopenblasp
collect2: error: ld returned 1 exit status
make: *** [siesta] Error 1

How I can I resolve this problem??

2/ I compile siesta as parallel version using libsiestaBLAS/LAPACK.a . Here is the arch.make :

 #
# Copyright (C) 1996-2016 The SIESTA group
# This file is distributed under the terms of the
# GNU General Public License: see COPYING in the top directory
# or http://www.gnu.org/copyleft/gpl.txt.
# See Docs/Contributors.txt for a list of contributors.
#
#-------------------------------------------------------------------
# arch.make file for gfortran compiler.
# To use this arch.make file you should rename it to
# arch.make
# or make a sym-link.
# For an explanation of the flags see DOCUMENTED-TEMPLATE.make

.SUFFIXES:
.SUFFIXES: .f .F .o .c .a .f90 .F90

SIESTA_ARCH = unknown

CC = gcc
FPP = $(FC) -E -P -x c
FC = gfortran
FC_SERIAL = gfortran

FFLAGS = -O2 -fPIC -ftree-vectorize

AR = ar
RANLIB = ranlib

SYS = nag

SP_KIND = 4
DP_KIND = 8
KINDS = $(SP_KIND) $(DP_KIND)

LDFLAGS =

COMP_LIBS = libsiestaLAPACK.a libsiestaBLAS.a

FPPFLAGS = $(DEFS_PREFIX)-DFC_HAVE_ABORT

# For GNU compiler
FFLAGS += -fopenmp
LIBS += -fopenmp

# Dependency rules ---------

FFLAGS_DEBUG = -g -O1 # your appropriate flags here...

# The atom.f code is very vulnerable. Particularly the Intel compiler
# will make an erroneous compilation of atom.f with high optimization
# levels.
atom.o: atom.F
 $(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<

.c.o:
 $(CC) -c $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $<
.F.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<
.F90.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $<
.f.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f) $<
.f90.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90) $<

but when I run calculation using 20 threads , its appear :

* Running in serial mode
* Running 20 OpenMP threads.
* Running 20 processes.
*OpenMP version 201511
* OpenMP NOT bound (please bind threads!)
* OpenMP runtime schedule DYNAMIC, chunks 1
** OpenMP runtime schedule DYNAMIC, chunks 16

is my compilation is correct and the code run as parallel ?

3/ if I use the library of siesta in the compilation not an optimized library, with performance will be afected (speed of calculation, precision of results,....), please explain me this point ?

Please answer in my questions and thank you in advance.

Nick Papior (nickpapior) said : #6

1) The linker line states:
"ld: warning: directory not found for option '-L/opt/openblas/lib '"

I.e. you haven't installed openblas in that location

2) It is correct and runs in parralel.

3) The performance is heavily affected, the library of siesta are the NetLib variants which is not optimized at all. You are heavily encouraged to try and get openblas to link correctly.

Maria (maria11) said : #7

Dear Prof. Nick,

Thank you again for your reply. As I know openblas is an optimized library of BLAS library. So just it would be sufficient to install an optimized library openblas without installing LAPACK library ??

 Please if you have a useful link from that I can install openblas, please help?

Thank you in advance.

Nick Papior (nickpapior) said : #8

It is true that the largest performance hit lies in BLAS, so LAPACK is not necessarily so important to have optimized (but still adviced).

You should ask the OpenBLAS community on how to install OpenBLAS:

https://github.com/xianyi/OpenBLAS

Please read the documentation for OpenBLAS.
NOTE: You can install LAPACK into the OpenBLAS library, 2nd note, if you have problems installing OpenBLAS you should ask the OpenBLAS development since it is outside the scope of Siesta.

Maria (maria11) said : #9

Dear Prof. Nick,

Thank you very much for your reply.

Can you help with this problem?

Provide an answer of your own, or ask Maria for more information if necessary.

To post a message you must log in.