Skip to content

Commit 8981841

Browse files
authored
Merge pull request #156 from Parallel-NetCDF/intra_node3
New feature: intra-node write aggregation
2 parents c1b24df + 7b4491a commit 8981841

40 files changed

+1933
-219
lines changed

benchmarks/C/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ unset PNETCDF_HINTS
2929

3030
for i in ${check_PROGRAMS} ; do
3131
for j in ${safe_modes} ; do
32+
for intra_aggr in 0 1 ; do
3233
if test "$j" = 1 ; then # test only in safe mode
3334
export PNETCDF_HINTS="romio_no_indep_rw=true"
35+
else
36+
export PNETCDF_HINTS=
37+
fi
38+
if test "$intra_aggr" = 1 ; then
39+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3440
fi
3541
export PNETCDF_SAFE_MODE=$j
3642
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -72,6 +78,7 @@ for i in ${check_PROGRAMS} ; do
7278
# Validator does not support nc4
7379
fi
7480
done
81+
done
7582
rm -f ${OUTDIR}/$i.nc
7683
rm -f ${OUTDIR}/$i.bb.nc
7784
rm -f ${OUTDIR}/$i.nc4

benchmarks/FLASH-IO/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ unset PNETCDF_HINTS
2929

3030
for i in ${check_PROGRAMS} ; do
3131
for j in ${safe_modes} ; do
32+
for intra_aggr in 0 1 ; do
3233
if test "$j" = 1 ; then # test only in safe mode
3334
export PNETCDF_HINTS="romio_no_indep_rw=true"
35+
else
36+
export PNETCDF_HINTS=
37+
fi
38+
if test "$intra_aggr" = 1 ; then
39+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3440
fi
3541
export PNETCDF_SAFE_MODE=$j
3642
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -72,6 +78,7 @@ for i in ${check_PROGRAMS} ; do
7278
${MPIRUN} ${NCMPIDIFF} -q ${TESTOUTDIR}/$i.ncmpi_plt_crn_0000.nc ${TESTOUTDIR}/$i.bb.ncmpi_plt_crn_0000.nc
7379
fi
7480
done
81+
done
7582
rm -f ${OUTDIR}/$i.ncmpi_chk_0000.nc
7683
rm -f ${OUTDIR}/$i.ncmpi_plt_cnt_0000.nc
7784
rm -f ${OUTDIR}/$i.ncmpi_plt_crn_0000.nc

examples/C/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ unset PNETCDF_HINTS
3232

3333
for i in ${check_PROGRAMS} ; do
3434
for j in ${safe_modes} ; do
35+
for intra_aggr in 0 1 ; do
3536
if test "$j" = 1 ; then # test only in safe mode
3637
export PNETCDF_HINTS="romio_no_indep_rw=true"
38+
else
39+
export PNETCDF_HINTS=
40+
fi
41+
if test "$intra_aggr" = 1 ; then
42+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3743
fi
3844
export PNETCDF_SAFE_MODE=$j
3945
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -92,6 +98,7 @@ for i in ${check_PROGRAMS} ; do
9298
# Validator does not support nc4
9399
fi
94100

101+
done
95102
done
96103
# delete output file
97104
if test $i = get_vara ; then

examples/CXX/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ unset PNETCDF_HINTS
3232

3333
for i in ${check_PROGRAMS} ; do
3434
for j in ${safe_modes} ; do
35+
for intra_aggr in 0 1 ; do
3536
if test "$j" = 1 ; then # test only in safe mode
3637
export PNETCDF_HINTS="romio_no_indep_rw=true"
38+
else
39+
export PNETCDF_HINTS=
40+
fi
41+
if test "$intra_aggr" = 1 ; then
42+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3743
fi
3844
export PNETCDF_SAFE_MODE=$j
3945
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -90,6 +96,7 @@ for i in ${check_PROGRAMS} ; do
9096
# Validator does not support nc4
9197
fi
9298
done
99+
done
93100
# delete output file
94101
if test $i = get_vara ; then
95102
rm -f ${OUTDIR}/put_vara.nc

examples/F77/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ unset PNETCDF_HINTS
3232

3333
for i in ${check_PROGRAMS} ; do
3434
for j in ${safe_modes} ; do
35+
for intra_aggr in 0 1 ; do
3536
if test "$j" = 1 ; then # test only in safe mode
3637
export PNETCDF_HINTS="romio_no_indep_rw=true"
38+
else
39+
export PNETCDF_HINTS=
40+
fi
41+
if test "$intra_aggr" = 1 ; then
42+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3743
fi
3844
export PNETCDF_SAFE_MODE=$j
3945
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -90,6 +96,7 @@ for i in ${check_PROGRAMS} ; do
9096
# Validator does not support nc4
9197
fi
9298
done
99+
done
93100
# delete output file
94101
rm -f ${OUTDIR}/$i.nc
95102
rm -f ${OUTDIR}/$i.bb.nc

examples/F90/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ unset PNETCDF_HINTS
3232

3333
for i in ${check_PROGRAMS} ; do
3434
for j in ${safe_modes} ; do
35+
for intra_aggr in 0 1 ; do
3536
if test "$j" = 1 ; then # test only in safe mode
3637
export PNETCDF_HINTS="romio_no_indep_rw=true"
38+
else
39+
export PNETCDF_HINTS=
40+
fi
41+
if test "$intra_aggr" = 1 ; then
42+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3743
fi
3844
export PNETCDF_SAFE_MODE=$j
3945
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -90,6 +96,7 @@ for i in ${check_PROGRAMS} ; do
9096
# Validator does not support nc4
9197
fi
9298
done
99+
done
93100
# delete output file
94101
rm -f ${OUTDIR}/$i.nc
95102
rm -f ${OUTDIR}/$i.bb.nc

