[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Support #PQG-365496]: netcdf and CCSM



> Netcdf Support,
> 
> I'm new to NCAR and I've noticed that the systems people here use the same
> compiler to compile netcdf as CCSM on any given system.  I'm wondering if
> this is a necessity.  I'm wondering if there is a technical reason that
> requires you to do this, ie. a reason why compiling for instance netcdf
> with intel compilers and CCSM with gfortran would cause netcdf and CCSM to
> be incompatible.
> 
> 
> thanks,
> 
> Diane Feddema,
> 
> CGD/NCAR
> 
> 

Howdy Diane!

Welcome to NCAR! The CCSM is a very exciting and important project.

To answer your question: yes, there is a reason to use the same fortran 
compiler for netCDF as you use for your fortran app. 

The netCDF library is written in C, not fortran. The netCDF fortran API 
actually calls the netCDF C library, not a fortran library. Since (until 
Fortran 2003) there is no standard way to call C from fortran, the netCDF 
configure script looks at your fortran compiler when netCDF is built, and does 
whatever special things are required to make that fortran compiler work with 
the C library.

If you then try to use a different fortran compiler on your application, the 
Fortran -> C layer will be wrong. When you try and link, the linker will report 
that a bunch of netCDF functions are missing, because it can't find them in the 
netCDF library.

This is all a bit of a pain, but we can look to the future with some hope, 
because fortran 2003 defines a standard way to call C from Fortran, and many 
compilers are already compliant with this. So, with plenty of work on our end, 
we can make this happen someday. Then it will not matter which fortran compiler 
you use.

I would also suggest you test the performance of the intel C compiler: icc. It 
might have different performance characteristics than gcc. In this case you 
would want to rebuild the netCDF library and application with each compiler set 
(gcc/gfortran vs. icc/ifort) and see which is faster.

Good luck and let us know if you have any more questions.

Ed

Ticket Details
===================
Ticket ID: PQG-365496
Department: Support netCDF
Priority: Normal
Status: Closed