Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

option, parallelism,...

Moderators: fgoudreault, mcote

Forum rules
Please have a look at ~abinit/doc/config/build-config.ac in the source package for detailed and up-to-date information about the configuration of Abinit 8 builds.
For a video explanation on how to build Abinit 7.x for Linux, please go to: http://www.youtube.com/watch?v=DppLQ-KQA68.
IMPORTANT: when an answer solves your problem, please check the little green V-like button on its upper-right corner to accept it.
Locked
jianglai
Posts: 5
Joined: Wed Jan 13, 2010 6:58 pm

Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

Post by jianglai » Tue Oct 12, 2010 1:36 am

Hi, I've had no problem compiling previous versions (6.2.3, etc) using GNU compilers on my Mac as long as i disable libxc and netcdf. But with 6.4.1 I've got the following error:
----------------------------------------------------
gfortran -m64 -DHAVE_CONFIG_H -I. -I../.. -I../../src/incs -I../../src/incs -ffree-form -J/Users/jianglai/Downloads/abinit-6.4.1/src/mods -O2 -m64 -g -ffree-line-length-none -c -o timab.o timab.F90
timab.F90:116.20:

integer(C_LONG_LONG) :: flops1
1
Error: Kind 0 not supported for type INTEGER at (1)
timab.F90:117.13:

real(C_FLOAT) :: real_time, proc_time
1
Error: Kind 0 not supported for type REAL at (1)
timab.F90:163.9:

flops1 = 0
1
Error: Symbol 'flops1' at (1) has no IMPLICIT type
timab.F90:164.12:

proc_time = zero
1
Error: Symbol 'proc_time' at (1) has no IMPLICIT type
timab.F90:165.12:

