Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
953 views
in Technique[技术] by (71.8m points)

visual studio 2010 - Use HDF5 from intel fortran on windows

I would like to create a HDF5 dataset from a fortran90 program compiled with intel fortran 2011 on Windows 7 using Visual Studio 2010

Can I use prebuilt binaries or how do I build new ones

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I build from source, the available built binaries use the MS C/C++ compiler while I want to build with the Intel compiler, and they are built with Intel Fortran v12.x while I'm using v14.x. I won't say that you can't use the binaries, but I've had enough of a struggle in the past to persuade me to build my own.

I've also had struggles with trying to build them directly from VS and now use CMake. Your first step ought to be to install CMake and figure out how to use it. You don't need much knowledge of the tool and the effort will be repaid several times over. You can, for example, also use CMake to build Szip and Zlib, if you want them. An increasing amount of this sort of software is made available with CMake support so you won't necessarily only use it for HDF5. For example, I use CMake to build VTK for Windows too.

Once you've done that and generated the solution/project files with CMake you can load up the solution in VS and build ALL_BUILD. This generally works smoothly, though I have found that some projects need to have their linkages adjusted and sometimes I get spurious flags in the command-lines sent to the compilers. Then, running VS in administrator mode, you can build the pseudo-target INSTALL.

I see that HDF5 1.8.12 is now available, I'll download and build it, let you know how I get on.

Compiling and Linking

If you just want to use HDF5 include the line

  USE, NON_INTRINSIC :: hdf5

at the appropriate place in your source file(s). Then, under Project Properties | Fortran | General | Additional Include Directories insert the path to the location of hdf5.mod. That should get you compiling.

To link, under Project | Properties | Linker | General | Additional Library Directories insert the path the location of the .lib files. Then, under Project | Properties | Linker | Input | Additional Dependencies insert hdf5_fortran.lib.

You should then be able to compile and link your program. If you want to use additional facilities, such as the HDF5 Table Interface, then use h5tb and figure out the linkages.

And consult the documentation. See, for example, ../HDF5-1.8.12/release_docs/USING_HDF5_VS.txt


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...