blob: 126f215cf782f8a48e646a668bbaa15bfdffb183 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<html>
<!--
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-->
<body>
<pre>
Using HDF5 with OpenMP
----------------------
1. Introduction to OpenMP
-------------------------
- For shared-memory parallelism
- A combination of library and directives
- Available for C/C++ and Fortran
- SGI leading effort
- Information at http://www.openmp.org and
http://www.sgi.com/software/openmp
2. Programming(SGI MPISpro compiler and C language)
---------------------------------------------------
- Turn on compiler '-mp' option
- Include 'omp.h' library in program
- Use library functions, directives and environment variables
3. Sample Programs
------------------
Appendix A contains four OpenMP-HDF5 test programs. (They are derived from
the hdf5/examples/h5_write.c). The purpose of these program is to
test OpenMP parallelism with the HDF5 library.
All tests were run on modi4 with SGI MPISpro compiler(cc) and make.
Program 1 and Program 2 are the working programs. Program 3 and Program 4
work occasionally due to racing conditions.
Follow the following steps to try the programs.
a. have your hdf5 library compiled,
b. go to hdf5/examples directory,
c. add -mp option to the end of the CFLAGS list in the Makefile. If you
have the compiled program in another directory, you should go to the
examples in that directory.
d. modify the hdf5/examples/h5_write.c according to the program attached
here.
e. use hdf5/tools/h5dump to examine the output file.
4. Conclusion
-------------
It is not safe to invoke HDF5 library calls via multiple threads in an
OpenMP program. But if one serializes HDF5 calls as illustrated in Program 1,
the HDF5 library works correctly with the OpenMP programs.
The serialization of HDF5 calls will slow down the OpenMP program unnecessarily.
Future study is needed to check possible ways to "un-seralize" the HDF5 calls.
One possibility is that the HDF5 library has a beta-version of Thread-safe
implmentation though it is for Pthreads environment. One can check on the
feasibility of running OpenMP programs with this version of HDF5 Thread-safe
library.
<A HREF="openmp-hdf5.c">Appendix A: OpenMP-HDF5 Programs</A>
-------
Updated: 2000/11/28
Contact: hdfhelp@ncsa.uiuc.edu
</pre>
</body>
</html>
|