2014-08-27 02:28:38 +08:00
|
|
|
## This is a automake file, part of Unidata's netCDF package.
|
2018-12-07 05:29:57 +08:00
|
|
|
# Copyright 2008, see the COPYRIGHT file for more information.
|
2014-08-27 02:28:38 +08:00
|
|
|
|
|
|
|
# This Makefile controls the building of the dispatch layer of the
|
|
|
|
# netCDF library. The dispatch layer decides whether to call the
|
|
|
|
# netcdf-classic code, netcdf-4 code, nc3 dap code, or nc4 dap
|
|
|
|
# code. It also contains code that sit above the dispatch layer, like
|
|
|
|
# the v2 API.
|
|
|
|
|
|
|
|
# Put together AM_CPPFLAGS and AM_LDFLAGS.
|
|
|
|
include $(top_srcdir)/lib_flags.am
|
|
|
|
|
|
|
|
# This is our output, the dispatch convenience library.
|
|
|
|
noinst_LTLIBRARIES = libdispatch.la
|
|
|
|
libdispatch_la_CPPFLAGS = ${AM_CPPFLAGS}
|
|
|
|
|
|
|
|
# The source files.
|
2022-04-24 19:41:14 +08:00
|
|
|
libdispatch_la_SOURCES = dcopy.c dfile.c ddim.c datt.c dattinq.c \
|
|
|
|
dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c dvarinq.c \
|
|
|
|
dinternal.c ddispatch.c dutf8.c nclog.c dstring.c ncuri.c nclist.c \
|
|
|
|
ncbytes.c nchashmap.c nctime.c nc.c nclistmgr.c dauth.c doffsets.c \
|
|
|
|
dpathmgr.c dutil.c dreadonly.c dnotnc4.c dnotnc3.c dinfermodel.c \
|
|
|
|
daux.c dinstance.c dcrc32.c dcrc32.h dcrc64.c ncexhash.c ncxcache.c \
|
Improve performance of the nc_reclaim_data and nc_copy_data functions.
re: Issue https://github.com/Unidata/netcdf-c/issues/2685
re: PR https://github.com/Unidata/netcdf-c/pull/2179
As noted in PR https://github.com/Unidata/netcdf-c/pull/2179,
the old code did not allow for reclaiming instances of types,
nor for properly copying them. That PR provided new functions
capable of reclaiming/copying instances of arbitrary types.
However, as noted by Issue https://github.com/Unidata/netcdf-c/issues/2685, using these
most general functions resulted in a significant performance
degradation, even for common cases.
This PR attempts to mitigate the cost of using the general
reclaim/copy functions in two ways.
First, the previous functions operating at the top level by
using ncid and typeid arguments. These functions were augmented
with equivalent versions that used the netcdf-c library internal
data structures to allow direct access to needed information.
These new functions are used internally to the library.
The second mitigation involves optimizing the internal functions
by providing early tests for common cases. This avoids
unnecessary recursive function calls.
The overall result is a significant improvement in speed by a
factor of roughly twenty -- your mileage may vary. These
optimized functions are still not as fast as the original (more
limited) functions, but they are getting close. Additional optimizations are
possible. But the cost is a significant "uglification" of the
code that I deemed a step too far, at least for now.
## Misc. Changes
1. Added a test case to check the proper reclamation/copy of complex types.
2. Found and fixed some places where nc_reclaim/copy should have been used.
3. Replaced, in the netcdf-c library, (almost all) occurrences of nc_reclaim_copy with calls to NC_reclaim/copy. This plus the optimizations is the primary speed-up mechanism.
4. In DAP4, the metadata is held in a substrate in-memory file; this required some changes so that the reclaim/copy code accessed that substrate dispatcher rather than the DAP4 dispatcher.
5. Re-factored and isolated the code that computes if a type is (transitively) variable-sized or not.
6. Clean up the reclamation code in ncgen; adding the use of nc_reclaim exposed some memory problems.
2023-05-21 07:11:25 +08:00
|
|
|
ncjson.c ds3util.c dparallel.c dmissing.c dinstance_intern.c
|
2022-04-02 12:11:28 +08:00
|
|
|
|
2017-02-17 05:27:54 +08:00
|
|
|
# Add the utf8 codebase
|
|
|
|
libdispatch_la_SOURCES += utf8proc.c utf8proc.h
|
|
|
|
|
2018-12-06 10:20:43 +08:00
|
|
|
# The rc code is currently only used by libdap2 and libdap4,
|
|
|
|
# but in the future, it will be expanded to be used as the
|
|
|
|
# general .rc file for the netcdf-c library. So, always compile it.
|
2020-11-20 08:01:04 +08:00
|
|
|
libdispatch_la_SOURCES += drc.c
|
2018-12-06 10:20:43 +08:00
|
|
|
|
2014-08-27 02:28:38 +08:00
|
|
|
# Add functions only found in netCDF-4.
|
2019-07-21 03:59:40 +08:00
|
|
|
# They are always defined, even if they just return an error
|
2014-08-27 02:28:38 +08:00
|
|
|
libdispatch_la_SOURCES += dgroup.c dvlen.c dcompound.c dtype.c denum.c \
|
2020-09-28 02:43:46 +08:00
|
|
|
dopaque.c dfilter.c
|
2014-08-27 02:28:38 +08:00
|
|
|
|
|
|
|
# Add V2 API convenience library if needed.
|
|
|
|
if BUILD_V2
|
2017-11-14 02:15:02 +08:00
|
|
|
noinst_LTLIBRARIES += libnetcdf2.la
|
2014-08-27 02:28:38 +08:00
|
|
|
libnetcdf2_la_SOURCES = dv2i.c
|
|
|
|
libnetcdf2_la_CPPFLAGS = ${AM_CPPFLAGS} -DDLL_EXPORT
|
|
|
|
endif # BUILD_V2
|
|
|
|
|
2024-03-19 04:31:58 +08:00
|
|
|
if NETCDF_ENABLE_BYTERANGE
|
Provide byte-range reading of remote datasets
re: issue https://github.com/Unidata/netcdf-c/issues/1251
Assume that you have the URL to a remote dataset
which is a normal netcdf-3 or netcdf-4 file.
This PR allows the netcdf-c to read that dataset's
contents as a netcdf file using HTTP byte ranges
if the remote server supports byte-range access.
Originally, this PR was set up to access Amazon S3 objects,
but it can also access other remote datasets such as those
provided by a Thredds server via the HTTPServer access protocol.
It may also work for other kinds of servers.
Note that this is not intended as a true production
capability because, as is known, this kind of access to
can be quite slow. In addition, the byte-range IO drivers
do not currently do any sort of optimization or caching.
An additional goal here is to gain some experience with
the Amazon S3 REST protocol.
This architecture and its use documented in
the file docs/byterange.dox.
There are currently two test cases:
1. nc_test/tst_s3raw.c - this does a simple open, check format, close cycle
for a remote netcdf-3 file and a remote netcdf-4 file.
2. nc_test/test_s3raw.sh - this uses ncdump to investigate some remote
datasets.
This PR also incorporates significantly changed model inference code
(see the superceded PR https://github.com/Unidata/netcdf-c/pull/1259).
1. It centralizes the code that infers the dispatcher.
2. It adds support for byte-range URLs
Other changes:
1. NC_HDF5_finalize was not being properly called by nc_finalize().
2. Fix minor bug in ncgen3.l
3. fix memory leak in nc4info.c
4. add code to walk the .daprc triples and to replace protocol=
fragment tag with a more general mode= tag.
Final Note:
Th inference code is still way too complicated. We need to move
to the validfile() model used by netcdf Java, where each
dispatcher is asked if it can process the file. This decentralizes
the inference code. This will be done after all the major new
dispatchers (PIO, Zarr, etc) have been implemented.
2019-01-02 09:27:36 +08:00
|
|
|
libdispatch_la_SOURCES += dhttp.c
|
2024-03-19 04:31:58 +08:00
|
|
|
endif # NETCDF_ENABLE_BYTERANGE
|
Provide byte-range reading of remote datasets
re: issue https://github.com/Unidata/netcdf-c/issues/1251
Assume that you have the URL to a remote dataset
which is a normal netcdf-3 or netcdf-4 file.
This PR allows the netcdf-c to read that dataset's
contents as a netcdf file using HTTP byte ranges
if the remote server supports byte-range access.
Originally, this PR was set up to access Amazon S3 objects,
but it can also access other remote datasets such as those
provided by a Thredds server via the HTTPServer access protocol.
It may also work for other kinds of servers.
Note that this is not intended as a true production
capability because, as is known, this kind of access to
can be quite slow. In addition, the byte-range IO drivers
do not currently do any sort of optimization or caching.
An additional goal here is to gain some experience with
the Amazon S3 REST protocol.
This architecture and its use documented in
the file docs/byterange.dox.
There are currently two test cases:
1. nc_test/tst_s3raw.c - this does a simple open, check format, close cycle
for a remote netcdf-3 file and a remote netcdf-4 file.
2. nc_test/test_s3raw.sh - this uses ncdump to investigate some remote
datasets.
This PR also incorporates significantly changed model inference code
(see the superceded PR https://github.com/Unidata/netcdf-c/pull/1259).
1. It centralizes the code that infers the dispatcher.
2. It adds support for byte-range URLs
Other changes:
1. NC_HDF5_finalize was not being properly called by nc_finalize().
2. Fix minor bug in ncgen3.l
3. fix memory leak in nc4info.c
4. add code to walk the .daprc triples and to replace protocol=
fragment tag with a more general mode= tag.
Final Note:
Th inference code is still way too complicated. We need to move
to the validfile() model used by netcdf Java, where each
dispatcher is asked if it can process the file. This decentralizes
the inference code. This will be done after all the major new
dispatchers (PIO, Zarr, etc) have been implemented.
2019-01-02 09:27:36 +08:00
|
|
|
|
2024-03-19 04:40:19 +08:00
|
|
|
if NETCDF_ENABLE_S3
|
|
|
|
if NETCDF_ENABLE_S3_INTERNAL
|
2023-04-26 07:15:06 +08:00
|
|
|
# Renamed to avoid conflicts with the HDF5 files
|
2023-05-10 11:13:49 +08:00
|
|
|
libdispatch_la_SOURCES += ncs3sdk_h5.c nch5s3comms.c nch5s3comms.h ncutil.h nccurl_setup.h \
|
2023-04-26 07:15:06 +08:00
|
|
|
nccurl_sha256.c nccurl_sha256.h nccurl_hmac.c nccurl_hmac.h
|
|
|
|
AM_CPPFLAGS += -I$(top_srcdir)/libncxml
|
|
|
|
libdispatch_la_CPPFLAGS += ${AM_CPPFLAGS}
|
|
|
|
else
|
|
|
|
libdispatch_la_SOURCES += ncs3sdk_aws.cpp awsincludes.h
|
2021-10-30 10:06:37 +08:00
|
|
|
AM_CXXFLAGS = -std=c++11
|
|
|
|
endif
|
2023-04-26 07:15:06 +08:00
|
|
|
endif
|
2021-10-30 10:06:37 +08:00
|
|
|
|
2021-12-24 13:18:56 +08:00
|
|
|
if REGEDIT
|
|
|
|
libdispatch_la_SOURCES += dreg.c
|
|
|
|
endif
|
|
|
|
|
2023-04-26 07:15:06 +08:00
|
|
|
# Support generation of 32-bit unsigned int random numbers
|
|
|
|
noinst_PROGRAMS = ncrandom
|
|
|
|
ncrandom_SOURCES = ncrandom.c
|
|
|
|
|
2023-04-10 03:10:41 +08:00
|
|
|
EXTRA_DIST = CMakeLists.txt ncsettings.hdr utf8proc_data.c XGetopt.c
|
2014-08-27 02:28:38 +08:00
|
|
|
|
2014-08-30 04:51:14 +08:00
|
|
|
# Build ncsettings.c as follows:
|
|
|
|
# 1. copy ncsettings.hdr to ncsettings.c
|
|
|
|
# 2. append libnetcdf.settings to ncsettings.c after
|
|
|
|
# processing it as follows:
|
|
|
|
# 1. convert tabs and cr to blanks
|
|
|
|
# 2. convert embedded double quote (") to escaped form (\").
|
|
|
|
# 3. append newline (\n) to each line
|
|
|
|
# 4. surround each line with double quotes.
|
|
|
|
# 3. finally, add a semicolon to the end of ncsettings.c
|
|
|
|
# to complete the string constant.
|
|
|
|
|
2014-08-27 02:28:38 +08:00
|
|
|
ncsettings.c: $(top_srcdir)/libnetcdf.settings ncsettings.hdr
|
|
|
|
rm -f ncsettings.c
|
|
|
|
cat ncsettings.hdr > ncsettings.c
|
2014-08-30 04:51:14 +08:00
|
|
|
tr '\t\r' ' ' <${top_srcdir}/libnetcdf.settings | \
|
|
|
|
sed -e 's/"/\\"/g' | \
|
|
|
|
sed -e 's/\(.*\)/\"\1\\n\"/' | \
|
|
|
|
cat >> ncsettings.c
|
2014-08-27 02:28:38 +08:00
|
|
|
echo ';' >> ncsettings.c
|
2021-10-13 04:03:48 +08:00
|
|
|
|
|
|
|
# Show what is needed to insert a new version of ezxml
|
|
|
|
# primary fix: The original ezxml.[ch] uses '//' comments;
|
|
|
|
# unpack and replace with '/*..*/'
|
2021-11-02 12:37:05 +08:00
|
|
|
|
|
|
|
REPO=https://downloads.sourceforge.net/project/ezxml/
|
2021-10-13 04:03:48 +08:00
|
|
|
EZXML=ezxml-0.8.6.tar.gz
|
|
|
|
ezxml::
|
|
|
|
rm -fr ./ezxml ./ezxml.[ch] ./license.txt
|
|
|
|
tar -zxf ./${EZXML}
|
|
|
|
sed -e 's|//\(.*\)|/*\1*/|' <ezxml/ezxml.c >./ezxml.c
|
|
|
|
sed -e 's|//\(.*\)|/*\1*/|' <ezxml/ezxml.h >./ezxml.h
|
|
|
|
cp ezxml/license.txt .
|