SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Downloaden Sie, um offline zu lesen
Parallel HDF5
Introductory Tutorial

HDF and HDF-EOS Workshop IX
November 30, 2005

HDF
Outline
• Overview of Parallel HDF5 design
• Setting up parallel environment
• Programming model for
– Creating and accessing a File
– Creating and accessing a Dataset
– Writing and reading Hyperslabs

• Parallel tutorial available at

– http://hdf.ncsa.uiuc.edu/HDF5/doc/Tu
tor

HDF-EOS Workshop IX

-2-

HDF
Overview of Parallel HDF5

HDF
PHDF5 Initial Target
• Support for MPI programming
• Not for shared memory
programming
– Threads
– OpenMP

• Has some experiments with

– Thread-safe support for Pthreads
– OpenMP if called “correctly”

HDF-EOS Workshop IX

-4-

HDF
PHDF5 Requirements
• PHDF5 files compatible with serial HDF5
files

– Shareable between different serial or parallel
platforms

• Single file image to all processes

– One file per process design is undesirable
• Expensive post processing
• Not useable by different number of processes

• Standard parallel I/O interface

– Must be portable to different platforms

HDF-EOS Workshop IX

-5-

HDF
Implementation Requirements
• No use of Threads

– Not commonly supported (1998)

• No reserved process

– May interfere with parallel algorithms

• No spawn process

– Not commonly supported even now

HDF-EOS Workshop IX

-6-

HDF
PHDF5 Implementation Layers

Parallel
Application

Parallel
Application

Parallel
Application

Parallel
Application

Parallel HDF5 + MPI

HDF library

MPI-IO

Local File
System

HDF-EOS Workshop IX

“NFS”

User Applications

Parallel I/O layer
GPFS/PVFS
Lustre/PFS…

-7-

Parallel File systems

HDF
Parallel Environment
Requirements
• MPI with MPI-IO

– MPICH ROMIO
– Vendor’s MPI-IO

• Parallel file system
–
–
–
–

GPFS
Lustre
PVFS
Specially configured NFS

HDF-EOS Workshop IX

-8-

HDF
How to Compile PHDF5 Applications
• h5pcc – HDF5 C compiler command
– Similar to mpicc

• h5pfc – HDF5 F90 compiler command
– Similar to mpif90

• To compile:
% h5pcc h5prog.c
% h5pfc h5prog.f90
• Show the compiler commands without
executing them (i.e., dry run):
% h5pcc –show h5prog.c
% h5pfc –show h5prog.f90
HDF-EOS Workshop IX

-9-

HDF
Collective vs. Independent
Calls
• MPI definition of collective call

– All processes of the communicator must
participate in the right order

• Independent means not collective
• Collective is not necessarily
synchronous

HDF-EOS Workshop IX

- 10 -

HDF
Programming Restrictions
• Most PHDF5 APIs are collective
• PHDF5 opens a parallel file with a
communicator

– Returns a file-handle
– Future access to the file via the filehandle
– All processes must participate in
collective PHDF5 APIs
– Different files can be opened via
different communicators

HDF-EOS Workshop IX

- 11 -

HDF
Examples of PHDF5 API
• Examples of PHDF5 collective API

– File operations: H5Fcreate, H5Fopen,
H5Fclose
– Objects creation: H5Dcreate, H5Dopen,
H5Dclose
– Objects structure: H5Dextend (increase
dimension sizes)

• Array data transfer can be collective or
independent
– Dataset operations: H5Dwrite, H5Dread

HDF-EOS Workshop IX

- 12 -

HDF
What Does PHDF5 Support ?
• After a file is opened by the processes of
a communicator

– All parts of file are accessible by all processes
– All objects in the file are accessible by all
processes
– Multiple processes write to the same data
array
– Each process writes to individual data array

HDF-EOS Workshop IX

- 13 -

HDF
PHDF5 API Languages
• C and F90 language interfaces
• Platforms supported:

– Most platforms with MPI-IO supported.
E.g.,
• IBM SP, Intel TFLOPS, SGI IRIX64/Altrix, HP
Alpha Clusters, Linux clusters

– Work in progress

• Red Storm, BlueGene/L, Cray xt3

HDF-EOS Workshop IX

- 14 -

HDF
Creating and Accessing a File
Programming model
• HDF5 uses access template object
(property list) to control the file access
mechanism
• General model to access HDF5 file in
parallel:
– Setup MPI-IO access template (access
property list)
– Open File
– Access Data
– Close File

HDF-EOS Workshop IX

- 15 -

HDF
Setup access template
Each process of the MPI communicator creates an
access template and sets it up with MPI parallel
access information
C:
herr_t H5Pset_fapl_mpio(hid_t plist_id,
MPI_Comm comm, MPI_Info info);

F90:
h5pset_fapl_mpio_f(plist_id, comm, info);
integer(hid_t) :: plist_id
integer
:: comm, info
plist_id is a file access property list identifier
HDF-EOS Workshop IX

- 16 -

HDF
C Example
Parallel File Create
23
24
26
27
28
29
33
34
35
36
37
38
42
49
50
51
52
54

comm = MPI_COMM_WORLD;
info = MPI_INFO_NULL;
/*
* Initialize MPI
*/
MPI_Init(&argc, &argv);
/*
* Set up file access property list for MPI-IO access
*/
plist_id = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(plist_id, comm, info);
file_id = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC,
H5P_DEFAULT, plist_id);
/*
* Close the file.
*/
H5Fclose(file_id);
MPI_Finalize();

HDF-EOS Workshop IX

- 17 -

HDF
F90 Example
Parallel File Create
23
24
26
29
30
32
34
35
37
38
40
41
43
45
46
49
51
52
54
56

