Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Link netcdf library in Intel FORTRAN

Guilong_Li
Beginner
3,643 Views

I used Compaq Visual Fortran to read netcdf file and used the following command

f90 myprog.f -link c:\netcdf\lib\netcdf.lib

to read netcdf format file.

Now I changed to use Intel Fortran. Does anyone tell me which command I should use in order to run my Fortran program to read netcdf forma?

Thanks

0 Kudos
1 Solution
tropfen
New Contributor I
3,643 Views

 

Hello Guilong Li

you have two opportunities to use netcdf based on a Win7 - IVF - VS system:

1) if you have Win7 Professional, install the XPMode and install there your Compaq Fortran an all you need for netcdf

2)In Win7  you can use the netcdf version 3.6.x. Download the following file ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/netcdf-ifort-3.6.1.zip. (A short documentation can be found http://www.unidata.ucar.edu/software/netcdf/docs/other-builds.html#ifort-361-windows) What you have to do is to copy the files inside the zip according to the directory. lib and include inside the lib and include (only ia32) directories of your IVF installation. The files in the bin directory you have to copy in the system32 directory of your windows installation. In your fortran source you have to add a line

include 'netcdf.inc'

It works only in the win32 builds. No win64 build support currently.

If you have netcdf4 files you have to convert those files to netcdf3 using http://nco.sourceforge.net/ (http://nco.sourceforge.net/src/nco-4.3.9.win32.cygwin.tar.gz) Using the command

ncks -3 Inputfile Outputfile

I hope i could help.

Frank

 

View solution in original post

0 Kudos
8 Replies
DavidWhite
Valued Contributor II
3,643 Views

Looks like you will need to build the netcdf library from the source code.  There is nothing on their website for Intel versions beyond 10.0, but this page may help:

http://www.unidata.ucar.edu/software/netcdf/docs/other-builds.html#ifort_mac_64

*edit*

also found some precompiled links:

http://www.unidata.ucar.edu/software/netcdf/docs/winbin.html

Regards,

David

0 Kudos
Amanda_S_Intel
Employee
3,643 Views

Here is an article on how to build NetCDF with compiler versions 13.0 and later:

http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-netcdf-with-the-intel-compilers

Regards,

--Amanda

0 Kudos
tropfen
New Contributor I
3,643 Views

Hello,

have i missed something or are all the 'new' NetCDF build with Intel Fortran based on the LINUX version?

Is there a windows version some where (NetCDF 4.x and Intel Fortran 13.X and newer)?

If yes can someone provide a basic project?

Frank

0 Kudos
Guilong_Li
Beginner
3,643 Views

Thanks.

Maybe I am not clear in my question. My current environemt is Windows 7 64 bit. The reason I switch to Intel Fortran is because my Compaq Fortran is not compatible to Windows 7 64 bit.

My Intel Fortran comes with Microsoft Visual Statio 2005 (Bought this license several years ago). There are warning message when I install MVS 2005, but the compiler command (ifort) works under DOS environment.

My requirement is straight forward. I only want to find a compitable netcdf working under this environment in order I can read netcdf format.

One more question, if I install netcdf successfully, which command can I  use to compile my Fortran program? Under Compaq environment, I can use "f90 myprog.f -link c:\netcdf\lib\netcdf.lib", how about Intel Fortran?

0 Kudos
TimP
Honored Contributor III
3,643 Views

If you're serious about wanting to use the old library build, it should be possible with the ia32 compiler installation, usiing /iface:cvf, or with Compaq Fortran running under XPM, if your BIOS permits XPM.

It's a little surprising that the references don't much address the question of running normally with current Visual Studio compatible Fortran compilers.  You ought to be able to link against a reported build for ifort win64 11.1, using 11.1 or newer, or follow similar steps in building from source with a more recent ifort.  Did you try it, and what were the problems?

You haven't said whether you want to address building from source using ifort 64-bit and C (supposing you have Visual Studio), loosely according to NCAR instructions, or to use the NCAR supplied libraries with Fortran iso_c_binding, and whether you are willing to use a shell similar to those recommended in the NCAR instructions.  Nor have you said whether you are willing to use a version which has been documented in recent use.

0 Kudos
tropfen
New Contributor I
3,644 Views

 

Hello Guilong Li

you have two opportunities to use netcdf based on a Win7 - IVF - VS system:

1) if you have Win7 Professional, install the XPMode and install there your Compaq Fortran an all you need for netcdf

2)In Win7  you can use the netcdf version 3.6.x. Download the following file ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/netcdf-ifort-3.6.1.zip. (A short documentation can be found http://www.unidata.ucar.edu/software/netcdf/docs/other-builds.html#ifort-361-windows) What you have to do is to copy the files inside the zip according to the directory. lib and include inside the lib and include (only ia32) directories of your IVF installation. The files in the bin directory you have to copy in the system32 directory of your windows installation. In your fortran source you have to add a line

include 'netcdf.inc'

It works only in the win32 builds. No win64 build support currently.

If you have netcdf4 files you have to convert those files to netcdf3 using http://nco.sourceforge.net/ (http://nco.sourceforge.net/src/nco-4.3.9.win32.cygwin.tar.gz) Using the command

ncks -3 Inputfile Outputfile

I hope i could help.

Frank

 

0 Kudos
Guilong_Li
Beginner
3,643 Views

Hi Frank,

I followed your instruction and use following command to successfully run the Fortran program

ifort readnetcdf.f /link "C:\Program Files (x86)\Intel\Compiler\11.0\072\fortran\lib\ia32\netcdf_f90.lib"

I tried to use netcdf.lib, but it doesn't work.

Thanks a lot.

Guilong

 

0 Kudos
tropfen
New Contributor I
3,643 Views

Hello Guilong,

netcdf.lib is not a stand alone libary. As far us i understand it needs serveral others libary's.

Frank

0 Kudos
Reply