Example of using parallel HDF5 libraries on the cluster. The specific example creates a random 2D array of dimension 20 X 30 and writes it to a HDF5 (.h5) file in parallel.
parallel_hdf5_2d.f90
: Fortran 90 source fileMakefile
: Makefile to compile the source coderun.sbatch
: Batch-job submission script to send the job to the queue
Commands to load necessary modules (module load
), compile the code (make
), and submit the job (sbatch
):
module load intel/21.2.0-fasrc01 openmpi/4.1.1-fasrc01 hdf5/1.12.1-fasrc01
make
sbatch run.sbatch
User_Codes/Parallel_Computing/Parallel_HDF5/Example2/run.sbatch
Lines 1 to 15 in 2789e21
HDF5 output:
[jharvard@holylogin04 Example2]$ h5dump pset_2d.h5
HDF5 "pset_2d.h5" {
GROUP "/" {
DATASET "DoubleArray" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 30, 20 ) / ( 30, 20 ) }
DATA {
(0,0): 0.19997, 0.141935, 0.9609, 0.557535, 0.638827, 0.462287,
(0,6): 0.498032, 0.867238, 0.762328, 0.23642, 0.0605957, 0.150953,
(0,12): 0.948071, 0.844535, 0.181702, 0.280175, 0.229308, 0.552097,
(0,18): 0.73992, 0.331059,
(1,0): 0.388762, 0.41635, 0.325443, 0.412334, 0.631472, 0.890654,
(1,6): 0.765588, 0.144551, 0.148686, 0.0065211, 0.367894, 0.152968,
(1,12): 0.220681, 0.629017, 0.459204, 0.697648, 0.389048, 0.919453,
(1,18): 0.199217, 0.58728,
(2,0): 0.363542, 0.754135, 0.194908, 0.815831, 0.938569, 0.42343,
(2,6): 0.296155, 0.811725, 0.364881, 0.893735, 0.00850734, 0.887926,
(2,12): 0.194576, 0.588769, 0.0942312, 0.0470023, 0.921254, 0.331883,
(2,18): 0.0983307, 0.941179,
(3,0): 0.0732383, 0.578579, 0.668021, 0.175048, 0.872878, 0.306461,
(3,6): 0.956044, 0.13224, 0.905966, 0.758271, 0.98402, 0.417583,
(3,12): 0.187216, 0.846184, 0.322552, 0.500836, 0.221774, 0.736674,
(3,18): 0.318103, 0.584469,
(4,0): 0.9694, 0.433704, 0.0462207, 0.207506, 0.933283, 0.789315,
(4,6): 0.484947, 0.045633, 0.756139, 0.152743, 0.741604, 0.256809,
(4,12): 0.0134879, 0.440945, 0.603259, 0.94596, 0.566918, 0.348724,
(4,18): 0.493279, 0.437733,
(5,0): 0.201657, 0.559481, 0.493622, 0.780411, 0.924335, 0.574803,
(5,6): 0.841705, 0.98707, 0.655486, 0.304916, 0.562055, 0.875621,
(5,12): 0.575744, 0.945588, 0.199575, 0.81643, 0.565091, 0.227075,
(5,18): 0.571788, 0.926918,
(6,0): 0.739542, 0.60732, 0.63896, 0.468232, 0.556615, 0.424539,
(6,6): 0.923961, 0.406805, 0.921849, 0.747749, 0.659131, 0.234704,
(6,12): 0.0811879, 0.0131869, 0.0224142, 0.0937791, 0.85796, 0.100633,
(6,18): 0.00793147, 0.116853,
(7,0): 0.224224, 0.257872, 0.473845, 0.82922, 0.413201, 0.134284,
(7,6): 0.617848, 0.545256, 0.884331, 0.17872, 0.0219987, 0.160113,
(7,12): 0.426875, 0.745531, 0.778603, 0.966953, 0.478293, 0.480435,
(7,18): 0.757997, 0.830556,
(8,0): 0.716843, 0.741072, 0.979138, 0.538633, 0.0806921, 0.304183,
(8,6): 0.401776, 0.746524, 0.532387, 0.0652913, 0.198581, 0.0198354,
(8,12): 0.342745, 0.393068, 0.90492, 0.579429, 0.180445, 0.893429,
(8,18): 0.689629, 0.589662,
(9,0): 0.946246, 0.443526, 0.648808, 0.0912926, 0.0309056, 0.918058,
(9,6): 0.255566, 0.542555, 0.932495, 0.718231, 0.692003, 0.111436,
(9,12): 0.568246, 0.94264, 0.918272, 0.204389, 0.915127, 0.0807761,
(9,18): 0.924301, 0.833772,
(10,0): 0.953839, 0.724419, 0.855626, 0.294668, 0.232474, 0.578473,
(10,6): 0.511305, 0.335583, 0.714625, 0.860544, 0.711387, 0.935738,
(10,12): 0.54794, 0.0397663, 0.138554, 0.605407, 0.172826, 0.0364979,
(10,18): 0.620361, 0.876303,
(11,0): 0.389057, 0.321, 0.822223, 0.698615, 0.111453, 0.474162,
(11,6): 0.164209, 0.0480765, 0.160595, 0.326446, 0.0681234, 0.844862,
(11,12): 0.178804, 0.829085, 0.878276, 0.0105085, 0.895585, 0.609042,
(11,18): 0.952739, 0.425498,
(12,0): 0.745232, 0.219068, 0.922195, 0.0561915, 0.329174, 0.371003,
(12,6): 0.289212, 0.869631, 0.831188, 0.44411, 0.0401795, 0.86705,
(12,12): 0.920181, 0.597854, 0.765649, 0.108976, 0.545615, 0.026541,
(12,18): 0.416392, 0.221965,
(13,0): 0.682888, 0.902264, 0.382844, 0.289127, 0.115312, 0.492319,
(13,6): 0.013543, 0.491749, 0.710592, 0.767551, 0.316195, 0.303195,
(13,12): 0.20531, 0.17625, 0.836124, 0.522006, 0.400819, 0.224369,
(13,18): 0.932966, 0.0024763,
(14,0): 0.928547, 0.137668, 0.631684, 0.938629, 0.643558, 0.16586,
(14,6): 0.462019, 0.889677, 0.713773, 0.385957, 0.996965, 0.403836,
(14,12): 0.89845, 0.185188, 0.109304, 0.442038, 0.0137578, 0.745944,
(14,18): 0.220068, 0.807168,
(15,0): 0.970184, 0.0648431, 0.936665, 0.828711, 0.515563, 0.902511,
(15,6): 0.235366, 0.981552, 0.954296, 0.599789, 0.646957, 0.655938,
(15,12): 0.312768, 0.0304353, 0.225, 0.279052, 0.00381425, 0.197655,
(15,18): 0.179823, 0.673274,
(16,0): 0.478561, 0.267599, 0.271681, 0.903424, 0.797367, 0.251352,
(16,6): 0.36653, 0.376599, 0.660687, 0.933613, 0.28664, 0.419267,
(16,12): 0.270074, 0.333177, 0.355519, 0.272609, 0.8249, 0.601249,
(16,18): 0.71363, 0.364507,
(17,0): 0.162045, 0.264363, 0.709854, 0.0404988, 0.907396, 0.729367,
(17,6): 0.132155, 0.995026, 0.387821, 0.857952, 0.0755082, 0.637159,
(17,12): 0.0852568, 0.286455, 0.520528, 0.550917, 0.794769, 0.603488,
(17,18): 0.473192, 0.242954,
(18,0): 0.0776111, 0.634118, 0.267922, 0.589789, 0.437744, 0.382594,
(18,6): 0.946084, 0.272269, 0.123039, 0.495633, 0.146897, 0.00878857,
(18,12): 0.809834, 0.321872, 0.597766, 0.841402, 0.182342, 0.985226,
(18,18): 0.382896, 0.24645,
(19,0): 0.456582, 0.763042, 0.903406, 0.417734, 0.856001, 0.652522,
(19,6): 0.151344, 0.680285, 0.895433, 0.972925, 0.326525, 0.552631,
(19,12): 0.47821, 0.217996, 0.21761, 0.153257, 0.454529, 0.387982,
(19,18): 0.442733, 0.0659948,
(20,0): 0.547025, 0.146929, 0.61213, 0.141371, 0.40137, 0.312466,
(20,6): 0.733753, 0.667523, 0.430454, 0.868006, 0.399573, 0.114485,
(20,12): 0.708054, 0.500267, 0.916429, 0.52498, 0.155908, 0.049926,
(20,18): 0.372179, 0.284487,
(21,0): 0.928065, 0.558102, 0.829536, 0.0570441, 0.948608, 0.999968,
(21,6): 0.396658, 0.668463, 0.920502, 0.2853, 0.107649, 0.514819,
(21,12): 0.554773, 0.514889, 0.846877, 0.342097, 0.0549875, 0.403139,
(21,18): 0.501305, 0.331021,
(22,0): 0.496615, 0.101418, 0.308106, 0.610946, 0.0448601, 0.768423,
(22,6): 0.723094, 0.421166, 0.269388, 0.217641, 0.756598, 0.786066,
(22,12): 0.46748, 0.157433, 0.958346, 0.0322059, 0.592156, 0.0972408,
(22,18): 0.294494, 0.0592722,
(23,0): 0.257479, 0.330613, 0.166219, 0.0994324, 0.371392, 0.298155,
(23,6): 0.806379, 0.0971079, 0.455407, 0.148006, 0.801886, 0.734742,
(23,12): 0.780538, 0.154538, 0.527889, 0.141999, 0.0906219, 0.672103,
(23,18): 0.0986985, 0.916402,
(24,0): 0.407812, 0.299418, 0.373969, 0.86123, 0.0278207, 0.777036,
(24,6): 0.3486, 0.45534, 0.143498, 0.548722, 0.535718, 0.95788,
(24,12): 0.947732, 0.353298, 0.529135, 0.761873, 0.32088, 0.153568,
(24,18): 0.0830575, 0.902861,
(25,0): 0.677801, 0.050991, 0.322467, 0.352986, 0.809829, 0.457181,
(25,6): 0.412096, 0.60625, 0.129612, 0.18131, 0.683606, 0.136816,
(25,12): 0.953743, 0.745772, 0.523554, 0.299599, 0.382882, 0.81292,
(25,18): 0.570297, 0.609519,
(26,0): 0.977274, 0.652812, 0.0140504, 0.552546, 0.470205, 0.750895,
(26,6): 0.412274, 0.427552, 0.344709, 0.0707082, 0.729903, 0.484372,
(26,12): 0.542491, 0.917389, 0.232797, 0.270997, 0.345675, 0.628197,
(26,18): 0.337676, 0.728221,
(27,0): 0.394154, 0.53568, 0.885043, 0.533979, 0.571448, 0.882907,
(27,6): 0.943829, 0.395185, 0.883093, 0.778241, 0.349599, 0.893328,
(27,12): 0.808859, 0.0123494, 0.172958, 0.193429, 0.5085, 0.405079,
(27,18): 0.120189, 0.538832,
(28,0): 0.111506, 0.783899, 0.268575, 0.401391, 0.787156, 0.147926,
(28,6): 0.251772, 0.419764, 0.174324, 0.640648, 0.35577, 0.987696,
(28,12): 0.929827, 0.792056, 0.25992, 0.0839463, 0.843952, 0.00170102,
(28,18): 0.379588, 0.276776,
(29,0): 0.242395, 0.00719544, 0.307363, 0.805876, 0.959202, 0.946004,
(29,6): 0.215797, 0.1411, 0.130233, 0.0848711, 0.0192242, 0.925911,
(29,12): 0.453873, 0.697028, 0.372451, 0.406458, 0.605853, 0.0929871,
(29,18): 0.27406, 0.487501
}
}
}
}
Output of parallel_hdf5_2d.out
Rank 0 out of 8 hostname holy7c24101.rc.fas.harvard.edu
Rank 4 out of 8 hostname holy7c24102.rc.fas.harvard.edu
Rank 1 out of 8 hostname holy7c24101.rc.fas.harvard.edu
Rank 2 out of 8 hostname holy7c24101.rc.fas.harvard.edu
Rank 3 out of 8 hostname holy7c24101.rc.fas.harvard.edu
Rank 5 out of 8 hostname holy7c24102.rc.fas.harvard.edu
Rank 6 out of 8 hostname holy7c24102.rc.fas.harvard.edu
Rank 7 out of 8 hostname holy7c24102.rc.fas.harvard.edu