comm = MPI_COMM_WORLD
info = MPI_INFO_NULL
CALL MPI_INIT(mpierror)
!
! Initialize FORTRAN predefined datatypes
CALL h5open_f(error)
!
! Setup file access property list for MPI-IO access.
CALL h5pcreate_f(H5P_FILE_ACCESS_F, plist_id, error)
CALL h5pset_fapl_mpio_f(plist_id, comm, info, error)
!
! Create the file collectively.
CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id,
error, access_prp = plist_id)
!
! Close the file.
CALL h5fclose_f(file_id, error)
!
! Close FORTRAN interface
CALL h5close_f(error)
CALL MPI_FINALIZE(mpierror)

HDF-EOS Workshop IX

- 18 -

HDF
Creating and Opening Dataset
• All processes of the communicator
open/close a dataset by a collective
call
– C: H5Dcreate or H5Dopen; H5Dclose
– F90: h5dcreate_f or h5dopen_f;
h5dclose_f

• All processes of the communicator
must extend an unlimited
dimension dataset before writing to
it
– C: H5Dextend
– F90: h5dextend_f

HDF-EOS Workshop IX

- 19 -

HDF
C Example
Parallel Dataset Create
56
57
58
59
60
61
62
63
64
65
66
67
68

file_id = H5Fcreate(…);
/*
* Create the dataspace for the dataset.
*/
dimsf[0] = NX;
dimsf[1] = NY;
filespace = H5Screate_simple(RANK, dimsf, NULL);

70
71
72
73
74

H5Dclose(dset_id);
/*
* Close the file.
*/
H5Fclose(file_id);

/*
* Create the dataset with default properties collective.
*/
dset_id = H5Dcreate(file_id, “dataset1”, H5T_NATIVE_INT,
filespace, H5P_DEFAULT);

HDF-EOS Workshop IX

- 20 -

HDF
F90 Example
Parallel Dataset Create
43 CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id,
error, access_prp = plist_id)
73 CALL h5screate_simple_f(rank, dimsf, filespace, error)
76 !
77 ! Create the dataset with default properties.
78 !
79 CALL h5dcreate_f(file_id, “dataset1”, H5T_NATIVE_INTEGER,
filespace, dset_id, error)
90
91
92
93
94
95

!
! Close the dataset.
CALL h5dclose_f(dset_id, error)
!
! Close the file.
CALL h5fclose_f(file_id, error)

HDF-EOS Workshop IX

- 21 -

HDF
Accessing a Dataset
• All processes that have opened
dataset may do collective I/O
• Each process may do independent
and arbitrary number of data I/O
access calls
– C: H5Dwrite and H5Dread
– F90: h5dwrite_f and h5dread_f

HDF-EOS Workshop IX

- 22 -

HDF
Accessing a Dataset
Programming model
• Create and set dataset transfer
property
– C: H5Pset_dxpl_mpio

– H5FD_MPIO_COLLECTIVE
– H5FD_MPIO_INDEPENDENT (default)

– F90: h5pset_dxpl_mpio_f

– H5FD_MPIO_COLLECTIVE_F
– H5FD_MPIO_INDEPENDENT_F (default)

• Access dataset with the defined
transfer property
HDF-EOS Workshop IX

- 23 -

HDF
C Example: Collective write

95 /*
96
* Create property list for collective dataset write.
97
*/
98 plist_id = H5Pcreate(H5P_DATASET_XFER);
99 H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
100
101 status = H5Dwrite(dset_id, H5T_NATIVE_INT,
102
memspace, filespace, plist_id, data);

HDF-EOS Workshop IX

- 24 -

HDF
F90 Example: Collective write

88
89
90
91
92
93
94
95
96

! Create property list for collective dataset write
!
CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error)
CALL h5pset_dxpl_mpio_f(plist_id, &
H5FD_MPIO_COLLECTIVE_F, error)
!
! Write the dataset collectively.
!
CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, &
error, &
file_space_id = filespace, &
mem_space_id = memspace, &
xfer_prp = plist_id)
HDF-EOS Workshop IX

- 25 -

HDF
Writing and Reading Hyperslabs
Programming model
• Distributed memory model: data is split
among processes
• PHDF5 uses hyperslab model
• Each process defines memory and file
hyperslabs
• Each process executes partial write/read
call
– Collective calls
– Independent calls

HDF-EOS Workshop IX

- 26 -

HDF
Hyperslab Example 1
Writing dataset by rows
P0
P1

File

P2
P3

HDF-EOS Workshop IX

- 27 -

HDF
Writing by rows
Output of h5dump utility
HDF5 "SDS_row.h5" {
GROUP "/" {
DATASET "IntArray" {
DATATYPE H5T_STD_I32BE
DATASPACE SIMPLE { ( 8, 5 ) / ( 8, 5 ) }
DATA {
10, 10, 10, 10, 10,
10, 10, 10, 10, 10,
11, 11, 11, 11, 11,
11, 11, 11, 11, 11,
12, 12, 12, 12, 12,
12, 12, 12, 12, 12,
13, 13, 13, 13, 13,
13, 13, 13, 13, 13
}
}
}
}
HDF-EOS Workshop IX

- 28 -

HDF
Example 1
Writing dataset by rows
File

P1 (memory space)

offset[1]
count[1]
count[0]

offset[0]

count[0] = dimsf[0]/mpi_size
count[1] = dimsf[1];
offset[0] = mpi_rank * count[0];
offset[1] = 0;
HDF-EOS Workshop IX

- 29 -

/* = 2 */

