Problem with configure script and compiler drivers

Having trouble compiling the Yambo source? Using an unusual architecture? Problems with the "configure" script? Problems in GPU architectures? This is the place to look.

Moderators: Davide Sangalli, andrea.ferretti, myrta gruning, andrea marini, Daniele Varsano, Conor Hogan, Nicola Spallanzani

Forum rules
If you have trouble compiling Yambo, please make sure to list:
(1) the compiler (vendor and release: e.g. intel 10.1)
(2) the architecture (e.g. 64-bit IBM SP5)
(3) if the problems occur compiling in serial/in parallel
(4) the version of Yambo (revision number/major release version)
(5) the relevant compiler error message
leoteo
Posts: 30
Joined: Tue Apr 09, 2013 5:40 pm

Problem with configure script and compiler drivers

Post by leoteo » Wed Mar 19, 2014 11:04 am

Dear Forum,

the configure script of Yambo tries to be clever and guess appropriate compiler flags from the name of the compiler executables.
However, CSCS HPC machines (http://user.cscs.ch/) use compiler driver scripts, which point to different compilers depending on the module currently loaded.
For example, the Fortran compiler is always invoked by 'ftn' . 'module load PrgEnv-gnu' will make it point to gfortran.

Of course, this means that the guess by the configure script will fail in some cases. In my case, Yambo thinks it recognizes 'ftn' and sets some FCFLAGS that the actual compiler does not understand. The problem is that the configure error message does not tell me this:

Code: Select all

configure: error: Found precompiler problems in processing the F90/C source.
This is confusing, since the actual error does not occur during the invocation of the precompiler, but occurs from an invocation of the Fortran compiler on the preprocessed code on line 7319 of the configure script (yambo 3.4.1 r.3187).

Code: Select all

eval $FC $FCFLAGS -c conftest.${F90SUFFIX} 2> conftest.er2
I think, there should be a separate configure error message for checking conftest.er2.

As for the larger picture, it would be nice to have some general instructions on how to proceed with the configure, when your system is using compiler drivers. The modules framework is becoming quite common on HPC machines.

Best,
leoteo

EDIT: Before writing this post, I was tempted to file a bug report on http://qe-forge.org/gf/project/yambo/tracker, but I see only two quite old bug reports there. Should this tracker be used or not?
Leopold Talirz
Swiss Federal Laboratories for Materials Science and Technology, Dübendorf, Switzerland
http://www.surfaces.ch

leoteo
Posts: 30
Joined: Tue Apr 09, 2013 5:40 pm

Re: Problem with configure script and compiler drivers

Post by leoteo » Thu Mar 20, 2014 10:59 am

There is of course one straightforward solution that allows to keep the options/libraries set by the compiler driver scripts.

Simply create script files with the original name of the compiler executables that call the wrappers.
E.g. when using the intel compiler, one can create a script file

ifort

Code: Select all

#!/bin/bash
ftn $@
and, analogously,

icc

Code: Select all

#!/bin/bash
cc $@
Then one can tell yambo the path to these scripts

Code: Select all

export FC=/path/to/ifort
export CC=/path/to/icc
Some machine-specific optimizations defined in the compiler drivers may conflict with the ones guessed by Yambo. For these cases I edited the configure by hand.
Leopold Talirz
Swiss Federal Laboratories for Materials Science and Technology, Dübendorf, Switzerland
http://www.surfaces.ch

User avatar
Daniele Varsano
Posts: 4198
Joined: Tue Mar 17, 2009 2:23 pm
Contact:

Re: Problem with configure script and compiler drivers

Post by Daniele Varsano » Thu Mar 20, 2014 11:05 am

Dear Leopold,
thanks a lot for your comments and workaround.
We will have a look at that very soon.

Best,
Daniele
Dr. Daniele Varsano
S3-CNR Institute of Nanoscience and MaX Center, Italy
MaX - Materials design at the Exascale
http://www.nano.cnr.it
http://www.max-centre.eu/

User avatar
andrea marini
Posts: 325
Joined: Mon Mar 16, 2009 4:27 pm
Contact:

Re: Problem with configure script and compiler drivers

Post by andrea marini » Fri Mar 21, 2014 9:56 am

Dear Leopold,

I will contact you personally in order to organize a skype conf. Everything can be coded and solved but I need more input from you.

Andrea
Andrea MARINI
Istituto di Struttura della Materia, CNR, (Italy)

User avatar
andrea marini
Posts: 325
Joined: Mon Mar 16, 2009 4:27 pm
Contact:

Re: Problem with configure script and compiler drivers

Post by andrea marini » Fri Mar 21, 2014 10:34 am

Can I suggest you to try to use the configure options like

CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
FC Fortran compiler command
FCFLAGS Fortran compiler flags
UFLAGS Unoptimized Fortran flags
F77 Fortran 77 compiler command
FFLAGS Fortran 77 compiler flags
PFC Parallel Fortran compiler command
MPICC Parallel C compiler command

Also switch on the compilation messages with

--enable-msgs-comps

So, you could use something like,

./configure FC=<fotraran> FCFLAGS=<fortran flags> --enable-msgs-comps

and in this way you should be able to fully configure the code.

Can you report if it works and/or what are the problems in this case ?

Andrea
Andrea MARINI
Istituto di Struttura della Materia, CNR, (Italy)

User avatar
myrta gruning
Posts: 242
Joined: Tue Mar 17, 2009 11:38 am
Contact:

Re: Problem with configure script and compiler drivers

Post by myrta gruning » Fri Mar 21, 2014 10:42 am

Dear Leopold

just a question. Setting
PFC=ftn
does not work?

What I normally do is fhaving a script that make sure that I am loading all correct modules and another one setting path, libraries etc and calling the configure.
For example, those are working for me on a cray
==

Code: Select all

module swap PrgEnv-pgi PrgEnv-gnu
module swap PrgEnv-cray PrgEnv-gnu
module load fftw
module load netcdf
module load cray-mpich2
==

Code: Select all

LIBSCI="-L$CRAY_LIBSCI_PREFIX_DIR/lib -lsci_gnu -lsci_gnu_mp -lgomp"
LNETCDF="-L$NETCDF_DIR/lib -lnetcdff -lnetcdf -lz -lpthread -L$HDF5_DIR/lib -lhdf5 -lhdf5_hl"
export PFC=ftn
export MPICC=cc
./configure --with-fftw=$FFTW_DIR --with-netcdf-include=$NETCDF_DIR/include --with-netcdf-lib=$NETCDF_DIR/lib --with-netcdf-link="$LNETCDF" --with-blas="$LIBSCI" --with-lapack="$LIBSCI"
==

in general writing the configure is very difficult, and I usually rely on existing piece of configure.

Best
m
Dr Myrta Grüning
School of Mathematics and Physics
Queen's University Belfast - Northern Ireland

http://www.researcherid.com/rid/B-1515-2009

User avatar
andrea marini
Posts: 325
Joined: Mon Mar 16, 2009 4:27 pm
Contact:

Re: Problem with configure script and compiler drivers

Post by andrea marini » Fri Mar 21, 2014 10:55 am

hmmmm... Maybe I understand what you mean.

At the time you launch configure ftn does not work. It must be loaded at a later time...

If this is not possible maybe we can add a a --skip-internal-checks option to not check if the FLAGS and the FC is compatible at the moment you launch the configure..

Andrea
Andrea MARINI
Istituto di Struttura della Materia, CNR, (Italy)

leoteo
Posts: 30
Joined: Tue Apr 09, 2013 5:40 pm

Re: Problem with configure script and compiler drivers

Post by leoteo » Fri Mar 21, 2014 11:02 am

Dear Myrta,

thank you very much for your suggestions! I also use a shell script to load the modules and set the environment variables.
The problem is when setting

Code: Select all

export FCFLAGS=
export FC=ftn
yambo overwrites the FCFLAGS

Code: Select all

...
checking for specific ftn flags... -O2 -fast -Munroll -Mnoframe -Mdalign
-Mbackslash
...
In my case, ftn points to ifort and these options are unknown to the ifort compiler. They cause the
confusing configure error message I described in the first forum post:

Code: Select all

configure: error: Found precompiler problems in processing the F90/C
source.
Since conftest.err2 now contains

Code: Select all

ifort: command line warning #10006: ignoring unknown option '-Munroll'
ifort: command line warning #10006: ignoring unknown option '-Mnoframe'
ifort: command line warning #10006: ignoring unknown option '-Mdalign'
ifort: command line warning #10006: ignoring unknown option '-Mbackslash'
Best,
Leopold

PS: In the line of the discussion, this post should be moved up one entry (I wrote this to Andrea per email previously)
Leopold Talirz
Swiss Federal Laboratories for Materials Science and Technology, Dübendorf, Switzerland
http://www.surfaces.ch

User avatar
andrea marini
Posts: 325
Joined: Mon Mar 16, 2009 4:27 pm
Contact:

Re: Problem with configure script and compiler drivers

Post by andrea marini » Fri Mar 21, 2014 11:06 am

Short solution is, then, to specifiy the Ifort flags in FCFLAGS...
Andrea MARINI
Istituto di Struttura della Materia, CNR, (Italy)

User avatar
myrta gruning
Posts: 242
Joined: Tue Mar 17, 2009 11:38 am
Contact:

Re: Problem with configure script and compiler drivers

Post by myrta gruning » Fri Mar 21, 2014 11:22 am

I agree with Andrea, and usually in the user guide for those HPC some suggestions for FCFLAGS are given.

I also would suggest to try PFC=ftn rather than FC, I fought quite a bit with my script, and it was sometime ago, but I remember that was important (maybe not, too much time. Once I found the solution I just kept the script with all correct setting and remove from memory the painful process to get it :roll: )

Best
m
Dr Myrta Grüning
School of Mathematics and Physics
Queen's University Belfast - Northern Ireland

http://www.researcherid.com/rid/B-1515-2009

Post Reply