examples/adios/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ unset PNETCDF_HINTS
2828

2929
for i in ${check_PROGRAMS} ; do
3030
for j in ${safe_modes} ; do
31+
for intra_aggr in 0 1 ; do
3132
if test "$j" = 1 ; then # test only in safe mode
3233
export PNETCDF_HINTS="romio_no_indep_rw=true"
34+
else
35+
export PNETCDF_HINTS=
36+
fi
37+
if test "$intra_aggr" = 1 ; then
38+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3339
fi
3440
export PNETCDF_SAFE_MODE=$j
3541
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -42,5 +48,6 @@ for i in ${check_PROGRAMS} ; do
4248
echo "PASS: C parallel run on $1 processes --------------- $i"
4349
fi
4450
done
51+
done
4552
done
4653

examples/burst_buffer/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ unset PNETCDF_HINTS
3333
for i in ${check_PROGRAMS} ; do
3434
# echo "---- exec=$i"
3535
for j in ${safe_modes} ; do
36+
for intra_aggr in 0 1 ; do
3637
if test "$j" = 1 ; then # test only in safe mode
3738
export PNETCDF_HINTS="romio_no_indep_rw=true"
39+
else
40+
export PNETCDF_HINTS=
41+
fi
42+
if test "$intra_aggr" = 1 ; then
43+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3844
fi
3945
export PNETCDF_SAFE_MODE=$j
4046
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -49,6 +55,7 @@ for i in ${check_PROGRAMS} ; do
4955
${TESTSEQRUN} ${VALIDATOR} -q ${TESTOUTDIR}/$i.nc
5056
# echo ""
5157
done
58+
done
5259
# delete output files
5360
rm -f ${OUTDIR}/$i.nc
5461
done

examples/tutorial/parallel_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ unset PNETCDF_HINTS
3232

3333
for i in ${check_PROGRAMS} ; do
3434
for j in ${safe_modes} ; do
35+
for intra_aggr in 0 1 ; do
3536
if test "$j" = 1 ; then # test only in safe mode
3637
export PNETCDF_HINTS="romio_no_indep_rw=true"
38+
else
39+
export PNETCDF_HINTS=
40+
fi
41+
if test "$intra_aggr" = 1 ; then
42+
export PNETCDF_HINTS="${PNETCDF_HINTS};nc_num_aggrs_per_node=2"
3743
fi
3844
export PNETCDF_SAFE_MODE=$j
3945
# echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}"
@@ -136,6 +142,7 @@ for i in ${check_PROGRAMS} ; do
136142
# Validator does not support nc4
137143
fi
138144
done
145+
done
139146
done
140147

141148
rm -f ${OUTDIR}/pnetcdf-*.nc

src/drivers/common/mem_alloc.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ void ncmpii_add_mem_entry(void *buf,
132132
/*----< ncmpii_del_mem_entry() >---------------------------------------------*/
133133
/* delete a malloc entry from the table */
134134
static
135-
void ncmpii_del_mem_entry(void *buf)
135+
int ncmpii_del_mem_entry(void *buf)
136136
{
137+
int err=0;
138+
137139
#ifdef ENABLE_THREAD_SAFE
138140
pthread_mutex_lock(&lock);
139141
#endif
@@ -146,6 +148,7 @@ void ncmpii_del_mem_entry(void *buf)
146148
if (ret == NULL) {
147149
fprintf(stderr, "Error at line %d file %s: tfind() buf=%p\n",
148150
__LINE__,__FILE__,buf);
151+
err = 1;
149152
goto fn_exit;
150153
}
151154
/* free space for func and filename */
@@ -159,6 +162,7 @@ void ncmpii_del_mem_entry(void *buf)
159162
if (ret == NULL) {
160163
fprintf(stderr, "Error at line %d file %s: tdelete() buf=%p\n",
161164
__LINE__,__FILE__,buf);
165+
err = 1;
162166
goto fn_exit;
163167
}
164168
free(tmp);
@@ -170,7 +174,7 @@ void ncmpii_del_mem_entry(void *buf)
170174
#ifdef ENABLE_THREAD_SAFE
171175
pthread_mutex_unlock(&lock);
172176
#endif
173-
return;
177+
return err;
174178
}
175179
#endif
176180

@@ -246,7 +250,9 @@ void *NCI_Realloc_fn(void *ptr,
246250
}
247251

248252
#ifdef PNC_MALLOC_TRACE
249-
ncmpii_del_mem_entry(ptr);
253+
if (ncmpii_del_mem_entry(ptr) != 0)
254+
fprintf(stderr, "realloc failed in file %s func %s line %d\n",
255+
filename, func, lineno);
250256
#endif
251257
void *buf = (void *) realloc(ptr, size);
252258
#ifdef PNETCDF_DEBUG
@@ -275,7 +281,9 @@ void NCI_Free_fn(void *ptr,
275281
{
276282
if (ptr == NULL) return;
277283
#ifdef PNC_MALLOC_TRACE
278-
ncmpii_del_mem_entry(ptr);
284+
if (ncmpii_del_mem_entry(ptr) != 0)
285+
fprintf(stderr, "free failed in file %s func %s line %d\n",
286+
filename, func, lineno);
279287
#endif
280288
free(ptr);
281289
}

0 commit comments

Comments
 (0)