HDF
C Example 1
71 /*
72
* Each process defines dataset in memory and
* writes it to the hyperslab
73
* in the file.
74
*/
75
count[0] = dimsf[0]/mpi_size;
76
count[1] = dimsf[1];
77
offset[0] = mpi_rank * count[0];
78
offset[1] = 0;
79
memspace = H5Screate_simple(RANK,count,NULL);
80
81 /*
82
* Select hyperslab in the file.
83
*/
84
filespace = H5Dget_space(dset_id);
85
H5Sselect_hyperslab(filespace,
H5S_SELECT_SET,offset,NULL,count,NULL);

HDF-EOS Workshop IX

- 30 -

HDF
Hyperslab Example 2
Writing dataset by columns

P0
File
P1

HDF-EOS Workshop IX

- 31 -

HDF
Writing by columns
Output of h5dump utility
HDF5 "SDS_col.h5" {
GROUP "/" {
DATASET "IntArray" {
DATATYPE H5T_STD_I32BE
DATASPACE SIMPLE { ( 8, 6 ) / ( 8, 6 ) }
DATA {
1, 2, 10, 20, 100, 200,
1, 2, 10, 20, 100, 200,
1, 2, 10, 20, 100, 200,
1, 2, 10, 20, 100, 200,
1, 2, 10, 20, 100, 200,
1, 2, 10, 20, 100, 200,
1, 2, 10, 20, 100, 200,
1, 2, 10, 20, 100, 200
}
}
}
}
HDF-EOS Workshop IX

- 32 -

HDF
Example 2
Writing Dataset by Column
Memory

P0 offset[1]

block[0]

P0
dimsm[0]
dimsm[1]

File

P1 offset[1]

block[1]
stride[1]

P1

HDF-EOS Workshop IX

- 33 -

HDF
C Example 2
85
86
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

HDF-EOS Workshop IX

/*
* Each process defines hyperslab in
* the file
*/
count[0] = 1;
count[1] = dimsm[1];
offset[0] = 0;
offset[1] = mpi_rank;
stride[0] = 1;
stride[1] = 2;
block[0] = dimsf[0];
block[1] = 1;
/*
* Each process selects hyperslab.
*/
filespace = H5Dget_space(dset_id);
H5Sselect_hyperslab(filespace,
H5S_SELECT_SET, offset, stride,
count, block);

- 34 -

HDF
Hyperslab Example 3
Writing dataset by pattern

P0

File

P1
P2
P3

HDF-EOS Workshop IX

- 35 -

HDF
Writing by Pattern
Output of h5dump utility
HDF5 "SDS_pat.h5" {
GROUP "/" {
DATASET "IntArray" {
DATATYPE H5T_STD_I32BE
DATASPACE SIMPLE { ( 8, 4 ) / ( 8, 4 ) }
DATA {
1, 3, 1, 3,
2, 4, 2, 4,
1, 3, 1, 3,
2, 4, 2, 4,
1, 3, 1, 3,
2, 4, 2, 4,
1, 3, 1, 3,
2, 4, 2, 4
}
}
}
}
HDF-EOS Workshop IX

- 36 -

HDF
Example 3
Writing dataset by pattern
Memory

File
stride[1]

P2
stride[0]
count[1]
offset[0] = 0;
offset[1] = 1;
count[0] = 4;
count[1] = 2;
stride[0] = 2;
stride[1] = 2;
HDF-EOS Workshop IX

offset[1]
- 37 -

HDF
C Example 3: Writing by
pattern
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

/* Each process defines dataset in memory and
* writes it to the hyperslab
* in the file.
*/
count[0] = 4;
count[1] = 2;
stride[0] = 2;
stride[1] = 2;
if(mpi_rank == 0) {
offset[0] = 0;
offset[1] = 0;
}
if(mpi_rank == 1) {
offset[0] = 1;
offset[1] = 0;
}
if(mpi_rank == 2) {
offset[0] = 0;
offset[1] = 1;
}
if(mpi_rank == 3) {
offset[0] = 1;
offset[1] = 1;
}

HDF-EOS Workshop IX

- 38 -

HDF
Hyperslab Example 4
Writing dataset by chunks

P0

P1

HDF-EOS Workshop IX

P2

P3

- 39 -

File

HDF
Writing by Chunks
Output of h5dump utility
HDF5 "SDS_chnk.h5" {
GROUP "/" {
DATASET "IntArray" {
DATATYPE H5T_STD_I32BE
DATASPACE SIMPLE { ( 8, 4 ) / ( 8, 4 ) }
DATA {
1, 1, 2, 2,
1, 1, 2, 2,
1, 1, 2, 2,
1, 1, 2, 2,
3, 3, 4, 4,
3, 3, 4, 4,
3, 3, 4, 4,
3, 3, 4, 4
}
}
}
}
HDF-EOS Workshop IX

- 40 -

HDF
Example 4
Writing dataset by chunks
File

Memory
P2

offset[1]

chunk_dims[1]
offset[0]
chunk_dims[0]

block[0]
block[0] = chunk_dims[0];
block[1] = chunk_dims[1];
offset[0] = chunk_dims[0];
offset[1] = 0;
HDF-EOS Workshop IX

block[1]
- 41 -

HDF
C Example 4
Writing by chunks
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
HDF-EOS Workshop IX

count[0] = 1;
count[1] = 1 ;
stride[0] = 1;
stride[1] = 1;
block[0] = chunk_dims[0];
block[1] = chunk_dims[1];
if(mpi_rank == 0) {
offset[0] = 0;
offset[1] = 0;
}
if(mpi_rank == 1) {
offset[0] = 0;
offset[1] = chunk_dims[1];
}
if(mpi_rank == 2) {
offset[0] = chunk_dims[0];
offset[1] = 0;
}
if(mpi_rank == 3) {
offset[0] = chunk_dims[0];
offset[1] = chunk_dims[1];
}
- 42 -

HDF
Useful Parallel HDF Links
• Parallel HDF information site

