Page 1 of 2
Problem with configure script and compiler drivers
Posted: Wed Mar 19, 2014 11:04 am
by leoteo
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?
Re: Problem with configure script and compiler drivers
Posted: Thu Mar 20, 2014 10:59 am
by leoteo
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
and, analogously,
icc
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.
Re: Problem with configure script and compiler drivers
Posted: Thu Mar 20, 2014 11:05 am
by Daniele Varsano
Dear Leopold,
thanks a lot for your comments and workaround.
We will have a look at that very soon.
Best,
Daniele
Re: Problem with configure script and compiler drivers
Posted: Fri Mar 21, 2014 9:56 am
by andrea marini
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
Re: Problem with configure script and compiler drivers
Posted: Fri Mar 21, 2014 10:34 am
by andrea marini
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
Re: Problem with configure script and compiler drivers
Posted: Fri Mar 21, 2014 10:42 am
by myrta gruning
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
Re: Problem with configure script and compiler drivers
Posted: Fri Mar 21, 2014 10:55 am
by andrea marini
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
Re: Problem with configure script and compiler drivers
Posted: Fri Mar 21, 2014 11:02 am
by leoteo
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
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)
Re: Problem with configure script and compiler drivers
Posted: Fri Mar 21, 2014 11:06 am
by andrea marini
Short solution is, then, to specifiy the Ifort flags in FCFLAGS...
Re: Problem with configure script and compiler drivers
Posted: Fri Mar 21, 2014 11:22 am
by myrta gruning
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

)
Best
m