real_time = zero
1
Error: Symbol 'real_time' at (1) has no IMPLICIT type
make[3]: *** [timab.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
----------------------------------------------------

The configure I used is:

./configure --prefix=/usr/local/abinit/ --enable-64bit-flags --disable-libxc --disable-netcdf

and I'm also attaching the config.log file.

I tried to use ifort(11.0.89) but got an link error described here viewtopic.php?f=2&t=446. However the fix involving ranlib does not work since there is no src/01_qespresso_ext/lib01_qespresso_ext.a file.

If anyone can give a clue it'll be really appreciated!

Thanks all.
Attachments
config.log
(148.53 KiB) Downloaded 486 times

User avatar
gmatteo
Posts: 291
Joined: Sun Aug 16, 2009 5:40 pm

Re: Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

Post by gmatteo » Tue Oct 12, 2010 4:57 pm

The values of C_LONG_LONG, C_FLOAT are found in configure by calling
standard autoconf macros that will try to compile simple C code.
In your case the compilation fails due to a wrong option passed to gcc
This is one of the errors reported in your config.log

configure:22645: result: 0
configure:22659: checking size of unsigned int
configure:22664: gcc -m64 -o conftest -m64 -g -O3 -mtune=native -march=native -funroll-loops -ffast-math conftest.c >&5
conftest.c:1: error: bad value (native) for -march= switch
configure:22664: $? = 1
configure: program exited with status 1

The options passed to your C compiler are stored in the environment variable:

CFLAGS='-m64 -g -O3 -mtune=native -march=native -funroll-loops -ffast-math '

By default, configure uses default values for CFLAGS according to your architecture and to other options passed to the script.
In your case the default values for CFLAGS seem to be wrong since march is not among the list of options supported on Darwin.
See for example:
http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html

Try to overwrite the default c options by passing an appropriate CFLAGS to configure, e.g.

./configure --prefix=/usr/local/abinit/ --enable-64bit-flags --disable-libxc --disable-netcdf CFLAGS='-m64 -g -O3 -mtune=native -funroll-loops -ffast-math '

BTW: There are very few C functions used in abinit hence C optimization is not so important for the overall performance of the code.

Hope it helps,
Matteo

jianglai
Posts: 5
Joined: Wed Jan 13, 2010 6:58 pm

Re: Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

Post by jianglai » Tue Oct 12, 2010 9:22 pm

Thanks a lot for the reply. The CFLAGS solved this problem but another emerges:
---------------------------------------
gfortran -m64 -DHAVE_CONFIG_H -I. -I../.. -I../../src/incs -I../../src/incs -ffree-form -J/Users/jianglai/Downloads/abinit-6.4.1/src/mods -O2 -m64 -g -ffree-line-length-none -c -o interfaces_95_drive.o interfaces_95_drive.F90
interfaces_95_drive.F90:1607.37:

type(electronpositron_type),pointer,intent(inout) :: electronpositron
1
Error: POINTER attribute conflicts with INTENT attribute at (1)
interfaces_95_drive.F90:1630.34:

real(dp), intent(inout), pointer :: taug(:,:)
1
Error: POINTER attribute conflicts with INTENT attribute at (1)
interfaces_95_drive.F90:1631.34:

real(dp), intent(inout), pointer :: taur(:,:)
1
Error: POINTER attribute conflicts with INTENT attribute at (1)
interfaces_95_drive.F90:1585.33:

& dtset,eigen,electronpositron,hdr,initialized,&
1
Error: Symbol 'electronpositron' at (1) has no IMPLICIT type
interfaces_95_drive.F90:1589.45:

& rhog,rhor,rprimd,scf_history,symrec,taug,taur,wffnew,&
1
Error: Symbol 'taug' at (1) has no IMPLICIT type
interfaces_95_drive.F90:1589.50:

& rhog,rhor,rprimd,scf_history,symrec,taug,taur,wffnew,&
1
Error: Symbol 'taur' at (1) has no IMPLICIT type
make[3]: *** [interfaces_95_drive.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
----------------------------------------
Any idea how to fix that? An again thank you for your help!

gmatteo wrote:The values of C_LONG_LONG, C_FLOAT are found in configure by calling
standard autoconf macros that will try to compile simple C code.
In your case the compilation fails due to a wrong option passed to gcc
This is one of the errors reported in your config.log

configure:22645: result: 0
configure:22659: checking size of unsigned int
configure:22664: gcc -m64 -o conftest -m64 -g -O3 -mtune=native -march=native -funroll-loops -ffast-math conftest.c >&5
conftest.c:1: error: bad value (native) for -march= switch
configure:22664: $? = 1
configure: program exited with status 1

The options passed to your C compiler are stored in the environment variable:

CFLAGS='-m64 -g -O3 -mtune=native -march=native -funroll-loops -ffast-math '

By default, configure uses default values for CFLAGS according to your architecture and to other options passed to the script.
In your case the default values for CFLAGS seem to be wrong since march is not among the list of options supported on Darwin.
See for example:
http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html

Try to overwrite the default c options by passing an appropriate CFLAGS to configure, e.g.

./configure --prefix=/usr/local/abinit/ --enable-64bit-flags --disable-libxc --disable-netcdf CFLAGS='-m64 -g -O3 -mtune=native -funroll-loops -ffast-math '

BTW: There are very few C functions used in abinit hence C optimization is not so important for the overall performance of the code.

Hope it helps,
Matteo
Attachments
config.log
(94.99 KiB) Downloaded 389 times

User avatar
Alain_Jacques
Posts: 279
Joined: Sat Aug 15, 2009 9:34 pm
Location: Université catholique de Louvain - Belgium

Re: Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

Post by Alain_Jacques » Wed Oct 13, 2010 11:13 am

The -march failure with gcc makes me think that you're mixing different releases of gnu compilers - not a good idea. I would advise to check that the gfortran, gcc and cpp are in sync i.e.

Code: Select all

gfortran -v && gcc -v && cpp -v
report the same version. If not, you should modify PATH and DYLD_LIBRARY_PATH for Abinit configure to find the right toolchain.

Kind regards,

Alain

jianglai
Posts: 5
Joined: Wed Jan 13, 2010 6:58 pm

Re: Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

Post by jianglai » Wed Oct 13, 2010 5:24 pm

They are all GCC 4.2.1 (Apple build 5664), I'v got the gfortran from AT&T's website and the rest of GNU compiler from xcode 3.2.4.

Alain_Jacques wrote:The -march failure with gcc makes me think that you're mixing different releases of gnu compilers - not a good idea. I would advise to check that the gfortran, gcc and cpp are in sync i.e.

Code: Select all

gfortran -v && gcc -v && cpp -v
report the same version. If not, you should modify PATH and DYLD_LIBRARY_PATH for Abinit configure to find the right toolchain.

Kind regards,

Alain

User avatar
gmatteo
Posts: 291
Joined: Sun Aug 16, 2009 5:40 pm

Re: Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

Post by gmatteo » Wed Oct 13, 2010 5:49 pm

Remove intent(inout) in the declaration of the electronpositron pointer,
both in 95_drive/scfcv_new.F90 and 95_driver/interfaces_95_driver.
F90 doesn't allow to specify the intent of a pointer.

jianglai
Posts: 5
Joined: Wed Jan 13, 2010 6:58 pm

Re: Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

Post by jianglai » Wed Oct 13, 2010 7:47 pm

Removing intent(out) works. Also I have to remove intent(out) for taug and taur. Thanks a lot!

PS: I was able to compile 6.4.1 on linux with GNU compiler without modifying the source code. So is this "pointer/intent(out) incompatibility" really because of the F90 specification or it's gfortran's implementation on Mac that does not allow for intent of a pointer?

gmatteo wrote:Remove intent(inout) in the declaration of the electronpositron pointer,
both in 95_drive/scfcv_new.F90 and 95_driver/interfaces_95_driver.
F90 doesn't allow to specify the intent of a pointer.

User avatar
Alain_Jacques
Posts: 279
Joined: Sat Aug 15, 2009 9:34 pm
Location: Université catholique de Louvain - Belgium

Re: Compile 6.4.1 on Mac OS X 10.6.4 using gnu compiler

Post by Alain_Jacques » Wed Oct 13, 2010 10:43 pm

This AT&T hacked compiler (to produce universal binaries) is quite an old beast - I cannot test compliance anymore on a version 4.2.1. Building a new gcc/gfortran 4.4.5 toolchain is far from being a complicated job. Another easy way to update to recent compilers is to install them from Fink or Macport. Now if Matteo's suggestions let to pass through the error message and gives you clean tests suite results, it's fine too.

Alain

WoodDM
Posts: 10
Joined: Tue Mar 02, 2010 5:52 am

Building 6.4.1 openmpi 1.5, OS X 10.6.4, gfortran 64 bit

Post by WoodDM » Mon Oct 18, 2010 9:08 pm

Howdy all.

I have an 8-core Mac Pro, so needed MPI support.

Following Alain Jacques's suggestion, I was careful to use a uniform release of the gfortran-related compilers, which I'd installed (in my case) with macports

Building openmpi version 1.5 (under bash):

export F77=/opt/local/bin/x86_64-apple-darwin10-gfortran-mp-4.4
export CC=/opt/local/bin/x86_64-apple-darwin10-gcc-mp-4.4
export FC=/opt/local/bin/x86_64-apple-darwin10-gfortran-mp-4.4
./configure --prefix=/opt/openmpi-1.5 --enable-shared --enable-static CFLAGS="-O3" CXXFLAGS="-O3" FCFLAGS="-O3" FFLAGS="-O3"

(then make, make install)

Building AB 6.4.1 (without the environment variables F77 CC, FC as set above)

./configure --enable-mpi --with-mpi-prefix=/opt/openmpi-1.5 --enable-64bit-flags --disable-libxc --prefix=/opt/etsf/abinit/6.4

(then make, make install)

[I find that the libxc stuff has been a problem for me for the 3-4 releases of AB]

All 30 tests upon performing make tests_fast succeed.

Hope this helps!
DMW

Locked