– http://hdf.ncsa.uiuc.edu/Parallel_HDF/

• Parallel HDF mailing list

– hdfparallel@ncsa.uiuc.edu

• Parallel HDF5 tutorial available at

– http://hdf.ncsa.uiuc.edu/HDF5/doc/Tu
tor

HDF-EOS Workshop IX

- 43 -

HDF
Thank you
This presentation is based upon work supported in part
by a Cooperative Agreement with the National
Aeronautics and Space Administration (NASA) under
NASA grant NNG05GC60A. Any opinions, findings, and
conclusions or recommendations expressed in this
material are those of the author(s) and do not
necessarily reflect the views of NASA. Other support
provided by NCSA and other sponsors and agencies
(http://hdf.ncsa.uiuc.edu/acknowledge.html).

Weitere ähnliche Inhalte

Was ist angesagt?

10分で分かるデータストレージ
10分で分かるデータストレージ10分で分かるデータストレージ
10分で分かるデータストレージ
Takashi Hoshino
 

Was ist angesagt? (20)

PreCICE CHT with OpenFOAM and CalculiX
PreCICE CHT with OpenFOAM and CalculiXPreCICE CHT with OpenFOAM and CalculiX
PreCICE CHT with OpenFOAM and CalculiX
 
Tame the small files problem and optimize data layout for streaming ingestion...
Tame the small files problem and optimize data layout for streaming ingestion...Tame the small files problem and optimize data layout for streaming ingestion...
Tame the small files problem and optimize data layout for streaming ingestion...
 
RBD: What will the future bring? - Jason Dillaman
RBD: What will the future bring? - Jason DillamanRBD: What will the future bring? - Jason Dillaman
RBD: What will the future bring? - Jason Dillaman
 
153 Oracle dba interview questions
153 Oracle dba interview questions153 Oracle dba interview questions
153 Oracle dba interview questions
 
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...
Oracle Active Data Guard 12c: Far Sync Instance, Real-Time Cascade and Other ...
 
HDFS Overview
HDFS OverviewHDFS Overview
HDFS Overview
 
AlwaysON Basics
AlwaysON BasicsAlwaysON Basics
AlwaysON Basics
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...
 
The Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationThe Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - Presentation
 
Migrating your clusters and workloads from Hadoop 2 to Hadoop 3
Migrating your clusters and workloads from Hadoop 2 to Hadoop 3Migrating your clusters and workloads from Hadoop 2 to Hadoop 3
Migrating your clusters and workloads from Hadoop 2 to Hadoop 3
 
iceberg introduction.pptx
iceberg introduction.pptxiceberg introduction.pptx
iceberg introduction.pptx
 
10分で分かるデータストレージ
10分で分かるデータストレージ10分で分かるデータストレージ
10分で分かるデータストレージ
 
What is new in Apache Hive 3.0?
What is new in Apache Hive 3.0?What is new in Apache Hive 3.0?
What is new in Apache Hive 3.0?
 
Low Latency OLAP with Hadoop and HBase
Low Latency OLAP with Hadoop and HBaseLow Latency OLAP with Hadoop and HBase
Low Latency OLAP with Hadoop and HBase
 
BigtopでHadoopをビルドする(Open Source Conference 2021 Online/Spring 発表資料)
BigtopでHadoopをビルドする(Open Source Conference 2021 Online/Spring 発表資料)BigtopでHadoopをビルドする(Open Source Conference 2021 Online/Spring 発表資料)
BigtopでHadoopをビルドする(Open Source Conference 2021 Online/Spring 発表資料)
 
サポートスペシャリストが語るXenDesktop / XenApp環境での最速トラブルシューティング
サポートスペシャリストが語るXenDesktop / XenApp環境での最速トラブルシューティングサポートスペシャリストが語るXenDesktop / XenApp環境での最速トラブルシューティング
サポートスペシャリストが語るXenDesktop / XenApp環境での最速トラブルシューティング
 
Tez Shuffle Handler: Shuffling at Scale with Apache Hadoop
Tez Shuffle Handler: Shuffling at Scale with Apache HadoopTez Shuffle Handler: Shuffling at Scale with Apache Hadoop
Tez Shuffle Handler: Shuffling at Scale with Apache Hadoop
 
Webinar: PostgreSQL continuous backup and PITR with Barman
Webinar: PostgreSQL continuous backup and PITR with BarmanWebinar: PostgreSQL continuous backup and PITR with Barman
Webinar: PostgreSQL continuous backup and PITR with Barman
 
Hiveを高速化するLLAP
Hiveを高速化するLLAPHiveを高速化するLLAP
Hiveを高速化するLLAP
 
Tuning Apache Kafka Connectors for Flink.pptx
Tuning Apache Kafka Connectors for Flink.pptxTuning Apache Kafka Connectors for Flink.pptx
Tuning Apache Kafka Connectors for Flink.pptx
 

Ähnlich wie Parallel HDF5 Introductory Tutorial

Ähnlich wie Parallel HDF5 Introductory Tutorial (20)

Overview of Parallel HDF5
Overview of Parallel HDF5Overview of Parallel HDF5
Overview of Parallel HDF5
 
Overview of Parallel HDF5 and Performance Tuning in HDF5 Library
Overview of Parallel HDF5 and Performance Tuning in HDF5 LibraryOverview of Parallel HDF5 and Performance Tuning in HDF5 Library
Overview of Parallel HDF5 and Performance Tuning in HDF5 Library
 
Overview of Parallel HDF5 and Performance Tuning in HDF5 Library
Overview of Parallel HDF5 and Performance Tuning in HDF5 LibraryOverview of Parallel HDF5 and Performance Tuning in HDF5 Library
Overview of Parallel HDF5 and Performance Tuning in HDF5 Library
 
HDF Update for DAAC Managers (2017-02-27)
HDF Update for DAAC Managers (2017-02-27)HDF Update for DAAC Managers (2017-02-27)
HDF Update for DAAC Managers (2017-02-27)
 
HDF Updae
HDF UpdaeHDF Updae
HDF Updae
 
Introduction to HDF5
Introduction to HDF5Introduction to HDF5
Introduction to HDF5
 
Introduction to HDF5
Introduction to HDF5Introduction to HDF5
Introduction to HDF5
 
HDF5 Tools
HDF5 ToolsHDF5 Tools
HDF5 Tools
 
Introduction to HDF5 Data and Programming Models
Introduction to HDF5 Data and Programming ModelsIntroduction to HDF5 Data and Programming Models
Introduction to HDF5 Data and Programming Models
 
HDF5 Advanced Topics - Datatypes and Partial I/O
HDF5 Advanced Topics - Datatypes and Partial I/OHDF5 Advanced Topics - Datatypes and Partial I/O
HDF5 Advanced Topics - Datatypes and Partial I/O
 
Introduction to HDF5
Introduction to HDF5Introduction to HDF5
Introduction to HDF5
 
Introduction to HDF5 Data Model, Programming Model and Library APIs
Introduction to HDF5 Data Model, Programming Model and Library APIsIntroduction to HDF5 Data Model, Programming Model and Library APIs
Introduction to HDF5 Data Model, Programming Model and Library APIs
 
HDF5 Advanced Topics
HDF5 Advanced TopicsHDF5 Advanced Topics
HDF5 Advanced Topics
 
HDF Update
HDF UpdateHDF Update
HDF Update
 
Advanced HDF5 Features
Advanced HDF5 FeaturesAdvanced HDF5 Features
Advanced HDF5 Features
 
Hdf5 parallel
Hdf5 parallelHdf5 parallel
Hdf5 parallel
 
Substituting HDF5 tools with Python/H5py scripts
Substituting HDF5 tools with Python/H5py scriptsSubstituting HDF5 tools with Python/H5py scripts
Substituting HDF5 tools with Python/H5py scripts
 
Hdf5 intro
Hdf5 introHdf5 intro
Hdf5 intro
 
HDF5 and Ecosystem: What Is New?
HDF5 and Ecosystem: What Is New?HDF5 and Ecosystem: What Is New?
HDF5 and Ecosystem: What Is New?
 
Introduction to HDF5
Introduction to HDF5Introduction to HDF5
Introduction to HDF5
 

Mehr von The HDF-EOS Tools and Information Center

Mehr von The HDF-EOS Tools and Information Center (20)

Cloud-Optimized HDF5 Files
Cloud-Optimized HDF5 FilesCloud-Optimized HDF5 Files
Cloud-Optimized HDF5 Files
 
Accessing HDF5 data in the cloud with HSDS
Accessing HDF5 data in the cloud with HSDSAccessing HDF5 data in the cloud with HSDS
Accessing HDF5 data in the cloud with HSDS
 
The State of HDF
The State of HDFThe State of HDF
The State of HDF
 
Highly Scalable Data Service (HSDS) Performance Features
Highly Scalable Data Service (HSDS) Performance FeaturesHighly Scalable Data Service (HSDS) Performance Features
Highly Scalable Data Service (HSDS) Performance Features
 
Creating Cloud-Optimized HDF5 Files
Creating Cloud-Optimized HDF5 FilesCreating Cloud-Optimized HDF5 Files
Creating Cloud-Optimized HDF5 Files
 
HDF5 OPeNDAP Handler Updates, and Performance Discussion
HDF5 OPeNDAP Handler Updates, and Performance DiscussionHDF5 OPeNDAP Handler Updates, and Performance Discussion
HDF5 OPeNDAP Handler Updates, and Performance Discussion
 
Hyrax: Serving Data from S3
Hyrax: Serving Data from S3Hyrax: Serving Data from S3
Hyrax: Serving Data from S3
 
Accessing Cloud Data and Services Using EDL, Pydap, MATLAB
Accessing Cloud Data and Services Using EDL, Pydap, MATLABAccessing Cloud Data and Services Using EDL, Pydap, MATLAB
Accessing Cloud Data and Services Using EDL, Pydap, MATLAB
 
HDF - Current status and Future Directions
HDF - Current status and Future DirectionsHDF - Current status and Future Directions
HDF - Current status and Future Directions
 
HDFEOS.org User Analsys, Updates, and Future
HDFEOS.org User Analsys, Updates, and FutureHDFEOS.org User Analsys, Updates, and Future
HDFEOS.org User Analsys, Updates, and Future
 
HDF - Current status and Future Directions
HDF - Current status and Future Directions HDF - Current status and Future Directions
HDF - Current status and Future Directions
 
H5Coro: The Cloud-Optimized Read-Only Library
H5Coro: The Cloud-Optimized Read-Only LibraryH5Coro: The Cloud-Optimized Read-Only Library
H5Coro: The Cloud-Optimized Read-Only Library
 
MATLAB Modernization on HDF5 1.10
MATLAB Modernization on HDF5 1.10MATLAB Modernization on HDF5 1.10
MATLAB Modernization on HDF5 1.10
 
HDF for the Cloud - Serverless HDF
HDF for the Cloud - Serverless HDFHDF for the Cloud - Serverless HDF
HDF for the Cloud - Serverless HDF
 
HDF5 <-> Zarr
HDF5 <-> ZarrHDF5 <-> Zarr
HDF5 <-> Zarr
 
HDF for the Cloud - New HDF Server Features
HDF for the Cloud - New HDF Server FeaturesHDF for the Cloud - New HDF Server Features
HDF for the Cloud - New HDF Server Features
 
Apache Drill and Unidata THREDDS Data Server for NASA HDF-EOS on S3
Apache Drill and Unidata THREDDS Data Server for NASA HDF-EOS on S3Apache Drill and Unidata THREDDS Data Server for NASA HDF-EOS on S3
Apache Drill and Unidata THREDDS Data Server for NASA HDF-EOS on S3
 
STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...
STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...
STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...
 
HDF5 Roadmap 2019-2020
HDF5 Roadmap 2019-2020HDF5 Roadmap 2019-2020
HDF5 Roadmap 2019-2020
 
Leveraging the Cloud for HDF Software Testing
Leveraging the Cloud for HDF Software TestingLeveraging the Cloud for HDF Software Testing
Leveraging the Cloud for HDF Software Testing
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Parallel HDF5 Introductory Tutorial

  • 1. Parallel HDF5 Introductory Tutorial HDF and HDF-EOS Workshop IX November 30, 2005 HDF
  • 2. Outline • Overview of Parallel HDF5 design • Setting up parallel environment • Programming model for – Creating and accessing a File – Creating and accessing a Dataset – Writing and reading Hyperslabs • Parallel tutorial available at – http://hdf.ncsa.uiuc.edu/HDF5/doc/Tu tor HDF-EOS Workshop IX -2- HDF
  • 4. PHDF5 Initial Target • Support for MPI programming • Not for shared memory programming – Threads – OpenMP • Has some experiments with – Thread-safe support for Pthreads – OpenMP if called “correctly” HDF-EOS Workshop IX -4- HDF
  • 5. PHDF5 Requirements • PHDF5 files compatible with serial HDF5 files – Shareable between different serial or parallel platforms • Single file image to all processes – One file per process design is undesirable • Expensive post processing • Not useable by different number of processes • Standard parallel I/O interface – Must be portable to different platforms HDF-EOS Workshop IX -5- HDF
  • 6. Implementation Requirements • No use of Threads – Not commonly supported (1998) • No reserved process – May interfere with parallel algorithms • No spawn process – Not commonly supported even now HDF-EOS Workshop IX -6- HDF
  • 7. PHDF5 Implementation Layers Parallel Application Parallel Application Parallel Application Parallel Application Parallel HDF5 + MPI HDF library MPI-IO Local File System HDF-EOS Workshop IX “NFS” User Applications Parallel I/O layer GPFS/PVFS Lustre/PFS… -7- Parallel File systems HDF
  • 8. Parallel Environment Requirements • MPI with MPI-IO – MPICH ROMIO – Vendor’s MPI-IO • Parallel file system – – – – GPFS Lustre PVFS Specially configured NFS HDF-EOS Workshop IX -8- HDF
  • 9. How to Compile PHDF5 Applications • h5pcc – HDF5 C compiler command – Similar to mpicc • h5pfc – HDF5 F90 compiler command – Similar to mpif90 • To compile: % h5pcc h5prog.c % h5pfc h5prog.f90 • Show the compiler commands without executing them (i.e., dry run): % h5pcc –show h5prog.c % h5pfc –show h5prog.f90 HDF-EOS Workshop IX -9- HDF
  • 10. Collective vs. Independent Calls • MPI definition of collective call – All processes of the communicator must participate in the right order • Independent means not collective • Collective is not necessarily synchronous HDF-EOS Workshop IX - 10 - HDF
  • 11. Programming Restrictions • Most PHDF5 APIs are collective • PHDF5 opens a parallel file with a communicator – Returns a file-handle – Future access to the file via the filehandle – All processes must participate in collective PHDF5 APIs – Different files can be opened via different communicators HDF-EOS Workshop IX - 11 - HDF
  • 12. Examples of PHDF5 API • Examples of PHDF5 collective API – File operations: H5Fcreate, H5Fopen, H5Fclose – Objects creation: H5Dcreate, H5Dopen, H5Dclose – Objects structure: H5Dextend (increase dimension sizes) • Array data transfer can be collective or independent – Dataset operations: H5Dwrite, H5Dread HDF-EOS Workshop IX - 12 - HDF
  • 13. What Does PHDF5 Support ? • After a file is opened by the processes of a communicator – All parts of file are accessible by all processes – All objects in the file are accessible by all processes – Multiple processes write to the same data array – Each process writes to individual data array HDF-EOS Workshop IX - 13 - HDF
  • 14. PHDF5 API Languages • C and F90 language interfaces • Platforms supported: – Most platforms with MPI-IO supported. E.g., • IBM SP, Intel TFLOPS, SGI IRIX64/Altrix, HP Alpha Clusters, Linux clusters – Work in progress • Red Storm, BlueGene/L, Cray xt3 HDF-EOS Workshop IX - 14 - HDF
  • 15. Creating and Accessing a File Programming model • HDF5 uses access template object (property list) to control the file access mechanism • General model to access HDF5 file in parallel: – Setup MPI-IO access template (access property list) – Open File – Access Data – Close File HDF-EOS Workshop IX - 15 - HDF
  • 16. Setup access template Each process of the MPI communicator creates an access template and sets it up with MPI parallel access information C: herr_t H5Pset_fapl_mpio(hid_t plist_id, MPI_Comm comm, MPI_Info info); F90: h5pset_fapl_mpio_f(plist_id, comm, info); integer(hid_t) :: plist_id integer :: comm, info plist_id is a file access property list identifier HDF-EOS Workshop IX - 16 - HDF
  • 17. C Example Parallel File Create 23 24 26 27 28 29 33 34 35 36 37 38 42 49 50 51 52 54 comm = MPI_COMM_WORLD; info = MPI_INFO_NULL; /* * Initialize MPI */ MPI_Init(&argc, &argv); /* * Set up file access property list for MPI-IO access */ plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); file_id = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id); /* * Close the file. */ H5Fclose(file_id); MPI_Finalize(); HDF-EOS Workshop IX - 17 - HDF
  • 18. F90 Example Parallel File Create 23 24 26 29 30 32 34 35 37 38 40 41 43 45 46 49 51 52 54 56 comm = MPI_COMM_WORLD info = MPI_INFO_NULL CALL MPI_INIT(mpierror) ! ! Initialize FORTRAN predefined datatypes CALL h5open_f(error) ! ! Setup file access property list for MPI-IO access. CALL h5pcreate_f(H5P_FILE_ACCESS_F, plist_id, error) CALL h5pset_fapl_mpio_f(plist_id, comm, info, error) ! ! Create the file collectively. CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plist_id) ! ! Close the file. CALL h5fclose_f(file_id, error) ! ! Close FORTRAN interface CALL h5close_f(error) CALL MPI_FINALIZE(mpierror) HDF-EOS Workshop IX - 18 - HDF
  • 19. Creating and Opening Dataset • All processes of the communicator open/close a dataset by a collective call – C: H5Dcreate or H5Dopen; H5Dclose – F90: h5dcreate_f or h5dopen_f; h5dclose_f • All processes of the communicator must extend an unlimited dimension dataset before writing to it – C: H5Dextend – F90: h5dextend_f HDF-EOS Workshop IX - 19 - HDF
  • 20. C Example Parallel Dataset Create 56 57 58 59 60 61 62 63 64 65 66 67 68 file_id = H5Fcreate(…); /* * Create the dataspace for the dataset. */ dimsf[0] = NX; dimsf[1] = NY; filespace = H5Screate_simple(RANK, dimsf, NULL); 70 71 72 73 74 H5Dclose(dset_id); /* * Close the file. */ H5Fclose(file_id); /* * Create the dataset with default properties collective. */ dset_id = H5Dcreate(file_id, “dataset1”, H5T_NATIVE_INT, filespace, H5P_DEFAULT); HDF-EOS Workshop IX - 20 - HDF
  • 21. F90 Example Parallel Dataset Create 43 CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plist_id) 73 CALL h5screate_simple_f(rank, dimsf, filespace, error) 76 ! 77 ! Create the dataset with default properties. 78 ! 79 CALL h5dcreate_f(file_id, “dataset1”, H5T_NATIVE_INTEGER, filespace, dset_id, error) 90 91 92 93 94 95 ! ! Close the dataset. CALL h5dclose_f(dset_id, error) ! ! Close the file. CALL h5fclose_f(file_id, error) HDF-EOS Workshop IX - 21 - HDF
  • 22. Accessing a Dataset • All processes that have opened dataset may do collective I/O • Each process may do independent and arbitrary number of data I/O access calls – C: H5Dwrite and H5Dread – F90: h5dwrite_f and h5dread_f HDF-EOS Workshop IX - 22 - HDF
  • 23. Accessing a Dataset Programming model • Create and set dataset transfer property – C: H5Pset_dxpl_mpio – H5FD_MPIO_COLLECTIVE – H5FD_MPIO_INDEPENDENT (default) – F90: h5pset_dxpl_mpio_f – H5FD_MPIO_COLLECTIVE_F – H5FD_MPIO_INDEPENDENT_F (default) • Access dataset with the defined transfer property HDF-EOS Workshop IX - 23 - HDF
  • 24. C Example: Collective write 95 /* 96 * Create property list for collective dataset write. 97 */ 98 plist_id = H5Pcreate(H5P_DATASET_XFER); 99 H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE); 100 101 status = H5Dwrite(dset_id, H5T_NATIVE_INT, 102 memspace, filespace, plist_id, data); HDF-EOS Workshop IX - 24 - HDF
  • 25. F90 Example: Collective write 88 89 90 91 92 93 94 95 96 ! Create property list for collective dataset write ! CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) CALL h5pset_dxpl_mpio_f(plist_id, & H5FD_MPIO_COLLECTIVE_F, error) ! ! Write the dataset collectively. ! CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, & error, & file_space_id = filespace, & mem_space_id = memspace, & xfer_prp = plist_id) HDF-EOS Workshop IX - 25 - HDF
  • 26. Writing and Reading Hyperslabs Programming model • Distributed memory model: data is split among processes • PHDF5 uses hyperslab model • Each process defines memory and file hyperslabs • Each process executes partial write/read call – Collective calls – Independent calls HDF-EOS Workshop IX - 26 - HDF
  • 27. Hyperslab Example 1 Writing dataset by rows P0 P1 File P2 P3 HDF-EOS Workshop IX - 27 - HDF
  • 28. Writing by rows Output of h5dump utility HDF5 "SDS_row.h5" { GROUP "/" { DATASET "IntArray" { DATATYPE H5T_STD_I32BE DATASPACE SIMPLE { ( 8, 5 ) / ( 8, 5 ) } DATA { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 } } } } HDF-EOS Workshop IX - 28 - HDF
  • 29. Example 1 Writing dataset by rows File P1 (memory space) offset[1] count[1] count[0] offset[0] count[0] = dimsf[0]/mpi_size count[1] = dimsf[1]; offset[0] = mpi_rank * count[0]; offset[1] = 0; HDF-EOS Workshop IX - 29 - /* = 2 */ HDF
  • 30. C Example 1 71 /* 72 * Each process defines dataset in memory and * writes it to the hyperslab 73 * in the file. 74 */ 75 count[0] = dimsf[0]/mpi_size; 76 count[1] = dimsf[1]; 77 offset[0] = mpi_rank * count[0]; 78 offset[1] = 0; 79 memspace = H5Screate_simple(RANK,count,NULL); 80 81 /* 82 * Select hyperslab in the file. 83 */ 84 filespace = H5Dget_space(dset_id); 85 H5Sselect_hyperslab(filespace, H5S_SELECT_SET,offset,NULL,count,NULL); HDF-EOS Workshop IX - 30 - HDF
  • 31. Hyperslab Example 2 Writing dataset by columns P0 File P1 HDF-EOS Workshop IX - 31 - HDF
  • 32. Writing by columns Output of h5dump utility HDF5 "SDS_col.h5" { GROUP "/" { DATASET "IntArray" { DATATYPE H5T_STD_I32BE DATASPACE SIMPLE { ( 8, 6 ) / ( 8, 6 ) } DATA { 1, 2, 10, 20, 100, 200, 1, 2, 10, 20, 100, 200, 1, 2, 10, 20, 100, 200, 1, 2, 10, 20, 100, 200, 1, 2, 10, 20, 100, 200, 1, 2, 10, 20, 100, 200, 1, 2, 10, 20, 100, 200, 1, 2, 10, 20, 100, 200 } } } } HDF-EOS Workshop IX - 32 - HDF
  • 33. Example 2 Writing Dataset by Column Memory P0 offset[1] block[0] P0 dimsm[0] dimsm[1] File P1 offset[1] block[1] stride[1] P1 HDF-EOS Workshop IX - 33 - HDF
  • 34. C Example 2 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 HDF-EOS Workshop IX /* * Each process defines hyperslab in * the file */ count[0] = 1; count[1] = dimsm[1]; offset[0] = 0; offset[1] = mpi_rank; stride[0] = 1; stride[1] = 2; block[0] = dimsf[0]; block[1] = 1; /* * Each process selects hyperslab. */ filespace = H5Dget_space(dset_id); H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, stride, count, block); - 34 - HDF
  • 35. Hyperslab Example 3 Writing dataset by pattern P0 File P1 P2 P3 HDF-EOS Workshop IX - 35 - HDF
  • 36. Writing by Pattern Output of h5dump utility HDF5 "SDS_pat.h5" { GROUP "/" { DATASET "IntArray" { DATATYPE H5T_STD_I32BE DATASPACE SIMPLE { ( 8, 4 ) / ( 8, 4 ) } DATA { 1, 3, 1, 3, 2, 4, 2, 4, 1, 3, 1, 3, 2, 4, 2, 4, 1, 3, 1, 3, 2, 4, 2, 4, 1, 3, 1, 3, 2, 4, 2, 4 } } } } HDF-EOS Workshop IX - 36 - HDF
  • 37. Example 3 Writing dataset by pattern Memory File stride[1] P2 stride[0] count[1] offset[0] = 0; offset[1] = 1; count[0] = 4; count[1] = 2; stride[0] = 2; stride[1] = 2; HDF-EOS Workshop IX offset[1] - 37 - HDF
  • 38. C Example 3: Writing by pattern 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 /* Each process defines dataset in memory and * writes it to the hyperslab * in the file. */ count[0] = 4; count[1] = 2; stride[0] = 2; stride[1] = 2; if(mpi_rank == 0) { offset[0] = 0; offset[1] = 0; } if(mpi_rank == 1) { offset[0] = 1; offset[1] = 0; } if(mpi_rank == 2) { offset[0] = 0; offset[1] = 1; } if(mpi_rank == 3) { offset[0] = 1; offset[1] = 1; } HDF-EOS Workshop IX - 38 - HDF
  • 39. Hyperslab Example 4 Writing dataset by chunks P0 P1 HDF-EOS Workshop IX P2 P3 - 39 - File HDF
  • 40. Writing by Chunks Output of h5dump utility HDF5 "SDS_chnk.h5" { GROUP "/" { DATASET "IntArray" { DATATYPE H5T_STD_I32BE DATASPACE SIMPLE { ( 8, 4 ) / ( 8, 4 ) } DATA { 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 4, 4 } } } } HDF-EOS Workshop IX - 40 - HDF
  • 41. Example 4 Writing dataset by chunks File Memory P2 offset[1] chunk_dims[1] offset[0] chunk_dims[0] block[0] block[0] = chunk_dims[0]; block[1] = chunk_dims[1]; offset[0] = chunk_dims[0]; offset[1] = 0; HDF-EOS Workshop IX block[1] - 41 - HDF
  • 42. C Example 4 Writing by chunks 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 HDF-EOS Workshop IX count[0] = 1; count[1] = 1 ; stride[0] = 1; stride[1] = 1; block[0] = chunk_dims[0]; block[1] = chunk_dims[1]; if(mpi_rank == 0) { offset[0] = 0; offset[1] = 0; } if(mpi_rank == 1) { offset[0] = 0; offset[1] = chunk_dims[1]; } if(mpi_rank == 2) { offset[0] = chunk_dims[0]; offset[1] = 0; } if(mpi_rank == 3) { offset[0] = chunk_dims[0]; offset[1] = chunk_dims[1]; } - 42 - HDF
  • 43. Useful Parallel HDF Links • Parallel HDF information site – http://hdf.ncsa.uiuc.edu/Parallel_HDF/ • Parallel HDF mailing list – hdfparallel@ncsa.uiuc.edu • Parallel HDF5 tutorial available at – http://hdf.ncsa.uiuc.edu/HDF5/doc/Tu tor HDF-EOS Workshop IX - 43 - HDF
  • 44. Thank you This presentation is based upon work supported in part by a Cooperative Agreement with the National Aeronautics and Space Administration (NASA) under NASA grant NNG05GC60A. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of NASA. Other support provided by NCSA and other sponsors and agencies (http://hdf.ncsa.uiuc.edu/acknowledge.html).