Skip to content

Commit dc9c3af

Browse files
committed
Remove use of hint nc_header_align_size in all tests and examples
Because nc_header_align_size serves exactly the same purpose of nc_var_align_size and when both are set by the users, only nc_var_align_size takes effect.
1 parent 54098aa commit dc9c3af

File tree

15 files changed

+45
-123
lines changed

15 files changed

+45
-123
lines changed

benchmarks/C/aggregation.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,9 @@ int benchmark_write(char *filename,
172172

173173
/* set PnetCDF I/O hints */
174174
MPI_Info_create(&info);
175-
/* disable the header extent alignments
176-
MPI_Info_set(info, "nc_header_align_size", "1"); size in bytes
177-
*/
178-
/* disable the fixed-size variable alignments */
175+
/* disable the fixed-size variable alignments, which also
176+
* disable the header extent alignments
177+
*/
179178
MPI_Info_set(info, "nc_var_align_size", "1");
180179

181180
nvars = 0;

benchmarks/C/write_block_read_column.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ int benchmark_write(char *filename,
8484

8585
/* set PnetCDF I/O hints */
8686
MPI_Info_create(&info);
87-
MPI_Info_set(info, "nc_header_align_size", "1"); /* size in bytes */
8887
MPI_Info_set(info, "nc_var_align_size", "1"); /* size in bytes */
8988
MPI_Info_set(info, "nc_header_read_chunk_size", "512"); /* size in bytes */
9089
/* note that set the above values to 1 to disable the alignment */

examples/C/get_info.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* Example standard output:
1717
18-
MPI File Info: nkeys = 35
18+
MPI File Info: nkeys = 34
1919
MPI File Info: [ 0] key = cb_buffer_size, value = 16777216
2020
MPI File Info: [ 1] key = romio_cb_read, value = automatic
2121
MPI File Info: [ 2] key = romio_cb_write, value = automatic
@@ -39,18 +39,17 @@
3939
MPI File Info: [20] key = striping_unit, value = 0
4040
MPI File Info: [21] key = striping_factor, value = 0
4141
MPI File Info: [22] key = start_iodevice, value = 0
42-
MPI File Info: [23] key = nc_header_align_size, value = 512
43-
MPI File Info: [24] key = nc_var_align_size, value = 4
44-
MPI File Info: [25] key = nc_record_align_size, value = 4
45-
MPI File Info: [26] key = nc_header_read_chunk_size, value = 262144
46-
MPI File Info: [27] key = nc_in_place_swap, value = auto
47-
MPI File Info: [28] key = nc_ibuf_size, value = 16777216
48-
MPI File Info: [29] key = pnetcdf_subfiling, value = disable
49-
MPI File Info: [30] key = nc_num_subfiles, value = 0
50-
MPI File Info: [31] key = nc_hash_size_dim, value = 256
51-
MPI File Info: [32] key = nc_hash_size_var, value = 256
52-
MPI File Info: [33] key = nc_hash_size_gattr, value = 64
53-
MPI File Info: [34] key = nc_hash_size_vattr, value = 8
42+
MPI File Info: [23] key = nc_var_align_size, value = 4
43+
MPI File Info: [24] key = nc_record_align_size, value = 4
44+
MPI File Info: [25] key = nc_header_read_chunk_size, value = 262144
45+
MPI File Info: [26] key = nc_in_place_swap, value = auto
46+
MPI File Info: [27] key = nc_ibuf_size, value = 16777216
47+
MPI File Info: [28] key = pnetcdf_subfiling, value = disable
48+
MPI File Info: [29] key = nc_num_subfiles, value = 0
49+
MPI File Info: [30] key = nc_hash_size_dim, value = 256
50+
MPI File Info: [31] key = nc_hash_size_var, value = 256
51+
MPI File Info: [32] key = nc_hash_size_gattr, value = 64
52+
MPI File Info: [33] key = nc_hash_size_vattr, value = 8
5453
*/
5554

5655
#include <stdio.h>

examples/C/hints.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
/* $Id$ */
88

99
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
10-
* This example sets two PnetCDF hints:
11-
* nc_header_align_size and nc_var_align_size
10+
* This example sets PnetCDF hint:
11+
* nc_var_align_size
1212
* and prints the hint values as well as the header size, header extent, and
1313
* two variables' starting file offsets.
1414
*
@@ -18,7 +18,6 @@
1818
*
1919
* % mpiexec -l -n 4 ./hints /pvfs2/wkliao/testfile.nc
2020
*
21-
* nc_header_align_size set to = 1024
2221
* nc_var_align_size set to = 512
2322
* nc_header_read_chunk_size set to = 256
2423
* header size = 252
@@ -94,7 +93,7 @@ int print_hints(int ncid,
9493
char value[MPI_MAX_INFO_VAL];
9594
int err, len, flag, nerrs=0;
9695
MPI_Offset header_size, header_extent, var_zy_start, var_yx_start;
97-
MPI_Offset h_align=-1, v_align=-1, h_chunk=-1;
96+
MPI_Offset v_align=-1, h_chunk=-1;
9897
MPI_Info info_used;
9998

10099
err = ncmpi_inq_header_size (ncid, &header_size); ERR
@@ -103,12 +102,7 @@ int print_hints(int ncid,
103102
err = ncmpi_inq_varoffset(ncid, varid1, &var_yx_start); ERR
104103

105104
err = ncmpi_inq_file_info(ncid, &info_used); ERR
106-
MPI_Info_get_valuelen(info_used, "nc_header_align_size", &len, &flag);
107-
if (flag) {
108-
MPI_Info_get(info_used, "nc_header_align_size", len+1, value, &flag);
109-
h_align = strtoll(value,NULL,10);
110-
}
111-
MPI_Info_get_valuelen(info_used, "nc_var_align_size", &len, &flag);
105+
MPI_Info_get_valuelen(info_used, "nc_var_align_size", &len, &flag);
112106
if (flag) {
113107
MPI_Info_get(info_used, "nc_var_align_size", len+1, value, &flag);
114108
v_align = strtoll(value,NULL,10);
@@ -120,11 +114,6 @@ int print_hints(int ncid,
120114
}
121115
MPI_Info_free(&info_used);
122116

123-
if (h_align == -1)
124-
printf("nc_header_align_size is NOT set\n");
125-
else
126-
printf("nc_header_align_size set to = %lld\n", h_align);
127-
128117
if (v_align == -1)
129118
printf("nc_var_align_size is NOT set\n");
130119
else
@@ -171,7 +160,6 @@ int main(int argc, char** argv)
171160
else snprintf(filename, 256, "%s", argv[optind]);
172161

173162
MPI_Info_create(&info);
174-
MPI_Info_set(info, "nc_header_align_size", "1024"); /* size in bytes */
175163
MPI_Info_set(info, "nc_var_align_size", "512"); /* size in bytes */
176164
MPI_Info_set(info, "nc_header_read_chunk_size", "256"); /* size in bytes */
177165
/* note that set the above values to 1 to disable the alignment */

examples/CXX/get_info.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* Example standard output:
1717
18-
MPI File Info: nkeys = 18
18+
MPI File Info: nkeys = 17
1919
MPI File Info: [ 0] key = cb_buffer_size, value = 16777216
2020
MPI File Info: [ 1] key = romio_cb_read, value = automatic
2121
MPI File Info: [ 2] key = romio_cb_write, value = automatic
@@ -31,9 +31,8 @@
3131
MPI File Info: [12] key = romio_ds_read, value = automatic
3232
MPI File Info: [13] key = romio_ds_write, value = automatic
3333
MPI File Info: [14] key = cb_config_list, value = *:1
34-
MPI File Info: [15] key = nc_header_align_size, value = 512
35-
MPI File Info: [16] key = nc_var_align_size, value = 512
36-
MPI File Info: [17] key = nc_header_read_chunk_size, value = 0
34+
MPI File Info: [15] key = nc_var_align_size, value = 512
35+
MPI File Info: [16] key = nc_header_read_chunk_size, value = 0
3736
*/
3837

3938
#include <stdio.h>

examples/CXX/hints.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
/* $Id$ */
88

99
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
10-
* This example sets two PnetCDF hints:
11-
* nc_header_align_size and nc_var_align_size
10+
* This example sets PnetCDF hint:
11+
* nc_var_align_size
1212
* and prints the hint values as well as the header size, header extent, and
1313
* two variables' starting file offsets.
1414
*
@@ -18,7 +18,6 @@
1818
*
1919
* % mpiexec -l -n 4 ./hints /pvfs2/wkliao/testfile.nc
2020
*
21-
* nc_header_align_size set to = 1024
2221
* nc_var_align_size set to = 512
2322
* nc_header_read_chunk_size set to = 256
2423
* header size = 252
@@ -64,7 +63,7 @@ void print_hints(NcmpiFile &ncFile,
6463
char value[MPI_MAX_INFO_VAL];
6564
int len, flag;
6665
MPI_Offset header_size, header_extent, var_zy_start, var_yx_start;
67-
MPI_Offset h_align=-1, v_align=-1, h_chunk=-1;
66+
MPI_Offset v_align=-1, h_chunk=-1;
6867
MPI_Info info_used;
6968

7069
ncFile.Inq_header_size(&header_size);
@@ -76,12 +75,7 @@ void print_hints(NcmpiFile &ncFile,
7675
/* get all the hints used */
7776
ncFile.Inq_file_info(&info_used);
7877

79-
MPI_Info_get_valuelen(info_used, (char*)"nc_header_align_size", &len, &flag);
80-
if (flag) {
81-
MPI_Info_get(info_used, (char*)"nc_header_align_size", len+1, value, &flag);
82-
h_align = strtoll(value,NULL,10);
83-
}
84-
MPI_Info_get_valuelen(info_used, (char*)"nc_var_align_size", &len, &flag);
78+
MPI_Info_get_valuelen(info_used, (char*)"nc_var_align_size", &len, &flag);
8579
if (flag) {
8680
MPI_Info_get(info_used, (char*)"nc_var_align_size", len+1, value, &flag);
8781
v_align = strtoll(value,NULL,10);
@@ -93,11 +87,6 @@ void print_hints(NcmpiFile &ncFile,
9387
}
9488
MPI_Info_free(&info_used);
9589

96-
if (h_align == -1)
97-
printf("nc_header_align_size is NOT set\n");
98-
else
99-
printf("nc_header_align_size set to = %lld\n", h_align);
100-
10190
if (v_align == -1)
10291
printf("nc_var_align_size is NOT set\n");
10392
else
@@ -141,7 +130,6 @@ int main(int argc, char** argv)
141130

142131
try {
143132
MPI_Info_create(&info);
144-
MPI_Info_set(info, (char*)"nc_header_align_size", (char*)"1024");
145133
MPI_Info_set(info, (char*)"nc_var_align_size", (char*)"512");
146134
MPI_Info_set(info, (char*)"nc_header_read_chunk_size", (char*)"256");
147135
/* note that set the above values to 1 to disable the alignment */

examples/F77/get_info.f

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
!
1616
! Example standard output:
1717
!
18-
! MPI File Info: nkeys = 18
18+
! MPI File Info: nkeys = 17
1919
! MPI File Info: [ 0] key = cb_buffer_size, value =16777216
2020
! MPI File Info: [ 1] key = romio_cb_read, value =automatic
2121
! MPI File Info: [ 2] key = romio_cb_write, value =automatic
@@ -31,9 +31,8 @@
3131
! MPI File Info: [12] key = romio_ds_read, value =automatic
3232
! MPI File Info: [13] key = romio_ds_write, value =automatic
3333
! MPI File Info: [14] key = cb_config_list, value =*:1
34-
! MPI File Info: [15] key = nc_header_align_size, value =0
35-
! MPI File Info: [16] key = nc_var_align_size, value =0
36-
! MPI File Info: [17] key = nc_header_read_chunk_size, value =0
34+
! MPI File Info: [15] key = nc_var_align_size, value =0
35+
! MPI File Info: [16] key = nc_header_read_chunk_size, value =0
3736

3837

3938
program main

examples/F77/hints.f

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
! $Id$
77

88
!
9-
! This example sets two PnetCDF hints:
10-
! nc_header_align_size and nc_var_align_size
9+
! This example sets PnetCDF hint:
10+
! nc_var_align_size
1111
! and prints the hint values as well as the header size, header extent, and
1212
! two variables' starting file offsets.
1313
!
@@ -17,7 +17,6 @@
1717
!
1818
! % mpiexec -n 4 ./hints /pvfs2/wkliao/testfile.nc
1919
!
20-
! nc_header_align_size set to = 1024
2120
! nc_var_align_size set to = 512
2221
! nc_header_read_chunk_size set to = 256
2322
! header size = 252
@@ -54,9 +53,8 @@ subroutine print_hints(ncid, varid0, varid1)
5453
logical flag
5554
integer*8 header_size, header_extent
5655
integer*8 var_zy_start, var_yx_start
57-
integer*8 h_align, v_align, h_chunk
56+
integer*8 v_align, h_chunk
5857
59-
h_align=-1
6058
v_align=-1
6159
h_chunk=-1
6260
@@ -72,13 +70,6 @@ subroutine print_hints(ncid, varid0, varid1)
7270
err = nfmpi_inq_file_info(ncid, info_used)
7371
call check(err, 'In nfmpi_inq_file_info : ')
7472
75-
call MPI_Info_get_valuelen(info_used, "nc_header_align_size",
76-
+ len, flag, err)
77-
if (flag) then
78-
call MPI_Info_get(info_used, "nc_header_align_size",
79-
+ len+1, value, flag, err)
80-
read(value, '(i16)') h_align
81-
endif
8273
call MPI_Info_get_valuelen(info_used, "nc_var_align_size",
8374
+ len, flag, err)
8475
if (flag) then
@@ -96,11 +87,6 @@ subroutine print_hints(ncid, varid0, varid1)
9687
endif
9788
call MPI_Info_free(info_used, err)
9889
99-
if (h_align .EQ. -1) then
100-
print*,"nc_header_align_size is NOT set"
101-
else
102-
print*,"nc_header_align_size set to = ", h_align
103-
endif
10490
if (v_align .EQ. -1) then
10591
print*,"nc_var_align_size is NOT set"
10692
else
@@ -178,7 +164,6 @@ program main
178164
+ MPI_COMM_WORLD, err)
179165
180166
call MPI_Info_create(info, err)
181-
call MPI_Info_set(info, "nc_header_align_size", "1024", err)
182167
call MPI_Info_set(info, "nc_var_align_size", "512", err)
183168
call MPI_Info_set(info, "nc_header_read_chunk_size", "256", err)
184169
! note that set the above values to 1 to disable the alignment

examples/F90/get_info.f90

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
!
1717
! Example standard output:
1818
!
19-
! MPI File Info: nkeys = 18
19+
! MPI File Info: nkeys = 17
2020
! MPI File Info: [ 0] key = cb_buffer_size, value =16777216
2121
! MPI File Info: [ 1] key = romio_cb_read, value =automatic
2222
! MPI File Info: [ 2] key = romio_cb_write, value =automatic
@@ -32,9 +32,8 @@
3232
! MPI File Info: [12] key = romio_ds_read, value =automatic
3333
! MPI File Info: [13] key = romio_ds_write, value =automatic
3434
! MPI File Info: [14] key = cb_config_list, value =*:1
35-
! MPI File Info: [15] key = nc_header_align_size, value =0
36-
! MPI File Info: [16] key = nc_var_align_size, value =0
37-
! MPI File Info: [17] key = nc_header_read_chunk_size, value =0
35+
! MPI File Info: [15] key = nc_var_align_size, value =0
36+
! MPI File Info: [16] key = nc_header_read_chunk_size, value =0
3837

3938

4039
program main

examples/F90/hints.f90

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
! $Id$
88

99
!
10-
! This example sets two PnetCDF hints:
11-
! nc_header_align_size and nc_var_align_size
10+
! This example sets PnetCDF hint:
11+
! nc_var_align_size
1212
! and prints the hint values as well as the header size, header extent, and
1313
! two variables' starting file offsets.
1414
!
@@ -18,7 +18,6 @@
1818
!
1919
! % mpiexec -n 4 ./hints /pvfs2/wkliao/testfile.nc
2020
!
21-
! nc_header_align_size set to = 1024
2221
! nc_var_align_size set to = 512
2322
! nc_header_read_chunk_size set to = 256
2423
! header size = 252
@@ -55,9 +54,8 @@ subroutine print_hints(ncid, varid0, varid1)
5554
logical flag
5655
integer(kind=MPI_OFFSET_KIND) header_size, header_extent
5756
integer(kind=MPI_OFFSET_KIND) var_zy_start, var_yx_start
58-
integer(kind=MPI_OFFSET_KIND) h_align, v_align, h_chunk
57+
integer(kind=MPI_OFFSET_KIND) v_align, h_chunk
5958

60-
h_align=-1
6159
v_align=-1
6260
h_chunk=-1
6361

@@ -73,13 +71,6 @@ subroutine print_hints(ncid, varid0, varid1)
7371
err = nf90mpi_inq_file_info(ncid, info_used)
7472
call check(err, 'In nf90mpi_inq_file_info : ')
7573

76-
call MPI_Info_get_valuelen(info_used, "nc_header_align_size", &
77-
len, flag, err)
78-
if (flag) then
79-
call MPI_Info_get(info_used, "nc_header_align_size", &
80-
len+1, value, flag, err)
81-
read(value, '(i16)') h_align
82-
endif
8374
call MPI_Info_get_valuelen(info_used, "nc_var_align_size", &
8475
len, flag, err)
8576
if (flag) then
@@ -97,11 +88,6 @@ subroutine print_hints(ncid, varid0, varid1)
9788
endif
9889
call MPI_Info_free(info_used, err)
9990

100-
if (h_align .EQ. -1) then
101-
print*,"nc_header_align_size is NOT set"
102-
else
103-
print*,"nc_header_align_size set to = ", h_align
104-
endif
10591
if (v_align .EQ. -1) then
10692
print*,"nc_var_align_size is NOT set"
10793
else
@@ -176,7 +162,6 @@ program main
176162
call MPI_Bcast(filename, 256, MPI_CHARACTER, 0, MPI_COMM_WORLD, err)
177163

178164
call MPI_Info_create(info, err)
179-
call MPI_Info_set(info, "nc_header_align_size", "1024", err)
180165
call MPI_Info_set(info, "nc_var_align_size", "512", err)
181166
call MPI_Info_set(info, "nc_header_read_chunk_size", "256", err)
182167
! note that set the above values to 1 to disable the alignment

0 commit comments

Comments
 (0)