mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
removed rest of LOCKNUMREC and _CRAYMPP obsolete macros
This commit is contained in:
parent
822b5f663e
commit
c7e022f7e5
@ -7,6 +7,13 @@ This file contains a high-level description of this package's evolution. Release
|
||||
|
||||
## 4.7.1 - TBD
|
||||
|
||||
* [Bug Fix] Remove obsolete _CRAYMPP and LOCKNUMREC macros from
|
||||
code. Also brought documentation up to date in man page. These macros
|
||||
were used in ancient times, before modern parallel I/O systems were
|
||||
developed. Programmers interested in parallel I/O should see
|
||||
nc_open_par() and nc_create_par().
|
||||
See [GitHub #1436](https://github.com/Unidata/netcdf-c/issues/1459)
|
||||
|
||||
* [Bug Fix] Reverted nccopy behavior so that if no -c parameters
|
||||
are given, then any default chunking is left to the netcdf-c library
|
||||
to decide.
|
||||
|
@ -221,15 +221,6 @@ NC_lookupvar(NC3_INFO* ncp, int varid, NC_var **varp);
|
||||
#define IS_RECVAR(vp) \
|
||||
((vp)->shape != NULL ? (*(vp)->shape == NC_UNLIMITED) : 0 )
|
||||
|
||||
#ifdef LOCKNUMREC
|
||||
/*
|
||||
* typedef SHMEM type
|
||||
* for whenever the SHMEM functions can handle other than shorts
|
||||
*/
|
||||
typedef unsigned short int ushmem_t;
|
||||
typedef short int shmem_t;
|
||||
#endif
|
||||
|
||||
struct NC3_INFO {
|
||||
/* contains the previous NC during redef. */
|
||||
NC3_INFO *old;
|
||||
@ -258,18 +249,6 @@ struct NC3_INFO {
|
||||
NC_dimarray dims;
|
||||
NC_attrarray attrs;
|
||||
NC_vararray vars;
|
||||
#ifdef LOCKNUMREC
|
||||
/* size and named indexes for the lock array protecting NC.numrecs */
|
||||
# define LOCKNUMREC_DIM 4
|
||||
# define LOCKNUMREC_VALUE 0
|
||||
# define LOCKNUMREC_LOCK 1
|
||||
# define LOCKNUMREC_SERVING 2
|
||||
# define LOCKNUMREC_BASEPE 3
|
||||
/* Used on Cray T3E MPP to maintain the
|
||||
* integrity of numrecs for an unlimited dimension
|
||||
*/
|
||||
ushmem_t lock[LOCKNUMREC_DIM];
|
||||
#endif
|
||||
};
|
||||
|
||||
#define NC_readonly(ncp) \
|
||||
@ -305,7 +284,6 @@ struct NC3_INFO {
|
||||
#define NC_doNsync(ncp) \
|
||||
fIsSet((ncp)->flags, NC_NSYNC)
|
||||
|
||||
#ifndef LOCKNUMREC
|
||||
# define NC_get_numrecs(nc3i) \
|
||||
((nc3i)->numrecs)
|
||||
|
||||
@ -314,11 +292,6 @@ struct NC3_INFO {
|
||||
|
||||
# define NC_increase_numrecs(nc3i, nrecs) \
|
||||
{if((nrecs) > (nc3i)->numrecs) ((nc3i)->numrecs = (nrecs));}
|
||||
#else
|
||||
size_t NC_get_numrecs(const NC3_INFO *nc3i);
|
||||
void NC_set_numrecs(NC3_INFO *nc3i, size_t nrecs);
|
||||
void NC_increase_numrecs(NC3_INFO *nc3i, size_t nrecs);
|
||||
#endif
|
||||
|
||||
/* Begin defined in nc.c */
|
||||
|
||||
|
@ -940,21 +940,6 @@ NC_endef(NC3_INFO *ncp,
|
||||
return ncio_sync(ncp->nciop);
|
||||
}
|
||||
|
||||
#ifdef LOCKNUMREC
|
||||
static int
|
||||
NC_init_pe(NC *ncp, int basepe) {
|
||||
if (basepe < 0 || basepe >= _num_pes()) {
|
||||
return NC_EINVAL; /* invalid base pe */
|
||||
}
|
||||
/* initialize common values */
|
||||
ncp->lock[LOCKNUMREC_VALUE] = 0;
|
||||
ncp->lock[LOCKNUMREC_LOCK] = 0;
|
||||
ncp->lock[LOCKNUMREC_SERVING] = 0;
|
||||
ncp->lock[LOCKNUMREC_BASEPE] = basepe;
|
||||
return NC_NOERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Compute the expected size of the file.
|
||||
@ -1552,37 +1537,6 @@ NC3_set_fill(int ncid,
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
#ifdef LOCKNUMREC
|
||||
|
||||
/* create function versions of the NC_*_numrecs macros */
|
||||
size_t
|
||||
NC_get_numrecs(const NC *nc3) {
|
||||
shmem_t numrec;
|
||||
shmem_short_get(&numrec, (shmem_t *) nc3->lock + LOCKNUMREC_VALUE, 1,
|
||||
nc3->lock[LOCKNUMREC_BASEPE]);
|
||||
return (size_t) numrec;
|
||||
}
|
||||
|
||||
void
|
||||
NC_set_numrecs(NC *nc3, size_t nrecs)
|
||||
{
|
||||
shmem_t numrec = (shmem_t) nrecs;
|
||||
/* update local value too */
|
||||
nc3->lock[LOCKNUMREC_VALUE] = (ushmem_t) numrec;
|
||||
shmem_short_put((shmem_t *) nc3->lock + LOCKNUMREC_VALUE, &numrec, 1,
|
||||
nc3->lock[LOCKNUMREC_BASEPE]);
|
||||
}
|
||||
|
||||
void NC_increase_numrecs(NC *nc3, size_t nrecs)
|
||||
{
|
||||
/* this is only called in one place that's already protected
|
||||
* by a lock ... so don't worry about it */
|
||||
if (nrecs > NC_get_numrecs(nc3))
|
||||
NC_set_numrecs(nc3, nrecs);
|
||||
}
|
||||
|
||||
#endif /* LOCKNUMREC */
|
||||
|
||||
/**
|
||||
* This obsolete function is retained for backward compatibility. It
|
||||
* does nothing.
|
||||
|
@ -28,13 +28,6 @@ dnl
|
||||
#include "ncx.h"
|
||||
#include "fbits.h"
|
||||
#include "onstack.h"
|
||||
#ifdef LOCKNUMREC
|
||||
# include <mpp/shmem.h> /* for SGI/Cray SHMEM routines */
|
||||
# ifdef LN_TEST
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#undef MIN /* system may define MIN somewhere and complain */
|
||||
#define MIN(mm,nn) (((mm) < (nn)) ? (mm) : (nn))
|
||||
@ -403,40 +396,6 @@ static int
|
||||
NCvnrecs(NC3_INFO* ncp, size_t numrecs)
|
||||
{
|
||||
int status = NC_NOERR;
|
||||
#ifdef LOCKNUMREC
|
||||
ushmem_t myticket = 0, nowserving = 0;
|
||||
ushmem_t numpe = (ushmem_t) _num_pes();
|
||||
|
||||
/* get ticket and wait */
|
||||
myticket = shmem_short_finc((shmem_t *) ncp->lock + LOCKNUMREC_LOCK,
|
||||
ncp->lock[LOCKNUMREC_BASEPE]);
|
||||
#ifdef LN_TEST
|
||||
fprintf(stderr,"%d of %d : ticket = %hu\n",
|
||||
_my_pe(), _num_pes(), myticket);
|
||||
#endif
|
||||
do {
|
||||
shmem_short_get((shmem_t *) &nowserving,
|
||||
(shmem_t *) ncp->lock + LOCKNUMREC_SERVING, 1,
|
||||
ncp->lock[LOCKNUMREC_BASEPE]);
|
||||
#ifdef LN_TEST
|
||||
fprintf(stderr,"%d of %d : serving = %hu\n",
|
||||
_my_pe(), _num_pes(), nowserving);
|
||||
#endif
|
||||
/* work-around for non-unique tickets */
|
||||
if (nowserving > myticket && nowserving < myticket + numpe ) {
|
||||
/* get a new ticket ... you've been bypassed */
|
||||
/* and handle the unlikely wrap-around effect */
|
||||
myticket = shmem_short_finc(
|
||||
(shmem_t *) ncp->lock + LOCKNUMREC_LOCK,
|
||||
ncp->lock[LOCKNUMREC_BASEPE]);
|
||||
#ifdef LN_TEST
|
||||
fprintf(stderr,"%d of %d : new ticket = %hu\n",
|
||||
_my_pe(), _num_pes(), myticket);
|
||||
#endif
|
||||
}
|
||||
} while(nowserving != myticket);
|
||||
/* now our turn to check & update value */
|
||||
#endif
|
||||
|
||||
if(numrecs > NC_get_numrecs(ncp))
|
||||
{
|
||||
@ -519,11 +478,6 @@ NCvnrecs(NC3_INFO* ncp, size_t numrecs)
|
||||
|
||||
}
|
||||
common_return:
|
||||
#ifdef LOCKNUMREC
|
||||
/* finished with our lock - increment serving number */
|
||||
(void) shmem_short_finc((shmem_t *) ncp->lock + LOCKNUMREC_SERVING,
|
||||
ncp->lock[LOCKNUMREC_BASEPE]);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user