NetCDF on Mac OS  [SOLVED]

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
gabriel.antonius
Posts: 58
Joined: Mon May 03, 2010 10:34 pm

NetCDF on Mac OS

Post by gabriel.antonius » Tue Apr 30, 2013 9:59 pm

Dear all,
Compiling abinit with netcdf on Mac OS has always been troublesome for me.
With abinit-7.2.2, whether I try to use the fallback or the one from macport, I get the following error:

Code: Select all

   Error: Function 'ncfile_create' at (1) has no IMPLICIT type


So it seems the header file is unuseable, despite its acceptance from the 'configure' script.

My configuration file is:

Code: Select all

   enable_mpi="yes"
   with_mpi_prefix="/opt/local/lib/openmpi"
   enable_mpi_io="no"

   with_fft_flavor="none"
   with_linalg_flavor="none"
   with_trio_flavor="netcdf"

   with_dft_flavor="libxc"
   enable_gw_dpc="yes"
   enable_64bit_flags="yes"


To use the netcdf from macport, I add the line

Code: Select all

   with_netcdf_incs="-I/opt/local/include"
   with_netcdf_libs="-L/opt/local/lib -lnetcdf -lnetcdff -lnetcdf_c++"


and I use the ports:

Code: Select all

   netcdf @4.2.1.1_1+dap+netcdf4
   netcdf-fortran @4.2_5+gcc45
   netcdf-cxx @4.2_1


My compilers are:

Code: Select all

   port:
      openmpi @1.6.3_0+gcc45

   openmpif90:
      GNU Fortran (MacPorts gcc45 4.5.4_6) 4.5.4

   openmpicc and openmpicxx:
      Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
      Target: x86_64-apple-darwin12.2.0
      Thread model: posix


My hardware is:

Code: Select all

    Model: MacBookPro6,2
   Processor: Intel Core i7


Does anyone have recipe to compile with netcdf on mac?
Last edited by gabriel.antonius on Wed May 01, 2013 4:28 pm, edited 1 time in total.
Gabriel Antonius
Université du Québec à Trois-Rivières

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

Re: NetCDF on Mac OS  [SOLVED]

Post by gmatteo » Wed May 01, 2013 1:37 am

Hi Gabriel,

I think the problem is due to the fact that you are not enabling ETSF-IO
try with this patch:

=== modified file 'src/95_drive/outscfcv.F90'
--- src/95_drive/outscfcv.F90 2013-04-13 10:47:41 +0000
+++ src/95_drive/outscfcv.F90 2013-04-30 23:30:22 +0000
@@ -1021,7 +1021,7 @@
! TODO should be addeded to dtfil_init1
fname = strcat(dtfil%filnam_ds(4),"_GSR")
! fname = "hello_crystal"
-#ifdef HAVE_TRIO_NETCDF
+#ifdef HAVE_TRIO_ETSF_IO
NCF_CHECK(ncfile_create(ncf,fname,NF90_CLOBBER),"Opening file")
call crystal_ncwrite(Crystal,ncf%ncid)
call bands_ncwrite(Bands,ncf%ncid)


Note, however, that many of the routines that write netcdf files rely on the
ETSF-IO library. Hence one should always enable both ETSF-IO and NETCDF.


Hope it helps,
Matteo

gabriel.antonius
Posts: 58
Joined: Mon May 03, 2010 10:34 pm

Re: NetCDF on Mac OS

Post by gabriel.antonius » Wed May 01, 2013 4:27 pm

Yep! Adding the line

Code: Select all

with_trio_flavor="netcdf+etsf_io"

did the trick.
Indeed, that was the default and I should have relied on that.
Many thanks!
Gabriel Antonius
Université du Québec à Trois-Rivières

Locked