From f9773afdef6056d35bd345da9753f391a5a20631 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 22 May 2015 09:06:13 -0600 Subject: [PATCH 1/3] mv list alloc from malloc to bget --- src/pio_darray.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pio_darray.c b/src/pio_darray.c index 9123ec43d9a..bc6efbc57e4 100644 --- a/src/pio_darray.c +++ b/src/pio_darray.c @@ -1190,8 +1190,8 @@ int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, const int vid, void } if(tmp_bufsize>0){ - startlist[rrlen] = (PIO_Offset *) malloc(fndims * sizeof(PIO_Offset)); - countlist[rrlen] = (PIO_Offset *) malloc(fndims * sizeof(PIO_Offset)); + startlist[rrlen] = (PIO_Offset *) bget(fndims * sizeof(PIO_Offset)); + countlist[rrlen] = (PIO_Offset *) bget(fndims * sizeof(PIO_Offset)); for(int j=0;jfh, vid, rrlen, startlist, countlist, IOBUF, iodesc->llen, iodesc->basetype); for(i=0;i Date: Fri, 29 May 2015 15:11:52 -0600 Subject: [PATCH 2/3] adress an issue with writing partial not decomposed fields and saving requests --- src/pio_c_put_template.c | 10 + src/pio_put_nc.c | 650 +++++++++++++++++++++++++++++++++++++++ src/pionfput_mod.F90.in | 13 +- 3 files changed, 671 insertions(+), 2 deletions(-) diff --git a/src/pio_c_put_template.c b/src/pio_c_put_template.c index 3a52029c12b..b2b367de3f9 100644 --- a/src/pio_c_put_template.c +++ b/src/pio_c_put_template.c @@ -50,6 +50,16 @@ int PIO_function() #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_function(); diff --git a/src/pio_put_nc.c b/src/pio_put_nc.c index 3435e1c1b44..8be08ee8a61 100644 --- a/src/pio_put_nc.c +++ b/src/pio_put_nc.c @@ -53,6 +53,16 @@ int PIOc_put_vars_uchar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_uchar(file->fh, varid, start, count, stride, op, request);; @@ -124,6 +134,16 @@ int PIOc_put_vars_ushort (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_ushort(file->fh, varid, start, count, stride, op, request);; @@ -195,6 +215,16 @@ int PIOc_put_vars_ulonglong (int ncid, int varid, const PIO_Offset start[], cons #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_ulonglong(file->fh, varid, start, count, stride, op, request);; @@ -266,6 +296,16 @@ int PIOc_put_varm (int ncid, int varid, const PIO_Offset start[], const PIO_Offs #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm(file->fh, varid, start, count, stride, imap, buf, bufcount, buftype, request);; @@ -337,6 +377,16 @@ int PIOc_put_vars_uint (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_uint(file->fh, varid, start, count, stride, op, request);; @@ -408,6 +458,16 @@ int PIOc_put_varm_uchar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_uchar(file->fh, varid, start, count, stride, imap, op, request);; @@ -479,6 +539,16 @@ int PIOc_put_var_ushort (int ncid, int varid, const unsigned short *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_ushort(file->fh, varid, op, request);; @@ -550,6 +620,16 @@ int PIOc_put_var1_longlong (int ncid, int varid, const PIO_Offset index[], const #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_longlong(file->fh, varid, index, op, request);; @@ -621,6 +701,16 @@ int PIOc_put_vara_uchar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_uchar(file->fh, varid, start, count, op, request);; @@ -692,6 +782,16 @@ int PIOc_put_varm_short (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_short(file->fh, varid, start, count, stride, imap, op, request);; @@ -763,6 +863,16 @@ int PIOc_put_var1_long (int ncid, int varid, const PIO_Offset index[], const lon #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_long(file->fh, varid, index, ip, request);; @@ -834,6 +944,16 @@ int PIOc_put_vars_long (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_long(file->fh, varid, start, count, stride, op, request);; @@ -905,6 +1025,16 @@ int PIOc_put_var_short (int ncid, int varid, const short *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_short(file->fh, varid, op, request);; @@ -976,6 +1106,16 @@ int PIOc_put_vara_int (int ncid, int varid, const PIO_Offset start[], const PIO_ #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_int(file->fh, varid, start, count, op, request);; @@ -1047,6 +1187,16 @@ int PIOc_put_var1_ushort (int ncid, int varid, const PIO_Offset index[], const u #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_ushort(file->fh, varid, index, op, request);; @@ -1118,6 +1268,16 @@ int PIOc_put_vara_text (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_text(file->fh, varid, start, count, op, request);; @@ -1189,6 +1349,16 @@ int PIOc_put_varm_text (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_text(file->fh, varid, start, count, stride, imap, op, request);; @@ -1260,6 +1430,16 @@ int PIOc_put_varm_ushort (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_ushort(file->fh, varid, start, count, stride, imap, op, request);; @@ -1331,6 +1511,16 @@ int PIOc_put_var_ulonglong (int ncid, int varid, const unsigned long long *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_ulonglong(file->fh, varid, op, request);; @@ -1402,6 +1592,16 @@ int PIOc_put_var_int (int ncid, int varid, const int *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_int(file->fh, varid, op, request);; @@ -1473,6 +1673,16 @@ int PIOc_put_var_longlong (int ncid, int varid, const long long *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_longlong(file->fh, varid, op, request);; @@ -1544,6 +1754,16 @@ int PIOc_put_var_schar (int ncid, int varid, const signed char *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_schar(file->fh, varid, op, request);; @@ -1615,6 +1835,16 @@ int PIOc_put_var_uint (int ncid, int varid, const unsigned int *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_uint(file->fh, varid, op, request);; @@ -1686,6 +1916,16 @@ int PIOc_put_var (int ncid, int varid, const void *buf, PIO_Offset bufcount, MPI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var(file->fh, varid, buf, bufcount, buftype, request);; @@ -1757,6 +1997,16 @@ int PIOc_put_vara_ushort (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_ushort(file->fh, varid, start, count, op, request);; @@ -1828,6 +2078,16 @@ int PIOc_put_vars_short (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_short(file->fh, varid, start, count, stride, op, request);; @@ -1899,6 +2159,16 @@ int PIOc_put_vara_uint (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_uint(file->fh, varid, start, count, op, request);; @@ -1970,6 +2240,16 @@ int PIOc_put_vara_schar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_schar(file->fh, varid, start, count, op, request);; @@ -2041,6 +2321,16 @@ int PIOc_put_varm_ulonglong (int ncid, int varid, const PIO_Offset start[], cons #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_ulonglong(file->fh, varid, start, count, stride, imap, op, request);; @@ -2112,6 +2402,16 @@ int PIOc_put_var1_uchar (int ncid, int varid, const PIO_Offset index[], const un #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_uchar(file->fh, varid, index, op, request);; @@ -2183,6 +2483,16 @@ int PIOc_put_varm_int (int ncid, int varid, const PIO_Offset start[], const PIO_ #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_int(file->fh, varid, start, count, stride, imap, op, request);; @@ -2254,6 +2564,16 @@ int PIOc_put_vars_schar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_schar(file->fh, varid, start, count, stride, op, request);; @@ -2325,6 +2645,16 @@ int PIOc_put_var1 (int ncid, int varid, const PIO_Offset index[], const void *bu #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1(file->fh, varid, index, buf, bufcount, buftype, request);; @@ -2396,6 +2726,16 @@ int PIOc_put_vara_float (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_float(file->fh, varid, start, count, op, request);; @@ -2467,6 +2807,16 @@ int PIOc_put_var1_float (int ncid, int varid, const PIO_Offset index[], const fl #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_float(file->fh, varid, index, op, request);; @@ -2538,6 +2888,16 @@ int PIOc_put_varm_float (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_float(file->fh, varid, start, count, stride, imap, op, request);; @@ -2609,6 +2969,16 @@ int PIOc_put_var1_text (int ncid, int varid, const PIO_Offset index[], const cha #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_text(file->fh, varid, index, op, request);; @@ -2680,6 +3050,16 @@ int PIOc_put_vars_text (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_text(file->fh, varid, start, count, stride, op, request);; @@ -2751,6 +3131,16 @@ int PIOc_put_varm_long (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_long(file->fh, varid, start, count, stride, imap, op, request);; @@ -2822,6 +3212,16 @@ int PIOc_put_vars_double (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_double(file->fh, varid, start, count, stride, op, request);; @@ -2893,6 +3293,16 @@ int PIOc_put_vara_longlong (int ncid, int varid, const PIO_Offset start[], const #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_longlong(file->fh, varid, start, count, op, request);; @@ -2964,6 +3374,16 @@ int PIOc_put_var_double (int ncid, int varid, const double *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_double(file->fh, varid, op, request);; @@ -3035,6 +3455,16 @@ int PIOc_put_var_float (int ncid, int varid, const float *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_float(file->fh, varid, op, request);; @@ -3106,6 +3536,16 @@ int PIOc_put_var1_ulonglong (int ncid, int varid, const PIO_Offset index[], cons #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_ulonglong(file->fh, varid, index, op, request);; @@ -3177,6 +3617,16 @@ int PIOc_put_varm_uint (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_uint(file->fh, varid, start, count, stride, imap, op, request);; @@ -3248,6 +3698,16 @@ int PIOc_put_var1_uint (int ncid, int varid, const PIO_Offset index[], const uns #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_uint(file->fh, varid, index, op, request);; @@ -3319,6 +3779,16 @@ int PIOc_put_var1_int (int ncid, int varid, const PIO_Offset index[], const int #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_int(file->fh, varid, index, op, request);; @@ -3390,6 +3860,16 @@ int PIOc_put_vars_float (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_float(file->fh, varid, start, count, stride, op, request);; @@ -3461,6 +3941,16 @@ int PIOc_put_vara_short (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_short(file->fh, varid, start, count, op, request);; @@ -3532,6 +4022,16 @@ int PIOc_put_var1_schar (int ncid, int varid, const PIO_Offset index[], const si #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_schar(file->fh, varid, index, op, request);; @@ -3603,6 +4103,16 @@ int PIOc_put_vara_ulonglong (int ncid, int varid, const PIO_Offset start[], cons #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_ulonglong(file->fh, varid, start, count, op, request);; @@ -3674,6 +4184,16 @@ int PIOc_put_varm_double (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_double(file->fh, varid, start, count, stride, imap, op, request);; @@ -3745,6 +4265,16 @@ int PIOc_put_vara (int ncid, int varid, const PIO_Offset start[], const PIO_Offs #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara(file->fh, varid, start, count, buf, bufcount, buftype, request);; @@ -3816,6 +4346,16 @@ int PIOc_put_vara_long (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_long(file->fh, varid, start, count, op, request);; @@ -3887,6 +4427,16 @@ int PIOc_put_var1_double (int ncid, int varid, const PIO_Offset index[], const d #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_double(file->fh, varid, index, op, request);; @@ -3958,6 +4508,16 @@ int PIOc_put_varm_schar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_schar(file->fh, varid, start, count, stride, imap, op, request);; @@ -4029,6 +4589,16 @@ int PIOc_put_var_text (int ncid, int varid, const char *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_text(file->fh, varid, op, request);; @@ -4100,6 +4670,16 @@ int PIOc_put_vars_int (int ncid, int varid, const PIO_Offset start[], const PIO_ #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_int(file->fh, varid, start, count, stride, op, request);; @@ -4171,6 +4751,16 @@ int PIOc_put_var1_short (int ncid, int varid, const PIO_Offset index[], const sh #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var1_short(file->fh, varid, index, op, request);; @@ -4242,6 +4832,16 @@ int PIOc_put_vars_longlong (int ncid, int varid, const PIO_Offset start[], const #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars_longlong(file->fh, varid, start, count, stride, op, request);; @@ -4313,6 +4913,16 @@ int PIOc_put_vara_double (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vara_double(file->fh, varid, start, count, op, request);; @@ -4384,6 +4994,16 @@ int PIOc_put_vars (int ncid, int varid, const PIO_Offset start[], const PIO_Offs #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_vars(file->fh, varid, start, count, stride, buf, bufcount, buftype, request);; @@ -4455,6 +5075,16 @@ int PIOc_put_var_uchar (int ncid, int varid, const unsigned char *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_uchar(file->fh, varid, op, request);; @@ -4526,6 +5156,16 @@ int PIOc_put_var_long (int ncid, int varid, const long *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_var_long(file->fh, varid, op, request);; @@ -4597,6 +5237,16 @@ int PIOc_put_varm_longlong (int ncid, int varid, const PIO_Offset start[], const #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; + if(vdesc->request != NC_REQ_NULL){ + int thisreq; + if(ios->io_rank==0){ + thisreq=vdesc->request; + }else{ + thisreq=NC_REQ_NULL; + } + ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); + vdesc->request = NC_REQ_NULL; + } if(ios->io_rank==0){ request = &(vdesc->request); ierr = ncmpi_bput_varm_longlong(file->fh, varid, start, count, stride, imap, op, request);; diff --git a/src/pionfput_mod.F90.in b/src/pionfput_mod.F90.in index 55d1145049f..e555010cd9a 100644 --- a/src/pionfput_mod.F90.in +++ b/src/pionfput_mod.F90.in @@ -109,9 +109,10 @@ contains type (File_desc_t), intent(inout) :: File integer, intent(in) :: varid, index(:) character(len=*), intent(in) :: ival + character, allocatable :: cval(:) + integer :: i #ifdef DOTHIS integer :: clen, i - character, allocatable :: cval(:) integer(C_SIZE_T), allocatable :: cindex(:) interface integer(C_INT) function PIOc_put_var1_text(ncid, varid, index, op) & @@ -153,7 +154,14 @@ contains allocate(count(ndims)) count = 1 count(1) = len(ival) - ierr = put_vara_1d_text(File,varid, index, count, (/ival/)) + allocate(cval(count(1)+1)) + cval = C_NULL_CHAR + do i=1,len_trim(ival) + cval(i) = ival(i:i) + end do + +!print *,__FILE__,__LINE__,index,count,ival + ierr = put_vara_1d_text(File,varid, index, count, cval) deallocate(count) #endif end function put_var1_text @@ -473,6 +481,7 @@ contains sd = size(ival) allocate(cval(clen*sd)) call Fstring2Cstring_{DIMS}d (ival, cval) + ierr = PIOc_put_vara_text(file%fh, varid-1, cstart, ccount, cval) deallocate(cval, cstart, ccount) From e21308e76a7dc6abc4a1d6a202b84db121877090 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 1 Jun 2015 12:56:07 -0600 Subject: [PATCH 3/3] another rework of the request handling mechanism --- src/pio.h | 8 +- src/pio_c_put_template.c | 18 +- src/pio_darray.c | 75 +- src/pio_file.c | 16 +- src/pio_nc.c | 3 - src/pio_put_nc.c | 1430 ++++++++++++++++---------------------- 6 files changed, 636 insertions(+), 914 deletions(-) diff --git a/src/pio.h b/src/pio.h index 85ffda93ee2..9c90b6b14e5 100644 --- a/src/pio.h +++ b/src/pio.h @@ -36,7 +36,7 @@ #define PIO_OFFSET MPI_OFFSET #define PIO_Offset MPI_Offset #define PIO_MAX_VARS NC_MAX_VARS -#define PIO_MAX_REQUESTS 100*PIO_MAX_VARS +#define PIO_MAX_REQUESTS 100 /** @@ -50,11 +50,9 @@ typedef struct var_desc_t { int record; int ndims; - int type; - bool distributed; - int request; // used for pnetcdf iput calls - int fillrequest; //used for fill in pnetcdf iput for subset rearranger + int request[PIO_MAX_REQUESTS]; // used for pnetcdf iput calls + int nreqs; void *fillbuf; void *iobuf; diff --git a/src/pio_c_put_template.c b/src/pio_c_put_template.c index b2b367de3f9..5e5c7c4c5e8 100644 --- a/src/pio_c_put_template.c +++ b/src/pio_c_put_template.c @@ -50,21 +50,17 @@ int PIO_function() #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; } if(ios->io_rank==0){ - request = &(vdesc->request); ierr = ncmpi_function(); }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; diff --git a/src/pio_darray.c b/src/pio_darray.c index 656fc05f3c7..b7cf3bc0f13 100644 --- a/src/pio_darray.c +++ b/src/pio_darray.c @@ -270,17 +270,18 @@ void compute_buffer_init(iosystem_desc_t ios) // printf("%s %d %d %ld %ld\n",__FILE__,__LINE__,ios->io_rank,iodesc->llen, tdsize); // ierr = ncmpi_put_varn_all(ncid, vid, iodesc->maxregions, startlist, countlist, // IOBUF, iodesc->llen, iodesc->basetype); - - if(vdesc->request != NC_REQ_NULL){ - printf("%s %d %d\n",__FILE__,__LINE__,vid); + int reqn=0; + + while(vdesc->request[reqn] != NC_REQ_NULL){ + reqn++; } - vdesc->distributed = true; + ierr = ncmpi_bput_varn(ncid, vid, rrcnt, startlist, countlist, - IOBUF, iodesc->llen, iodesc->basetype, &(vdesc->request)); - if(vdesc->request == NC_REQ_NULL){ - vdesc->request = PIO_REQ_NULL; //keeps wait calls in sync + IOBUF, iodesc->llen, iodesc->basetype, vdesc->request+reqn); + if(vdesc->request[reqn] == NC_REQ_NULL){ + vdesc->request[reqn] = PIO_REQ_NULL; //keeps wait calls in sync } - + vdesc->nreqs = reqn; // printf("%s %d %X %d\n",__FILE__,__LINE__,IOBUF,request); for(i=0;irequest != NC_REQ_NULL){ - printf("%s %d %d\n",__FILE__,__LINE__,vid[nv]); - } - vdesc->distributed = true; - + int reqn=0; + while(vdesc->request[reqn] != NC_REQ_NULL){ + reqn++; + } ierr = ncmpi_iput_varn(ncid, vid[nv], rrcnt, startlist, countlist, - bufptr, llen, basetype, &(vdesc->request)); + bufptr, llen, basetype, vdesc->request+reqn); /* ierr = ncmpi_bput_varn(ncid, vid[nv], rrcnt, startlist, countlist, bufptr, llen, basetype, &(vdesc->request)); */ - if(vdesc->request == NC_REQ_NULL){ - vdesc->request = PIO_REQ_NULL; //keeps wait calls in sync + if(vdesc->request[reqn] == NC_REQ_NULL){ + vdesc->request[reqn] = PIO_REQ_NULL; //keeps wait calls in sync } - + vdesc->nreqs = reqn; + printf("%s %d %d %d\n",__FILE__,__LINE__,vdesc->nreqs,vdesc->request[reqn-1]); } for(i=0;imaxfillregions, iodesc->fillregion, iodesc->holegridsize, iodesc->holegridsize, iodesc->num_aiotasks, vdesc0->fillbuf, frame); - for(int nv=0;nvvarlist+vid[nv]; - vdesc->fillrequest = vdesc->request; - vdesc->request = NC_REQ_NULL; - } - } ierr = pio_write_darray_multi_nc(file, nvars, vid, @@ -794,7 +789,7 @@ int PIOc_write_darray_multi(const int ncid, const int vid[], const int ioid, con wmb = wmb->next; } /* flush the previous record before starting a new one. this is collective */ - if((vdesc->request != NC_REQ_NULL) || + if((vdesc->request[0] != NC_REQ_NULL) || (wmb->frame != NULL && vdesc->record != wmb->frame[0])){ needsflush = 2; // flush to disk } @@ -1321,31 +1316,24 @@ int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) #ifdef MPIO_ONESIDED /*onesided optimization requires that all of the requests in a wait_all call represent a contiguous block of data in the file */ - if(rcnt>0 && (prev_type != vdesc->type || - prev_dist != vdesc->distributed || - prev_record != vdesc->record || - (vdesc->request == NC_REQ_NULL && - vdesc->fillrequest == NC_REQ_NULL))){ + if(rcnt>0 && (prev_record != vdesc->record || + vdesc->nreqs==0)){ if(file->iosystem->io_rank==0) printf("%s %d %d\n",__FILE__,__LINE__,rcnt); ierr = ncmpi_wait_all(file->fh, rcnt, request,status); rcnt=0; } prev_record = vdesc->record; - prev_dist = vdesc->distributed; - prev_type = vdesc->type; #endif - // printf("%s %d %d %d %d %d \n",__FILE__,__LINE__,i,rcnt,vdesc->request,vdesc->fillrequest); - - if(vdesc->request != NC_REQ_NULL){ - // if(file->iosystem->io_rank==0) printf("%s %d %d %d %d %d %d\n",__FILE__,__LINE__,i,vdesc->request,vdesc->distributed, vdesc->record, vdesc->type); - request[rcnt++] = max(vdesc->request,NC_REQ_NULL); - vdesc->request = NC_REQ_NULL; - } - if(vdesc->fillrequest != NC_REQ_NULL){ - //if(file->iosystem->io_rank==0) printf("%s %d %d %d %d\n",__FILE__,__LINE__,i,vdesc->fillrequest, vdesc->distributed); - request[rcnt++]=max(vdesc->fillrequest,NC_REQ_NULL); - vdesc->fillrequest = NC_REQ_NULL; + // printf("%s %d %d %d %d %d \n",__FILE__,__LINE__,i,rcnt,vdesc->request,vdesc->fillrequest); + int reqcnt=0; + while(vdesc->request[reqcnt] != NC_REQ_NULL) { + // if(file->iosystem->io_rank==0) printf("%s %d %d %d %d %d %d\n",__FILE__,__LINE__,i,vdesc->request,vdesc->distributed, vdesc->record, vdesc->type); + printf("%s %d %d %d\n",__FILE__,__LINE__,i,vdesc->request[0]); + request[rcnt++] = max(vdesc->request[reqcnt],NC_REQ_NULL); + vdesc->request[reqcnt] = NC_REQ_NULL; + reqcnt++; } + vdesc->nreqs=0; // if(file->iosystem->io_rank < 2) printf("%s %d varid=%d\n",__FILE__,__LINE__,i); #ifdef FLUSH_EVERY_VAR ierr = ncmpi_wait_all(file->fh, rcnt, request,status); @@ -1353,6 +1341,9 @@ int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) #endif } + if(file->iosystem->io_rank==0){ + printf("%s %d %d\n",__FILE__,__LINE__,rcnt); + } if(rcnt>0){ if(file->iosystem->io_rank==0){ printf("%s %d %d\n",__FILE__,__LINE__,rcnt); diff --git a/src/pio_file.c b/src/pio_file.c index ba8aa17850c..a06898c2434 100644 --- a/src/pio_file.c +++ b/src/pio_file.c @@ -43,10 +43,10 @@ int PIOc_openfile(const int iosysid, int *ncidp, int *iotype, file->varlist[i].record = -1; file->varlist[i].ndims = -1; #ifdef _PNETCDF - file->varlist[i].request = NC_REQ_NULL; - file->varlist[i].fillrequest = NC_REQ_NULL; - file->varlist[i].distributed = false; - file->varlist[i].type = 0; + for(int req=0;reqvarlist[i].request[req] = NC_REQ_NULL; + } + file->varlist[i].nreqs=0; #endif file->varlist[i].fillbuf = NULL; file->varlist[i].iobuf = NULL; @@ -164,10 +164,10 @@ int PIOc_createfile(const int iosysid, int *ncidp, int *iotype, file->varlist[i].record = -1; file->varlist[i].ndims = -1; #ifdef _PNETCDF - file->varlist[i].request = NC_REQ_NULL; - file->varlist[i].fillrequest = NC_REQ_NULL; - file->varlist[i].distributed = false; - file->varlist[i].type = 0; + for(int req=0;reqvarlist[i].request[req] = NC_REQ_NULL; + } + file->varlist[i].nreqs=0; #endif file->varlist[i].fillbuf = NULL; file->varlist[i].iobuf = NULL; diff --git a/src/pio_nc.c b/src/pio_nc.c index 30ce67c8aae..b532b40fa88 100644 --- a/src/pio_nc.c +++ b/src/pio_nc.c @@ -347,11 +347,8 @@ int PIOc_def_var (int ncid, const char *name, nc_type xtype, int ndims, const in ierr = iotype_error(file->iotype,__FILE__,__LINE__); } } -if(ierr != PIO_NOERR) - printf("%s %d %s\n",__FILE__,__LINE__,name); ierr = check_netcdf(file, ierr, errstr,__LINE__); mpierr = MPI_Bcast(varidp , 1, MPI_INT, ios->ioroot, ios->my_comm); - file->varlist[*varidp].type = xtype; return ierr; } diff --git a/src/pio_put_nc.c b/src/pio_put_nc.c index 8be08ee8a61..5bda3ea0287 100644 --- a/src/pio_put_nc.c +++ b/src/pio_put_nc.c @@ -53,21 +53,17 @@ int PIOc_put_vars_uchar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_uchar(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -134,21 +130,17 @@ int PIOc_put_vars_ushort (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_ushort(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -215,21 +207,17 @@ int PIOc_put_vars_ulonglong (int ncid, int varid, const PIO_Offset start[], cons #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_ulonglong(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -296,21 +284,17 @@ int PIOc_put_varm (int ncid, int varid, const PIO_Offset start[], const PIO_Offs #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm(file->fh, varid, start, count, stride, imap, buf, bufcount, buftype, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -377,21 +361,17 @@ int PIOc_put_vars_uint (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_uint(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -458,21 +438,17 @@ int PIOc_put_varm_uchar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_uchar(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -539,21 +515,17 @@ int PIOc_put_var_ushort (int ncid, int varid, const unsigned short *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_ushort(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -620,21 +592,17 @@ int PIOc_put_var1_longlong (int ncid, int varid, const PIO_Offset index[], const #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_longlong(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -701,21 +669,17 @@ int PIOc_put_vara_uchar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_uchar(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -782,21 +746,17 @@ int PIOc_put_varm_short (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_short(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -863,21 +823,17 @@ int PIOc_put_var1_long (int ncid, int varid, const PIO_Offset index[], const lon #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_long(file->fh, varid, index, ip, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -944,21 +900,17 @@ int PIOc_put_vars_long (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_long(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1025,21 +977,17 @@ int PIOc_put_var_short (int ncid, int varid, const short *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_short(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1106,21 +1054,17 @@ int PIOc_put_vara_int (int ncid, int varid, const PIO_Offset start[], const PIO_ #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_int(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1187,21 +1131,17 @@ int PIOc_put_var1_ushort (int ncid, int varid, const PIO_Offset index[], const u #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_ushort(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1268,21 +1208,17 @@ int PIOc_put_vara_text (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_text(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1349,21 +1285,17 @@ int PIOc_put_varm_text (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_text(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1430,21 +1362,17 @@ int PIOc_put_varm_ushort (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_ushort(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1511,21 +1439,17 @@ int PIOc_put_var_ulonglong (int ncid, int varid, const unsigned long long *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_ulonglong(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1592,21 +1516,17 @@ int PIOc_put_var_int (int ncid, int varid, const int *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_int(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1673,21 +1593,17 @@ int PIOc_put_var_longlong (int ncid, int varid, const long long *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_longlong(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1754,21 +1670,17 @@ int PIOc_put_var_schar (int ncid, int varid, const signed char *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_schar(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1835,21 +1747,17 @@ int PIOc_put_var_uint (int ncid, int varid, const unsigned int *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_uint(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1916,21 +1824,17 @@ int PIOc_put_var (int ncid, int varid, const void *buf, PIO_Offset bufcount, MPI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var(file->fh, varid, buf, bufcount, buftype, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -1997,21 +1901,17 @@ int PIOc_put_vara_ushort (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_ushort(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2078,21 +1978,17 @@ int PIOc_put_vars_short (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_short(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2159,21 +2055,17 @@ int PIOc_put_vara_uint (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_uint(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2240,21 +2132,17 @@ int PIOc_put_vara_schar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_schar(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2321,21 +2209,17 @@ int PIOc_put_varm_ulonglong (int ncid, int varid, const PIO_Offset start[], cons #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_ulonglong(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2402,21 +2286,17 @@ int PIOc_put_var1_uchar (int ncid, int varid, const PIO_Offset index[], const un #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_uchar(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2483,21 +2363,17 @@ int PIOc_put_varm_int (int ncid, int varid, const PIO_Offset start[], const PIO_ #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_int(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2564,21 +2440,17 @@ int PIOc_put_vars_schar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_schar(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2645,21 +2517,17 @@ int PIOc_put_var1 (int ncid, int varid, const PIO_Offset index[], const void *bu #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1(file->fh, varid, index, buf, bufcount, buftype, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2726,21 +2594,17 @@ int PIOc_put_vara_float (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_float(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2807,21 +2671,17 @@ int PIOc_put_var1_float (int ncid, int varid, const PIO_Offset index[], const fl #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_float(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2888,21 +2748,17 @@ int PIOc_put_varm_float (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_float(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -2969,21 +2825,17 @@ int PIOc_put_var1_text (int ncid, int varid, const PIO_Offset index[], const cha #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_text(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3050,21 +2902,17 @@ int PIOc_put_vars_text (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_text(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3131,21 +2979,17 @@ int PIOc_put_varm_long (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_long(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3212,21 +3056,17 @@ int PIOc_put_vars_double (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_double(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3293,21 +3133,17 @@ int PIOc_put_vara_longlong (int ncid, int varid, const PIO_Offset start[], const #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_longlong(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3374,21 +3210,17 @@ int PIOc_put_var_double (int ncid, int varid, const double *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_double(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3455,21 +3287,17 @@ int PIOc_put_var_float (int ncid, int varid, const float *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_float(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3536,21 +3364,17 @@ int PIOc_put_var1_ulonglong (int ncid, int varid, const PIO_Offset index[], cons #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_ulonglong(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3617,21 +3441,17 @@ int PIOc_put_varm_uint (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_uint(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3698,21 +3518,17 @@ int PIOc_put_var1_uint (int ncid, int varid, const PIO_Offset index[], const uns #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_uint(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3779,21 +3595,17 @@ int PIOc_put_var1_int (int ncid, int varid, const PIO_Offset index[], const int #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_int(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3860,21 +3672,17 @@ int PIOc_put_vars_float (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_float(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -3941,21 +3749,17 @@ int PIOc_put_vara_short (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_short(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4022,21 +3826,17 @@ int PIOc_put_var1_schar (int ncid, int varid, const PIO_Offset index[], const si #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_schar(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4103,21 +3903,17 @@ int PIOc_put_vara_ulonglong (int ncid, int varid, const PIO_Offset start[], cons #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_ulonglong(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4184,21 +3980,17 @@ int PIOc_put_varm_double (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_double(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4265,21 +4057,17 @@ int PIOc_put_vara (int ncid, int varid, const PIO_Offset start[], const PIO_Offs #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara(file->fh, varid, start, count, buf, bufcount, buftype, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4346,21 +4134,17 @@ int PIOc_put_vara_long (int ncid, int varid, const PIO_Offset start[], const PIO #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_long(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4427,21 +4211,17 @@ int PIOc_put_var1_double (int ncid, int varid, const PIO_Offset index[], const d #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_double(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4508,21 +4288,17 @@ int PIOc_put_varm_schar (int ncid, int varid, const PIO_Offset start[], const PI #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_schar(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4589,21 +4365,17 @@ int PIOc_put_var_text (int ncid, int varid, const char *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_text(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4670,21 +4442,17 @@ int PIOc_put_vars_int (int ncid, int varid, const PIO_Offset start[], const PIO_ #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_int(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4751,21 +4519,17 @@ int PIOc_put_var1_short (int ncid, int varid, const PIO_Offset index[], const sh #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var1_short(file->fh, varid, index, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4832,21 +4596,17 @@ int PIOc_put_vars_longlong (int ncid, int varid, const PIO_Offset start[], const #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars_longlong(file->fh, varid, start, count, stride, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4913,21 +4673,17 @@ int PIOc_put_vara_double (int ncid, int varid, const PIO_Offset start[], const P #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vara_double(file->fh, varid, start, count, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -4994,21 +4750,17 @@ int PIOc_put_vars (int ncid, int varid, const PIO_Offset start[], const PIO_Offs #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_vars(file->fh, varid, start, count, stride, buf, bufcount, buftype, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -5075,21 +4827,17 @@ int PIOc_put_var_uchar (int ncid, int varid, const unsigned char *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_uchar(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -5156,21 +4904,17 @@ int PIOc_put_var_long (int ncid, int varid, const long *op) #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_var_long(file->fh, varid, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break; @@ -5237,21 +4981,17 @@ int PIOc_put_varm_longlong (int ncid, int varid, const PIO_Offset start[], const #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: vdesc = file->varlist + varid; - if(vdesc->request != NC_REQ_NULL){ - int thisreq; - if(ios->io_rank==0){ - thisreq=vdesc->request; - }else{ - thisreq=NC_REQ_NULL; - } - ncmpi_wait_all(file->fh, 1, &thisreq, &ierr); - vdesc->request = NC_REQ_NULL; - } - if(ios->io_rank==0){ - request = &(vdesc->request); + int reqn; + reqn = vdesc->nreqs; + request = vdesc->request; + while(*request != NC_REQ_NULL){ + reqn++; + request = vdesc->request+reqn; + } + if(ios->io_rank==0){ ierr = ncmpi_bput_varm_longlong(file->fh, varid, start, count, stride, imap, op, request);; }else{ - vdesc->request = PIO_REQ_NULL; + *request = PIO_REQ_NULL; } flush_output_buffer(file, false, 0); break;