Difference between revisions of "Hdf5"
m |
|||
Line 1: | Line 1: | ||
− | + | To compile a serial program that uses HDF5, use ''module'' to set your paths correctly, then link the libraries at compile time. | |
− | To compile a serial program that uses HDF5, use module to set your paths correctly, then link the libraries at compile time. | ||
+ | In this example, the C-source code ''test.c'' uses both the base HDF5 libraries and the newer high-level routines (i.e. it has ''#include "hdf5.h"'' and ''#include "hdf5_hl.h"''), so needs ''libhdf5'' and ''libhdf5_hl'': | ||
+ | |||
+ | '''C-version''' | ||
module purge | module purge | ||
− | module load intel hdf5/ | + | module load intel hdf5/187-v18-serial-intel |
icc -o test test.c -lhdf5_hl -lhdf5 -limf | icc -o test test.c -lhdf5_hl -lhdf5 -limf | ||
Line 9: | Line 11: | ||
icc -o test test.c -L${SCINET_HDF5_LIB} -lhdf5_hl -lhdf5 -limf | icc -o test test.c -L${SCINET_HDF5_LIB} -lhdf5_hl -lhdf5 -limf | ||
− | + | ||
+ | The equivalent '''Fortran-version''', would be: | ||
+ | |||
+ | module purge | ||
+ | module load intel hdf5/187-v18-serial-intel | ||
+ | |||
+ | ifort -o test test.c -lhdf5_fortran -lhdf5 -lsz -lz | ||
+ | #or, if you prefer to be explicit, | ||
+ | ifort -o test test.c -L${SCINET_HDF5_LIB} -lhdf5_fortran -lhdf5 -L{$SCINET_SZIP_LIB} -lsz -lz | ||
+ | |||
+ | |||
+ | Remember when you run the program that you must have loaded the corresponding module, e.g. hdf5/187-v18-serial-intel in the case of the example. | ||
+ | |||
+ | In addition to the serial version, there are modules for parallel implemetations (e.g. with open/mpi) and Intel and GNU compilers. | ||
+ | <br> | ||
+ | You can use ''module avail hdf5'', to check which modules are available and fit better your needs. | ||
+ | |||
+ | |||
+ | |||
+ | == Further material about HDF5 == | ||
+ | |||
+ | |||
+ | '''HDF5-Tables''': http://wiki.scinethpc.ca/wiki/index.php/Hdf5_table | ||
+ | |||
+ | Slides and examples from a '''parallel I/O''' course that may be useful: | ||
+ | |||
+ | https://support.scinet.utoronto.ca/wiki/index.php/Knowledge_Base:_Tutorials_and_Manuals#I.2FO | ||
+ | |||
+ | https://support.scinet.utoronto.ca/wiki/images/a/af/Netcdfhdf5.pdf |
Latest revision as of 16:22, 7 January 2015
To compile a serial program that uses HDF5, use module to set your paths correctly, then link the libraries at compile time.
In this example, the C-source code test.c uses both the base HDF5 libraries and the newer high-level routines (i.e. it has #include "hdf5.h" and #include "hdf5_hl.h"), so needs libhdf5 and libhdf5_hl:
C-version
module purge module load intel hdf5/187-v18-serial-intel
icc -o test test.c -lhdf5_hl -lhdf5 -limf #or, if you prefer to be explicit, icc -o test test.c -L${SCINET_HDF5_LIB} -lhdf5_hl -lhdf5 -limf
The equivalent Fortran-version, would be:
module purge module load intel hdf5/187-v18-serial-intel
ifort -o test test.c -lhdf5_fortran -lhdf5 -lsz -lz #or, if you prefer to be explicit, ifort -o test test.c -L${SCINET_HDF5_LIB} -lhdf5_fortran -lhdf5 -L{$SCINET_SZIP_LIB} -lsz -lz
Remember when you run the program that you must have loaded the corresponding module, e.g. hdf5/187-v18-serial-intel in the case of the example.
In addition to the serial version, there are modules for parallel implemetations (e.g. with open/mpi) and Intel and GNU compilers.
You can use module avail hdf5, to check which modules are available and fit better your needs.
Further material about HDF5
HDF5-Tables: http://wiki.scinethpc.ca/wiki/index.php/Hdf5_table
Slides and examples from a parallel I/O course that may be useful:
https://support.scinet.utoronto.ca/wiki/index.php/Knowledge_Base:_Tutorials_and_Manuals#I.2FO
https://support.scinet.utoronto.ca/wiki/images/a/af/Netcdfhdf5.pdf