diff --git a/Makefile.am b/Makefile.am index 845b67d5..aa693c27 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,17 +1,16 @@ AUTOMAKE_OPTIONS = subdir-objects ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -lib_LIBRARIES = lib/libads.a -lib_libads_a_SOURCES = src/ads/isax_file_loaders.c src/ads/isax_first_buffer_layer.c src/ads/isax_index.c src/ads/isax_node.c src/ads/isax_node_buffer.c src/ads/isax_node_record.c src/ads/isax_node_split.c src/ads/isax_query_engine.c src/ads/isax_visualize_index.c src/ads/pqueue.c src/ads/sax/sax.c src/ads/sax/ts.c src/ads/inmemory_query_engine.c src/ads/parallel_inmemory_query_engine.c src/ads/inmemory_index_engine.c src/ads/parallel_index_engine.c src/ads/parallel_query_engine.c src/ads/inmemory_topk_engine.c src/ads/sfa/dft.c src/ads/sfa/sfa.c src/ads/calc_utils.c -lib_libads_a_CFLAGS =-I/opt/local/include -Iinclude/ -I/vol/home-vol3/wbi/schaefpa/fftw-3.3.10/include -march=native -mavx -mavx2 -msse3 -fopenmp +lib_LIBRARIES = lib/libads.a +lib_libads_a_SOURCES = src/ads/isax_file_loaders.c src/ads/isax_first_buffer_layer.c src/ads/isax_index.c src/ads/isax_node.c src/ads/isax_node_buffer.c src/ads/isax_node_record.c src/ads/isax_node_split.c src/ads/isax_query_engine.c src/ads/isax_visualize_index.c src/ads/pqueue.c src/ads/sax/sax.c src/ads/sax/ts.c src/ads/inmemory_query_engine.c src/ads/parallel_inmemory_query_engine.c src/ads/inmemory_index_engine.c src/ads/parallel_index_engine.c src/ads/parallel_query_engine.c src/ads/inmemory_topk_engine.c src/ads/sfa/dft.c src/ads/sfa/sfa.c src/ads/calc_utils.c +lib_libads_a_CFLAGS = -Iinclude/ -I/usr/include ${APPLE_OMP} ${APPLE_NOWARN_CONV} -march=${BUILD_ARCH} -fopenmp -fcommon -std=gnu11 +#lib_libads_a_CFLAGS = -Iinclude/ -I/usr/include -fopenmp -fcommon -std=gnu11 bin_PROGRAMS = bin/MESSI - - - bin_MESSI_SOURCES = src/utils/MESSI.c -bin_MESSI_CFLAGS = -I/opt/local/include -I/usr/include/ -Iinclude/ -I/usr/local/include/ -I/vol/home-vol3/wbi/schaefpa/fftw-3.3.10/include -march=native -bin_MESSI_LDADD = -lm -lreadline -lads -lfftw3f -lm -lpthread -bin_MESSI_LDFLAGS = -L/opt/local/lib -Llib/ -L/vol/home-vol3/wbi/schaefpa/fftw-3.3.10/.libs -mavx -mavx2 -msse3 -fopenmp +bin_MESSI_CFLAGS = -I/usr/include/ -Iinclude/ ${APPLE_OMP} ${APPLE_FFTW} -march=${BUILD_ARCH} -std=gnu11 +#bin_MESSI_CFLAGS = -I/usr/include/ -Iinclude/ -std=gnu11 +bin_MESSI_LDADD = -lm -lads -lfftw3f -lpthread ${NUMA} +bin_MESSI_LDFLAGS = -Llib/ -L/usr/lib${LIB64} -fopenmp diff --git a/Makefile.in b/Makefile.in index a8460d6c..5ab6b6a9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -87,6 +87,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ bin_PROGRAMS = bin/MESSI$(EXEEXT) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -101,6 +103,8 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" +PROGRAMS = $(bin_PROGRAMS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -128,9 +132,7 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" LIBRARIES = $(lib_LIBRARIES) -AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) @@ -162,10 +164,10 @@ am_lib_libads_a_OBJECTS = \ src/ads/sfa/lib_libads_a-sfa.$(OBJEXT) \ src/ads/lib_libads_a-calc_utils.$(OBJEXT) lib_libads_a_OBJECTS = $(am_lib_libads_a_OBJECTS) -PROGRAMS = $(bin_PROGRAMS) am_bin_MESSI_OBJECTS = src/utils/bin_MESSI-MESSI.$(OBJEXT) bin_MESSI_OBJECTS = $(am_bin_MESSI_OBJECTS) -bin_MESSI_DEPENDENCIES = +am__DEPENDENCIES_1 = +bin_MESSI_DEPENDENCIES = $(am__DEPENDENCIES_1) bin_MESSI_LINK = $(CCLD) $(bin_MESSI_CFLAGS) $(CFLAGS) \ $(bin_MESSI_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) @@ -182,7 +184,29 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = src/ads/$(DEPDIR)/lib_libads_a-calc_utils.Po \ + src/ads/$(DEPDIR)/lib_libads_a-inmemory_index_engine.Po \ + src/ads/$(DEPDIR)/lib_libads_a-inmemory_query_engine.Po \ + src/ads/$(DEPDIR)/lib_libads_a-inmemory_topk_engine.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_file_loaders.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_first_buffer_layer.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_index.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_node.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_node_buffer.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_node_record.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_node_split.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_query_engine.Po \ + src/ads/$(DEPDIR)/lib_libads_a-isax_visualize_index.Po \ + src/ads/$(DEPDIR)/lib_libads_a-parallel_index_engine.Po \ + src/ads/$(DEPDIR)/lib_libads_a-parallel_inmemory_query_engine.Po \ + src/ads/$(DEPDIR)/lib_libads_a-parallel_query_engine.Po \ + src/ads/$(DEPDIR)/lib_libads_a-pqueue.Po \ + src/ads/sax/$(DEPDIR)/lib_libads_a-sax.Po \ + src/ads/sax/$(DEPDIR)/lib_libads_a-ts.Po \ + src/ads/sfa/$(DEPDIR)/lib_libads_a-dft.Po \ + src/ads/sfa/$(DEPDIR)/lib_libads_a-sfa.Po \ + src/utils/$(DEPDIR)/bin_MESSI-MESSI.Po am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -207,8 +231,8 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -230,8 +254,8 @@ CTAGS = ctags CSCOPE = cscope AM_RECURSIVE_TARGETS = cscope am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \ - COPYING ChangeLog INSTALL NEWS README ar-lib compile depcomp \ - install-sh missing + COPYING ChangeLog INSTALL NEWS README ar-lib compile \ + config.guess config.sub depcomp install-sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -252,10 +276,16 @@ distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLE_FFTW = @APPLE_FFTW@ +APPLE_NOWARN_CONV = @APPLE_NOWARN_CONV@ +APPLE_OMP = @APPLE_OMP@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BREW_ROOT = @BREW_ROOT@ +BUILD_ARCH = @BUILD_ARCH@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -279,11 +309,13 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIB64 = @LIB64@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ +NUMA = @NUMA@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -302,6 +334,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ @@ -310,14 +343,22 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ +build = @build@ build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +host = @host@ host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ @@ -333,6 +374,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -345,11 +387,12 @@ AUTOMAKE_OPTIONS = subdir-objects ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} lib_LIBRARIES = lib/libads.a lib_libads_a_SOURCES = src/ads/isax_file_loaders.c src/ads/isax_first_buffer_layer.c src/ads/isax_index.c src/ads/isax_node.c src/ads/isax_node_buffer.c src/ads/isax_node_record.c src/ads/isax_node_split.c src/ads/isax_query_engine.c src/ads/isax_visualize_index.c src/ads/pqueue.c src/ads/sax/sax.c src/ads/sax/ts.c src/ads/inmemory_query_engine.c src/ads/parallel_inmemory_query_engine.c src/ads/inmemory_index_engine.c src/ads/parallel_index_engine.c src/ads/parallel_query_engine.c src/ads/inmemory_topk_engine.c src/ads/sfa/dft.c src/ads/sfa/sfa.c src/ads/calc_utils.c -lib_libads_a_CFLAGS = -I/opt/local/include -Iinclude/ -I/vol/home-vol3/wbi/schaefpa/fftw-3.3.10/include -march=native -mavx -mavx2 -msse3 -fopenmp +lib_libads_a_CFLAGS = -Iinclude/ -I/usr/include ${APPLE_OMP} ${APPLE_NOWARN_CONV} -march=${BUILD_ARCH} -fopenmp -fcommon -std=gnu11 bin_MESSI_SOURCES = src/utils/MESSI.c -bin_MESSI_CFLAGS = -I/opt/local/include -I/usr/include/ -Iinclude/ -I/usr/local/include/ -I/vol/home-vol3/wbi/schaefpa/fftw-3.3.10/include -march=native -bin_MESSI_LDADD = -lm -lreadline -lads -lfftw3f -lm -lpthread -bin_MESSI_LDFLAGS = -L/opt/local/lib -Llib/ -L/vol/home-vol3/wbi/schaefpa/fftw-3.3.10/.libs -mavx -mavx2 -msse3 -fopenmp +bin_MESSI_CFLAGS = -I/usr/include/ -Iinclude/ ${APPLE_OMP} ${APPLE_FFTW} -march=${BUILD_ARCH} -std=gnu11 +#bin_MESSI_CFLAGS = -I/usr/include/ -Iinclude/ -std=gnu11 +bin_MESSI_LDADD = -lm -lads -lfftw3f -lpthread ${NUMA} +bin_MESSI_LDFLAGS = -Llib/ -L/usr/lib${LIB64} -fopenmp all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -376,8 +419,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -403,6 +446,48 @@ $(srcdir)/config.h.in: $(am__configure_deps) distclean-hdr: -rm -f config.h stamp-h1 +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \ @@ -502,48 +587,6 @@ lib/libads.a: $(lib_libads_a_OBJECTS) $(lib_libads_a_DEPENDENCIES) $(EXTRA_lib_l $(AM_V_at)-rm -f lib/libads.a $(AM_V_AR)$(lib_libads_a_AR) lib/libads.a $(lib_libads_a_OBJECTS) $(lib_libads_a_LIBADD) $(AM_V_at)$(RANLIB) lib/libads.a -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) src/utils/$(am__dirstamp): @$(MKDIR_P) src/utils @: > src/utils/$(am__dirstamp) @@ -570,28 +613,34 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-calc_utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-inmemory_index_engine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-inmemory_query_engine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-inmemory_topk_engine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_file_loaders.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_first_buffer_layer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_index.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_node.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_node_buffer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_node_record.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_node_split.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_query_engine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_visualize_index.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-parallel_index_engine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-parallel_inmemory_query_engine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-parallel_query_engine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-pqueue.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/sax/$(DEPDIR)/lib_libads_a-sax.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/sax/$(DEPDIR)/lib_libads_a-ts.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/sfa/$(DEPDIR)/lib_libads_a-dft.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ads/sfa/$(DEPDIR)/lib_libads_a-sfa.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/utils/$(DEPDIR)/bin_MESSI-MESSI.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-calc_utils.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-inmemory_index_engine.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-inmemory_query_engine.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-inmemory_topk_engine.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_file_loaders.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_first_buffer_layer.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_index.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_node.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_node_buffer.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_node_record.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_node_split.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_query_engine.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-isax_visualize_index.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-parallel_index_engine.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-parallel_inmemory_query_engine.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-parallel_query_engine.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/$(DEPDIR)/lib_libads_a-pqueue.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/sax/$(DEPDIR)/lib_libads_a-sax.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/sax/$(DEPDIR)/lib_libads_a-ts.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/sfa/$(DEPDIR)/lib_libads_a-dft.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/ads/sfa/$(DEPDIR)/lib_libads_a-sfa.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/utils/$(DEPDIR)/bin_MESSI-MESSI.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -976,7 +1025,10 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -1031,6 +1083,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -1073,6 +1129,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -1143,7 +1201,7 @@ check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) config.h installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1193,7 +1251,28 @@ clean-am: clean-binPROGRAMS clean-generic clean-libLIBRARIES \ distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf src/ads/$(DEPDIR) src/ads/sax/$(DEPDIR) src/ads/sfa/$(DEPDIR) src/utils/$(DEPDIR) + -rm -f src/ads/$(DEPDIR)/lib_libads_a-calc_utils.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-inmemory_index_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-inmemory_query_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-inmemory_topk_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_file_loaders.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_first_buffer_layer.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_index.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_node.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_node_buffer.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_node_record.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_node_split.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_query_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_visualize_index.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-parallel_index_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-parallel_inmemory_query_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-parallel_query_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-pqueue.Po + -rm -f src/ads/sax/$(DEPDIR)/lib_libads_a-sax.Po + -rm -f src/ads/sax/$(DEPDIR)/lib_libads_a-ts.Po + -rm -f src/ads/sfa/$(DEPDIR)/lib_libads_a-dft.Po + -rm -f src/ads/sfa/$(DEPDIR)/lib_libads_a-sfa.Po + -rm -f src/utils/$(DEPDIR)/bin_MESSI-MESSI.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags @@ -1241,7 +1320,28 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf src/ads/$(DEPDIR) src/ads/sax/$(DEPDIR) src/ads/sfa/$(DEPDIR) src/utils/$(DEPDIR) + -rm -f src/ads/$(DEPDIR)/lib_libads_a-calc_utils.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-inmemory_index_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-inmemory_query_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-inmemory_topk_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_file_loaders.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_first_buffer_layer.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_index.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_node.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_node_buffer.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_node_record.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_node_split.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_query_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-isax_visualize_index.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-parallel_index_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-parallel_inmemory_query_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-parallel_query_engine.Po + -rm -f src/ads/$(DEPDIR)/lib_libads_a-pqueue.Po + -rm -f src/ads/sax/$(DEPDIR)/lib_libads_a-sax.Po + -rm -f src/ads/sax/$(DEPDIR)/lib_libads_a-ts.Po + -rm -f src/ads/sfa/$(DEPDIR)/lib_libads_a-dft.Po + -rm -f src/ads/sfa/$(DEPDIR)/lib_libads_a-sfa.Po + -rm -f src/utils/$(DEPDIR)/bin_MESSI-MESSI.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1261,19 +1361,20 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLIBRARIES .MAKE: all install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \ - clean-binPROGRAMS clean-cscope clean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles am--refresh check \ + check-am clean clean-binPROGRAMS clean-cscope clean-generic \ clean-libLIBRARIES cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-tags distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am install-binPROGRAMS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-libLIBRARIES install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ + dist-xz dist-zip dist-zstd distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-libLIBRARIES diff --git a/aclocal.m4 b/aclocal.m4 index df8ff837..09837598 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.2 -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2017 Free Software Foundation, Inc. +# Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15.1], [], +m4_if([$1], [1.16.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,74 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15.1])dnl +[AM_AUTOMAKE_VERSION([1.16.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_AR([ACT-IF-FAIL]) +# ------------------------- +# Try to determine the archiver interface, and trigger the ar-lib wrapper +# if it is needed. If the detection of archiver interface fails, run +# ACT-IF-FAIL (default is to abort configure with a proper error message). +AC_DEFUN([AM_PROG_AR], +[AC_BEFORE([$0], [LT_INIT])dnl +AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([ar-lib])dnl +AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) +: ${AR=ar} + +AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], + [AC_LANG_PUSH([C]) + am_cv_ar_interface=ar + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], + [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + ]) + AC_LANG_POP([C])]) + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + m4_default([$1], + [AC_MSG_ERROR([could not determine $AR interface])]) + ;; +esac +AC_SUBST([AR])dnl +]) + # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +170,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +201,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,13 +392,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. - # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], @@ -346,49 +405,43 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -397,18 +450,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -495,8 +547,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -563,7 +615,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -605,7 +657,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -626,7 +678,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2017 Free Software Foundation, Inc. +# Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -647,7 +699,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -655,49 +707,42 @@ AC_SUBST([am__leading_dot])]) # AM_MAKE_INCLUDE() # ----------------- -# Check to see how make treats includes. +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -736,7 +781,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -765,7 +810,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -812,7 +857,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -831,7 +876,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -912,7 +957,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2017 Free Software Foundation, Inc. +# Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -972,7 +1017,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1000,7 +1045,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2017 Free Software Foundation, Inc. +# Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1019,7 +1064,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2017 Free Software Foundation, Inc. +# Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/autogen.sh b/autogen.sh old mode 100755 new mode 100644 diff --git a/autom4te.cache/output.1 b/autom4te.cache/output.1 index 07d20fec..0b014ea1 100644 --- a/autom4te.cache/output.1 +++ b/autom4te.cache/output.1 @@ -625,37 +625,44 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIB@&t@OBJS +APPLE_NOWARN_CONV +APPLE_FFTW +APPLE_OMP +BREW_ROOT +NUMA +BUILD_ARCH +LIB64 +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build EGREP GREP CPP -RANLIB -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -ac_ct_CC -CFLAGS -CC am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT ac_ct_CXX -CPPFLAGS -LDFLAGS CXXFLAGS CXX +RANLIB AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR am__untar am__tar AMTAR @@ -679,6 +686,15 @@ am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +ac_ct_AR +AR target_alias host_alias build_alias @@ -698,6 +714,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -716,12 +733,13 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking -enable_silent_rules enable_dependency_tracking +enable_silent_rules with_no_benchmarking with_with_debug with_with_clustering @@ -730,14 +748,14 @@ with_verbose ac_precious_vars='build_alias host_alias target_alias -CXX -CXXFLAGS +CC +CFLAGS LDFLAGS LIBS CPPFLAGS +CXX +CXXFLAGS CCC -CC -CFLAGS CPP' @@ -777,6 +795,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1029,6 +1048,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1166,7 +1194,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1319,6 +1347,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1340,6 +1369,10 @@ Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi @@ -1353,12 +1386,12 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1369,15 +1402,15 @@ Optional Packages: --verbose enable stuff Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags + CXX C++ compiler command + CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -1460,10 +1493,10 @@ fi ## Autoconf initialization. ## ## ------------------------ ## -@%:@ ac_fn_cxx_try_compile LINENO -@%:@ ---------------------------- +@%:@ ac_fn_c_try_compile LINENO +@%:@ -------------------------- @%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () +ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext @@ -1483,7 +1516,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || + test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 @@ -1496,12 +1529,12 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} @%:@ ac_fn_cxx_try_compile +} @%:@ ac_fn_c_try_compile -@%:@ ac_fn_c_try_compile LINENO -@%:@ -------------------------- +@%:@ ac_fn_cxx_try_compile LINENO +@%:@ ---------------------------- @%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () +ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext @@ -1521,7 +1554,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || + test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 @@ -1534,7 +1567,7 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} @%:@ ac_fn_c_try_compile +} @%:@ ac_fn_cxx_try_compile @%:@ ac_fn_c_try_cpp LINENO @%:@ ---------------------- @@ -2089,8 +2122,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.15' - ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -2120,220 +2151,117 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in @%:@(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done IFS=$as_save_IFS -rm -rf conftest.one conftest.two conftest.dir - fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2342,7 +2270,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" + ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2352,29 +2280,30 @@ IFS=$as_save_IFS fi fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + fi fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else + ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do @@ -2382,7 +2311,11 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2390,88 +2323,88 @@ done done IFS=$as_save_IFS +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $@%:@ != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi fi fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done IFS=$as_save_IFS fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -for ac_prog in gawk mawk nawk awk + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2480,7 +2413,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" + ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2490,13 +2423,1133 @@ IFS=$as_save_IFS fi fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +@%:@include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac + +am__api_version='1.16' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in @%:@(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2543,6 +3596,69 @@ else fi rmdir .tst 2>/dev/null +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in @%:@( + '0:this is the am__doit target') : + case $s in @%:@( + BSD) : + am__include='.include' am__quote='"' ;; @%:@( + *) : + am__include='include' am__quote='' ;; +esac ;; @%:@( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } + +@%:@ Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + @%:@ Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; @@ -2625,8 +3741,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -2645,6 +3761,134 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -2676,41 +3920,201 @@ END cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + +ac_config_headers="$ac_config_headers config.h" + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } -ac_config_headers="$ac_config_headers config.h" +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2719,7 +4123,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2729,32 +4133,28 @@ IFS=$as_save_IFS fi fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$CXX" && break - done fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2763,7 +4163,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" + ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2773,21 +4173,17 @@ IFS=$as_save_IFS fi fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -2795,287 +4191,148 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - CXX=$ac_ct_CXX + RANLIB=$ac_ct_RANLIB fi +else + RANLIB="$ac_cv_prog_RANLIB" fi +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } done + done +IFS=$as_save_IFS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 -$as_echo_n "checking whether the C++ compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi done -test "$ac_cv_exeext" = no && ac_cv_exeext= + done +IFS=$as_save_IFS -else - ac_file='' fi -if test -z "$ac_file"; then : +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C++ compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 -$as_echo_n "checking for C++ compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; + test -n "$ac_ct_CXX" && break +done - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no + if test "x$ac_ct_CXX" = x; then + CXX="g++" else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C++ compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac + test $ac_status = 0; } done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : @@ -3186,79 +4443,16 @@ elif test $ac_cv_prog_cxx_g = yes; then fi else if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -@%:@ Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= + CXXFLAGS="-O2" + else + CXXFLAGS= + fi fi - - +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= @@ -3867,344 +5061,124 @@ static char *f (char * (*g) (char **, int), char **p, ...) These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done - done -IFS=$as_save_IFS +rm -f conftest.$ac_ext +CC=$ac_save_CC fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi @@ -4611,6 +5585,127 @@ if test "x$ac_cv_header_values_h" = xyes; then : fi +ac_fn_c_check_header_mongrel "$LINENO" "fftw3.h" "ac_cv_header_fftw3_h" "$ac_includes_default" +if test "x$ac_cv_header_fftw3_h" = xyes; then : + +fi + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +CANONICAL_HOST=$host +case $host in + *-*-linux*) + ac_fn_c_check_header_mongrel "$LINENO" "numa.h" "ac_cv_header_numa_h" "$ac_includes_default" +if test "x$ac_cv_header_numa_h" = xyes; then : + +fi + + + LIB64='64' + ;; + *-*-darwin*) + echo "darwin detected, skipping numa.h dep, setting brew environment" + BREW_ROOT=`brew config|grep HOMEBREW_PREFIX|awk '{print $2}'` + APPLE_OMP='-I${BREW_ROOT}/opt/libomp/include' + APPLE_FFTW='-I${BREW_ROOT}/opt/fftw/include' + APPLE_NOWARN_CONV='-Wno-int-conversion' + LDFLAGS='${LD_FLAGS} -L${BREW_ROOT}/opt/fftw/lib' + case $host_cpu in + arm) + BUILD_ARCH='armv8.2-a' + ;; + esac + ;; +esac +case $host_cpu in + x86_64) + echo "x86_64-cpu" + BUILD_ARCH='haswell' + NUMA='-lnuma' + ;; + aarch64) + echo "arm64-cpu" + BUILD_ARCH='armv8.2-a' + ;; +esac + + + + + + + + if test "$ac_cv_header_values_h" == yes then @@ -4804,6 +5899,14 @@ $as_echo_n "checking that generated files are newer than configure... " >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -4812,18 +5915,10 @@ else am__EXEEXT_FALSE= fi -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -5406,7 +6501,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _ACEOF @@ -5416,8 +6511,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -6018,29 +7113,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in @%:@( + *\'*) : + eval set x "$CONFIG_FILES" ;; @%:@( + *) : + set x $CONFIG_FILES ;; @%:@( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6058,53 +7159,50 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; diff --git a/autom4te.cache/output.2 b/autom4te.cache/output.2 index 20f54e56..31173907 100644 --- a/autom4te.cache/output.2 +++ b/autom4te.cache/output.2 @@ -629,8 +629,6 @@ EGREP GREP CPP RANLIB -ac_ct_AR -AR am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -644,7 +642,6 @@ am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE -am__quote am__include DEPDIR OBJEXT @@ -700,6 +697,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -718,7 +716,8 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -779,6 +778,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1031,6 +1031,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1168,7 +1177,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1321,6 +1330,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -2091,7 +2101,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.15' +am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -2627,8 +2637,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -2679,7 +2689,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -3202,45 +3212,45 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" - -am_make=${MAKE-make} -cat > confinc << 'END' +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in @%:@( + '0:this is the am__doit target') : + case $s in @%:@( + BSD) : + am__include='.include' am__quote='"' ;; @%:@( + *) : + am__include='include' am__quote='' ;; +esac ;; @%:@( + *) : ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } @%:@ Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : @@ -4116,178 +4126,6 @@ else fi - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar lib "link -lib" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar lib "link -lib" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 -$as_echo_n "checking the archiver ($AR) interface... " >&6; } -if ${am_cv_ar_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - am_cv_ar_interface=ar - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int some_variable = 0; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 - (eval $am_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 - (eval $am_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 -$as_echo "$am_cv_ar_interface" >&6; } - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - as_fn_error $? "could not determine $AR interface" "$LINENO" 5 - ;; -esac - if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 @@ -4381,6 +4219,7 @@ else fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4784,6 +4623,18 @@ if test "x$ac_cv_header_values_h" = xyes; then : fi +ac_fn_c_check_header_mongrel "$LINENO" "fftw3.h" "ac_cv_header_fftw3_h" "$ac_includes_default" +if test "x$ac_cv_header_fftw3_h" = xyes; then : + +fi + + +ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" +if test "x$ac_cv_header_readline_readline_h" = xyes; then : + +fi + + if test "$ac_cv_header_values_h" == yes then @@ -5579,7 +5430,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _ACEOF @@ -6191,29 +6042,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in @%:@( + *\'*) : + eval set x "$CONFIG_FILES" ;; @%:@( + *) : + set x $CONFIG_FILES ;; @%:@( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6231,53 +6088,50 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; @@ -6318,4 +6172,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/autom4te.cache/output.3 b/autom4te.cache/output.3 index 07d20fec..0b014ea1 100644 --- a/autom4te.cache/output.3 +++ b/autom4te.cache/output.3 @@ -625,37 +625,44 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIB@&t@OBJS +APPLE_NOWARN_CONV +APPLE_FFTW +APPLE_OMP +BREW_ROOT +NUMA +BUILD_ARCH +LIB64 +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build EGREP GREP CPP -RANLIB -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -ac_ct_CC -CFLAGS -CC am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT ac_ct_CXX -CPPFLAGS -LDFLAGS CXXFLAGS CXX +RANLIB AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR am__untar am__tar AMTAR @@ -679,6 +686,15 @@ am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +ac_ct_AR +AR target_alias host_alias build_alias @@ -698,6 +714,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -716,12 +733,13 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking -enable_silent_rules enable_dependency_tracking +enable_silent_rules with_no_benchmarking with_with_debug with_with_clustering @@ -730,14 +748,14 @@ with_verbose ac_precious_vars='build_alias host_alias target_alias -CXX -CXXFLAGS +CC +CFLAGS LDFLAGS LIBS CPPFLAGS +CXX +CXXFLAGS CCC -CC -CFLAGS CPP' @@ -777,6 +795,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1029,6 +1048,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1166,7 +1194,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1319,6 +1347,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1340,6 +1369,10 @@ Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi @@ -1353,12 +1386,12 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1369,15 +1402,15 @@ Optional Packages: --verbose enable stuff Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags + CXX C++ compiler command + CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -1460,10 +1493,10 @@ fi ## Autoconf initialization. ## ## ------------------------ ## -@%:@ ac_fn_cxx_try_compile LINENO -@%:@ ---------------------------- +@%:@ ac_fn_c_try_compile LINENO +@%:@ -------------------------- @%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () +ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext @@ -1483,7 +1516,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || + test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 @@ -1496,12 +1529,12 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} @%:@ ac_fn_cxx_try_compile +} @%:@ ac_fn_c_try_compile -@%:@ ac_fn_c_try_compile LINENO -@%:@ -------------------------- +@%:@ ac_fn_cxx_try_compile LINENO +@%:@ ---------------------------- @%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () +ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext @@ -1521,7 +1554,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || + test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 @@ -1534,7 +1567,7 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} @%:@ ac_fn_c_try_compile +} @%:@ ac_fn_cxx_try_compile @%:@ ac_fn_c_try_cpp LINENO @%:@ ---------------------- @@ -2089,8 +2122,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.15' - ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -2120,220 +2151,117 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in @%:@(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done IFS=$as_save_IFS -rm -rf conftest.one conftest.two conftest.dir - fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2342,7 +2270,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" + ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2352,29 +2280,30 @@ IFS=$as_save_IFS fi fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + fi fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else + ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do @@ -2382,7 +2311,11 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2390,88 +2323,88 @@ done done IFS=$as_save_IFS +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $@%:@ != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi fi fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done IFS=$as_save_IFS fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -for ac_prog in gawk mawk nawk awk + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2480,7 +2413,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" + ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2490,13 +2423,1133 @@ IFS=$as_save_IFS fi fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +@%:@include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac + +am__api_version='1.16' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in @%:@(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2543,6 +3596,69 @@ else fi rmdir .tst 2>/dev/null +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in @%:@( + '0:this is the am__doit target') : + case $s in @%:@( + BSD) : + am__include='.include' am__quote='"' ;; @%:@( + *) : + am__include='include' am__quote='' ;; +esac ;; @%:@( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } + +@%:@ Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + @%:@ Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; @@ -2625,8 +3741,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -2645,6 +3761,134 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -2676,41 +3920,201 @@ END cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + +ac_config_headers="$ac_config_headers config.h" + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } -ac_config_headers="$ac_config_headers config.h" +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2719,7 +4123,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2729,32 +4133,28 @@ IFS=$as_save_IFS fi fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$CXX" && break - done fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2763,7 +4163,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" + ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2773,21 +4173,17 @@ IFS=$as_save_IFS fi fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -2795,287 +4191,148 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - CXX=$ac_ct_CXX + RANLIB=$ac_ct_RANLIB fi +else + RANLIB="$ac_cv_prog_RANLIB" fi +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } done + done +IFS=$as_save_IFS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 -$as_echo_n "checking whether the C++ compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi done -test "$ac_cv_exeext" = no && ac_cv_exeext= + done +IFS=$as_save_IFS -else - ac_file='' fi -if test -z "$ac_file"; then : +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C++ compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 -$as_echo_n "checking for C++ compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; + test -n "$ac_ct_CXX" && break +done - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no + if test "x$ac_ct_CXX" = x; then + CXX="g++" else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C++ compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac + test $ac_status = 0; } done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : @@ -3186,79 +4443,16 @@ elif test $ac_cv_prog_cxx_g = yes; then fi else if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -@%:@ Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= + CXXFLAGS="-O2" + else + CXXFLAGS= + fi fi - - +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= @@ -3867,344 +5061,124 @@ static char *f (char * (*g) (char **, int), char **p, ...) These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done - done -IFS=$as_save_IFS +rm -f conftest.$ac_ext +CC=$ac_save_CC fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi @@ -4611,6 +5585,127 @@ if test "x$ac_cv_header_values_h" = xyes; then : fi +ac_fn_c_check_header_mongrel "$LINENO" "fftw3.h" "ac_cv_header_fftw3_h" "$ac_includes_default" +if test "x$ac_cv_header_fftw3_h" = xyes; then : + +fi + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +CANONICAL_HOST=$host +case $host in + *-*-linux*) + ac_fn_c_check_header_mongrel "$LINENO" "numa.h" "ac_cv_header_numa_h" "$ac_includes_default" +if test "x$ac_cv_header_numa_h" = xyes; then : + +fi + + + LIB64='64' + ;; + *-*-darwin*) + echo "darwin detected, skipping numa.h dep, setting brew environment" + BREW_ROOT=`brew config|grep HOMEBREW_PREFIX|awk '{print $2}'` + APPLE_OMP='-I${BREW_ROOT}/opt/libomp/include' + APPLE_FFTW='-I${BREW_ROOT}/opt/fftw/include' + APPLE_NOWARN_CONV='-Wno-int-conversion' + LDFLAGS='${LD_FLAGS} -L${BREW_ROOT}/opt/fftw/lib' + case $host_cpu in + arm) + BUILD_ARCH='armv8.2-a' + ;; + esac + ;; +esac +case $host_cpu in + x86_64) + echo "x86_64-cpu" + BUILD_ARCH='haswell' + NUMA='-lnuma' + ;; + aarch64) + echo "arm64-cpu" + BUILD_ARCH='armv8.2-a' + ;; +esac + + + + + + + + if test "$ac_cv_header_values_h" == yes then @@ -4804,6 +5899,14 @@ $as_echo_n "checking that generated files are newer than configure... " >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -4812,18 +5915,10 @@ else am__EXEEXT_FALSE= fi -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -5406,7 +6501,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _ACEOF @@ -5416,8 +6511,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -6018,29 +7113,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in @%:@( + *\'*) : + eval set x "$CONFIG_FILES" ;; @%:@( + *) : + set x $CONFIG_FILES ;; @%:@( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6058,53 +7159,50 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; diff --git a/autom4te.cache/requests b/autom4te.cache/requests index cf07c15f..30dfdb33 100644 --- a/autom4te.cache/requests +++ b/autom4te.cache/requests @@ -34,47 +34,47 @@ 'configure.ac' ], { - 'AC_DEFUN_ONCE' => 1, - 'AM_DEP_TRACK' => 1, + '_AM_DEPENDENCIES' => 1, + 'AM_SET_DEPDIR' => 1, + 'AM_RUN_LOG' => 1, + '_AM_AUTOCONF_VERSION' => 1, 'AM_SUBST_NOTMAKE' => 1, - '_m4_warn' => 1, - 'm4_include' => 1, 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1, - 'AC_CONFIG_MACRO_DIR' => 1, - 'AC_DEFUN' => 1, - '_AM_SUBST_NOTMAKE' => 1, - '_AM_CONFIG_MACRO_DIRS' => 1, - 'AM_INIT_AUTOMAKE' => 1, + 'AM_MAKE_INCLUDE' => 1, + '_AM_SET_OPTIONS' => 1, 'AM_MISSING_HAS_RUN' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'AM_PROG_CC_C_O' => 1, - '_AM_SET_OPTION' => 1, 'AM_SET_LEADING_DOT' => 1, - '_AM_SET_OPTIONS' => 1, - '_AM_DEPENDENCIES' => 1, - 'AM_SILENT_RULES' => 1, - '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, - 'AC_CONFIG_MACRO_DIR_TRACE' => 1, + 'AM_DEP_TRACK' => 1, 'AU_DEFUN' => 1, - 'AM_SANITY_CHECK' => 1, + 'm4_pattern_allow' => 1, + 'AC_CONFIG_MACRO_DIR_TRACE' => 1, + 'AC_DEFUN_ONCE' => 1, + '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, '_AC_AM_CONFIG_HEADER_HOOK' => 1, - '_AM_PROG_TAR' => 1, - '_AM_PROG_CC_C_O' => 1, + 'AM_SANITY_CHECK' => 1, + '_AM_CONFIG_MACRO_DIRS' => 1, + 'AM_CONDITIONAL' => 1, 'm4_pattern_forbid' => 1, - 'AM_MISSING_PROG' => 1, + '_AM_PROG_CC_C_O' => 1, 'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, + '_m4_warn' => 1, 'include' => 1, - 'AM_SET_DEPDIR' => 1, - 'AM_CONDITIONAL' => 1, - 'AM_MAKE_INCLUDE' => 1, + '_AM_MANGLE_OPTION' => 1, + '_AM_SUBST_NOTMAKE' => 1, 'AM_PROG_INSTALL_STRIP' => 1, - '_AM_AUTOCONF_VERSION' => 1, - 'm4_pattern_allow' => 1, + 'AM_PROG_CC_C_O' => 1, + 'AM_PROG_INSTALL_SH' => 1, + 'AM_SILENT_RULES' => 1, 'AM_AUX_DIR_EXPAND' => 1, + 'AM_MISSING_PROG' => 1, + 'AM_INIT_AUTOMAKE' => 1, + '_AM_SET_OPTION' => 1, '_AM_IF_OPTION' => 1, - 'AM_RUN_LOG' => 1, - '_AM_MANGLE_OPTION' => 1, - 'AM_PROG_INSTALL_SH' => 1 + 'AC_DEFUN' => 1, + 'AC_CONFIG_MACRO_DIR' => 1, + '_AM_PROG_TAR' => 1, + 'm4_include' => 1, + 'AM_AUTOMAKE_VERSION' => 1 } ], 'Autom4te::Request' ), bless( [ @@ -89,68 +89,363 @@ 'configure.ac' ], { - 'AC_CONFIG_HEADERS' => 1, - 'm4_pattern_forbid' => 1, - 'sinclude' => 1, + 'AM_PROG_F77_C_O' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AM_PROG_CC_C_O' => 1, 'LT_INIT' => 1, - 'AC_SUBST_TRACE' => 1, - 'AC_FC_PP_SRCEXT' => 1, - 'AC_INIT' => 1, - 'AC_CANONICAL_SYSTEM' => 1, '_AM_COND_ELSE' => 1, - 'AM_ENABLE_MULTILIB' => 1, - 'AC_CONFIG_AUX_DIR' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AM_PATH_GUILE' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AM_PROG_CXX_C_O' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, + 'm4_include' => 1, + 'm4_sinclude' => 1, + 'AM_PROG_LIBTOOL' => 1, 'AM_NLS' => 1, - 'AM_CONDITIONAL' => 1, - 'AC_CONFIG_LIBOBJ_DIR' => 1, 'AM_PROG_MKDIR_P' => 1, - 'AM_PROG_AR' => 1, - 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, - 'AM_EXTRA_RECURSIVE_TARGETS' => 1, 'AC_CANONICAL_TARGET' => 1, - 'AC_FC_PP_DEFINE' => 1, - 'AC_FC_FREEFORM' => 1, - 'include' => 1, - 'AC_FC_SRCEXT' => 1, - 'AC_CONFIG_FILES' => 1, - 'AM_GNU_GETTEXT' => 1, + 'AC_CONFIG_LINKS' => 1, 'AC_SUBST' => 1, - 'AM_MAINTAINER_MODE' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_INIT' => 1, 'm4_pattern_allow' => 1, - 'AC_CANONICAL_HOST' => 1, - 'AC_LIBLTDL_INSTALLABLE' => 1, - 'AM_PROG_F77_C_O' => 1, - '_AM_MAKEFILE_INCLUDE' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AM_EXTRA_RECURSIVE_TARGETS' => 1, + 'AC_LIBSOURCE' => 1, + 'AM_PROG_FC_C_O' => 1, + 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, 'AC_CONFIG_SUBDIRS' => 1, - 'AH_OUTPUT' => 1, + 'AM_XGETTEXT_OPTION' => 1, '_m4_warn' => 1, - 'AM_PROG_CXX_C_O' => 1, - '_LT_AC_TAGCONFIG' => 1, - '_AM_SUBST_NOTMAKE' => 1, + 'AH_OUTPUT' => 1, + 'sinclude' => 1, + 'AC_CONFIG_FILES' => 1, + 'm4_pattern_forbid' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_FC_PP_DEFINE' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'AM_SILENT_RULES' => 1, + 'AC_LIBLTDL_INSTALLABLE' => 1, + '_AM_MAKEFILE_INCLUDE' => 1, + 'AM_AUTOMAKE_VERSION' => 1, 'AC_LIBLTDL_CONVENIENCE' => 1, + '_LT_AC_TAGCONFIG' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_FC_SRCEXT' => 1, + 'AM_POT_TOOLS' => 1, 'AM_INIT_AUTOMAKE' => 1, - 'AC_PROG_LIBTOOL' => 1, - 'm4_include' => 1, - 'LT_CONFIG_LTDL_DIR' => 1, - 'AM_PROG_FC_C_O' => 1, - '_AM_COND_IF' => 1, - 'AC_LIBSOURCE' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AC_SUBST_TRACE' => 1, + '_AM_COND_ENDIF' => 1, + 'AM_PROG_MOC' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AC_FC_FREEFORM' => 1, + 'include' => 1, 'AM_MAKEFILE_INCLUDE' => 1, - 'm4_sinclude' => 1, - 'AM_POT_TOOLS' => 1, - 'AM_XGETTEXT_OPTION' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AM_CONDITIONAL' => 1, + '_AM_COND_IF' => 1, + 'AC_FC_PP_SRCEXT' => 1, + 'AM_PROG_AR' => 1 + } + ], 'Autom4te::Request' ), + bless( [ + '2', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + '-', + '/usr/share/aclocal-1.16/internal/ac-config-macro-dirs.m4', + '/usr/share/aclocal-1.16/amversion.m4', + '/usr/share/aclocal-1.16/auxdir.m4', + '/usr/share/aclocal-1.16/cond.m4', + '/usr/share/aclocal-1.16/depend.m4', + '/usr/share/aclocal-1.16/depout.m4', + '/usr/share/aclocal-1.16/init.m4', + '/usr/share/aclocal-1.16/install-sh.m4', + '/usr/share/aclocal-1.16/lead-dot.m4', + '/usr/share/aclocal-1.16/make.m4', + '/usr/share/aclocal-1.16/missing.m4', + '/usr/share/aclocal-1.16/options.m4', + '/usr/share/aclocal-1.16/prog-cc-c-o.m4', + '/usr/share/aclocal-1.16/runlog.m4', + '/usr/share/aclocal-1.16/sanity.m4', + '/usr/share/aclocal-1.16/silent.m4', + '/usr/share/aclocal-1.16/strip.m4', + '/usr/share/aclocal-1.16/substnot.m4', + '/usr/share/aclocal-1.16/tar.m4', + 'configure.ac' + ], + { + 'include' => 1, + '_m4_warn' => 1, + 'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, + '_AM_PROG_CC_C_O' => 1, + 'm4_pattern_forbid' => 1, + 'AM_CONDITIONAL' => 1, + '_AM_CONFIG_MACRO_DIRS' => 1, + 'AM_SANITY_CHECK' => 1, + '_AC_AM_CONFIG_HEADER_HOOK' => 1, + '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, + 'AC_DEFUN_ONCE' => 1, + 'AC_CONFIG_MACRO_DIR_TRACE' => 1, + 'm4_pattern_allow' => 1, + 'AU_DEFUN' => 1, + 'AM_DEP_TRACK' => 1, + 'AM_SET_LEADING_DOT' => 1, + 'AM_MISSING_HAS_RUN' => 1, + 'AM_MAKE_INCLUDE' => 1, + '_AM_SET_OPTIONS' => 1, + 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1, + 'AM_SUBST_NOTMAKE' => 1, + '_AM_AUTOCONF_VERSION' => 1, + 'AM_RUN_LOG' => 1, + 'AM_SET_DEPDIR' => 1, + '_AM_DEPENDENCIES' => 1, + 'm4_include' => 1, 'AM_AUTOMAKE_VERSION' => 1, + '_AM_PROG_TAR' => 1, + 'AC_CONFIG_MACRO_DIR' => 1, + 'AC_DEFUN' => 1, + '_AM_IF_OPTION' => 1, + '_AM_SET_OPTION' => 1, + 'AM_MISSING_PROG' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AM_AUX_DIR_EXPAND' => 1, + 'AM_SILENT_RULES' => 1, 'AM_PROG_CC_C_O' => 1, - 'AM_PATH_GUILE' => 1, - 'AC_CANONICAL_BUILD' => 1, - 'AC_CONFIG_LINKS' => 1, + 'AM_PROG_INSTALL_SH' => 1, + 'AM_PROG_INSTALL_STRIP' => 1, + '_AM_SUBST_NOTMAKE' => 1, + '_AM_MANGLE_OPTION' => 1 + } + ], 'Autom4te::Request' ), + bless( [ + '3', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + '-', + '/usr/share/aclocal-1.16/internal/ac-config-macro-dirs.m4', + '/usr/share/aclocal/libtool.m4', + '/usr/share/aclocal/ltargz.m4', + '/usr/share/aclocal/ltdl.m4', + '/usr/share/aclocal/ltoptions.m4', + '/usr/share/aclocal/ltsugar.m4', + '/usr/share/aclocal/ltversion.m4', + '/usr/share/aclocal/lt~obsolete.m4', + '/usr/share/aclocal-1.16/amversion.m4', + '/usr/share/aclocal-1.16/ar-lib.m4', + '/usr/share/aclocal-1.16/auxdir.m4', + '/usr/share/aclocal-1.16/cond.m4', + '/usr/share/aclocal-1.16/depend.m4', + '/usr/share/aclocal-1.16/depout.m4', + '/usr/share/aclocal-1.16/init.m4', + '/usr/share/aclocal-1.16/install-sh.m4', + '/usr/share/aclocal-1.16/lead-dot.m4', + '/usr/share/aclocal-1.16/make.m4', + '/usr/share/aclocal-1.16/missing.m4', + '/usr/share/aclocal-1.16/options.m4', + '/usr/share/aclocal-1.16/prog-cc-c-o.m4', + '/usr/share/aclocal-1.16/runlog.m4', + '/usr/share/aclocal-1.16/sanity.m4', + '/usr/share/aclocal-1.16/silent.m4', + '/usr/share/aclocal-1.16/strip.m4', + '/usr/share/aclocal-1.16/substnot.m4', + '/usr/share/aclocal-1.16/tar.m4', + 'configure.ac' + ], + { + 'AM_SILENT_RULES' => 1, + 'AM_AUX_DIR_EXPAND' => 1, + 'AC_LIBTOOL_SYS_LIB_STRIP' => 1, + 'AM_PROG_INSTALL_SH' => 1, + 'AC_CONFIG_MACRO_DIR' => 1, + '_LT_LIBOBJ' => 1, + 'LT_SYS_DLSEARCH_PATH' => 1, + 'LTOPTIONS_VERSION' => 1, + 'AM_PROG_LD' => 1, + 'AC_LIBTOOL_PROG_LD_SHLIBS' => 1, + 'LT_LANG' => 1, + 'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1, + 'AM_SET_LEADING_DOT' => 1, + '_AC_AM_CONFIG_HEADER_HOOK' => 1, + '_LT_PREPARE_SED_QUOTE_VARS' => 1, + 'AC_LIBTOOL_COMPILER_OPTION' => 1, + '_LT_CC_BASENAME' => 1, + '_AM_SET_OPTIONS' => 1, + 'AC_LTDL_DLSYM_USCORE' => 1, + 'AC_LIBTOOL_OBJDIR' => 1, + 'LT_LIB_M' => 1, + 'AC_DISABLE_SHARED' => 1, + 'include' => 1, + 'LT_SYS_DLOPEN_DEPLIBS' => 1, + '_LT_COMPILER_OPTION' => 1, + 'LT_CMD_MAX_LEN' => 1, + 'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1, + 'AC_LIBTOOL_PROG_COMPILER_PIC' => 1, + 'AC_PROG_NM' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'LT_SYS_DLOPEN_SELF' => 1, + '_LT_AC_TRY_DLOPEN_SELF' => 1, + 'AC_LIBTOOL_LANG_C_CONFIG' => 1, + 'm4_include' => 1, + '_LT_AC_LANG_F77' => 1, + 'm4_pattern_allow' => 1, + 'LT_PROG_GCJ' => 1, + 'AC_LIBTOOL_LANG_CXX_CONFIG' => 1, + 'AC_LIBTOOL_DLOPEN_SELF' => 1, + 'AU_DEFUN' => 1, + 'LT_FUNC_DLSYM_USCORE' => 1, + 'LT_SYS_MODULE_EXT' => 1, 'LT_SUPPORTED_TAG' => 1, + 'AC_DEFUN_ONCE' => 1, + 'AC_LIBTOOL_CXX' => 1, + 'AC_LIBTOOL_GCJ' => 1, + 'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1, + 'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1, + '_LT_AC_LANG_GCJ_CONFIG' => 1, + 'AC_PROG_LD_RELOAD_FLAG' => 1, + 'LT_OUTPUT' => 1, + 'AC_LIBTOOL_RC' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'AC_LTDL_SYMBOL_USCORE' => 1, + '_LT_AC_CHECK_DLFCN' => 1, + 'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1, + 'AC_LTDL_PREOPEN' => 1, + '_LT_PROG_F77' => 1, + 'AC_PATH_TOOL_PREFIX' => 1, + 'AM_ENABLE_STATIC' => 1, + 'LT_SYS_SYMBOL_USCORE' => 1, + 'AC_LIBLTDL_CONVENIENCE' => 1, + 'AC_LIBTOOL_PROG_CC_C_O' => 1, + 'AC_LTDL_SHLIBPATH' => 1, + '_LT_PROG_CXX' => 1, + 'AM_SANITY_CHECK' => 1, + '_LT_PROG_FC' => 1, + 'AM_DISABLE_STATIC' => 1, + 'AC_LIBTOOL_PICMODE' => 1, + '_AM_AUTOCONF_VERSION' => 1, + '_LT_AC_LANG_CXX' => 1, + 'LTDL_CONVENIENCE' => 1, + '_AM_PROG_CC_C_O' => 1, + 'AC_LTDL_ENABLE_INSTALL' => 1, + 'AC_LIBTOOL_WIN32_DLL' => 1, + '_AM_CONFIG_MACRO_DIRS' => 1, + 'LTDL_INSTALLABLE' => 1, + 'AC_LIBTOOL_F77' => 1, + '_LT_AC_SYS_LIBPATH_AIX' => 1, + 'LT_WITH_LTDL' => 1, + 'AC_LTDL_OBJDIR' => 1, + '_AM_MANGLE_OPTION' => 1, + 'AM_PROG_CC_C_O' => 1, + '_AC_PROG_LIBTOOL' => 1, + '_AM_IF_OPTION' => 1, + 'LT_LIB_DLLOAD' => 1, + 'AC_CHECK_LIBM' => 1, + 'AC_PATH_MAGIC' => 1, + 'AC_ENABLE_SHARED' => 1, + 'AM_RUN_LOG' => 1, + 'AM_MAKE_INCLUDE' => 1, + 'AC_LIBTOOL_DLOPEN' => 1, + 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1, + '_LT_AC_LANG_C_CONFIG' => 1, + '_LT_LINKER_BOILERPLATE' => 1, + 'LTDL_INIT' => 1, + 'LT_PATH_LD' => 1, + '_LT_AC_FILE_LTDLL_C' => 1, + 'AC_PROG_LD' => 1, + '_LT_AC_TAGCONFIG' => 1, + 'AC_LIBTOOL_LANG_F77_CONFIG' => 1, + 'LT_SYS_MODULE_PATH' => 1, + '_LT_WITH_SYSROOT' => 1, + '_LT_REQUIRED_DARWIN_CHECKS' => 1, + 'LT_PROG_GO' => 1, + '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, + 'AM_DISABLE_SHARED' => 1, + 'AM_SET_DEPDIR' => 1, + 'AC_LIB_LTDL' => 1, + 'AC_LTDL_SYSSEARCHPATH' => 1, + 'AM_PROG_AR' => 1, + 'LTVERSION_VERSION' => 1, + '_LT_LINKER_OPTION' => 1, + 'AM_CONDITIONAL' => 1, + '_LTDL_SETUP' => 1, + '_LT_AC_PROG_ECHO_BACKSLASH' => 1, + 'LT_PROG_RC' => 1, + 'AC_LIBTOOL_LINKER_OPTION' => 1, + 'LTOBSOLETE_VERSION' => 1, 'AM_PROG_LIBTOOL' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, - 'AC_REQUIRE_AUX_FILE' => 1, - '_AM_COND_ENDIF' => 1, - 'AM_SILENT_RULES' => 1, - 'AM_PROG_MOC' => 1 + '_LT_PROG_LTMAIN' => 1, + 'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1, + 'AC_LTDL_SHLIBEXT' => 1, + 'AM_PROG_NM' => 1, + 'AM_MISSING_PROG' => 1, + 'AC_LIBTOOL_POSTDEP_PREDEP' => 1, + '_LT_AC_LANG_CXX_CONFIG' => 1, + 'AC_LIBTOOL_CONFIG' => 1, + '_LT_AC_TAGVAR' => 1, + '_LT_COMPILER_BOILERPLATE' => 1, + '_LT_AC_SHELL_INIT' => 1, + 'AM_DEP_TRACK' => 1, + 'AC_DEPLIBS_CHECK_METHOD' => 1, + 'AC_WITH_LTDL' => 1, + 'AM_SUBST_NOTMAKE' => 1, + '_LT_DLL_DEF_P' => 1, + 'AM_MISSING_HAS_RUN' => 1, + 'AC_LIBTOOL_SETUP' => 1, + 'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, + 'LT_FUNC_ARGZ' => 1, + 'm4_pattern_forbid' => 1, + 'AC_ENABLE_FAST_INSTALL' => 1, + 'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1, + 'AC_LTDL_DLLIB' => 1, + 'LT_AC_PROG_SED' => 1, + '_LT_AC_LANG_GCJ' => 1, + 'AM_PROG_INSTALL_STRIP' => 1, + 'AC_LIBLTDL_INSTALLABLE' => 1, + '_LT_AC_PROG_CXXCPP' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AC_PROG_LD_GNU' => 1, + '_LT_AC_LOCK' => 1, + '_AM_PROG_TAR' => 1, + 'AC_PROG_EGREP' => 1, + '_AM_SET_OPTION' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_ENABLE_STATIC' => 1, + 'AC_CONFIG_MACRO_DIR_TRACE' => 1, + 'LTSUGAR_VERSION' => 1, + '_LT_AC_LANG_F77_CONFIG' => 1, + 'LT_AC_PROG_GCJ' => 1, + '_AM_DEPENDENCIES' => 1, + '_LT_PROG_ECHO_BACKSLASH' => 1, + '_LT_AC_LANG_RC_CONFIG' => 1, + 'LT_PATH_NM' => 1, + 'LT_AC_PROG_EGREP' => 1, + 'AC_DISABLE_STATIC' => 1, + 'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1, + 'LT_AC_PROG_RC' => 1, + '_LT_AC_SYS_COMPILER' => 1, + '_LT_PATH_TOOL_PREFIX' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'LT_INIT' => 1, + 'AC_DEFUN' => 1, + 'AC_DISABLE_FAST_INSTALL' => 1, + 'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1, + 'AC_LIBTOOL_LANG_RC_CONFIG' => 1, + '_m4_warn' => 1, + 'AC_LIBTOOL_FC' => 1, + 'AM_ENABLE_SHARED' => 1 } ], 'Autom4te::Request' ) ); diff --git a/autom4te.cache/traces.1 b/autom4te.cache/traces.1 index 2ddb9a45..2a7c662b 100644 --- a/autom4te.cache/traces.1 +++ b/autom4te.cache/traces.1 @@ -1,3 +1,6 @@ +m4trace:aclocal.m4:741: -1- AC_SUBST([am__quote]) +m4trace:aclocal.m4:741: -1- AC_SUBST_TRACE([am__quote]) +m4trace:aclocal.m4:741: -1- m4_pattern_allow([^am__quote$]) m4trace:configure.ac:1: -1- AC_INIT([ParIS Parallel index of sequence], [1.3], [botao.peng@parisdescartes.fr], [libads]) m4trace:configure.ac:1: -1- m4_pattern_forbid([^_?A[CHUM]_]) m4trace:configure.ac:1: -1- m4_pattern_forbid([_AC_]) @@ -63,6 +66,9 @@ m4trace:configure.ac:1: -1- m4_pattern_allow([^sharedstatedir$]) m4trace:configure.ac:1: -1- AC_SUBST([localstatedir], ['${prefix}/var']) m4trace:configure.ac:1: -1- AC_SUBST_TRACE([localstatedir]) m4trace:configure.ac:1: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.ac:1: -1- AC_SUBST([runstatedir], ['${localstatedir}/run']) +m4trace:configure.ac:1: -1- AC_SUBST_TRACE([runstatedir]) +m4trace:configure.ac:1: -1- m4_pattern_allow([^runstatedir$]) m4trace:configure.ac:1: -1- AC_SUBST([includedir], ['${prefix}/include']) m4trace:configure.ac:1: -1- AC_SUBST_TRACE([includedir]) m4trace:configure.ac:1: -1- m4_pattern_allow([^includedir$]) @@ -146,300 +152,402 @@ m4trace:configure.ac:1: -1- m4_pattern_allow([^host_alias$]) m4trace:configure.ac:1: -1- AC_SUBST([target_alias]) m4trace:configure.ac:1: -1- AC_SUBST_TRACE([target_alias]) m4trace:configure.ac:1: -1- m4_pattern_allow([^target_alias$]) -m4trace:configure.ac:4: -1- AM_INIT_AUTOMAKE([1.10 -Wall no-define]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) -m4trace:configure.ac:4: -1- AM_AUTOMAKE_VERSION([1.15.1]) -m4trace:configure.ac:4: -1- AC_REQUIRE_AUX_FILE([install-sh]) -m4trace:configure.ac:4: -1- AC_SUBST([INSTALL_PROGRAM]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) -m4trace:configure.ac:4: -1- AC_SUBST([INSTALL_SCRIPT]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([INSTALL_SCRIPT]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) -m4trace:configure.ac:4: -1- AC_SUBST([INSTALL_DATA]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([INSTALL_DATA]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_DATA$]) -m4trace:configure.ac:4: -1- AC_SUBST([am__isrc], [' -I$(srcdir)']) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([am__isrc]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^am__isrc$]) -m4trace:configure.ac:4: -1- _AM_SUBST_NOTMAKE([am__isrc]) -m4trace:configure.ac:4: -1- AC_SUBST([CYGPATH_W]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([CYGPATH_W]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^CYGPATH_W$]) -m4trace:configure.ac:4: -1- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME']) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([PACKAGE]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^PACKAGE$]) -m4trace:configure.ac:4: -1- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION']) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([VERSION]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^VERSION$]) -m4trace:configure.ac:4: -1- AC_REQUIRE_AUX_FILE([missing]) -m4trace:configure.ac:4: -1- AC_SUBST([ACLOCAL]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([ACLOCAL]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^ACLOCAL$]) -m4trace:configure.ac:4: -1- AC_SUBST([AUTOCONF]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AUTOCONF]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AUTOCONF$]) -m4trace:configure.ac:4: -1- AC_SUBST([AUTOMAKE]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AUTOMAKE]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AUTOMAKE$]) -m4trace:configure.ac:4: -1- AC_SUBST([AUTOHEADER]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AUTOHEADER]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AUTOHEADER$]) -m4trace:configure.ac:4: -1- AC_SUBST([MAKEINFO]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([MAKEINFO]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^MAKEINFO$]) -m4trace:configure.ac:4: -1- AC_SUBST([install_sh]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([install_sh]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^install_sh$]) -m4trace:configure.ac:4: -1- AC_SUBST([STRIP]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([STRIP]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^STRIP$]) -m4trace:configure.ac:4: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) -m4trace:configure.ac:4: -1- AC_REQUIRE_AUX_FILE([install-sh]) -m4trace:configure.ac:4: -1- AC_SUBST([MKDIR_P]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([MKDIR_P]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^MKDIR_P$]) -m4trace:configure.ac:4: -1- AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([mkdir_p]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^mkdir_p$]) -m4trace:configure.ac:4: -1- AC_SUBST([AWK]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AWK]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AWK$]) -m4trace:configure.ac:4: -1- AC_SUBST([SET_MAKE]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([SET_MAKE]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^SET_MAKE$]) -m4trace:configure.ac:4: -1- AC_SUBST([am__leading_dot]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([am__leading_dot]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^am__leading_dot$]) -m4trace:configure.ac:4: -1- AC_SUBST([AMTAR], ['$${TAR-tar}']) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AMTAR]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AMTAR$]) -m4trace:configure.ac:4: -1- AC_SUBST([am__tar]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([am__tar]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^am__tar$]) -m4trace:configure.ac:4: -1- AC_SUBST([am__untar]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([am__untar]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^am__untar$]) -m4trace:configure.ac:4: -1- AM_SILENT_RULES -m4trace:configure.ac:4: -1- AC_SUBST([AM_V]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AM_V]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_V$]) -m4trace:configure.ac:4: -1- _AM_SUBST_NOTMAKE([AM_V]) -m4trace:configure.ac:4: -1- AC_SUBST([AM_DEFAULT_V]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AM_DEFAULT_V]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_DEFAULT_V$]) -m4trace:configure.ac:4: -1- _AM_SUBST_NOTMAKE([AM_DEFAULT_V]) -m4trace:configure.ac:4: -1- AC_SUBST([AM_DEFAULT_VERBOSITY]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AM_DEFAULT_VERBOSITY]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_DEFAULT_VERBOSITY$]) -m4trace:configure.ac:4: -1- AC_SUBST([AM_BACKSLASH]) -m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AM_BACKSLASH]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_BACKSLASH$]) -m4trace:configure.ac:4: -1- _AM_SUBST_NOTMAKE([AM_BACKSLASH]) -m4trace:configure.ac:5: -1- AC_CONFIG_HEADERS([config.h]) -m4trace:configure.ac:6: -1- AC_SUBST([CXX]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([CXX]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CXX$]) -m4trace:configure.ac:6: -1- AC_SUBST([CXXFLAGS]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([CXXFLAGS]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CXXFLAGS$]) -m4trace:configure.ac:6: -1- AC_SUBST([LDFLAGS]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([LDFLAGS]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.ac:6: -1- AC_SUBST([LIBS]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.ac:6: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.ac:6: -1- AC_SUBST([CXX]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([CXX]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CXX$]) -m4trace:configure.ac:6: -1- AC_SUBST([ac_ct_CXX]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([ac_ct_CXX]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^ac_ct_CXX$]) -m4trace:configure.ac:6: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([EXEEXT]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^EXEEXT$]) -m4trace:configure.ac:6: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([OBJEXT]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^OBJEXT$]) -m4trace:configure.ac:6: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([DEPDIR]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^DEPDIR$]) -m4trace:configure.ac:6: -1- AC_SUBST([am__include]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([am__include]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__include$]) -m4trace:configure.ac:6: -1- AC_SUBST([am__quote]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([am__quote]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__quote$]) -m4trace:configure.ac:6: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -m4trace:configure.ac:6: -1- AC_SUBST([AMDEP_TRUE]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([AMDEP_TRUE]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^AMDEP_TRUE$]) -m4trace:configure.ac:6: -1- AC_SUBST([AMDEP_FALSE]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([AMDEP_FALSE]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^AMDEP_FALSE$]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE]) -m4trace:configure.ac:6: -1- AC_SUBST([AMDEPBACKSLASH]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([AMDEPBACKSLASH]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH]) -m4trace:configure.ac:6: -1- AC_SUBST([am__nodep]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([am__nodep]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__nodep$]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([am__nodep]) -m4trace:configure.ac:6: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([CXXDEPMODE]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CXXDEPMODE$]) -m4trace:configure.ac:6: -1- AM_CONDITIONAL([am__fastdepCXX], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) -m4trace:configure.ac:6: -1- AC_SUBST([am__fastdepCXX_TRUE]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([am__fastdepCXX_TRUE]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__fastdepCXX_TRUE$]) -m4trace:configure.ac:6: -1- AC_SUBST([am__fastdepCXX_FALSE]) -m4trace:configure.ac:6: -1- AC_SUBST_TRACE([am__fastdepCXX_FALSE]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__fastdepCXX_FALSE$]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([am__fastdepCXX_TRUE]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([am__fastdepCXX_FALSE]) -m4trace:configure.ac:7: -1- AC_SUBST([CC]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- AC_SUBST([CFLAGS]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([CFLAGS]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CFLAGS$]) -m4trace:configure.ac:7: -1- AC_SUBST([LDFLAGS]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([LDFLAGS]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.ac:7: -1- AC_SUBST([LIBS]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.ac:7: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.ac:7: -1- AC_SUBST([CC]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- AC_SUBST([CC]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- AC_SUBST([CC]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- AC_SUBST([CC]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- AC_SUBST([ac_ct_CC]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([ac_ct_CC]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^ac_ct_CC$]) -m4trace:configure.ac:7: -1- AC_REQUIRE_AUX_FILE([compile]) -m4trace:configure.ac:7: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([CCDEPMODE]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CCDEPMODE$]) -m4trace:configure.ac:7: -1- AM_CONDITIONAL([am__fastdepCC], [ +m4trace:configure.ac:4: -1- AM_PROG_AR +m4trace:configure.ac:4: -1- AC_REQUIRE_AUX_FILE([ar-lib]) +m4trace:configure.ac:4: -1- AC_SUBST([AR]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AR]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^AR$]) +m4trace:configure.ac:4: -1- AC_SUBST([ac_ct_AR]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([ac_ct_AR]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^ac_ct_AR$]) +m4trace:configure.ac:4: -1- AC_SUBST([CC]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- AC_SUBST([CFLAGS]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([CFLAGS]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.ac:4: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:4: -1- AC_SUBST([LIBS]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:4: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:4: -1- AC_SUBST([CC]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- AC_SUBST([CC]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- AC_SUBST([CC]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- AC_SUBST([CC]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([ac_ct_CC]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.ac:4: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([EXEEXT]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^EXEEXT$]) +m4trace:configure.ac:4: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([OBJEXT]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^OBJEXT$]) +m4trace:configure.ac:4: -1- AC_REQUIRE_AUX_FILE([compile]) +m4trace:configure.ac:4: -1- AC_SUBST([AR]) +m4trace:configure.ac:4: -1- AC_SUBST_TRACE([AR]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^AR$]) +m4trace:configure.ac:5: -1- AM_INIT_AUTOMAKE([1.10 -Wall no-define]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) +m4trace:configure.ac:5: -1- AM_AUTOMAKE_VERSION([1.16.2]) +m4trace:configure.ac:5: -1- AC_REQUIRE_AUX_FILE([install-sh]) +m4trace:configure.ac:5: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) +m4trace:configure.ac:5: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([INSTALL_SCRIPT]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) +m4trace:configure.ac:5: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([INSTALL_DATA]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^INSTALL_DATA$]) +m4trace:configure.ac:5: -1- AC_SUBST([am__isrc], [' -I$(srcdir)']) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([am__isrc]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__isrc$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([am__isrc]) +m4trace:configure.ac:5: -1- AC_SUBST([CYGPATH_W]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([CYGPATH_W]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^CYGPATH_W$]) +m4trace:configure.ac:5: -1- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME']) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([PACKAGE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^PACKAGE$]) +m4trace:configure.ac:5: -1- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION']) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([VERSION]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^VERSION$]) +m4trace:configure.ac:5: -1- AC_REQUIRE_AUX_FILE([missing]) +m4trace:configure.ac:5: -1- AC_SUBST([ACLOCAL]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([ACLOCAL]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^ACLOCAL$]) +m4trace:configure.ac:5: -1- AC_SUBST([AUTOCONF]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AUTOCONF]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AUTOCONF$]) +m4trace:configure.ac:5: -1- AC_SUBST([AUTOMAKE]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AUTOMAKE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AUTOMAKE$]) +m4trace:configure.ac:5: -1- AC_SUBST([AUTOHEADER]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AUTOHEADER]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AUTOHEADER$]) +m4trace:configure.ac:5: -1- AC_SUBST([MAKEINFO]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([MAKEINFO]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^MAKEINFO$]) +m4trace:configure.ac:5: -1- AC_SUBST([install_sh]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([install_sh]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^install_sh$]) +m4trace:configure.ac:5: -1- AC_SUBST([STRIP]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([STRIP]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^STRIP$]) +m4trace:configure.ac:5: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) +m4trace:configure.ac:5: -1- AC_REQUIRE_AUX_FILE([install-sh]) +m4trace:configure.ac:5: -1- AC_SUBST([MKDIR_P]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([MKDIR_P]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^MKDIR_P$]) +m4trace:configure.ac:5: -1- AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([mkdir_p]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^mkdir_p$]) +m4trace:configure.ac:5: -1- AC_SUBST([AWK]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AWK]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AWK$]) +m4trace:configure.ac:5: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([SET_MAKE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^SET_MAKE$]) +m4trace:configure.ac:5: -1- AC_SUBST([am__leading_dot]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([am__leading_dot]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__leading_dot$]) +m4trace:configure.ac:5: -1- AC_SUBST([AMTAR], ['$${TAR-tar}']) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AMTAR]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AMTAR$]) +m4trace:configure.ac:5: -1- AC_SUBST([am__tar]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([am__tar]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__tar$]) +m4trace:configure.ac:5: -1- AC_SUBST([am__untar]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([am__untar]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__untar$]) +m4trace:configure.ac:5: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([DEPDIR]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^DEPDIR$]) +m4trace:configure.ac:5: -1- AC_SUBST([am__include]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([am__include]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__include$]) +m4trace:configure.ac:5: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +m4trace:configure.ac:5: -1- AC_SUBST([AMDEP_TRUE]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AMDEP_TRUE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AMDEP_TRUE$]) +m4trace:configure.ac:5: -1- AC_SUBST([AMDEP_FALSE]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AMDEP_FALSE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AMDEP_FALSE$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE]) +m4trace:configure.ac:5: -1- AC_SUBST([AMDEPBACKSLASH]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AMDEPBACKSLASH]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH]) +m4trace:configure.ac:5: -1- AC_SUBST([am__nodep]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([am__nodep]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__nodep$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([am__nodep]) +m4trace:configure.ac:5: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([CCDEPMODE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^CCDEPMODE$]) +m4trace:configure.ac:5: -1- AM_CONDITIONAL([am__fastdepCC], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) -m4trace:configure.ac:7: -1- AC_SUBST([am__fastdepCC_TRUE]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) -m4trace:configure.ac:7: -1- AC_SUBST([am__fastdepCC_FALSE]) -m4trace:configure.ac:7: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) -m4trace:configure.ac:7: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE]) -m4trace:configure.ac:7: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE]) +m4trace:configure.ac:5: -1- AC_SUBST([am__fastdepCC_TRUE]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) +m4trace:configure.ac:5: -1- AC_SUBST([am__fastdepCC_FALSE]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE]) +m4trace:configure.ac:5: -1- AM_SILENT_RULES +m4trace:configure.ac:5: -1- AC_SUBST([AM_V]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AM_V]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_V$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AM_V]) +m4trace:configure.ac:5: -1- AC_SUBST([AM_DEFAULT_V]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AM_DEFAULT_V]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_DEFAULT_V$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AM_DEFAULT_V]) +m4trace:configure.ac:5: -1- AC_SUBST([AM_DEFAULT_VERBOSITY]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AM_DEFAULT_VERBOSITY]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_DEFAULT_VERBOSITY$]) +m4trace:configure.ac:5: -1- AC_SUBST([AM_BACKSLASH]) +m4trace:configure.ac:5: -1- AC_SUBST_TRACE([AM_BACKSLASH]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_BACKSLASH$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AM_BACKSLASH]) +m4trace:configure.ac:6: -1- AC_CONFIG_HEADERS([config.h]) +m4trace:configure.ac:7: -1- AM_PROG_AR +m4trace:configure.ac:7: -1- AC_REQUIRE_AUX_FILE([ar-lib]) +m4trace:configure.ac:7: -1- AC_SUBST([AR]) +m4trace:configure.ac:7: -1- AC_SUBST_TRACE([AR]) +m4trace:configure.ac:7: -1- m4_pattern_allow([^AR$]) +m4trace:configure.ac:7: -1- AC_SUBST([ac_ct_AR]) +m4trace:configure.ac:7: -1- AC_SUBST_TRACE([ac_ct_AR]) +m4trace:configure.ac:7: -1- m4_pattern_allow([^ac_ct_AR$]) +m4trace:configure.ac:7: -1- AC_SUBST([AR]) +m4trace:configure.ac:7: -1- AC_SUBST_TRACE([AR]) +m4trace:configure.ac:7: -1- m4_pattern_allow([^AR$]) m4trace:configure.ac:8: -1- AC_SUBST([RANLIB]) m4trace:configure.ac:8: -1- AC_SUBST_TRACE([RANLIB]) m4trace:configure.ac:8: -1- m4_pattern_allow([^RANLIB$]) -m4trace:configure.ac:9: -1- AM_PROG_CC_C_O -m4trace:configure.ac:10: -1- AC_SUBST([CPP]) -m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CPP]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:9: -1- AC_SUBST([CXX]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([CXX]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CXX$]) +m4trace:configure.ac:9: -1- AC_SUBST([CXXFLAGS]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([CXXFLAGS]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CXXFLAGS$]) +m4trace:configure.ac:9: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:9: -1- AC_SUBST([LIBS]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:9: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:9: -1- AC_SUBST([CXX]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([CXX]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CXX$]) +m4trace:configure.ac:9: -1- AC_SUBST([ac_ct_CXX]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([ac_ct_CXX]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^ac_ct_CXX$]) +m4trace:configure.ac:9: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([CXXDEPMODE]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CXXDEPMODE$]) +m4trace:configure.ac:9: -1- AM_CONDITIONAL([am__fastdepCXX], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) +m4trace:configure.ac:9: -1- AC_SUBST([am__fastdepCXX_TRUE]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([am__fastdepCXX_TRUE]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^am__fastdepCXX_TRUE$]) +m4trace:configure.ac:9: -1- AC_SUBST([am__fastdepCXX_FALSE]) +m4trace:configure.ac:9: -1- AC_SUBST_TRACE([am__fastdepCXX_FALSE]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^am__fastdepCXX_FALSE$]) +m4trace:configure.ac:9: -1- _AM_SUBST_NOTMAKE([am__fastdepCXX_TRUE]) +m4trace:configure.ac:9: -1- _AM_SUBST_NOTMAKE([am__fastdepCXX_FALSE]) +m4trace:configure.ac:10: -1- AC_SUBST([CC]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- AC_SUBST([CFLAGS]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CFLAGS]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.ac:10: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:10: -1- AC_SUBST([LIBS]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^LIBS$]) m4trace:configure.ac:10: -1- AC_SUBST([CPPFLAGS]) m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CPPFLAGS]) m4trace:configure.ac:10: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.ac:10: -1- AC_SUBST([CPP]) -m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CPP]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^CPP$]) -m4trace:configure.ac:10: -1- AC_SUBST([GREP]) -m4trace:configure.ac:10: -1- AC_SUBST_TRACE([GREP]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^GREP$]) -m4trace:configure.ac:10: -1- AC_SUBST([EGREP]) -m4trace:configure.ac:10: -1- AC_SUBST_TRACE([EGREP]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^EGREP$]) -m4trace:configure.ac:10: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^STDC_HEADERS$]) -m4trace:configure.ac:10: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ +m4trace:configure.ac:10: -1- AC_SUBST([CC]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- AC_SUBST([CC]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- AC_SUBST([CC]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- AC_SUBST([CC]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.ac:10: -1- AC_SUBST_TRACE([ac_ct_CC]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.ac:10: -1- AC_REQUIRE_AUX_FILE([compile]) +m4trace:configure.ac:11: -1- AM_PROG_CC_C_O +m4trace:configure.ac:13: -1- AC_SUBST([CPP]) +m4trace:configure.ac:13: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:13: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.ac:13: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:13: -1- AC_SUBST([CPP]) +m4trace:configure.ac:13: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:13: -1- AC_SUBST([GREP]) +m4trace:configure.ac:13: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.ac:13: -1- AC_SUBST([EGREP]) +m4trace:configure.ac:13: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^STDC_HEADERS$]) +m4trace:configure.ac:13: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ @%:@undef STDC_HEADERS]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_TYPES_H]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_SYS_STAT_H]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDLIB_H]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STRING_H]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_MEMORY_H]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STRINGS_H]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_INTTYPES_H]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_STDINT_H]) -m4trace:configure.ac:10: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.ac:13: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ @%:@undef HAVE_UNISTD_H]) -m4trace:configure.ac:14: -1- AC_DEFINE_TRACE_LITERAL([VALUES]) -m4trace:configure.ac:14: -1- m4_pattern_allow([^VALUES$]) -m4trace:configure.ac:14: -1- AH_OUTPUT([VALUES], [/* include values.h */ +m4trace:configure.ac:15: -1- AC_CANONICAL_HOST +m4trace:configure.ac:15: -1- AC_CANONICAL_BUILD +m4trace:configure.ac:15: -1- AC_REQUIRE_AUX_FILE([config.sub]) +m4trace:configure.ac:15: -1- AC_REQUIRE_AUX_FILE([config.guess]) +m4trace:configure.ac:15: -1- AC_SUBST([build], [$ac_cv_build]) +m4trace:configure.ac:15: -1- AC_SUBST_TRACE([build]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^build$]) +m4trace:configure.ac:15: -1- AC_SUBST([build_cpu], [$[1]]) +m4trace:configure.ac:15: -1- AC_SUBST_TRACE([build_cpu]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^build_cpu$]) +m4trace:configure.ac:15: -1- AC_SUBST([build_vendor], [$[2]]) +m4trace:configure.ac:15: -1- AC_SUBST_TRACE([build_vendor]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^build_vendor$]) +m4trace:configure.ac:15: -1- AC_SUBST([build_os]) +m4trace:configure.ac:15: -1- AC_SUBST_TRACE([build_os]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^build_os$]) +m4trace:configure.ac:15: -1- AC_SUBST([host], [$ac_cv_host]) +m4trace:configure.ac:15: -1- AC_SUBST_TRACE([host]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^host$]) +m4trace:configure.ac:15: -1- AC_SUBST([host_cpu], [$[1]]) +m4trace:configure.ac:15: -1- AC_SUBST_TRACE([host_cpu]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^host_cpu$]) +m4trace:configure.ac:15: -1- AC_SUBST([host_vendor], [$[2]]) +m4trace:configure.ac:15: -1- AC_SUBST_TRACE([host_vendor]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^host_vendor$]) +m4trace:configure.ac:15: -1- AC_SUBST([host_os]) +m4trace:configure.ac:15: -1- AC_SUBST_TRACE([host_os]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^host_os$]) +m4trace:configure.ac:47: -1- AC_SUBST([LIB64]) +m4trace:configure.ac:47: -1- AC_SUBST_TRACE([LIB64]) +m4trace:configure.ac:47: -1- m4_pattern_allow([^LIB64$]) +m4trace:configure.ac:48: -1- AC_SUBST([BUILD_ARCH]) +m4trace:configure.ac:48: -1- AC_SUBST_TRACE([BUILD_ARCH]) +m4trace:configure.ac:48: -1- m4_pattern_allow([^BUILD_ARCH$]) +m4trace:configure.ac:49: -1- AC_SUBST([NUMA]) +m4trace:configure.ac:49: -1- AC_SUBST_TRACE([NUMA]) +m4trace:configure.ac:49: -1- m4_pattern_allow([^NUMA$]) +m4trace:configure.ac:50: -1- AC_SUBST([BREW_ROOT]) +m4trace:configure.ac:50: -1- AC_SUBST_TRACE([BREW_ROOT]) +m4trace:configure.ac:50: -1- m4_pattern_allow([^BREW_ROOT$]) +m4trace:configure.ac:51: -1- AC_SUBST([APPLE_OMP]) +m4trace:configure.ac:51: -1- AC_SUBST_TRACE([APPLE_OMP]) +m4trace:configure.ac:51: -1- m4_pattern_allow([^APPLE_OMP$]) +m4trace:configure.ac:52: -1- AC_SUBST([APPLE_FFTW]) +m4trace:configure.ac:52: -1- AC_SUBST_TRACE([APPLE_FFTW]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^APPLE_FFTW$]) +m4trace:configure.ac:53: -1- AC_SUBST([APPLE_NOWARN_CONV]) +m4trace:configure.ac:53: -1- AC_SUBST_TRACE([APPLE_NOWARN_CONV]) +m4trace:configure.ac:53: -1- m4_pattern_allow([^APPLE_NOWARN_CONV$]) +m4trace:configure.ac:54: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.ac:54: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.ac:54: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:58: -1- AC_DEFINE_TRACE_LITERAL([VALUES]) +m4trace:configure.ac:58: -1- m4_pattern_allow([^VALUES$]) +m4trace:configure.ac:58: -1- AH_OUTPUT([VALUES], [/* include values.h */ @%:@undef VALUES]) -m4trace:configure.ac:22: -1- AC_DEFINE_TRACE_LITERAL([BENCHMARK]) -m4trace:configure.ac:22: -1- m4_pattern_allow([^BENCHMARK$]) -m4trace:configure.ac:22: -1- AH_OUTPUT([BENCHMARK], [/* Create a benchmark version */ +m4trace:configure.ac:66: -1- AC_DEFINE_TRACE_LITERAL([BENCHMARK]) +m4trace:configure.ac:66: -1- m4_pattern_allow([^BENCHMARK$]) +m4trace:configure.ac:66: -1- AH_OUTPUT([BENCHMARK], [/* Create a benchmark version */ @%:@undef BENCHMARK]) -m4trace:configure.ac:29: -1- AC_DEFINE_TRACE_LITERAL([DEBUG]) -m4trace:configure.ac:29: -1- m4_pattern_allow([^DEBUG$]) -m4trace:configure.ac:29: -1- AH_OUTPUT([DEBUG], [/* Enable debugging info */ +m4trace:configure.ac:73: -1- AC_DEFINE_TRACE_LITERAL([DEBUG]) +m4trace:configure.ac:73: -1- m4_pattern_allow([^DEBUG$]) +m4trace:configure.ac:73: -1- AH_OUTPUT([DEBUG], [/* Enable debugging info */ @%:@undef DEBUG]) -m4trace:configure.ac:36: -1- AC_DEFINE_TRACE_LITERAL([CLUSTERED]) -m4trace:configure.ac:36: -1- m4_pattern_allow([^CLUSTERED$]) -m4trace:configure.ac:36: -1- AH_OUTPUT([CLUSTERED], [/* Enable clustering */ +m4trace:configure.ac:80: -1- AC_DEFINE_TRACE_LITERAL([CLUSTERED]) +m4trace:configure.ac:80: -1- m4_pattern_allow([^CLUSTERED$]) +m4trace:configure.ac:80: -1- AH_OUTPUT([CLUSTERED], [/* Enable clustering */ @%:@undef CLUSTERED]) -m4trace:configure.ac:43: -1- AC_DEFINE_TRACE_LITERAL([VERBOSE]) -m4trace:configure.ac:43: -1- m4_pattern_allow([^VERBOSE$]) -m4trace:configure.ac:43: -1- AH_OUTPUT([VERBOSE], [/* Enable verbose output */ +m4trace:configure.ac:87: -1- AC_DEFINE_TRACE_LITERAL([VERBOSE]) +m4trace:configure.ac:87: -1- m4_pattern_allow([^VERBOSE$]) +m4trace:configure.ac:87: -1- AH_OUTPUT([VERBOSE], [/* Enable verbose output */ @%:@undef VERBOSE]) -m4trace:configure.ac:45: -1- AC_DEFINE_TRACE_LITERAL([VERBOSE]) -m4trace:configure.ac:45: -1- m4_pattern_allow([^VERBOSE$]) -m4trace:configure.ac:45: -1- AH_OUTPUT([VERBOSE], [/* Disable verbose output */ +m4trace:configure.ac:89: -1- AC_DEFINE_TRACE_LITERAL([VERBOSE]) +m4trace:configure.ac:89: -1- m4_pattern_allow([^VERBOSE$]) +m4trace:configure.ac:89: -1- AH_OUTPUT([VERBOSE], [/* Disable verbose output */ @%:@undef VERBOSE]) -m4trace:configure.ac:49: -1- AC_CONFIG_FILES([Makefile]) -m4trace:configure.ac:50: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) -m4trace:configure.ac:50: -1- m4_pattern_allow([^LIB@&t@OBJS$]) -m4trace:configure.ac:50: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([LTLIBOBJS]) -m4trace:configure.ac:50: -1- m4_pattern_allow([^LTLIBOBJS$]) -m4trace:configure.ac:50: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"]) -m4trace:configure.ac:50: -1- AC_SUBST([am__EXEEXT_TRUE]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([am__EXEEXT_TRUE]) -m4trace:configure.ac:50: -1- m4_pattern_allow([^am__EXEEXT_TRUE$]) -m4trace:configure.ac:50: -1- AC_SUBST([am__EXEEXT_FALSE]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([am__EXEEXT_FALSE]) -m4trace:configure.ac:50: -1- m4_pattern_allow([^am__EXEEXT_FALSE$]) -m4trace:configure.ac:50: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE]) -m4trace:configure.ac:50: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([top_builddir]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([top_build_prefix]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([srcdir]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([abs_srcdir]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([top_srcdir]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([abs_top_srcdir]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([builddir]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([abs_builddir]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([abs_top_builddir]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([INSTALL]) -m4trace:configure.ac:50: -1- AC_SUBST_TRACE([MKDIR_P]) +m4trace:configure.ac:93: -1- AC_CONFIG_FILES([Makefile]) +m4trace:configure.ac:94: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) +m4trace:configure.ac:94: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.ac:94: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([LTLIBOBJS]) +m4trace:configure.ac:94: -1- m4_pattern_allow([^LTLIBOBJS$]) +m4trace:configure.ac:94: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"]) +m4trace:configure.ac:94: -1- AC_SUBST([am__EXEEXT_TRUE]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([am__EXEEXT_TRUE]) +m4trace:configure.ac:94: -1- m4_pattern_allow([^am__EXEEXT_TRUE$]) +m4trace:configure.ac:94: -1- AC_SUBST([am__EXEEXT_FALSE]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([am__EXEEXT_FALSE]) +m4trace:configure.ac:94: -1- m4_pattern_allow([^am__EXEEXT_FALSE$]) +m4trace:configure.ac:94: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE]) +m4trace:configure.ac:94: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([top_builddir]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([top_build_prefix]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([srcdir]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([abs_srcdir]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([top_srcdir]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([abs_top_srcdir]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([builddir]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([abs_builddir]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([abs_top_builddir]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([INSTALL]) +m4trace:configure.ac:94: -1- AC_SUBST_TRACE([MKDIR_P]) diff --git a/autom4te.cache/traces.2 b/autom4te.cache/traces.2 index bee4e7ab..f067a009 100644 --- a/autom4te.cache/traces.2 +++ b/autom4te.cache/traces.2 @@ -1,1751 +1,18 @@ -m4trace:/usr/share/aclocal/libtool.m4:61: -1- AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS=$ltmain - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -]) -m4trace:/usr/share/aclocal/libtool.m4:99: -1- AU_DEFUN([AC_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:99: -1- AC_DEFUN([AC_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:100: -1- AU_DEFUN([AM_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:100: -1- AC_DEFUN([AM_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LIBTOOL' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:619: -1- AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -'$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2011 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test 0 != $[#] -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try '$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try '$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test yes = "$silent" && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -]) -m4trace:/usr/share/aclocal/libtool.m4:811: -1- AC_DEFUN([LT_SUPPORTED_TAG], []) -m4trace:/usr/share/aclocal/libtool.m4:822: -1- AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Go], [_LT_LANG(GO)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -]) -m4trace:/usr/share/aclocal/libtool.m4:914: -1- AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -m4trace:/usr/share/aclocal/libtool.m4:914: -1- AC_DEFUN([AC_LIBTOOL_CXX], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_CXX' is obsolete. -You should run autoupdate.])dnl -LT_LANG(C++)]) -m4trace:/usr/share/aclocal/libtool.m4:915: -1- AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -m4trace:/usr/share/aclocal/libtool.m4:915: -1- AC_DEFUN([AC_LIBTOOL_F77], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_F77' is obsolete. -You should run autoupdate.])dnl -LT_LANG(Fortran 77)]) -m4trace:/usr/share/aclocal/libtool.m4:916: -1- AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -m4trace:/usr/share/aclocal/libtool.m4:916: -1- AC_DEFUN([AC_LIBTOOL_FC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_FC' is obsolete. -You should run autoupdate.])dnl -LT_LANG(Fortran)]) -m4trace:/usr/share/aclocal/libtool.m4:917: -1- AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -m4trace:/usr/share/aclocal/libtool.m4:917: -1- AC_DEFUN([AC_LIBTOOL_GCJ], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_GCJ' is obsolete. -You should run autoupdate.])dnl -LT_LANG(Java)]) -m4trace:/usr/share/aclocal/libtool.m4:918: -1- AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -m4trace:/usr/share/aclocal/libtool.m4:918: -1- AC_DEFUN([AC_LIBTOOL_RC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_RC' is obsolete. -You should run autoupdate.])dnl -LT_LANG(Windows Resource)]) -m4trace:/usr/share/aclocal/libtool.m4:1246: -1- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], - [Search for dependent libraries within DIR (or the compiler's sysroot - if not specified).])], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case $with_sysroot in #( - yes) - if test yes = "$GCC"; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([$with_sysroot]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac - - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and where our libraries should be installed.])]) -m4trace:/usr/share/aclocal/libtool.m4:1577: -1- AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test yes = "[$]$2"; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -]) -m4trace:/usr/share/aclocal/libtool.m4:1619: -1- AU_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:1619: -1- AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_COMPILER_OPTION' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:1628: -1- AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS -]) - -if test yes = "[$]$2"; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -]) -m4trace:/usr/share/aclocal/libtool.m4:1663: -1- AU_DEFUN([AC_LIBTOOL_LINKER_OPTION], [m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:1663: -1- AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_LINKER_OPTION' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:1670: -1- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring=ABCD - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test X`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test 17 != "$i" # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n "$lt_cv_sys_max_cmd_len"; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -]) -m4trace:/usr/share/aclocal/libtool.m4:1809: -1- AU_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:1809: -1- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_SYS_MAX_CMD_LEN' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:1920: -1- AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl -if test yes != "$enable_dlopen"; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen=load_add_on - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen=LoadLibrary - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ - lt_cv_dlopen=dyld - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - tpf*) - # Don't try to run any link tests for TPF. We know it's impossible - # because TPF is a cross-compiler, and we know how we open DSOs. - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - lt_cv_dlopen_self=no - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen=shl_load], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen=dlopen], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test no = "$lt_cv_dlopen"; then - enable_dlopen=no - else - enable_dlopen=yes - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS=$CPPFLAGS - test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS=$LDFLAGS - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS=$LIBS - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test yes = "$lt_cv_dlopen_self"; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS=$save_CPPFLAGS - LDFLAGS=$save_LDFLAGS - LIBS=$save_LIBS - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -]) -m4trace:/usr/share/aclocal/libtool.m4:2045: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:2045: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN_SELF' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:3154: -1- AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$1"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD - ;; -esac]) -MAGIC_CMD=$lt_cv_path_MAGIC_CMD -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -]) -m4trace:/usr/share/aclocal/libtool.m4:3216: -1- AU_DEFUN([AC_PATH_TOOL_PREFIX], [m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:3216: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_DIAGNOSE([obsolete], [The macro `AC_PATH_TOOL_PREFIX' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:3239: -1- AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test no = "$withval" || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test yes = "$GCC"; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD=$ac_prog - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test yes = "$with_gnu_ld"; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 | sed '1q'` in - *$lt_bad_file* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break 2 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break 2 - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS=$lt_save_ifs - done - : ${lt_cv_path_NM=no} -fi]) -if test no != "$lt_cv_path_NM"; then - NM=$lt_cv_path_NM -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols -headers" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test : != "$DUMPBIN"; then - NM=$DUMPBIN - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -]) -m4trace:/usr/share/aclocal/libtool.m4:3753: -1- AU_DEFUN([AM_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:3753: -1- AC_DEFUN([AM_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_NM' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:3754: -1- AU_DEFUN([AC_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:3754: -1- AC_DEFUN([AC_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_NM' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:3825: -1- AC_DEFUN([_LT_DLL_DEF_P], [dnl - test DEF = "`$SED -n dnl - -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace - -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments - -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl - -e q dnl Only consider the first "real" line - $1`" dnl -]) -m4trace:/usr/share/aclocal/libtool.m4:3839: -1- AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM=-lm) - ;; -esac -AC_SUBST([LIBM]) -]) -m4trace:/usr/share/aclocal/libtool.m4:3858: -1- AU_DEFUN([AC_CHECK_LIBM], [m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:3858: -1- AC_DEFUN([AC_CHECK_LIBM], [AC_DIAGNOSE([obsolete], [The macro `AC_CHECK_LIBM' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:8121: -1- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) -m4trace:/usr/share/aclocal/libtool.m4:8130: -1- AU_DEFUN([LT_AC_PROG_GCJ], [m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:8130: -1- AC_DEFUN([LT_AC_PROG_GCJ], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_GCJ' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:8137: -1- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) -]) -m4trace:/usr/share/aclocal/libtool.m4:8144: -1- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) -]) -m4trace:/usr/share/aclocal/libtool.m4:8149: -1- AU_DEFUN([LT_AC_PROG_RC], [m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:8149: -1- AC_DEFUN([LT_AC_PROG_RC], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_RC' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:8269: -1- AU_DEFUN([LT_AC_PROG_SED], [m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])]) -m4trace:/usr/share/aclocal/libtool.m4:8269: -1- AC_DEFUN([LT_AC_PROG_SED], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_SED' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])]) -m4trace:/usr/share/aclocal/ltargz.m4:12: -1- AC_DEFUN([LT_FUNC_ARGZ], [ -AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) - -AC_CHECK_TYPES([error_t], - [], - [AC_DEFINE([error_t], [int], - [Define to a type to use for 'error_t' if it is not otherwise available.]) - AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h - does not typedef error_t.])], - [#if defined(HAVE_ARGZ_H) -# include -#endif]) - -LT_ARGZ_H= -AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ - argz_next argz_stringify], [], [LT_ARGZ_H=lt__argz.h; AC_LIBOBJ([lt__argz])]) - -dnl if have system argz functions, allow forced use of -dnl libltdl-supplied implementation (and default to do so -dnl on "known bad" systems). Could use a runtime check, but -dnl (a) detecting malloc issues is notoriously unreliable -dnl (b) only known system that declares argz functions, -dnl provides them, yet they are broken, is cygwin -dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) -dnl So, it's more straightforward simply to special case -dnl this for known bad systems. -AS_IF([test -z "$LT_ARGZ_H"], - [AC_CACHE_CHECK( - [if argz actually works], - [lt_cv_sys_argz_works], - [[case $host_os in #( - *cygwin*) - lt_cv_sys_argz_works=no - if test no != "$cross_compiling"; then - lt_cv_sys_argz_works="guessing no" - else - lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' - save_IFS=$IFS - IFS=-. - set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` - IFS=$save_IFS - lt_os_major=${2-0} - lt_os_minor=${3-0} - lt_os_micro=${4-0} - if test 1 -lt "$lt_os_major" \ - || { test 1 -eq "$lt_os_major" \ - && { test 5 -lt "$lt_os_minor" \ - || { test 5 -eq "$lt_os_minor" \ - && test 24 -lt "$lt_os_micro"; }; }; }; then - lt_cv_sys_argz_works=yes - fi - fi - ;; #( - *) lt_cv_sys_argz_works=yes ;; - esac]]) - AS_IF([test yes = "$lt_cv_sys_argz_works"], - [AC_DEFINE([HAVE_WORKING_ARGZ], 1, - [This value is set to 1 to indicate that the system argz facility works])], - [LT_ARGZ_H=lt__argz.h - AC_LIBOBJ([lt__argz])])]) - -AC_SUBST([LT_ARGZ_H]) -]) -m4trace:/usr/share/aclocal/ltdl.m4:16: -1- AC_DEFUN([LT_CONFIG_LTDL_DIR], [AC_BEFORE([$0], [LTDL_INIT]) -_$0($*) -]) -m4trace:/usr/share/aclocal/ltdl.m4:68: -1- AC_DEFUN([LTDL_CONVENIENCE], [AC_BEFORE([$0], [LTDL_INIT])dnl -dnl Although the argument is deprecated and no longer documented, -dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one -dnl here make sure it is the same as any other declaration of libltdl's -dnl location! This also ensures lt_ltdl_dir is set when configure.ac is -dnl not yet using an explicit LT_CONFIG_LTDL_DIR. -m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl -_$0() -]) -m4trace:/usr/share/aclocal/ltdl.m4:81: -1- AU_DEFUN([AC_LIBLTDL_CONVENIENCE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) -_LTDL_CONVENIENCE]) -m4trace:/usr/share/aclocal/ltdl.m4:81: -1- AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBLTDL_CONVENIENCE' is obsolete. -You should run autoupdate.])dnl -_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) -_LTDL_CONVENIENCE]) -m4trace:/usr/share/aclocal/ltdl.m4:124: -1- AC_DEFUN([LTDL_INSTALLABLE], [AC_BEFORE([$0], [LTDL_INIT])dnl -dnl Although the argument is deprecated and no longer documented, -dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one -dnl here make sure it is the same as any other declaration of libltdl's -dnl location! This also ensures lt_ltdl_dir is set when configure.ac is -dnl not yet using an explicit LT_CONFIG_LTDL_DIR. -m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl -_$0() -]) -m4trace:/usr/share/aclocal/ltdl.m4:137: -1- AU_DEFUN([AC_LIBLTDL_INSTALLABLE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) -_LTDL_INSTALLABLE]) -m4trace:/usr/share/aclocal/ltdl.m4:137: -1- AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBLTDL_INSTALLABLE' is obsolete. -You should run autoupdate.])dnl -_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) -_LTDL_INSTALLABLE]) -m4trace:/usr/share/aclocal/ltdl.m4:213: -1- AC_DEFUN([_LT_LIBOBJ], [ - m4_pattern_allow([^_LT_LIBOBJS$]) - _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" -]) -m4trace:/usr/share/aclocal/ltdl.m4:226: -1- AC_DEFUN([LTDL_INIT], [dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -dnl We need to keep our own list of libobjs separate from our parent project, -dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while -dnl we look for our own LIBOBJs. -m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) -m4_pushdef([AC_LIBSOURCES]) - -dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: -m4_if(_LTDL_MODE, [], - [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) - m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], - [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) - -AC_ARG_WITH([included_ltdl], - [AS_HELP_STRING([--with-included-ltdl], - [use the GNU ltdl sources included here])]) - -if test yes != "$with_included_ltdl"; then - # We are not being forced to use the included libltdl sources, so - # decide whether there is a useful installed version we can use. - AC_CHECK_HEADER([ltdl.h], - [AC_CHECK_DECL([lt_dlinterface_register], - [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], - [with_included_ltdl=no], - [with_included_ltdl=yes])], - [with_included_ltdl=yes], - [AC_INCLUDES_DEFAULT - #include ])], - [with_included_ltdl=yes], - [AC_INCLUDES_DEFAULT] - ) -fi - -dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE -dnl was called yet, then for old times' sake, we assume libltdl is in an -dnl eponymous directory: -AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) - -AC_ARG_WITH([ltdl_include], - [AS_HELP_STRING([--with-ltdl-include=DIR], - [use the ltdl headers installed in DIR])]) - -if test -n "$with_ltdl_include"; then - if test -f "$with_ltdl_include/ltdl.h"; then : - else - AC_MSG_ERROR([invalid ltdl include directory: '$with_ltdl_include']) - fi -else - with_ltdl_include=no -fi - -AC_ARG_WITH([ltdl_lib], - [AS_HELP_STRING([--with-ltdl-lib=DIR], - [use the libltdl.la installed in DIR])]) - -if test -n "$with_ltdl_lib"; then - if test -f "$with_ltdl_lib/libltdl.la"; then : - else - AC_MSG_ERROR([invalid ltdl library directory: '$with_ltdl_lib']) - fi -else - with_ltdl_lib=no -fi - -case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in - ,yes,no,no,) - m4_case(m4_default(_LTDL_TYPE, [convenience]), - [convenience], [_LTDL_CONVENIENCE], - [installable], [_LTDL_INSTALLABLE], - [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) - ;; - ,no,no,no,) - # If the included ltdl is not to be used, then use the - # preinstalled libltdl we found. - AC_DEFINE([HAVE_LTDL], [1], - [Define this if a modern libltdl is already installed]) - LIBLTDL=-lltdl - LTDLDEPS= - LTDLINCL= - ;; - ,no*,no,*) - AC_MSG_ERROR(['--with-ltdl-include' and '--with-ltdl-lib' options must be used together]) - ;; - *) with_included_ltdl=no - LIBLTDL="-L$with_ltdl_lib -lltdl" - LTDLDEPS= - LTDLINCL=-I$with_ltdl_include - ;; -esac -INCLTDL=$LTDLINCL - -# Report our decision... -AC_MSG_CHECKING([where to find libltdl headers]) -AC_MSG_RESULT([$LTDLINCL]) -AC_MSG_CHECKING([where to find libltdl library]) -AC_MSG_RESULT([$LIBLTDL]) - -_LTDL_SETUP - -dnl restore autoconf definition. -m4_popdef([AC_LIBOBJ]) -m4_popdef([AC_LIBSOURCES]) - -AC_CONFIG_COMMANDS_PRE([ - _ltdl_libobjs= - _ltdl_ltlibobjs= - if test -n "$_LT_LIBOBJS"; then - # Remove the extension. - _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do - _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" - _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" - done - fi - AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) - AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) -]) - -# Only expand once: -m4_define([LTDL_INIT]) -]) -m4trace:/usr/share/aclocal/ltdl.m4:352: -1- AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) -m4trace:/usr/share/aclocal/ltdl.m4:352: -1- AC_DEFUN([AC_LIB_LTDL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIB_LTDL' is obsolete. -You should run autoupdate.])dnl -LTDL_INIT($@)]) -m4trace:/usr/share/aclocal/ltdl.m4:353: -1- AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) -m4trace:/usr/share/aclocal/ltdl.m4:353: -1- AC_DEFUN([AC_WITH_LTDL], [AC_DIAGNOSE([obsolete], [The macro `AC_WITH_LTDL' is obsolete. -You should run autoupdate.])dnl -LTDL_INIT($@)]) -m4trace:/usr/share/aclocal/ltdl.m4:354: -1- AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) -m4trace:/usr/share/aclocal/ltdl.m4:354: -1- AC_DEFUN([LT_WITH_LTDL], [AC_DIAGNOSE([obsolete], [The macro `LT_WITH_LTDL' is obsolete. -You should run autoupdate.])dnl -LTDL_INIT($@)]) -m4trace:/usr/share/aclocal/ltdl.m4:367: -1- AC_DEFUN([_LTDL_SETUP], [AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_SYS_MODULE_EXT])dnl -AC_REQUIRE([LT_SYS_MODULE_PATH])dnl -AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl -AC_REQUIRE([LT_LIB_DLLOAD])dnl -AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl -AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl -AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl -AC_REQUIRE([LT_FUNC_ARGZ])dnl - -m4_require([_LT_CHECK_OBJDIR])dnl -m4_require([_LT_HEADER_DLFCN])dnl -m4_require([_LT_CHECK_DLPREOPEN])dnl -m4_require([_LT_DECL_SED])dnl - -dnl Don't require this, or it will be expanded earlier than the code -dnl that sets the variables it relies on: -_LT_ENABLE_INSTALL - -dnl _LTDL_MODE specific code must be called at least once: -_LTDL_MODE_DISPATCH - -# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS -# the user used. This is so that ltdl.h can pick up the parent projects -# config.h file, The first file in AC_CONFIG_HEADERS must contain the -# definitions required by ltdl.c. -# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). -AC_CONFIG_COMMANDS_PRE([dnl -m4_pattern_allow([^LT_CONFIG_H$])dnl -m4_ifset([AH_HEADER], - [LT_CONFIG_H=AH_HEADER], - [m4_ifset([AC_LIST_HEADERS], - [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's|^[[ ]]*||;s|[[ :]].*$||'`], - [])])]) -AC_SUBST([LT_CONFIG_H]) - -AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], - [], [], [AC_INCLUDES_DEFAULT]) - -AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) -AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) - -m4_pattern_allow([LT_LIBEXT])dnl -AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) - -name= -eval "lt_libprefix=\"$libname_spec\"" -m4_pattern_allow([LT_LIBPREFIX])dnl -AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) - -name=ltdl -eval "LTDLOPEN=\"$libname_spec\"" -AC_SUBST([LTDLOPEN]) -]) -m4trace:/usr/share/aclocal/ltdl.m4:443: -1- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_CACHE_CHECK([whether deplibs are loaded by dlopen], - [lt_cv_sys_dlopen_deplibs], - [# PORTME does your system automatically load deplibs for dlopen? - # or its logical equivalent (e.g. shl_load for HP-UX < 11) - # For now, we just catch OSes we know something about -- in the - # future, we'll try test this programmatically. - lt_cv_sys_dlopen_deplibs=unknown - case $host_os in - aix3*|aix4.1.*|aix4.2.*) - # Unknown whether this is true for these versions of AIX, but - # we want this 'case' here to explicitly catch those versions. - lt_cv_sys_dlopen_deplibs=unknown - ;; - aix[[4-9]]*) - lt_cv_sys_dlopen_deplibs=yes - ;; - amigaos*) - case $host_cpu in - powerpc) - lt_cv_sys_dlopen_deplibs=no - ;; - esac - ;; - bitrig*) - lt_cv_sys_dlopen_deplibs=yes - ;; - darwin*) - # Assuming the user has installed a libdl from somewhere, this is true - # If you are looking for one http://www.opendarwin.org/projects/dlcompat - lt_cv_sys_dlopen_deplibs=yes - ;; - freebsd* | dragonfly*) - lt_cv_sys_dlopen_deplibs=yes - ;; - gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) - # GNU and its variants, using gnu ld.so (Glibc) - lt_cv_sys_dlopen_deplibs=yes - ;; - hpux10*|hpux11*) - lt_cv_sys_dlopen_deplibs=yes - ;; - interix*) - lt_cv_sys_dlopen_deplibs=yes - ;; - irix[[12345]]*|irix6.[[01]]*) - # Catch all versions of IRIX before 6.2, and indicate that we don't - # know how it worked for any of those versions. - lt_cv_sys_dlopen_deplibs=unknown - ;; - irix*) - # The case above catches anything before 6.2, and it's known that - # at 6.2 and later dlopen does load deplibs. - lt_cv_sys_dlopen_deplibs=yes - ;; - netbsd*) - lt_cv_sys_dlopen_deplibs=yes - ;; - openbsd*) - lt_cv_sys_dlopen_deplibs=yes - ;; - osf[[1234]]*) - # dlopen did load deplibs (at least at 4.x), but until the 5.x series, - # it did *not* use an RPATH in a shared library to find objects the - # library depends on, so we explicitly say 'no'. - lt_cv_sys_dlopen_deplibs=no - ;; - osf5.0|osf5.0a|osf5.1) - # dlopen *does* load deplibs and with the right loader patch applied - # it even uses RPATH in a shared library to search for shared objects - # that the library depends on, but there's no easy way to know if that - # patch is installed. Since this is the case, all we can really - # say is unknown -- it depends on the patch being installed. If - # it is, this changes to 'yes'. Without it, it would be 'no'. - lt_cv_sys_dlopen_deplibs=unknown - ;; - osf*) - # the two cases above should catch all versions of osf <= 5.1. Read - # the comments above for what we know about them. - # At > 5.1, deplibs are loaded *and* any RPATH in a shared library - # is used to find them so we can finally say 'yes'. - lt_cv_sys_dlopen_deplibs=yes - ;; - qnx*) - lt_cv_sys_dlopen_deplibs=yes - ;; - solaris*) - lt_cv_sys_dlopen_deplibs=yes - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - esac - ]) -if test yes != "$lt_cv_sys_dlopen_deplibs"; then - AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], - [Define if the OS needs help to load dependent libraries for dlopen().]) -fi -]) -m4trace:/usr/share/aclocal/ltdl.m4:545: -1- AU_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:545: -1- AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYS_DLOPEN_DEPLIBS' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:552: -1- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([what extension is used for runtime loadable modules], - [libltdl_cv_shlibext], -[ -module=yes -eval libltdl_cv_shlibext=$shrext_cmds -module=no -eval libltdl_cv_shrext=$shrext_cmds - ]) -if test -n "$libltdl_cv_shlibext"; then - m4_pattern_allow([LT_MODULE_EXT])dnl - AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], - [Define to the extension used for runtime loadable modules, say, ".so".]) -fi -if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then - m4_pattern_allow([LT_SHARED_EXT])dnl - AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], - [Define to the shared library suffix, say, ".dylib".]) -fi -if test -n "$shared_archive_member_spec"; then - m4_pattern_allow([LT_SHARED_LIB_MEMBER])dnl - AC_DEFINE_UNQUOTED([LT_SHARED_LIB_MEMBER], ["($shared_archive_member_spec.o)"], - [Define to the shared archive member specification, say "(shr.o)".]) -fi -]) -m4trace:/usr/share/aclocal/ltdl.m4:580: -1- AU_DEFUN([AC_LTDL_SHLIBEXT], [m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:580: -1- AC_DEFUN([AC_LTDL_SHLIBEXT], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBEXT' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:587: -1- AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([what variable specifies run-time module search path], - [lt_cv_module_path_var], [lt_cv_module_path_var=$shlibpath_var]) -if test -n "$lt_cv_module_path_var"; then - m4_pattern_allow([LT_MODULE_PATH_VAR])dnl - AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], - [Define to the name of the environment variable that determines the run-time module search path.]) -fi -]) -m4trace:/usr/share/aclocal/ltdl.m4:599: -1- AU_DEFUN([AC_LTDL_SHLIBPATH], [m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:599: -1- AC_DEFUN([AC_LTDL_SHLIBPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBPATH' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:606: -1- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([for the default library search path], - [lt_cv_sys_dlsearch_path], - [lt_cv_sys_dlsearch_path=$sys_lib_dlsearch_path_spec]) -if test -n "$lt_cv_sys_dlsearch_path"; then - sys_dlsearch_path= - for dir in $lt_cv_sys_dlsearch_path; do - if test -z "$sys_dlsearch_path"; then - sys_dlsearch_path=$dir - else - sys_dlsearch_path=$sys_dlsearch_path$PATH_SEPARATOR$dir - fi - done - m4_pattern_allow([LT_DLSEARCH_PATH])dnl - AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], - [Define to the system default library search path.]) -fi -]) -m4trace:/usr/share/aclocal/ltdl.m4:627: -1- AU_DEFUN([AC_LTDL_SYSSEARCHPATH], [m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:627: -1- AC_DEFUN([AC_LTDL_SYSSEARCHPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYSSEARCHPATH' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:653: -1- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$]) -LT_DLLOADERS= -AC_SUBST([LT_DLLOADERS]) - -AC_LANG_PUSH([C]) -lt_dlload_save_LIBS=$LIBS - -LIBADD_DLOPEN= -AC_SEARCH_LIBS([dlopen], [dl], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - if test "$ac_cv_search_dlopen" != "none required"; then - LIBADD_DLOPEN=-ldl - fi - libltdl_cv_lib_dl_dlopen=yes - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H -# include -#endif - ]], [[dlopen(0, 0);]])], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - libltdl_cv_func_dlopen=yes - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], - [AC_CHECK_LIB([svld], [dlopen], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - LIBADD_DLOPEN=-lsvld libltdl_cv_func_dlopen=yes - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) -if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen" -then - lt_save_LIBS=$LIBS - LIBS="$LIBS $LIBADD_DLOPEN" - AC_CHECK_FUNCS([dlerror]) - LIBS=$lt_save_LIBS -fi -AC_SUBST([LIBADD_DLOPEN]) - -LIBADD_SHL_LOAD= -AC_CHECK_FUNC([shl_load], - [AC_DEFINE([HAVE_SHL_LOAD], [1], - [Define if you have the shl_load function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], - [AC_CHECK_LIB([dld], [shl_load], - [AC_DEFINE([HAVE_SHL_LOAD], [1], - [Define if you have the shl_load function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" - LIBADD_SHL_LOAD=-ldld])]) -AC_SUBST([LIBADD_SHL_LOAD]) - -case $host_os in -darwin[[1567]].*) -# We only want this for pre-Mac OS X 10.4. - AC_CHECK_FUNC([_dyld_func_lookup], - [AC_DEFINE([HAVE_DYLD], [1], - [Define if you have the _dyld_func_lookup function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) - ;; -beos*) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" - ;; -cygwin* | mingw* | pw32*) - AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" - ;; -esac - -AC_CHECK_LIB([dld], [dld_link], - [AC_DEFINE([HAVE_DLD], [1], - [Define if you have the GNU dld library.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) -AC_SUBST([LIBADD_DLD_LINK]) - -m4_pattern_allow([^LT_DLPREOPEN$]) -LT_DLPREOPEN= -if test -n "$LT_DLLOADERS" -then - for lt_loader in $LT_DLLOADERS; do - LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " - done - AC_DEFINE([HAVE_LIBDLLOADER], [1], - [Define if libdlloader will be built on this platform]) -fi -AC_SUBST([LT_DLPREOPEN]) - -dnl This isn't used anymore, but set it for backwards compatibility -LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" -AC_SUBST([LIBADD_DL]) - -LIBS=$lt_dlload_save_LIBS -AC_LANG_POP -]) -m4trace:/usr/share/aclocal/ltdl.m4:748: -1- AU_DEFUN([AC_LTDL_DLLIB], [m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:748: -1- AC_DEFUN([AC_LTDL_DLLIB], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLLIB' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:756: -1- AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -AC_CACHE_CHECK([for _ prefix in compiled symbols], - [lt_cv_sys_symbol_underscore], - [lt_cv_sys_symbol_underscore=no - cat > conftest.$ac_ext <<_LT_EOF -void nm_test_func(){} -int main(){nm_test_func;return 0;} -_LT_EOF - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - ac_nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then - # See whether the symbols have a leading underscore. - if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then - lt_cv_sys_symbol_underscore=yes - else - if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then - : - else - echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD - fi - fi - else - echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.c >&AS_MESSAGE_LOG_FD - fi - rm -rf conftest* - ]) - sys_symbol_underscore=$lt_cv_sys_symbol_underscore - AC_SUBST([sys_symbol_underscore]) -]) -m4trace:/usr/share/aclocal/ltdl.m4:793: -1- AU_DEFUN([AC_LTDL_SYMBOL_USCORE], [m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:793: -1- AC_DEFUN([AC_LTDL_SYMBOL_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYMBOL_USCORE' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:800: -1- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([_LT_COMPILER_PIC])dnl for lt_prog_compiler_wl -AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl for lt_cv_sys_symbol_underscore -AC_REQUIRE([LT_SYS_MODULE_EXT])dnl for libltdl_cv_shlibext -if test yes = "$lt_cv_sys_symbol_underscore"; then - if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen"; then - AC_CACHE_CHECK([whether we have to add an underscore for dlsym], - [libltdl_cv_need_uscore], - [libltdl_cv_need_uscore=unknown - dlsym_uscore_save_LIBS=$LIBS - LIBS="$LIBS $LIBADD_DLOPEN" - libname=conftmod # stay within 8.3 filename limits! - cat >$libname.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif -int fnord () { return 42; }] -_LT_EOF - - # ltfn_module_cmds module_cmds - # Execute tilde-delimited MODULE_CMDS with environment primed for - # $module_cmds or $archive_cmds type content. - ltfn_module_cmds () - {( # subshell avoids polluting parent global environment - module_cmds_save_ifs=$IFS; IFS='~' - for cmd in @S|@1; do - IFS=$module_cmds_save_ifs - libobjs=$libname.$ac_objext; lib=$libname$libltdl_cv_shlibext - rpath=/not-exists; soname=$libname$libltdl_cv_shlibext; output_objdir=. - major=; versuffix=; verstring=; deplibs= - ECHO=echo; wl=$lt_prog_compiler_wl; allow_undefined_flag= - eval $cmd - done - IFS=$module_cmds_save_ifs - )} - - # Compile a loadable module using libtool macro expansion results. - $CC $pic_flag -c $libname.$ac_ext - ltfn_module_cmds "${module_cmds:-$archive_cmds}" - - # Try to fetch fnord with dlsym(). - libltdl_dlunknown=0; libltdl_dlnouscore=1; libltdl_dluscore=2 - cat >conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" -#if HAVE_DLFCN_H -#include -#endif -#include -#ifndef RTLD_GLOBAL -# ifdef DL_GLOBAL -# define RTLD_GLOBAL DL_GLOBAL -# else -# define RTLD_GLOBAL 0 -# endif -#endif -#ifndef RTLD_NOW -# ifdef DL_NOW -# define RTLD_NOW DL_NOW -# else -# define RTLD_NOW 0 -# endif -#endif -int main () { - void *handle = dlopen ("`pwd`/$libname$libltdl_cv_shlibext", RTLD_GLOBAL|RTLD_NOW); - int status = $libltdl_dlunknown; - if (handle) { - if (dlsym (handle, "fnord")) - status = $libltdl_dlnouscore; - else { - if (dlsym (handle, "_fnord")) - status = $libltdl_dluscore; - else - puts (dlerror ()); - } - dlclose (handle); - } else - puts (dlerror ()); - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - libltdl_status=$? - case x$libltdl_status in - x$libltdl_dlnouscore) libltdl_cv_need_uscore=no ;; - x$libltdl_dluscore) libltdl_cv_need_uscore=yes ;; - x*) libltdl_cv_need_uscore=unknown ;; - esac - fi - rm -rf conftest* $libname* - LIBS=$dlsym_uscore_save_LIBS - ]) - fi -fi - -if test yes = "$libltdl_cv_need_uscore"; then - AC_DEFINE([NEED_USCORE], [1], - [Define if dlsym() requires a leading underscore in symbol names.]) -fi -]) -m4trace:/usr/share/aclocal/ltdl.m4:907: -1- AU_DEFUN([AC_LTDL_DLSYM_USCORE], [m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])]) -m4trace:/usr/share/aclocal/ltdl.m4:907: -1- AC_DEFUN([AC_LTDL_DLSYM_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLSYM_USCORE' is obsolete. -You should run autoupdate.])dnl -m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])]) -m4trace:/usr/share/aclocal/ltoptions.m4:14: -1- AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) -m4trace:/usr/share/aclocal/ltoptions.m4:113: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'dlopen' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:113: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN' is obsolete. -You should run autoupdate.])dnl -_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'dlopen' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:148: -1- AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'win32-dll' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:148: -1- AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_WIN32_DLL' is obsolete. -You should run autoupdate.])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'win32-dll' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:197: -1- AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:201: -1- AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:205: -1- AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -m4trace:/usr/share/aclocal/ltoptions.m4:205: -1- AC_DEFUN([AM_ENABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_SHARED' is obsolete. -You should run autoupdate.])dnl -AC_ENABLE_SHARED($@)]) -m4trace:/usr/share/aclocal/ltoptions.m4:206: -1- AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -m4trace:/usr/share/aclocal/ltoptions.m4:206: -1- AC_DEFUN([AM_DISABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_SHARED' is obsolete. -You should run autoupdate.])dnl -AC_DISABLE_SHARED($@)]) -m4trace:/usr/share/aclocal/ltoptions.m4:251: -1- AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:255: -1- AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:259: -1- AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -m4trace:/usr/share/aclocal/ltoptions.m4:259: -1- AC_DEFUN([AM_ENABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_STATIC' is obsolete. -You should run autoupdate.])dnl -AC_ENABLE_STATIC($@)]) -m4trace:/usr/share/aclocal/ltoptions.m4:260: -1- AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -m4trace:/usr/share/aclocal/ltoptions.m4:260: -1- AC_DEFUN([AM_DISABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_STATIC' is obsolete. -You should run autoupdate.])dnl -AC_DISABLE_STATIC($@)]) -m4trace:/usr/share/aclocal/ltoptions.m4:305: -1- AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the 'fast-install' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:305: -1- AC_DEFUN([AC_ENABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_ENABLE_FAST_INSTALL' is obsolete. -You should run autoupdate.])dnl -_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the 'fast-install' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:312: -1- AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the 'disable-fast-install' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:312: -1- AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_DISABLE_FAST_INSTALL' is obsolete. -You should run autoupdate.])dnl -_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the 'disable-fast-install' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:411: -1- AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'pic-only' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltoptions.m4:411: -1- AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_PICMODE' is obsolete. -You should run autoupdate.])dnl -_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'pic-only' option into LT_INIT's first parameter.]) -]) -m4trace:/usr/share/aclocal/ltsugar.m4:14: -1- AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) -m4trace:/usr/share/aclocal/ltversion.m4:18: -1- AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' -macro_revision='2.4.6' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:37: -1- AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:41: -1- AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:42: -1- AC_DEFUN([_LT_AC_SHELL_INIT]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:43: -1- AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:45: -1- AC_DEFUN([_LT_AC_TAGVAR]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:46: -1- AC_DEFUN([AC_LTDL_ENABLE_INSTALL]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:47: -1- AC_DEFUN([AC_LTDL_PREOPEN]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:48: -1- AC_DEFUN([_LT_AC_SYS_COMPILER]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:49: -1- AC_DEFUN([_LT_AC_LOCK]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:50: -1- AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:51: -1- AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:52: -1- AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:53: -1- AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:54: -1- AC_DEFUN([AC_LIBTOOL_OBJDIR]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:55: -1- AC_DEFUN([AC_LTDL_OBJDIR]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:56: -1- AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:57: -1- AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:58: -1- AC_DEFUN([AC_PATH_MAGIC]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:59: -1- AC_DEFUN([AC_PROG_LD_GNU]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:60: -1- AC_DEFUN([AC_PROG_LD_RELOAD_FLAG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:61: -1- AC_DEFUN([AC_DEPLIBS_CHECK_METHOD]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:62: -1- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:63: -1- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:64: -1- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:65: -1- AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:66: -1- AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:67: -1- AC_DEFUN([LT_AC_PROG_EGREP]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:72: -1- AC_DEFUN([_AC_PROG_LIBTOOL]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:73: -1- AC_DEFUN([AC_LIBTOOL_SETUP]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:74: -1- AC_DEFUN([_LT_AC_CHECK_DLFCN]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:75: -1- AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:76: -1- AC_DEFUN([_LT_AC_TAGCONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:78: -1- AC_DEFUN([_LT_AC_LANG_CXX]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:79: -1- AC_DEFUN([_LT_AC_LANG_F77]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:80: -1- AC_DEFUN([_LT_AC_LANG_GCJ]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:81: -1- AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:82: -1- AC_DEFUN([_LT_AC_LANG_C_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:83: -1- AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:84: -1- AC_DEFUN([_LT_AC_LANG_CXX_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:85: -1- AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:86: -1- AC_DEFUN([_LT_AC_LANG_F77_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:87: -1- AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:88: -1- AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:89: -1- AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:90: -1- AC_DEFUN([_LT_AC_LANG_RC_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:91: -1- AC_DEFUN([AC_LIBTOOL_CONFIG]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:92: -1- AC_DEFUN([_LT_AC_FILE_LTDLL_C]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:94: -1- AC_DEFUN([_LT_AC_PROG_CXXCPP]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:97: -1- AC_DEFUN([_LT_PROG_F77]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:98: -1- AC_DEFUN([_LT_PROG_FC]) -m4trace:/usr/share/aclocal/lt~obsolete.m4:99: -1- AC_DEFUN([_LT_PROG_CXX]) -m4trace:/usr/share/aclocal-1.15/amversion.m4:14: -1- AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' +m4trace:/usr/share/aclocal-1.16/amversion.m4:14: -1- AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15.1], [], +m4_if([$1], [1.16.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) -m4trace:/usr/share/aclocal-1.15/amversion.m4:33: -1- AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15.1])dnl +m4trace:/usr/share/aclocal-1.16/amversion.m4:33: -1- AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -m4trace:/usr/share/aclocal-1.15/ar-lib.m4:13: -1- AC_DEFUN([AM_PROG_AR], [AC_BEFORE([$0], [LT_INIT])dnl -AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([ar-lib])dnl -AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) -: ${AR=ar} - -AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], - [AC_LANG_PUSH([C]) - am_cv_ar_interface=ar - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], - [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - ]) - AC_LANG_POP([C])]) - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - m4_default([$1], - [AC_MSG_ERROR([could not determine $AR interface])]) - ;; -esac -AC_SUBST([AR])dnl -]) -m4trace:/usr/share/aclocal-1.15/auxdir.m4:47: -1- AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +m4trace:/usr/share/aclocal-1.16/auxdir.m4:47: -1- AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) -m4trace:/usr/share/aclocal-1.15/cond.m4:12: -1- AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl +m4trace:/usr/share/aclocal-1.16/cond.m4:12: -1- AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl @@ -1765,7 +32,7 @@ AC_CONFIG_COMMANDS_PRE( AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) -m4trace:/usr/share/aclocal-1.15/depend.m4:26: -1- AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl +m4trace:/usr/share/aclocal-1.16/depend.m4:26: -1- AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl @@ -1895,10 +162,10 @@ AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) -m4trace:/usr/share/aclocal-1.15/depend.m4:163: -1- AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl +m4trace:/usr/share/aclocal-1.16/depend.m4:163: -1- AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) -m4trace:/usr/share/aclocal-1.15/depend.m4:171: -1- AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl +m4trace:/usr/share/aclocal-1.16/depend.m4:171: -1- AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) @@ -1916,60 +183,53 @@ _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) -m4trace:/usr/share/aclocal-1.15/depout.m4:12: -1- AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ +m4trace:/usr/share/aclocal-1.16/depout.m4:11: -1- AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk } ]) -m4trace:/usr/share/aclocal-1.15/depout.m4:71: -1- AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], +m4trace:/usr/share/aclocal-1.16/depout.m4:64: -1- AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) -m4trace:/usr/share/aclocal-1.15/init.m4:29: -1- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) +m4trace:/usr/share/aclocal-1.16/init.m4:29: -1- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -2029,8 +289,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -2097,7 +357,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -2111,7 +371,7 @@ dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) -m4trace:/usr/share/aclocal-1.15/init.m4:186: -1- AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +m4trace:/usr/share/aclocal-1.16/init.m4:186: -1- AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do @@ -2123,7 +383,7 @@ for _am_header in $config_headers :; do esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -m4trace:/usr/share/aclocal-1.15/install-sh.m4:11: -1- AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +m4trace:/usr/share/aclocal-1.16/install-sh.m4:11: -1- AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) @@ -2133,7 +393,7 @@ if test x"${install_sh+set}" != xset; then esac fi AC_SUBST([install_sh])]) -m4trace:/usr/share/aclocal-1.15/lead-dot.m4:10: -1- AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null +m4trace:/usr/share/aclocal-1.16/lead-dot.m4:10: -1- AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. @@ -2142,47 +402,39 @@ else fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -m4trace:/usr/share/aclocal-1.15/make.m4:12: -1- AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} -cat > confinc << 'END' +m4trace:/usr/share/aclocal-1.16/make.m4:13: -1- AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) -m4trace:/usr/share/aclocal-1.15/missing.m4:11: -1- AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +m4trace:/usr/share/aclocal-1.16/make.m4:42: -1- m4_pattern_allow([^am__quote$]) +m4trace:/usr/share/aclocal-1.16/missing.m4:11: -1- AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) -m4trace:/usr/share/aclocal-1.15/missing.m4:20: -1- AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +m4trace:/usr/share/aclocal-1.16/missing.m4:20: -1- AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -2200,11 +452,11 @@ else AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -m4trace:/usr/share/aclocal-1.15/options.m4:11: -1- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) -m4trace:/usr/share/aclocal-1.15/options.m4:17: -1- AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) -m4trace:/usr/share/aclocal-1.15/options.m4:23: -1- AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) -m4trace:/usr/share/aclocal-1.15/options.m4:29: -1- AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -m4trace:/usr/share/aclocal-1.15/prog-cc-c-o.m4:12: -1- AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +m4trace:/usr/share/aclocal-1.16/options.m4:11: -1- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) +m4trace:/usr/share/aclocal-1.16/options.m4:17: -1- AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) +m4trace:/usr/share/aclocal-1.16/options.m4:23: -1- AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) +m4trace:/usr/share/aclocal-1.16/options.m4:29: -1- AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +m4trace:/usr/share/aclocal-1.16/prog-cc-c-o.m4:12: -1- AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( @@ -2236,13 +488,13 @@ if test "$am_cv_prog_cc_c_o" != yes; then CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) -m4trace:/usr/share/aclocal-1.15/prog-cc-c-o.m4:47: -1- AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -m4trace:/usr/share/aclocal-1.15/runlog.m4:12: -1- AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD +m4trace:/usr/share/aclocal-1.16/prog-cc-c-o.m4:47: -1- AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) +m4trace:/usr/share/aclocal-1.16/runlog.m4:12: -1- AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) -m4trace:/usr/share/aclocal-1.15/sanity.m4:11: -1- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) +m4trace:/usr/share/aclocal-1.16/sanity.m4:11: -1- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -2313,7 +565,7 @@ AC_CONFIG_COMMANDS_PRE( AC_MSG_RESULT([done])]) rm -f conftest.file ]) -m4trace:/usr/share/aclocal-1.15/silent.m4:12: -1- AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl +m4trace:/usr/share/aclocal-1.16/silent.m4:12: -1- AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) @@ -2361,7 +613,7 @@ AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -m4trace:/usr/share/aclocal-1.15/strip.m4:17: -1- AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +m4trace:/usr/share/aclocal-1.16/strip.m4:17: -1- AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake @@ -2372,9 +624,9 @@ if test "$cross_compiling" != no; then fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -m4trace:/usr/share/aclocal-1.15/substnot.m4:12: -1- AC_DEFUN([_AM_SUBST_NOTMAKE]) -m4trace:/usr/share/aclocal-1.15/substnot.m4:17: -1- AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) -m4trace:/usr/share/aclocal-1.15/tar.m4:23: -1- AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used +m4trace:/usr/share/aclocal-1.16/substnot.m4:12: -1- AC_DEFUN([_AM_SUBST_NOTMAKE]) +m4trace:/usr/share/aclocal-1.16/substnot.m4:17: -1- AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) +m4trace:/usr/share/aclocal-1.16/tar.m4:23: -1- AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) @@ -2509,6 +761,7 @@ m4trace:configure.ac:1: -1- m4_pattern_allow([^datadir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^sysconfdir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^sharedstatedir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.ac:1: -1- m4_pattern_allow([^runstatedir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^includedir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^oldincludedir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^docdir$]) @@ -2537,7 +790,7 @@ m4trace:configure.ac:1: -1- m4_pattern_allow([^target_alias$]) m4trace:configure.ac:4: -1- AM_INIT_AUTOMAKE([1.10 -Wall no-define]) m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) m4trace:configure.ac:4: -1- AM_SET_CURRENT_AUTOMAKE_VERSION -m4trace:configure.ac:4: -1- AM_AUTOMAKE_VERSION([1.15.1]) +m4trace:configure.ac:4: -1- AM_AUTOMAKE_VERSION([1.16.2]) m4trace:configure.ac:4: -1- _AM_AUTOCONF_VERSION([2.69]) m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) @@ -2632,8 +885,8 @@ m4trace:configure.ac:6: -1- AM_SET_DEPDIR m4trace:configure.ac:6: -1- m4_pattern_allow([^DEPDIR$]) m4trace:configure.ac:6: -1- AM_OUTPUT_DEPENDENCY_COMMANDS m4trace:configure.ac:6: -1- AM_MAKE_INCLUDE +m4trace:configure.ac:6: -1- AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) m4trace:configure.ac:6: -1- m4_pattern_allow([^am__include$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__quote$]) m4trace:configure.ac:6: -1- AM_DEP_TRACK m4trace:configure.ac:6: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) m4trace:configure.ac:6: -1- m4_pattern_allow([^AMDEP_TRUE$]) @@ -2673,31 +926,29 @@ m4trace:configure.ac:7: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) m4trace:configure.ac:7: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) m4trace:configure.ac:7: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE]) m4trace:configure.ac:7: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE]) -m4trace:configure.ac:8: -1- AM_PROG_AR -m4trace:configure.ac:8: -1- m4_pattern_allow([^AR$]) -m4trace:configure.ac:8: -1- m4_pattern_allow([^ac_ct_AR$]) -m4trace:configure.ac:8: -1- m4_pattern_allow([^AR$]) -m4trace:configure.ac:9: -1- m4_pattern_allow([^RANLIB$]) -m4trace:configure.ac:10: -1- AM_PROG_CC_C_O -m4trace:configure.ac:11: -1- m4_pattern_allow([^CPP$]) -m4trace:configure.ac:11: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.ac:11: -1- m4_pattern_allow([^CPP$]) -m4trace:configure.ac:11: -1- AC_PROG_EGREP -m4trace:configure.ac:11: -1- m4_pattern_allow([^GREP$]) -m4trace:configure.ac:11: -1- m4_pattern_allow([^EGREP$]) -m4trace:configure.ac:11: -1- m4_pattern_allow([^STDC_HEADERS$]) -m4trace:configure.ac:15: -1- m4_pattern_allow([^VALUES$]) -m4trace:configure.ac:23: -1- m4_pattern_allow([^BENCHMARK$]) -m4trace:configure.ac:30: -1- m4_pattern_allow([^DEBUG$]) -m4trace:configure.ac:37: -1- m4_pattern_allow([^CLUSTERED$]) -m4trace:configure.ac:44: -1- m4_pattern_allow([^VERBOSE$]) -m4trace:configure.ac:46: -1- m4_pattern_allow([^VERBOSE$]) -m4trace:configure.ac:51: -1- m4_pattern_allow([^LIB@&t@OBJS$]) -m4trace:configure.ac:51: -1- m4_pattern_allow([^LTLIBOBJS$]) -m4trace:configure.ac:51: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"]) -m4trace:configure.ac:51: -1- m4_pattern_allow([^am__EXEEXT_TRUE$]) -m4trace:configure.ac:51: -1- m4_pattern_allow([^am__EXEEXT_FALSE$]) -m4trace:configure.ac:51: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE]) -m4trace:configure.ac:51: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE]) -m4trace:configure.ac:51: -1- _AC_AM_CONFIG_HEADER_HOOK(["$ac_file"]) -m4trace:configure.ac:51: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS +m4trace:configure.ac:8: -1- m4_pattern_allow([^RANLIB$]) +m4trace:configure.ac:9: -1- AM_PROG_CC_C_O +m4trace:configure.ac:10: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^STDC_HEADERS$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^VALUES$]) +m4trace:configure.ac:24: -1- m4_pattern_allow([^BENCHMARK$]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^DEBUG$]) +m4trace:configure.ac:38: -1- m4_pattern_allow([^CLUSTERED$]) +m4trace:configure.ac:45: -1- m4_pattern_allow([^VERBOSE$]) +m4trace:configure.ac:47: -1- m4_pattern_allow([^VERBOSE$]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^LTLIBOBJS$]) +m4trace:configure.ac:52: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^am__EXEEXT_TRUE$]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^am__EXEEXT_FALSE$]) +m4trace:configure.ac:52: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE]) +m4trace:configure.ac:52: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE]) +m4trace:configure.ac:52: -1- _AC_AM_CONFIG_HEADER_HOOK(["$ac_file"]) +m4trace:configure.ac:52: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS +m4trace:configure.ac:52: -1- AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) diff --git a/autom4te.cache/traces.3 b/autom4te.cache/traces.3 index f82de460..5f6ce49a 100644 --- a/autom4te.cache/traces.3 +++ b/autom4te.cache/traces.3 @@ -1,18 +1,1751 @@ -m4trace:/usr/share/aclocal-1.15/amversion.m4:14: -1- AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' +m4trace:/usr/share/aclocal/libtool.m4:61: -1- AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +]) +m4trace:/usr/share/aclocal/libtool.m4:99: -1- AU_DEFUN([AC_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:99: -1- AC_DEFUN([AC_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:100: -1- AU_DEFUN([AM_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:100: -1- AC_DEFUN([AM_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LIBTOOL' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_INIT], [LT_INIT($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:619: -1- AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +]) +m4trace:/usr/share/aclocal/libtool.m4:812: -1- AC_DEFUN([LT_SUPPORTED_TAG], []) +m4trace:/usr/share/aclocal/libtool.m4:823: -1- AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +]) +m4trace:/usr/share/aclocal/libtool.m4:915: -1- AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +m4trace:/usr/share/aclocal/libtool.m4:915: -1- AC_DEFUN([AC_LIBTOOL_CXX], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_CXX' is obsolete. +You should run autoupdate.])dnl +LT_LANG(C++)]) +m4trace:/usr/share/aclocal/libtool.m4:916: -1- AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +m4trace:/usr/share/aclocal/libtool.m4:916: -1- AC_DEFUN([AC_LIBTOOL_F77], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_F77' is obsolete. +You should run autoupdate.])dnl +LT_LANG(Fortran 77)]) +m4trace:/usr/share/aclocal/libtool.m4:917: -1- AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +m4trace:/usr/share/aclocal/libtool.m4:917: -1- AC_DEFUN([AC_LIBTOOL_FC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_FC' is obsolete. +You should run autoupdate.])dnl +LT_LANG(Fortran)]) +m4trace:/usr/share/aclocal/libtool.m4:918: -1- AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +m4trace:/usr/share/aclocal/libtool.m4:918: -1- AC_DEFUN([AC_LIBTOOL_GCJ], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_GCJ' is obsolete. +You should run autoupdate.])dnl +LT_LANG(Java)]) +m4trace:/usr/share/aclocal/libtool.m4:919: -1- AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +m4trace:/usr/share/aclocal/libtool.m4:919: -1- AC_DEFUN([AC_LIBTOOL_RC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_RC' is obsolete. +You should run autoupdate.])dnl +LT_LANG(Windows Resource)]) +m4trace:/usr/share/aclocal/libtool.m4:1247: -1- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([$with_sysroot]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and where our libraries should be installed.])]) +m4trace:/usr/share/aclocal/libtool.m4:1578: -1- AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test yes = "[$]$2"; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +]) +m4trace:/usr/share/aclocal/libtool.m4:1620: -1- AU_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:1620: -1- AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_COMPILER_OPTION' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:1629: -1- AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS +]) + +if test yes = "[$]$2"; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +]) +m4trace:/usr/share/aclocal/libtool.m4:1664: -1- AU_DEFUN([AC_LIBTOOL_LINKER_OPTION], [m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:1664: -1- AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_LINKER_OPTION' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:1671: -1- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n "$lt_cv_sys_max_cmd_len"; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +]) +m4trace:/usr/share/aclocal/libtool.m4:1810: -1- AU_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:1810: -1- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_SYS_MAX_CMD_LEN' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:1921: -1- AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl +if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen=shl_load], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen=dlopen], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +]) +m4trace:/usr/share/aclocal/libtool.m4:2046: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:2046: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN_SELF' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:3158: -1- AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac]) +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +]) +m4trace:/usr/share/aclocal/libtool.m4:3220: -1- AU_DEFUN([AC_PATH_TOOL_PREFIX], [m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:3220: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_DIAGNOSE([obsolete], [The macro `AC_PATH_TOOL_PREFIX' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:3243: -1- AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi]) +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +]) +m4trace:/usr/share/aclocal/libtool.m4:3757: -1- AU_DEFUN([AM_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:3757: -1- AC_DEFUN([AM_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_NM' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:3758: -1- AU_DEFUN([AC_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:3758: -1- AC_DEFUN([AC_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_NM' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:3829: -1- AC_DEFUN([_LT_DLL_DEF_P], [dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +]) +m4trace:/usr/share/aclocal/libtool.m4:3843: -1- AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM=-lm) + ;; +esac +AC_SUBST([LIBM]) +]) +m4trace:/usr/share/aclocal/libtool.m4:3862: -1- AU_DEFUN([AC_CHECK_LIBM], [m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:3862: -1- AC_DEFUN([AC_CHECK_LIBM], [AC_DIAGNOSE([obsolete], [The macro `AC_CHECK_LIBM' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:8125: -1- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) +m4trace:/usr/share/aclocal/libtool.m4:8134: -1- AU_DEFUN([LT_AC_PROG_GCJ], [m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:8134: -1- AC_DEFUN([LT_AC_PROG_GCJ], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_GCJ' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:8141: -1- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) +]) +m4trace:/usr/share/aclocal/libtool.m4:8148: -1- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) +]) +m4trace:/usr/share/aclocal/libtool.m4:8153: -1- AU_DEFUN([LT_AC_PROG_RC], [m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:8153: -1- AC_DEFUN([LT_AC_PROG_RC], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_RC' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:8273: -1- AU_DEFUN([LT_AC_PROG_SED], [m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])]) +m4trace:/usr/share/aclocal/libtool.m4:8273: -1- AC_DEFUN([LT_AC_PROG_SED], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_SED' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])]) +m4trace:/usr/share/aclocal/ltargz.m4:12: -1- AC_DEFUN([LT_FUNC_ARGZ], [ +AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_TYPES([error_t], + [], + [AC_DEFINE([error_t], [int], + [Define to a type to use for 'error_t' if it is not otherwise available.]) + AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h + does not typedef error_t.])], + [#if defined(HAVE_ARGZ_H) +# include +#endif]) + +LT_ARGZ_H= +AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ + argz_next argz_stringify], [], [LT_ARGZ_H=lt__argz.h; AC_LIBOBJ([lt__argz])]) + +dnl if have system argz functions, allow forced use of +dnl libltdl-supplied implementation (and default to do so +dnl on "known bad" systems). Could use a runtime check, but +dnl (a) detecting malloc issues is notoriously unreliable +dnl (b) only known system that declares argz functions, +dnl provides them, yet they are broken, is cygwin +dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) +dnl So, it's more straightforward simply to special case +dnl this for known bad systems. +AS_IF([test -z "$LT_ARGZ_H"], + [AC_CACHE_CHECK( + [if argz actually works], + [lt_cv_sys_argz_works], + [[case $host_os in #( + *cygwin*) + lt_cv_sys_argz_works=no + if test no != "$cross_compiling"; then + lt_cv_sys_argz_works="guessing no" + else + lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' + save_IFS=$IFS + IFS=-. + set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` + IFS=$save_IFS + lt_os_major=${2-0} + lt_os_minor=${3-0} + lt_os_micro=${4-0} + if test 1 -lt "$lt_os_major" \ + || { test 1 -eq "$lt_os_major" \ + && { test 5 -lt "$lt_os_minor" \ + || { test 5 -eq "$lt_os_minor" \ + && test 24 -lt "$lt_os_micro"; }; }; }; then + lt_cv_sys_argz_works=yes + fi + fi + ;; #( + *) lt_cv_sys_argz_works=yes ;; + esac]]) + AS_IF([test yes = "$lt_cv_sys_argz_works"], + [AC_DEFINE([HAVE_WORKING_ARGZ], 1, + [This value is set to 1 to indicate that the system argz facility works])], + [LT_ARGZ_H=lt__argz.h + AC_LIBOBJ([lt__argz])])]) + +AC_SUBST([LT_ARGZ_H]) +]) +m4trace:/usr/share/aclocal/ltdl.m4:16: -1- AC_DEFUN([LT_CONFIG_LTDL_DIR], [AC_BEFORE([$0], [LTDL_INIT]) +_$0($*) +]) +m4trace:/usr/share/aclocal/ltdl.m4:68: -1- AC_DEFUN([LTDL_CONVENIENCE], [AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +]) +m4trace:/usr/share/aclocal/ltdl.m4:81: -1- AU_DEFUN([AC_LIBLTDL_CONVENIENCE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_CONVENIENCE]) +m4trace:/usr/share/aclocal/ltdl.m4:81: -1- AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBLTDL_CONVENIENCE' is obsolete. +You should run autoupdate.])dnl +_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_CONVENIENCE]) +m4trace:/usr/share/aclocal/ltdl.m4:124: -1- AC_DEFUN([LTDL_INSTALLABLE], [AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +]) +m4trace:/usr/share/aclocal/ltdl.m4:137: -1- AU_DEFUN([AC_LIBLTDL_INSTALLABLE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_INSTALLABLE]) +m4trace:/usr/share/aclocal/ltdl.m4:137: -1- AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBLTDL_INSTALLABLE' is obsolete. +You should run autoupdate.])dnl +_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_INSTALLABLE]) +m4trace:/usr/share/aclocal/ltdl.m4:213: -1- AC_DEFUN([_LT_LIBOBJ], [ + m4_pattern_allow([^_LT_LIBOBJS$]) + _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" +]) +m4trace:/usr/share/aclocal/ltdl.m4:226: -1- AC_DEFUN([LTDL_INIT], [dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +dnl We need to keep our own list of libobjs separate from our parent project, +dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while +dnl we look for our own LIBOBJs. +m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) +m4_pushdef([AC_LIBSOURCES]) + +dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: +m4_if(_LTDL_MODE, [], + [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) + m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) + +AC_ARG_WITH([included_ltdl], + [AS_HELP_STRING([--with-included-ltdl], + [use the GNU ltdl sources included here])]) + +if test yes != "$with_included_ltdl"; then + # We are not being forced to use the included libltdl sources, so + # decide whether there is a useful installed version we can use. + AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_DECL([lt_dlinterface_register], + [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], + [with_included_ltdl=no], + [with_included_ltdl=yes])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT + #include ])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT] + ) +fi + +dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE +dnl was called yet, then for old times' sake, we assume libltdl is in an +dnl eponymous directory: +AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) + +AC_ARG_WITH([ltdl_include], + [AS_HELP_STRING([--with-ltdl-include=DIR], + [use the ltdl headers installed in DIR])]) + +if test -n "$with_ltdl_include"; then + if test -f "$with_ltdl_include/ltdl.h"; then : + else + AC_MSG_ERROR([invalid ltdl include directory: '$with_ltdl_include']) + fi +else + with_ltdl_include=no +fi + +AC_ARG_WITH([ltdl_lib], + [AS_HELP_STRING([--with-ltdl-lib=DIR], + [use the libltdl.la installed in DIR])]) + +if test -n "$with_ltdl_lib"; then + if test -f "$with_ltdl_lib/libltdl.la"; then : + else + AC_MSG_ERROR([invalid ltdl library directory: '$with_ltdl_lib']) + fi +else + with_ltdl_lib=no +fi + +case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in + ,yes,no,no,) + m4_case(m4_default(_LTDL_TYPE, [convenience]), + [convenience], [_LTDL_CONVENIENCE], + [installable], [_LTDL_INSTALLABLE], + [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) + ;; + ,no,no,no,) + # If the included ltdl is not to be used, then use the + # preinstalled libltdl we found. + AC_DEFINE([HAVE_LTDL], [1], + [Define this if a modern libltdl is already installed]) + LIBLTDL=-lltdl + LTDLDEPS= + LTDLINCL= + ;; + ,no*,no,*) + AC_MSG_ERROR(['--with-ltdl-include' and '--with-ltdl-lib' options must be used together]) + ;; + *) with_included_ltdl=no + LIBLTDL="-L$with_ltdl_lib -lltdl" + LTDLDEPS= + LTDLINCL=-I$with_ltdl_include + ;; +esac +INCLTDL=$LTDLINCL + +# Report our decision... +AC_MSG_CHECKING([where to find libltdl headers]) +AC_MSG_RESULT([$LTDLINCL]) +AC_MSG_CHECKING([where to find libltdl library]) +AC_MSG_RESULT([$LIBLTDL]) + +_LTDL_SETUP + +dnl restore autoconf definition. +m4_popdef([AC_LIBOBJ]) +m4_popdef([AC_LIBSOURCES]) + +AC_CONFIG_COMMANDS_PRE([ + _ltdl_libobjs= + _ltdl_ltlibobjs= + if test -n "$_LT_LIBOBJS"; then + # Remove the extension. + _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do + _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" + _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" + done + fi + AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) + AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) +]) + +# Only expand once: +m4_define([LTDL_INIT]) +]) +m4trace:/usr/share/aclocal/ltdl.m4:352: -1- AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) +m4trace:/usr/share/aclocal/ltdl.m4:352: -1- AC_DEFUN([AC_LIB_LTDL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIB_LTDL' is obsolete. +You should run autoupdate.])dnl +LTDL_INIT($@)]) +m4trace:/usr/share/aclocal/ltdl.m4:353: -1- AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) +m4trace:/usr/share/aclocal/ltdl.m4:353: -1- AC_DEFUN([AC_WITH_LTDL], [AC_DIAGNOSE([obsolete], [The macro `AC_WITH_LTDL' is obsolete. +You should run autoupdate.])dnl +LTDL_INIT($@)]) +m4trace:/usr/share/aclocal/ltdl.m4:354: -1- AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) +m4trace:/usr/share/aclocal/ltdl.m4:354: -1- AC_DEFUN([LT_WITH_LTDL], [AC_DIAGNOSE([obsolete], [The macro `LT_WITH_LTDL' is obsolete. +You should run autoupdate.])dnl +LTDL_INIT($@)]) +m4trace:/usr/share/aclocal/ltdl.m4:367: -1- AC_DEFUN([_LTDL_SETUP], [AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_SYS_MODULE_EXT])dnl +AC_REQUIRE([LT_SYS_MODULE_PATH])dnl +AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl +AC_REQUIRE([LT_LIB_DLLOAD])dnl +AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl +AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl +AC_REQUIRE([LT_FUNC_ARGZ])dnl + +m4_require([_LT_CHECK_OBJDIR])dnl +m4_require([_LT_HEADER_DLFCN])dnl +m4_require([_LT_CHECK_DLPREOPEN])dnl +m4_require([_LT_DECL_SED])dnl + +dnl Don't require this, or it will be expanded earlier than the code +dnl that sets the variables it relies on: +_LT_ENABLE_INSTALL + +dnl _LTDL_MODE specific code must be called at least once: +_LTDL_MODE_DISPATCH + +# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS +# the user used. This is so that ltdl.h can pick up the parent projects +# config.h file, The first file in AC_CONFIG_HEADERS must contain the +# definitions required by ltdl.c. +# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). +AC_CONFIG_COMMANDS_PRE([dnl +m4_pattern_allow([^LT_CONFIG_H$])dnl +m4_ifset([AH_HEADER], + [LT_CONFIG_H=AH_HEADER], + [m4_ifset([AC_LIST_HEADERS], + [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's|^[[ ]]*||;s|[[ :]].*$||'`], + [])])]) +AC_SUBST([LT_CONFIG_H]) + +AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], + [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) +AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) + +m4_pattern_allow([LT_LIBEXT])dnl +AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) + +name= +eval "lt_libprefix=\"$libname_spec\"" +m4_pattern_allow([LT_LIBPREFIX])dnl +AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) + +name=ltdl +eval "LTDLOPEN=\"$libname_spec\"" +AC_SUBST([LTDLOPEN]) +]) +m4trace:/usr/share/aclocal/ltdl.m4:443: -1- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + [lt_cv_sys_dlopen_deplibs], + [# PORTME does your system automatically load deplibs for dlopen? + # or its logical equivalent (e.g. shl_load for HP-UX < 11) + # For now, we just catch OSes we know something about -- in the + # future, we'll try test this programmatically. + lt_cv_sys_dlopen_deplibs=unknown + case $host_os in + aix3*|aix4.1.*|aix4.2.*) + # Unknown whether this is true for these versions of AIX, but + # we want this 'case' here to explicitly catch those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + aix[[4-9]]*) + lt_cv_sys_dlopen_deplibs=yes + ;; + amigaos*) + case $host_cpu in + powerpc) + lt_cv_sys_dlopen_deplibs=no + ;; + esac + ;; + bitrig*) + lt_cv_sys_dlopen_deplibs=yes + ;; + darwin*) + # Assuming the user has installed a libdl from somewhere, this is true + # If you are looking for one http://www.opendarwin.org/projects/dlcompat + lt_cv_sys_dlopen_deplibs=yes + ;; + freebsd* | dragonfly*) + lt_cv_sys_dlopen_deplibs=yes + ;; + gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) + # GNU and its variants, using gnu ld.so (Glibc) + lt_cv_sys_dlopen_deplibs=yes + ;; + hpux10*|hpux11*) + lt_cv_sys_dlopen_deplibs=yes + ;; + interix*) + lt_cv_sys_dlopen_deplibs=yes + ;; + irix[[12345]]*|irix6.[[01]]*) + # Catch all versions of IRIX before 6.2, and indicate that we don't + # know how it worked for any of those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + irix*) + # The case above catches anything before 6.2, and it's known that + # at 6.2 and later dlopen does load deplibs. + lt_cv_sys_dlopen_deplibs=yes + ;; + netbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + openbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + osf[[1234]]*) + # dlopen did load deplibs (at least at 4.x), but until the 5.x series, + # it did *not* use an RPATH in a shared library to find objects the + # library depends on, so we explicitly say 'no'. + lt_cv_sys_dlopen_deplibs=no + ;; + osf5.0|osf5.0a|osf5.1) + # dlopen *does* load deplibs and with the right loader patch applied + # it even uses RPATH in a shared library to search for shared objects + # that the library depends on, but there's no easy way to know if that + # patch is installed. Since this is the case, all we can really + # say is unknown -- it depends on the patch being installed. If + # it is, this changes to 'yes'. Without it, it would be 'no'. + lt_cv_sys_dlopen_deplibs=unknown + ;; + osf*) + # the two cases above should catch all versions of osf <= 5.1. Read + # the comments above for what we know about them. + # At > 5.1, deplibs are loaded *and* any RPATH in a shared library + # is used to find them so we can finally say 'yes'. + lt_cv_sys_dlopen_deplibs=yes + ;; + qnx*) + lt_cv_sys_dlopen_deplibs=yes + ;; + solaris*) + lt_cv_sys_dlopen_deplibs=yes + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + esac + ]) +if test yes != "$lt_cv_sys_dlopen_deplibs"; then + AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], + [Define if the OS needs help to load dependent libraries for dlopen().]) +fi +]) +m4trace:/usr/share/aclocal/ltdl.m4:545: -1- AU_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:545: -1- AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYS_DLOPEN_DEPLIBS' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:552: -1- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([what extension is used for runtime loadable modules], + [libltdl_cv_shlibext], +[ +module=yes +eval libltdl_cv_shlibext=$shrext_cmds +module=no +eval libltdl_cv_shrext=$shrext_cmds + ]) +if test -n "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_MODULE_EXT])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], + [Define to the extension used for runtime loadable modules, say, ".so".]) +fi +if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_SHARED_EXT])dnl + AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], + [Define to the shared library suffix, say, ".dylib".]) +fi +if test -n "$shared_archive_member_spec"; then + m4_pattern_allow([LT_SHARED_LIB_MEMBER])dnl + AC_DEFINE_UNQUOTED([LT_SHARED_LIB_MEMBER], ["($shared_archive_member_spec.o)"], + [Define to the shared archive member specification, say "(shr.o)".]) +fi +]) +m4trace:/usr/share/aclocal/ltdl.m4:580: -1- AU_DEFUN([AC_LTDL_SHLIBEXT], [m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:580: -1- AC_DEFUN([AC_LTDL_SHLIBEXT], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBEXT' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:587: -1- AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([what variable specifies run-time module search path], + [lt_cv_module_path_var], [lt_cv_module_path_var=$shlibpath_var]) +if test -n "$lt_cv_module_path_var"; then + m4_pattern_allow([LT_MODULE_PATH_VAR])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], + [Define to the name of the environment variable that determines the run-time module search path.]) +fi +]) +m4trace:/usr/share/aclocal/ltdl.m4:599: -1- AU_DEFUN([AC_LTDL_SHLIBPATH], [m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:599: -1- AC_DEFUN([AC_LTDL_SHLIBPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBPATH' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:606: -1- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([for the default library search path], + [lt_cv_sys_dlsearch_path], + [lt_cv_sys_dlsearch_path=$sys_lib_dlsearch_path_spec]) +if test -n "$lt_cv_sys_dlsearch_path"; then + sys_dlsearch_path= + for dir in $lt_cv_sys_dlsearch_path; do + if test -z "$sys_dlsearch_path"; then + sys_dlsearch_path=$dir + else + sys_dlsearch_path=$sys_dlsearch_path$PATH_SEPARATOR$dir + fi + done + m4_pattern_allow([LT_DLSEARCH_PATH])dnl + AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], + [Define to the system default library search path.]) +fi +]) +m4trace:/usr/share/aclocal/ltdl.m4:627: -1- AU_DEFUN([AC_LTDL_SYSSEARCHPATH], [m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:627: -1- AC_DEFUN([AC_LTDL_SYSSEARCHPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYSSEARCHPATH' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:653: -1- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$]) +LT_DLLOADERS= +AC_SUBST([LT_DLLOADERS]) + +AC_LANG_PUSH([C]) +lt_dlload_save_LIBS=$LIBS + +LIBADD_DLOPEN= +AC_SEARCH_LIBS([dlopen], [dl], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + if test "$ac_cv_search_dlopen" != "none required"; then + LIBADD_DLOPEN=-ldl + fi + libltdl_cv_lib_dl_dlopen=yes + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H +# include +#endif + ]], [[dlopen(0, 0);]])], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + libltdl_cv_func_dlopen=yes + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_CHECK_LIB([svld], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DLOPEN=-lsvld libltdl_cv_func_dlopen=yes + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) +if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen" +then + lt_save_LIBS=$LIBS + LIBS="$LIBS $LIBADD_DLOPEN" + AC_CHECK_FUNCS([dlerror]) + LIBS=$lt_save_LIBS +fi +AC_SUBST([LIBADD_DLOPEN]) + +LIBADD_SHL_LOAD= +AC_CHECK_FUNC([shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], + [AC_CHECK_LIB([dld], [shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" + LIBADD_SHL_LOAD=-ldld])]) +AC_SUBST([LIBADD_SHL_LOAD]) + +case $host_os in +darwin[[1567]].*) +# We only want this for pre-Mac OS X 10.4. + AC_CHECK_FUNC([_dyld_func_lookup], + [AC_DEFINE([HAVE_DYLD], [1], + [Define if you have the _dyld_func_lookup function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) + ;; +beos*) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" + ;; +cygwin* | mingw* | pw32*) + AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" + ;; +esac + +AC_CHECK_LIB([dld], [dld_link], + [AC_DEFINE([HAVE_DLD], [1], + [Define if you have the GNU dld library.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) +AC_SUBST([LIBADD_DLD_LINK]) + +m4_pattern_allow([^LT_DLPREOPEN$]) +LT_DLPREOPEN= +if test -n "$LT_DLLOADERS" +then + for lt_loader in $LT_DLLOADERS; do + LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " + done + AC_DEFINE([HAVE_LIBDLLOADER], [1], + [Define if libdlloader will be built on this platform]) +fi +AC_SUBST([LT_DLPREOPEN]) + +dnl This isn't used anymore, but set it for backwards compatibility +LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" +AC_SUBST([LIBADD_DL]) + +LIBS=$lt_dlload_save_LIBS +AC_LANG_POP +]) +m4trace:/usr/share/aclocal/ltdl.m4:748: -1- AU_DEFUN([AC_LTDL_DLLIB], [m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:748: -1- AC_DEFUN([AC_LTDL_DLLIB], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLLIB' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:756: -1- AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([for _ prefix in compiled symbols], + [lt_cv_sys_symbol_underscore], + [lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.c >&AS_MESSAGE_LOG_FD + fi + rm -rf conftest* + ]) + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + AC_SUBST([sys_symbol_underscore]) +]) +m4trace:/usr/share/aclocal/ltdl.m4:793: -1- AU_DEFUN([AC_LTDL_SYMBOL_USCORE], [m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:793: -1- AC_DEFUN([AC_LTDL_SYMBOL_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYMBOL_USCORE' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:800: -1- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([_LT_COMPILER_PIC])dnl for lt_prog_compiler_wl +AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl for lt_cv_sys_symbol_underscore +AC_REQUIRE([LT_SYS_MODULE_EXT])dnl for libltdl_cv_shlibext +if test yes = "$lt_cv_sys_symbol_underscore"; then + if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen"; then + AC_CACHE_CHECK([whether we have to add an underscore for dlsym], + [libltdl_cv_need_uscore], + [libltdl_cv_need_uscore=unknown + dlsym_uscore_save_LIBS=$LIBS + LIBS="$LIBS $LIBADD_DLOPEN" + libname=conftmod # stay within 8.3 filename limits! + cat >$libname.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif +int fnord () { return 42; }] +_LT_EOF + + # ltfn_module_cmds module_cmds + # Execute tilde-delimited MODULE_CMDS with environment primed for + # $module_cmds or $archive_cmds type content. + ltfn_module_cmds () + {( # subshell avoids polluting parent global environment + module_cmds_save_ifs=$IFS; IFS='~' + for cmd in @S|@1; do + IFS=$module_cmds_save_ifs + libobjs=$libname.$ac_objext; lib=$libname$libltdl_cv_shlibext + rpath=/not-exists; soname=$libname$libltdl_cv_shlibext; output_objdir=. + major=; versuffix=; verstring=; deplibs= + ECHO=echo; wl=$lt_prog_compiler_wl; allow_undefined_flag= + eval $cmd + done + IFS=$module_cmds_save_ifs + )} + + # Compile a loadable module using libtool macro expansion results. + $CC $pic_flag -c $libname.$ac_ext + ltfn_module_cmds "${module_cmds:-$archive_cmds}" + + # Try to fetch fnord with dlsym(). + libltdl_dlunknown=0; libltdl_dlnouscore=1; libltdl_dluscore=2 + cat >conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" +#if HAVE_DLFCN_H +#include +#endif +#include +#ifndef RTLD_GLOBAL +# ifdef DL_GLOBAL +# define RTLD_GLOBAL DL_GLOBAL +# else +# define RTLD_GLOBAL 0 +# endif +#endif +#ifndef RTLD_NOW +# ifdef DL_NOW +# define RTLD_NOW DL_NOW +# else +# define RTLD_NOW 0 +# endif +#endif +int main () { + void *handle = dlopen ("`pwd`/$libname$libltdl_cv_shlibext", RTLD_GLOBAL|RTLD_NOW); + int status = $libltdl_dlunknown; + if (handle) { + if (dlsym (handle, "fnord")) + status = $libltdl_dlnouscore; + else { + if (dlsym (handle, "_fnord")) + status = $libltdl_dluscore; + else + puts (dlerror ()); + } + dlclose (handle); + } else + puts (dlerror ()); + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + libltdl_status=$? + case x$libltdl_status in + x$libltdl_dlnouscore) libltdl_cv_need_uscore=no ;; + x$libltdl_dluscore) libltdl_cv_need_uscore=yes ;; + x*) libltdl_cv_need_uscore=unknown ;; + esac + fi + rm -rf conftest* $libname* + LIBS=$dlsym_uscore_save_LIBS + ]) + fi +fi + +if test yes = "$libltdl_cv_need_uscore"; then + AC_DEFINE([NEED_USCORE], [1], + [Define if dlsym() requires a leading underscore in symbol names.]) +fi +]) +m4trace:/usr/share/aclocal/ltdl.m4:907: -1- AU_DEFUN([AC_LTDL_DLSYM_USCORE], [m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])]) +m4trace:/usr/share/aclocal/ltdl.m4:907: -1- AC_DEFUN([AC_LTDL_DLSYM_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLSYM_USCORE' is obsolete. +You should run autoupdate.])dnl +m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])]) +m4trace:/usr/share/aclocal/ltoptions.m4:14: -1- AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) +m4trace:/usr/share/aclocal/ltoptions.m4:113: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:113: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN' is obsolete. +You should run autoupdate.])dnl +_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:148: -1- AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:148: -1- AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_WIN32_DLL' is obsolete. +You should run autoupdate.])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:197: -1- AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:201: -1- AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:205: -1- AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +m4trace:/usr/share/aclocal/ltoptions.m4:205: -1- AC_DEFUN([AM_ENABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_SHARED' is obsolete. +You should run autoupdate.])dnl +AC_ENABLE_SHARED($@)]) +m4trace:/usr/share/aclocal/ltoptions.m4:206: -1- AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +m4trace:/usr/share/aclocal/ltoptions.m4:206: -1- AC_DEFUN([AM_DISABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_SHARED' is obsolete. +You should run autoupdate.])dnl +AC_DISABLE_SHARED($@)]) +m4trace:/usr/share/aclocal/ltoptions.m4:251: -1- AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:255: -1- AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:259: -1- AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +m4trace:/usr/share/aclocal/ltoptions.m4:259: -1- AC_DEFUN([AM_ENABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_STATIC' is obsolete. +You should run autoupdate.])dnl +AC_ENABLE_STATIC($@)]) +m4trace:/usr/share/aclocal/ltoptions.m4:260: -1- AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +m4trace:/usr/share/aclocal/ltoptions.m4:260: -1- AC_DEFUN([AM_DISABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_STATIC' is obsolete. +You should run autoupdate.])dnl +AC_DISABLE_STATIC($@)]) +m4trace:/usr/share/aclocal/ltoptions.m4:305: -1- AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:305: -1- AC_DEFUN([AC_ENABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_ENABLE_FAST_INSTALL' is obsolete. +You should run autoupdate.])dnl +_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:312: -1- AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:312: -1- AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_DISABLE_FAST_INSTALL' is obsolete. +You should run autoupdate.])dnl +_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:411: -1- AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltoptions.m4:411: -1- AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_PICMODE' is obsolete. +You should run autoupdate.])dnl +_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) +m4trace:/usr/share/aclocal/ltsugar.m4:14: -1- AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) +m4trace:/usr/share/aclocal/ltversion.m4:18: -1- AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' +macro_revision='2.4.6' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:37: -1- AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:41: -1- AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:42: -1- AC_DEFUN([_LT_AC_SHELL_INIT]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:43: -1- AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:45: -1- AC_DEFUN([_LT_AC_TAGVAR]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:46: -1- AC_DEFUN([AC_LTDL_ENABLE_INSTALL]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:47: -1- AC_DEFUN([AC_LTDL_PREOPEN]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:48: -1- AC_DEFUN([_LT_AC_SYS_COMPILER]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:49: -1- AC_DEFUN([_LT_AC_LOCK]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:50: -1- AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:51: -1- AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:52: -1- AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:53: -1- AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:54: -1- AC_DEFUN([AC_LIBTOOL_OBJDIR]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:55: -1- AC_DEFUN([AC_LTDL_OBJDIR]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:56: -1- AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:57: -1- AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:58: -1- AC_DEFUN([AC_PATH_MAGIC]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:59: -1- AC_DEFUN([AC_PROG_LD_GNU]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:60: -1- AC_DEFUN([AC_PROG_LD_RELOAD_FLAG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:61: -1- AC_DEFUN([AC_DEPLIBS_CHECK_METHOD]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:62: -1- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:63: -1- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:64: -1- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:65: -1- AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:66: -1- AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:67: -1- AC_DEFUN([LT_AC_PROG_EGREP]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:72: -1- AC_DEFUN([_AC_PROG_LIBTOOL]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:73: -1- AC_DEFUN([AC_LIBTOOL_SETUP]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:74: -1- AC_DEFUN([_LT_AC_CHECK_DLFCN]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:75: -1- AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:76: -1- AC_DEFUN([_LT_AC_TAGCONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:78: -1- AC_DEFUN([_LT_AC_LANG_CXX]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:79: -1- AC_DEFUN([_LT_AC_LANG_F77]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:80: -1- AC_DEFUN([_LT_AC_LANG_GCJ]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:81: -1- AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:82: -1- AC_DEFUN([_LT_AC_LANG_C_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:83: -1- AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:84: -1- AC_DEFUN([_LT_AC_LANG_CXX_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:85: -1- AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:86: -1- AC_DEFUN([_LT_AC_LANG_F77_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:87: -1- AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:88: -1- AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:89: -1- AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:90: -1- AC_DEFUN([_LT_AC_LANG_RC_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:91: -1- AC_DEFUN([AC_LIBTOOL_CONFIG]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:92: -1- AC_DEFUN([_LT_AC_FILE_LTDLL_C]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:94: -1- AC_DEFUN([_LT_AC_PROG_CXXCPP]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:97: -1- AC_DEFUN([_LT_PROG_F77]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:98: -1- AC_DEFUN([_LT_PROG_FC]) +m4trace:/usr/share/aclocal/lt~obsolete.m4:99: -1- AC_DEFUN([_LT_PROG_CXX]) +m4trace:/usr/share/aclocal-1.16/amversion.m4:14: -1- AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15.1], [], +m4_if([$1], [1.16.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) -m4trace:/usr/share/aclocal-1.15/amversion.m4:33: -1- AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15.1])dnl +m4trace:/usr/share/aclocal-1.16/amversion.m4:33: -1- AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -m4trace:/usr/share/aclocal-1.15/auxdir.m4:47: -1- AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +m4trace:/usr/share/aclocal-1.16/ar-lib.m4:13: -1- AC_DEFUN([AM_PROG_AR], [AC_BEFORE([$0], [LT_INIT])dnl +AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([ar-lib])dnl +AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) +: ${AR=ar} + +AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], + [AC_LANG_PUSH([C]) + am_cv_ar_interface=ar + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], + [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + ]) + AC_LANG_POP([C])]) + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + m4_default([$1], + [AC_MSG_ERROR([could not determine $AR interface])]) + ;; +esac +AC_SUBST([AR])dnl +]) +m4trace:/usr/share/aclocal-1.16/auxdir.m4:47: -1- AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) -m4trace:/usr/share/aclocal-1.15/cond.m4:12: -1- AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl +m4trace:/usr/share/aclocal-1.16/cond.m4:12: -1- AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl @@ -32,7 +1765,7 @@ AC_CONFIG_COMMANDS_PRE( AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) -m4trace:/usr/share/aclocal-1.15/depend.m4:26: -1- AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl +m4trace:/usr/share/aclocal-1.16/depend.m4:26: -1- AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl @@ -162,10 +1895,10 @@ AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) -m4trace:/usr/share/aclocal-1.15/depend.m4:163: -1- AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl +m4trace:/usr/share/aclocal-1.16/depend.m4:163: -1- AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) -m4trace:/usr/share/aclocal-1.15/depend.m4:171: -1- AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl +m4trace:/usr/share/aclocal-1.16/depend.m4:171: -1- AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) @@ -183,60 +1916,53 @@ _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) -m4trace:/usr/share/aclocal-1.15/depout.m4:12: -1- AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ +m4trace:/usr/share/aclocal-1.16/depout.m4:11: -1- AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk } ]) -m4trace:/usr/share/aclocal-1.15/depout.m4:71: -1- AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], +m4trace:/usr/share/aclocal-1.16/depout.m4:64: -1- AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) -m4trace:/usr/share/aclocal-1.15/init.m4:29: -1- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) +m4trace:/usr/share/aclocal-1.16/init.m4:29: -1- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -296,8 +2022,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -364,7 +2090,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -378,7 +2104,7 @@ dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) -m4trace:/usr/share/aclocal-1.15/init.m4:186: -1- AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +m4trace:/usr/share/aclocal-1.16/init.m4:186: -1- AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do @@ -390,7 +2116,7 @@ for _am_header in $config_headers :; do esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -m4trace:/usr/share/aclocal-1.15/install-sh.m4:11: -1- AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +m4trace:/usr/share/aclocal-1.16/install-sh.m4:11: -1- AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) @@ -400,7 +2126,7 @@ if test x"${install_sh+set}" != xset; then esac fi AC_SUBST([install_sh])]) -m4trace:/usr/share/aclocal-1.15/lead-dot.m4:10: -1- AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null +m4trace:/usr/share/aclocal-1.16/lead-dot.m4:10: -1- AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. @@ -409,47 +2135,39 @@ else fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -m4trace:/usr/share/aclocal-1.15/make.m4:12: -1- AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} -cat > confinc << 'END' +m4trace:/usr/share/aclocal-1.16/make.m4:13: -1- AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) -m4trace:/usr/share/aclocal-1.15/missing.m4:11: -1- AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +m4trace:/usr/share/aclocal-1.16/make.m4:42: -1- m4_pattern_allow([^am__quote$]) +m4trace:/usr/share/aclocal-1.16/missing.m4:11: -1- AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) -m4trace:/usr/share/aclocal-1.15/missing.m4:20: -1- AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +m4trace:/usr/share/aclocal-1.16/missing.m4:20: -1- AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -467,11 +2185,11 @@ else AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -m4trace:/usr/share/aclocal-1.15/options.m4:11: -1- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) -m4trace:/usr/share/aclocal-1.15/options.m4:17: -1- AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) -m4trace:/usr/share/aclocal-1.15/options.m4:23: -1- AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) -m4trace:/usr/share/aclocal-1.15/options.m4:29: -1- AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -m4trace:/usr/share/aclocal-1.15/prog-cc-c-o.m4:12: -1- AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +m4trace:/usr/share/aclocal-1.16/options.m4:11: -1- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) +m4trace:/usr/share/aclocal-1.16/options.m4:17: -1- AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) +m4trace:/usr/share/aclocal-1.16/options.m4:23: -1- AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) +m4trace:/usr/share/aclocal-1.16/options.m4:29: -1- AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +m4trace:/usr/share/aclocal-1.16/prog-cc-c-o.m4:12: -1- AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( @@ -503,13 +2221,13 @@ if test "$am_cv_prog_cc_c_o" != yes; then CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) -m4trace:/usr/share/aclocal-1.15/prog-cc-c-o.m4:47: -1- AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -m4trace:/usr/share/aclocal-1.15/runlog.m4:12: -1- AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD +m4trace:/usr/share/aclocal-1.16/prog-cc-c-o.m4:47: -1- AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) +m4trace:/usr/share/aclocal-1.16/runlog.m4:12: -1- AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) -m4trace:/usr/share/aclocal-1.15/sanity.m4:11: -1- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) +m4trace:/usr/share/aclocal-1.16/sanity.m4:11: -1- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -580,7 +2298,7 @@ AC_CONFIG_COMMANDS_PRE( AC_MSG_RESULT([done])]) rm -f conftest.file ]) -m4trace:/usr/share/aclocal-1.15/silent.m4:12: -1- AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl +m4trace:/usr/share/aclocal-1.16/silent.m4:12: -1- AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) @@ -628,7 +2346,7 @@ AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -m4trace:/usr/share/aclocal-1.15/strip.m4:17: -1- AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +m4trace:/usr/share/aclocal-1.16/strip.m4:17: -1- AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake @@ -639,9 +2357,9 @@ if test "$cross_compiling" != no; then fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -m4trace:/usr/share/aclocal-1.15/substnot.m4:12: -1- AC_DEFUN([_AM_SUBST_NOTMAKE]) -m4trace:/usr/share/aclocal-1.15/substnot.m4:17: -1- AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) -m4trace:/usr/share/aclocal-1.15/tar.m4:23: -1- AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used +m4trace:/usr/share/aclocal-1.16/substnot.m4:12: -1- AC_DEFUN([_AM_SUBST_NOTMAKE]) +m4trace:/usr/share/aclocal-1.16/substnot.m4:17: -1- AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) +m4trace:/usr/share/aclocal-1.16/tar.m4:23: -1- AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) @@ -776,6 +2494,7 @@ m4trace:configure.ac:1: -1- m4_pattern_allow([^datadir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^sysconfdir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^sharedstatedir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.ac:1: -1- m4_pattern_allow([^runstatedir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^includedir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^oldincludedir$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^docdir$]) @@ -801,63 +2520,81 @@ m4trace:configure.ac:1: -1- m4_pattern_allow([^LIBS$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^build_alias$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^host_alias$]) m4trace:configure.ac:1: -1- m4_pattern_allow([^target_alias$]) -m4trace:configure.ac:4: -1- AM_INIT_AUTOMAKE([1.10 -Wall no-define]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) -m4trace:configure.ac:4: -1- AM_SET_CURRENT_AUTOMAKE_VERSION -m4trace:configure.ac:4: -1- AM_AUTOMAKE_VERSION([1.15.1]) -m4trace:configure.ac:4: -1- _AM_AUTOCONF_VERSION([2.69]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_DATA$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^am__isrc$]) -m4trace:configure.ac:4: -1- _AM_SUBST_NOTMAKE([am__isrc]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^CYGPATH_W$]) -m4trace:configure.ac:4: -1- _AM_SET_OPTIONS([1.10 -Wall no-define]) -m4trace:configure.ac:4: -1- _AM_SET_OPTION([1.10]) -m4trace:configure.ac:4: -2- _AM_MANGLE_OPTION([1.10]) -m4trace:configure.ac:4: -1- _AM_SET_OPTION([-Wall]) -m4trace:configure.ac:4: -2- _AM_MANGLE_OPTION([-Wall]) -m4trace:configure.ac:4: -1- _AM_SET_OPTION([no-define]) -m4trace:configure.ac:4: -2- _AM_MANGLE_OPTION([no-define]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^PACKAGE$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^VERSION$]) -m4trace:configure.ac:4: -1- _AM_IF_OPTION([no-define], [], [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])]) -m4trace:configure.ac:4: -2- _AM_MANGLE_OPTION([no-define]) -m4trace:configure.ac:4: -1- AM_SANITY_CHECK -m4trace:configure.ac:4: -1- AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -m4trace:configure.ac:4: -1- AM_MISSING_HAS_RUN +m4trace:configure.ac:4: -1- AM_PROG_AR m4trace:configure.ac:4: -1- AM_AUX_DIR_EXPAND -m4trace:configure.ac:4: -1- m4_pattern_allow([^ACLOCAL$]) -m4trace:configure.ac:4: -1- AM_MISSING_PROG([AUTOCONF], [autoconf]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AUTOCONF$]) -m4trace:configure.ac:4: -1- AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AUTOMAKE$]) -m4trace:configure.ac:4: -1- AM_MISSING_PROG([AUTOHEADER], [autoheader]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AUTOHEADER$]) -m4trace:configure.ac:4: -1- AM_MISSING_PROG([MAKEINFO], [makeinfo]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^MAKEINFO$]) -m4trace:configure.ac:4: -1- AM_PROG_INSTALL_SH -m4trace:configure.ac:4: -1- m4_pattern_allow([^install_sh$]) -m4trace:configure.ac:4: -1- AM_PROG_INSTALL_STRIP -m4trace:configure.ac:4: -1- m4_pattern_allow([^STRIP$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^MKDIR_P$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^mkdir_p$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AWK$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^SET_MAKE$]) -m4trace:configure.ac:4: -1- AM_SET_LEADING_DOT -m4trace:configure.ac:4: -1- m4_pattern_allow([^am__leading_dot$]) -m4trace:configure.ac:4: -1- _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], +m4trace:configure.ac:4: -1- m4_pattern_allow([^AR$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^ac_ct_AR$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^EXEEXT$]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^OBJEXT$]) +m4trace:configure.ac:4: -1- _AM_PROG_CC_C_O +m4trace:configure.ac:4: -1- AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) +m4trace:configure.ac:4: -1- m4_pattern_allow([^AR$]) +m4trace:configure.ac:5: -1- AM_INIT_AUTOMAKE([1.10 -Wall no-define]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) +m4trace:configure.ac:5: -1- AM_SET_CURRENT_AUTOMAKE_VERSION +m4trace:configure.ac:5: -1- AM_AUTOMAKE_VERSION([1.16.2]) +m4trace:configure.ac:5: -1- _AM_AUTOCONF_VERSION([2.69]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^INSTALL_DATA$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__isrc$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([am__isrc]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^CYGPATH_W$]) +m4trace:configure.ac:5: -1- _AM_SET_OPTIONS([1.10 -Wall no-define]) +m4trace:configure.ac:5: -1- _AM_SET_OPTION([1.10]) +m4trace:configure.ac:5: -2- _AM_MANGLE_OPTION([1.10]) +m4trace:configure.ac:5: -1- _AM_SET_OPTION([-Wall]) +m4trace:configure.ac:5: -2- _AM_MANGLE_OPTION([-Wall]) +m4trace:configure.ac:5: -1- _AM_SET_OPTION([no-define]) +m4trace:configure.ac:5: -2- _AM_MANGLE_OPTION([no-define]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^PACKAGE$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^VERSION$]) +m4trace:configure.ac:5: -1- _AM_IF_OPTION([no-define], [], [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])]) +m4trace:configure.ac:5: -2- _AM_MANGLE_OPTION([no-define]) +m4trace:configure.ac:5: -1- AM_SANITY_CHECK +m4trace:configure.ac:5: -1- AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +m4trace:configure.ac:5: -1- AM_MISSING_HAS_RUN +m4trace:configure.ac:5: -1- m4_pattern_allow([^ACLOCAL$]) +m4trace:configure.ac:5: -1- AM_MISSING_PROG([AUTOCONF], [autoconf]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AUTOCONF$]) +m4trace:configure.ac:5: -1- AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AUTOMAKE$]) +m4trace:configure.ac:5: -1- AM_MISSING_PROG([AUTOHEADER], [autoheader]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AUTOHEADER$]) +m4trace:configure.ac:5: -1- AM_MISSING_PROG([MAKEINFO], [makeinfo]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^MAKEINFO$]) +m4trace:configure.ac:5: -1- AM_PROG_INSTALL_SH +m4trace:configure.ac:5: -1- m4_pattern_allow([^install_sh$]) +m4trace:configure.ac:5: -1- AM_PROG_INSTALL_STRIP +m4trace:configure.ac:5: -1- m4_pattern_allow([^STRIP$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^MKDIR_P$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^mkdir_p$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AWK$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^SET_MAKE$]) +m4trace:configure.ac:5: -1- AM_SET_LEADING_DOT +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__leading_dot$]) +m4trace:configure.ac:5: -1- _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) -m4trace:configure.ac:4: -2- _AM_MANGLE_OPTION([tar-ustar]) -m4trace:configure.ac:4: -1- _AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])]) -m4trace:configure.ac:4: -2- _AM_MANGLE_OPTION([tar-pax]) -m4trace:configure.ac:4: -1- _AM_PROG_TAR([v7]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AMTAR$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^am__tar$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^am__untar$]) -m4trace:configure.ac:4: -1- _AM_IF_OPTION([no-dependencies], [], [AC_PROVIDE_IFELSE([AC_PROG_CC], +m4trace:configure.ac:5: -2- _AM_MANGLE_OPTION([tar-ustar]) +m4trace:configure.ac:5: -1- _AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])]) +m4trace:configure.ac:5: -2- _AM_MANGLE_OPTION([tar-pax]) +m4trace:configure.ac:5: -1- _AM_PROG_TAR([v7]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AMTAR$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__tar$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__untar$]) +m4trace:configure.ac:5: -1- _AM_IF_OPTION([no-dependencies], [], [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl @@ -874,92 +2611,114 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) -m4trace:configure.ac:4: -2- _AM_MANGLE_OPTION([no-dependencies]) -m4trace:configure.ac:4: -1- AM_SILENT_RULES -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_V$]) -m4trace:configure.ac:4: -1- AM_SUBST_NOTMAKE([AM_V]) -m4trace:configure.ac:4: -1- _AM_SUBST_NOTMAKE([AM_V]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_DEFAULT_V$]) -m4trace:configure.ac:4: -1- AM_SUBST_NOTMAKE([AM_DEFAULT_V]) -m4trace:configure.ac:4: -1- _AM_SUBST_NOTMAKE([AM_DEFAULT_V]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_DEFAULT_VERBOSITY$]) -m4trace:configure.ac:4: -1- m4_pattern_allow([^AM_BACKSLASH$]) -m4trace:configure.ac:4: -1- _AM_SUBST_NOTMAKE([AM_BACKSLASH]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CXX$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CXXFLAGS$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CXX$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^ac_ct_CXX$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^EXEEXT$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^OBJEXT$]) -m4trace:configure.ac:6: -1- _AM_DEPENDENCIES([CXX]) -m4trace:configure.ac:6: -1- AM_SET_DEPDIR -m4trace:configure.ac:6: -1- m4_pattern_allow([^DEPDIR$]) -m4trace:configure.ac:6: -1- AM_OUTPUT_DEPENDENCY_COMMANDS -m4trace:configure.ac:6: -1- AM_MAKE_INCLUDE -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__include$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__quote$]) -m4trace:configure.ac:6: -1- AM_DEP_TRACK -m4trace:configure.ac:6: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^AMDEP_TRUE$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^AMDEP_FALSE$]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__nodep$]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([am__nodep]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^CXXDEPMODE$]) -m4trace:configure.ac:6: -1- AM_CONDITIONAL([am__fastdepCXX], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__fastdepCXX_TRUE$]) -m4trace:configure.ac:6: -1- m4_pattern_allow([^am__fastdepCXX_FALSE$]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([am__fastdepCXX_TRUE]) -m4trace:configure.ac:6: -1- _AM_SUBST_NOTMAKE([am__fastdepCXX_FALSE]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CFLAGS$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^ac_ct_CC$]) -m4trace:configure.ac:7: -1- _AM_PROG_CC_C_O -m4trace:configure.ac:7: -1- AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) -m4trace:configure.ac:7: -1- _AM_DEPENDENCIES([CC]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^CCDEPMODE$]) -m4trace:configure.ac:7: -1- AM_CONDITIONAL([am__fastdepCC], [ +m4trace:configure.ac:5: -2- _AM_MANGLE_OPTION([no-dependencies]) +m4trace:configure.ac:5: -1- _AM_DEPENDENCIES([CC]) +m4trace:configure.ac:5: -1- AM_SET_DEPDIR +m4trace:configure.ac:5: -1- m4_pattern_allow([^DEPDIR$]) +m4trace:configure.ac:5: -1- AM_OUTPUT_DEPENDENCY_COMMANDS +m4trace:configure.ac:5: -1- AM_MAKE_INCLUDE +m4trace:configure.ac:5: -1- AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__include$]) +m4trace:configure.ac:5: -1- AM_DEP_TRACK +m4trace:configure.ac:5: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AMDEP_TRUE$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AMDEP_FALSE$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__nodep$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([am__nodep]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^CCDEPMODE$]) +m4trace:configure.ac:5: -1- AM_CONDITIONAL([am__fastdepCC], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) -m4trace:configure.ac:7: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) -m4trace:configure.ac:7: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE]) -m4trace:configure.ac:7: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE]) +m4trace:configure.ac:5: -1- AM_SILENT_RULES +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_V$]) +m4trace:configure.ac:5: -1- AM_SUBST_NOTMAKE([AM_V]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AM_V]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_DEFAULT_V$]) +m4trace:configure.ac:5: -1- AM_SUBST_NOTMAKE([AM_DEFAULT_V]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AM_DEFAULT_V]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_DEFAULT_VERBOSITY$]) +m4trace:configure.ac:5: -1- m4_pattern_allow([^AM_BACKSLASH$]) +m4trace:configure.ac:5: -1- _AM_SUBST_NOTMAKE([AM_BACKSLASH]) +m4trace:configure.ac:7: -1- AM_PROG_AR +m4trace:configure.ac:7: -1- m4_pattern_allow([^AR$]) +m4trace:configure.ac:7: -1- m4_pattern_allow([^ac_ct_AR$]) +m4trace:configure.ac:7: -1- m4_pattern_allow([^AR$]) m4trace:configure.ac:8: -1- m4_pattern_allow([^RANLIB$]) -m4trace:configure.ac:9: -1- AM_PROG_CC_C_O -m4trace:configure.ac:10: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CXX$]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CXXFLAGS$]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CXX$]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^ac_ct_CXX$]) +m4trace:configure.ac:9: -1- _AM_DEPENDENCIES([CXX]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^CXXDEPMODE$]) +m4trace:configure.ac:9: -1- AM_CONDITIONAL([am__fastdepCXX], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^am__fastdepCXX_TRUE$]) +m4trace:configure.ac:9: -1- m4_pattern_allow([^am__fastdepCXX_FALSE$]) +m4trace:configure.ac:9: -1- _AM_SUBST_NOTMAKE([am__fastdepCXX_TRUE]) +m4trace:configure.ac:9: -1- _AM_SUBST_NOTMAKE([am__fastdepCXX_FALSE]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^LIBS$]) m4trace:configure.ac:10: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^CPP$]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^GREP$]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^EGREP$]) -m4trace:configure.ac:10: -1- m4_pattern_allow([^STDC_HEADERS$]) -m4trace:configure.ac:14: -1- m4_pattern_allow([^VALUES$]) -m4trace:configure.ac:22: -1- m4_pattern_allow([^BENCHMARK$]) -m4trace:configure.ac:29: -1- m4_pattern_allow([^DEBUG$]) -m4trace:configure.ac:36: -1- m4_pattern_allow([^CLUSTERED$]) -m4trace:configure.ac:43: -1- m4_pattern_allow([^VERBOSE$]) -m4trace:configure.ac:45: -1- m4_pattern_allow([^VERBOSE$]) -m4trace:configure.ac:50: -1- m4_pattern_allow([^LIB@&t@OBJS$]) -m4trace:configure.ac:50: -1- m4_pattern_allow([^LTLIBOBJS$]) -m4trace:configure.ac:50: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"]) -m4trace:configure.ac:50: -1- m4_pattern_allow([^am__EXEEXT_TRUE$]) -m4trace:configure.ac:50: -1- m4_pattern_allow([^am__EXEEXT_FALSE$]) -m4trace:configure.ac:50: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE]) -m4trace:configure.ac:50: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE]) -m4trace:configure.ac:50: -1- _AC_AM_CONFIG_HEADER_HOOK(["$ac_file"]) -m4trace:configure.ac:50: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:10: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.ac:10: -1- _AM_PROG_CC_C_O +m4trace:configure.ac:10: -1- AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) +m4trace:configure.ac:11: -1- AM_PROG_CC_C_O +m4trace:configure.ac:13: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:13: -1- AC_PROG_EGREP +m4trace:configure.ac:13: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.ac:13: -1- m4_pattern_allow([^STDC_HEADERS$]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^build$]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^build_cpu$]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^build_vendor$]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^build_os$]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^host$]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^host_cpu$]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^host_vendor$]) +m4trace:configure.ac:15: -1- m4_pattern_allow([^host_os$]) +m4trace:configure.ac:47: -1- m4_pattern_allow([^LIB64$]) +m4trace:configure.ac:48: -1- m4_pattern_allow([^BUILD_ARCH$]) +m4trace:configure.ac:49: -1- m4_pattern_allow([^NUMA$]) +m4trace:configure.ac:50: -1- m4_pattern_allow([^BREW_ROOT$]) +m4trace:configure.ac:51: -1- m4_pattern_allow([^APPLE_OMP$]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^APPLE_FFTW$]) +m4trace:configure.ac:53: -1- m4_pattern_allow([^APPLE_NOWARN_CONV$]) +m4trace:configure.ac:54: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:58: -1- m4_pattern_allow([^VALUES$]) +m4trace:configure.ac:66: -1- m4_pattern_allow([^BENCHMARK$]) +m4trace:configure.ac:73: -1- m4_pattern_allow([^DEBUG$]) +m4trace:configure.ac:80: -1- m4_pattern_allow([^CLUSTERED$]) +m4trace:configure.ac:87: -1- m4_pattern_allow([^VERBOSE$]) +m4trace:configure.ac:89: -1- m4_pattern_allow([^VERBOSE$]) +m4trace:configure.ac:94: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.ac:94: -1- m4_pattern_allow([^LTLIBOBJS$]) +m4trace:configure.ac:94: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"]) +m4trace:configure.ac:94: -1- m4_pattern_allow([^am__EXEEXT_TRUE$]) +m4trace:configure.ac:94: -1- m4_pattern_allow([^am__EXEEXT_FALSE$]) +m4trace:configure.ac:94: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE]) +m4trace:configure.ac:94: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE]) +m4trace:configure.ac:94: -1- _AC_AM_CONFIG_HEADER_HOOK(["$ac_file"]) +m4trace:configure.ac:94: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS +m4trace:configure.ac:94: -1- AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) diff --git a/clean.sh b/clean.sh old mode 100755 new mode 100644 diff --git a/compile b/compile old mode 100755 new mode 100644 diff --git a/config.h.in~ b/config.h.in~ index 9fc36a41..5f4179ef 100644 --- a/config.h.in~ +++ b/config.h.in~ @@ -3,6 +3,9 @@ /* Create a benchmark version */ #undef BENCHMARK +/* armv8.2-a */ +#undef BUILD_ARCH + /* Enable clustering */ #undef CLUSTERED diff --git a/config.log b/config.log index c9a09884..c475e748 100644 --- a/config.log +++ b/config.log @@ -10,11 +10,11 @@ generated by GNU Autoconf 2.69. Invocation command line was ## Platform. ## ## --------- ## -hostname = gruenau2 +hostname = rr075 uname -m = x86_64 -uname -r = 5.14.21-150500.55.49-default +uname -r = 5.14.0-639.el9.x86_64 uname -s = Linux -uname -v = #1 SMP PREEMPT_DYNAMIC Sun Feb 11 17:48:15 UTC 2024 (36baf2f) +uname -v = #1 SMP PREEMPT_DYNAMIC Sat Nov 15 10:30:41 UTC 2025 /usr/bin/uname -p = x86_64 /bin/uname -X = unknown @@ -27,250 +27,223 @@ uname -v = #1 SMP PREEMPT_DYNAMIC Sun Feb 11 17:48:15 UTC 2024 (36baf2f) /usr/bin/oslevel = unknown /bin/universe = unknown -PATH: /vol/home-vol3/wbi/schaefpa/miniconda3/bin -PATH: /vol/home-vol3/wbi/schaefpa/miniconda3/condabin -PATH: /bin +PATH: /home/roadrunner/.cargo/bin +PATH: /home/roadrunner/miniconda3/envs/py3k/bin +PATH: /home/roadrunner/miniconda3/condabin +PATH: /home/roadrunner/.local/bin +PATH: /home/roadrunner/bin +PATH: /usr/local/bin +PATH: /usr/local/sbin PATH: /usr/bin -PATH: /opt/kde3/bin -PATH: /opt/gnome/bin -PATH: /opt/gnome2/bin -PATH: /usr/local/X11/bin -PATH: /usr/X11/bin -PATH: /vol/home-vol3/wbi/schaefpa/bin -PATH: . PATH: /usr/sbin -PATH: /sbin -PATH: /usr/local/java/bin -PATH: /usr/local/bin -PATH: /vol/home-vol3/wbi/schaefpa/.local/bin -PATH: /vol/home-vol3/wbi/schaefpa/R/bin ## ----------- ## ## Core tests. ## ## ----------- ## -configure:1995: loading site script /usr/share/site/x86_64-unknown-linux-gnu -| #!/bin/sh -| # Site script for configure. It is resourced via $CONFIG_SITE environment varaible. -| -| # If user did not specify libdir, guess the correct target: -| # Use lib64 for 64 bit bi-arch targets, keep the default for the rest. -| if test "$libdir" = '${exec_prefix}/lib' ; then -| -| ac_config_site_64bit_host=NONE -| -| case "$host" in -| "" ) -| # User did not specify host target. -| # The native platform x86_64 is a bi-arch platform. -| # Try to detect cross-compilation to inferior architecture. -| -| # We are trying to guess 32-bit target compilation. It's not as easy as -| # it sounds, as there is possible several intermediate combinations. -| ac_config_site_cross_to_32bit_host=NONE -| -| # User defined -m32 in CFLAGS or CXXFLAGS or CC or CXX: -| # (It's sufficient for 32-bit, but alone may cause mis-behavior of some checks.) -| case "$CFLAGS $CXXFLAGS $CC $CXX" in -| *-m32*) -| ac_config_site_cross_to_32bit_host=YES -| ;; -| esac -| -| # Running with linux32: -| # (Changes detected platform, but not the toolchain target.) -| case "`/bin/uname -i`" in -| x86_64 | ppc64 | s390x | aarch64 ) -| ;; -| * ) -| ac_config_site_cross_to_32bit_host=YES -| ;; -| esac -| -| if test "x$ac_config_site_cross_to_32bit_host" = xNONE; then -| ac_config_site_64bit_host=YES -| fi -| -| ;; -| *x86_64* | *ppc64* | *s390x* | *aarch64* ) -| ac_config_site_64bit_host=YES -| ;; -| esac -| -| if test "x$ac_config_site_64bit_host" = xYES; then -| libdir='${exec_prefix}/lib64' -| fi -| fi -| -| # If user did not specify libexecdir, set the correct target: -| # Nor FHS nor openSUSE allow prefix/libexec. Let's default to prefix/lib. -| -| if test "$libexecdir" = '${exec_prefix}/libexec' ; then -| libexecdir='${exec_prefix}/lib' -| fi -| -| # Continue with the standard behavior of configure defined in AC_SITE_LOAD: -| if test "x$prefix" != xNONE; then -| ac_site_file1=$prefix/share/config.site -| ac_site_file2=$prefix/etc/config.site -| else -| ac_site_file1=$ac_default_prefix/share/config.site -| ac_site_file2=$ac_default_prefix/etc/config.site -| fi -| for ac_site_file in "$ac_site_file1" "$ac_site_file2" -| do -| test "x$ac_site_file" = xNONE && continue -| if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then -| { $as_echo "/usr/share/site/x86_64-unknown-linux-gnu:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -| $as_echo "/usr/share/site/x86_64-unknown-linux-gnu: loading site script $ac_site_file" >&6;} -| sed 's/^/| /' "$ac_site_file" >&5 -| . "$ac_site_file" \ -| || { { $as_echo "/usr/share/site/x86_64-unknown-linux-gnu:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -| $as_echo "/usr/share/site/x86_64-unknown-linux-gnu: error: in \`$ac_pwd':" >&2;} -| as_fn_error $? "failed to load site script $ac_site_file -| See \`config.log' for more details" "$LINENO" 5; } -| fi -| done -configure:2137: checking for a BSD-compatible install -configure:2205: result: /usr/bin/install -c -configure:2216: checking whether build environment is sane -configure:2271: result: yes -configure:2422: checking for a thread-safe mkdir -p -configure:2461: result: /bin/mkdir -p -configure:2468: checking for gawk -configure:2484: found /bin/gawk -configure:2495: result: gawk -configure:2506: checking whether make sets $(MAKE) -configure:2528: result: yes -configure:2557: checking whether make supports nested variables -configure:2574: result: yes -configure:2751: checking for g++ -configure:2767: found /usr/bin/g++ -configure:2778: result: g++ -configure:2805: checking for C++ compiler version -configure:2814: g++ --version >&5 -g++ (SUSE Linux) 7.5.0 -Copyright (C) 2017 Free Software Foundation, Inc. +configure:2205: checking for gcc +configure:2221: found /usr/bin/gcc +configure:2232: result: gcc +configure:2461: checking for C compiler version +configure:2470: gcc --version >&5 +gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-14) +Copyright (C) 2021 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:2481: $? = 0 +configure:2470: gcc -v >&5 +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-redhat-linux +Configured with: ../configure --enable-bootstrap --enable-host-pie --enable-host-bind-now --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --enable-initfini-array --without-isl --enable-multilib --with-linker-hash-style=gnu --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 11.5.0 20240719 (Red Hat 11.5.0-14) (GCC) +... rest of stderr output deleted ... +configure:2481: $? = 0 +configure:2470: gcc -V >&5 +gcc: error: unrecognized command-line option '-V' +gcc: fatal error: no input files +compilation terminated. +configure:2481: $? = 1 +configure:2470: gcc -qversion >&5 +gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'? +gcc: fatal error: no input files +compilation terminated. +configure:2481: $? = 1 +configure:2501: checking whether the C compiler works +configure:2523: gcc conftest.c >&5 +configure:2527: $? = 0 +configure:2575: result: yes +configure:2578: checking for C compiler default output file name +configure:2580: result: a.out +configure:2586: checking for suffix of executables +configure:2593: gcc -o conftest conftest.c >&5 +configure:2597: $? = 0 +configure:2619: result: +configure:2641: checking whether we are cross compiling +configure:2649: gcc -o conftest conftest.c >&5 +configure:2653: $? = 0 +configure:2660: ./conftest +configure:2664: $? = 0 +configure:2679: result: no +configure:2684: checking for suffix of object files +configure:2706: gcc -c conftest.c >&5 +configure:2710: $? = 0 +configure:2731: result: o +configure:2735: checking whether we are using the GNU C compiler +configure:2754: gcc -c conftest.c >&5 +configure:2754: $? = 0 +configure:2763: result: yes +configure:2772: checking whether gcc accepts -g +configure:2792: gcc -c -g conftest.c >&5 +configure:2792: $? = 0 +configure:2833: result: yes +configure:2850: checking for gcc option to accept ISO C89 +configure:2913: gcc -c -g -O2 conftest.c >&5 +configure:2913: $? = 0 +configure:2926: result: none needed +configure:2951: checking whether gcc understands -c and -o together +configure:2973: gcc -c conftest.c -o conftest2.o +configure:2976: $? = 0 +configure:2973: gcc -c conftest.c -o conftest2.o +configure:2976: $? = 0 +configure:2988: result: yes +configure:3055: checking for ar +configure:3071: found /usr/bin/ar +configure:3082: result: ar +configure:3108: checking the archiver (ar) interface +configure:3124: gcc -c -g -O2 conftest.c >&5 +configure:3124: $? = 0 +configure:3126: ar cru libconftest.a conftest.o >&5 +configure:3129: $? = 0 +configure:3157: result: ar +configure:3193: checking for a BSD-compatible install +configure:3261: result: /usr/bin/install -c +configure:3272: checking whether build environment is sane +configure:3327: result: yes +configure:3475: checking for a thread-safe mkdir -p +configure:3514: result: /usr/bin/mkdir -p +configure:3521: checking for gawk +configure:3537: found /usr/bin/gawk +configure:3548: result: gawk +configure:3559: checking whether make sets $(MAKE) +configure:3581: result: yes +configure:3603: checking whether make supports the include directive +configure:3618: make -f confmf.GNU && cat confinc.out +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +this is the am__doit target +configure:3621: $? = 0 +configure:3640: result: yes (GNU style) +configure:3673: checking whether make supports nested variables +configure:3690: result: yes +configure:3766: checking dependency style of gcc +configure:3877: result: gcc3 +configure:4039: checking the archiver (ar) interface +configure:4088: result: ar +configure:4151: checking for ranlib +configure:4167: found /usr/bin/ranlib +configure:4178: result: ranlib +configure:4258: checking for g++ +configure:4274: found /usr/bin/g++ +configure:4285: result: g++ +configure:4312: checking for C++ compiler version +configure:4321: g++ --version >&5 +g++ (GCC) 11.5.0 20240719 (Red Hat 11.5.0-14) +Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -configure:2825: $? = 0 -configure:2814: g++ -v >&5 +configure:4332: $? = 0 +configure:4321: g++ -v >&5 Using built-in specs. COLLECT_GCC=g++ -COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/7/lto-wrapper -OFFLOAD_TARGET_NAMES=hsa:nvptx-none -Target: x86_64-suse-linux -Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go --enable-offload-targets=hsa,nvptx-none, --without-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/7 --enable-ssp --disable-libssp --disable-libvtv --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-7 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-redhat-linux +Configured with: ../configure --enable-bootstrap --enable-host-pie --enable-host-bind-now --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --enable-initfini-array --without-isl --enable-multilib --with-linker-hash-style=gnu --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread model: posix -gcc version 7.5.0 (SUSE Linux) -configure:2825: $? = 0 -configure:2814: g++ -V >&5 -g++: error: unrecognized command line option '-V' +Supported LTO compression algorithms: zlib zstd +gcc version 11.5.0 20240719 (Red Hat 11.5.0-14) (GCC) +... rest of stderr output deleted ... +configure:4332: $? = 0 +configure:4321: g++ -V >&5 +g++: error: unrecognized command-line option '-V' g++: fatal error: no input files compilation terminated. -configure:2825: $? = 1 -configure:2814: g++ -qversion >&5 -g++: error: unrecognized command line option '-qversion'; did you mean '--version'? +configure:4332: $? = 1 +configure:4321: g++ -qversion >&5 +g++: error: unrecognized command-line option '-qversion'; did you mean '--version'? g++: fatal error: no input files compilation terminated. -configure:2825: $? = 1 -configure:2845: checking whether the C++ compiler works -configure:2867: g++ conftest.cpp >&5 -configure:2871: $? = 0 -configure:2919: result: yes -configure:2922: checking for C++ compiler default output file name -configure:2924: result: a.out -configure:2930: checking for suffix of executables -configure:2937: g++ -o conftest conftest.cpp >&5 -configure:2941: $? = 0 -configure:2963: result: -configure:2985: checking whether we are cross compiling -configure:2993: g++ -o conftest conftest.cpp >&5 -configure:2997: $? = 0 -configure:3004: ./conftest -configure:3008: $? = 0 -configure:3023: result: no -configure:3028: checking for suffix of object files -configure:3050: g++ -c conftest.cpp >&5 -configure:3054: $? = 0 -configure:3075: result: o -configure:3079: checking whether we are using the GNU C++ compiler -configure:3098: g++ -c conftest.cpp >&5 -configure:3098: $? = 0 -configure:3107: result: yes -configure:3116: checking whether g++ accepts -g -configure:3136: g++ -c -g conftest.cpp >&5 -configure:3136: $? = 0 -configure:3177: result: yes -configure:3211: checking for style of include used by make -configure:3239: result: GNU -configure:3265: checking dependency style of g++ -configure:3376: result: gcc3 -configure:3439: checking for gcc -configure:3455: found /usr/bin/gcc -configure:3466: result: gcc -configure:3695: checking for C compiler version -configure:3704: gcc --version >&5 -gcc (SUSE Linux) 7.5.0 -Copyright (C) 2017 Free Software Foundation, Inc. +configure:4332: $? = 1 +configure:4336: checking whether we are using the GNU C++ compiler +configure:4355: g++ -c conftest.cpp >&5 +configure:4355: $? = 0 +configure:4364: result: yes +configure:4373: checking whether g++ accepts -g +configure:4393: g++ -c -g conftest.cpp >&5 +configure:4393: $? = 0 +configure:4434: result: yes +configure:4459: checking dependency style of g++ +configure:4570: result: gcc3 +configure:4633: checking for gcc +configure:4660: result: gcc +configure:4889: checking for C compiler version +configure:4898: gcc --version >&5 +gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-14) +Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -configure:3715: $? = 0 -configure:3704: gcc -v >&5 +configure:4909: $? = 0 +configure:4898: gcc -v >&5 Using built-in specs. COLLECT_GCC=gcc -COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/7/lto-wrapper -OFFLOAD_TARGET_NAMES=hsa:nvptx-none -Target: x86_64-suse-linux -Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go --enable-offload-targets=hsa,nvptx-none, --without-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/7 --enable-ssp --disable-libssp --disable-libvtv --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-7 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-redhat-linux +Configured with: ../configure --enable-bootstrap --enable-host-pie --enable-host-bind-now --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --enable-initfini-array --without-isl --enable-multilib --with-linker-hash-style=gnu --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread model: posix -gcc version 7.5.0 (SUSE Linux) -configure:3715: $? = 0 -configure:3704: gcc -V >&5 -gcc: error: unrecognized command line option '-V' +Supported LTO compression algorithms: zlib zstd +gcc version 11.5.0 20240719 (Red Hat 11.5.0-14) (GCC) +... rest of stderr output deleted ... +configure:4909: $? = 0 +configure:4898: gcc -V >&5 +gcc: error: unrecognized command-line option '-V' gcc: fatal error: no input files compilation terminated. -configure:3715: $? = 1 -configure:3704: gcc -qversion >&5 -gcc: error: unrecognized command line option '-qversion'; did you mean '--version'? +configure:4909: $? = 1 +configure:4898: gcc -qversion >&5 +gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'? gcc: fatal error: no input files compilation terminated. -configure:3715: $? = 1 -configure:3719: checking whether we are using the GNU C compiler -configure:3738: gcc -c conftest.c >&5 -configure:3738: $? = 0 -configure:3747: result: yes -configure:3756: checking whether gcc accepts -g -configure:3776: gcc -c -g conftest.c >&5 -configure:3776: $? = 0 -configure:3817: result: yes -configure:3834: checking for gcc option to accept ISO C89 -configure:3897: gcc -c -g -O2 conftest.c >&5 -configure:3897: $? = 0 -configure:3910: result: none needed -configure:3935: checking whether gcc understands -c and -o together -configure:3957: gcc -c conftest.c -o conftest2.o -configure:3960: $? = 0 -configure:3957: gcc -c conftest.c -o conftest2.o -configure:3960: $? = 0 -configure:3972: result: yes -configure:3991: checking dependency style of gcc -configure:4102: result: gcc3 -configure:4160: checking for ranlib -configure:4176: found /usr/bin/ranlib -configure:4187: result: ranlib -configure:4216: checking how to run the C preprocessor -configure:4247: gcc -E conftest.c -configure:4247: $? = 0 -configure:4261: gcc -E conftest.c +configure:4909: $? = 1 +configure:4913: checking whether we are using the GNU C compiler +configure:4941: result: yes +configure:4950: checking whether gcc accepts -g +configure:5011: result: yes +configure:5028: checking for gcc option to accept ISO C89 +configure:5104: result: none needed +configure:5129: checking whether gcc understands -c and -o together +configure:5166: result: yes +configure:5190: checking how to run the C preprocessor +configure:5221: gcc -E conftest.c +configure:5221: $? = 0 +configure:5235: gcc -E conftest.c conftest.c:9:10: fatal error: ac_nonexistent.h: No such file or directory - #include - ^~~~~~~~~~~~~~~~~~ + 9 | #include + | ^~~~~~~~~~~~~~~~~~ compilation terminated. -configure:4261: $? = 1 +configure:5235: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "ParIS Parallel index of sequence" @@ -281,15 +254,15 @@ configure: failed program was: | #define PACKAGE_URL "" | /* end confdefs.h. */ | #include -configure:4286: result: gcc -E -configure:4306: gcc -E conftest.c -configure:4306: $? = 0 -configure:4320: gcc -E conftest.c +configure:5260: result: gcc -E +configure:5280: gcc -E conftest.c +configure:5280: $? = 0 +configure:5294: gcc -E conftest.c conftest.c:9:10: fatal error: ac_nonexistent.h: No such file or directory - #include - ^~~~~~~~~~~~~~~~~~ + 9 | #include + | ^~~~~~~~~~~~~~~~~~ compilation terminated. -configure:4320: $? = 1 +configure:5294: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "ParIS Parallel index of sequence" @@ -300,72 +273,97 @@ configure: failed program was: | #define PACKAGE_URL "" | /* end confdefs.h. */ | #include -configure:4349: checking for grep that handles long lines and -e -configure:4407: result: /bin/grep -configure:4412: checking for egrep -configure:4474: result: /bin/grep -E -configure:4479: checking for ANSI C header files -configure:4499: gcc -c -g -O2 conftest.c >&5 -configure:4499: $? = 0 -configure:4572: gcc -o conftest -g -O2 conftest.c >&5 -configure:4572: $? = 0 -configure:4572: ./conftest -configure:4572: $? = 0 -configure:4583: result: yes -configure:4596: checking for sys/types.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4596: checking for sys/stat.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4596: checking for stdlib.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4596: checking for string.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4596: checking for memory.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4596: checking for strings.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4596: checking for inttypes.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4596: checking for stdint.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4596: checking for unistd.h -configure:4596: gcc -c -g -O2 conftest.c >&5 -configure:4596: $? = 0 -configure:4596: result: yes -configure:4608: checking values.h usability -configure:4608: gcc -c -g -O2 conftest.c >&5 -configure:4608: $? = 0 -configure:4608: result: yes -configure:4608: checking values.h presence -configure:4608: gcc -E conftest.c -configure:4608: $? = 0 -configure:4608: result: yes -configure:4608: checking for values.h -configure:4608: result: yes -configure:4799: checking that generated files are newer than configure -configure:4805: result: done -configure:4832: creating ./config.status +configure:5323: checking for grep that handles long lines and -e +configure:5381: result: /usr/bin/grep +configure:5386: checking for egrep +configure:5448: result: /usr/bin/grep -E +configure:5453: checking for ANSI C header files +configure:5473: gcc -c -g -O2 conftest.c >&5 +configure:5473: $? = 0 +configure:5546: gcc -o conftest -g -O2 conftest.c >&5 +configure:5546: $? = 0 +configure:5546: ./conftest +configure:5546: $? = 0 +configure:5557: result: yes +configure:5570: checking for sys/types.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5570: checking for sys/stat.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5570: checking for stdlib.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5570: checking for string.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5570: checking for memory.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5570: checking for strings.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5570: checking for inttypes.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5570: checking for stdint.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5570: checking for unistd.h +configure:5570: gcc -c -g -O2 conftest.c >&5 +configure:5570: $? = 0 +configure:5570: result: yes +configure:5582: checking values.h usability +configure:5582: gcc -c -g -O2 conftest.c >&5 +configure:5582: $? = 0 +configure:5582: result: yes +configure:5582: checking values.h presence +configure:5582: gcc -E conftest.c +configure:5582: $? = 0 +configure:5582: result: yes +configure:5582: checking for values.h +configure:5582: result: yes +configure:5588: checking fftw3.h usability +configure:5588: gcc -c -g -O2 conftest.c >&5 +configure:5588: $? = 0 +configure:5588: result: yes +configure:5588: checking fftw3.h presence +configure:5588: gcc -E conftest.c +configure:5588: $? = 0 +configure:5588: result: yes +configure:5588: checking for fftw3.h +configure:5588: result: yes +configure:5598: checking build system type +configure:5612: result: x86_64-pc-linux-gnu +configure:5632: checking host system type +configure:5645: result: x86_64-pc-linux-gnu +configure:5668: checking numa.h usability +configure:5668: gcc -c -g -O2 conftest.c >&5 +configure:5668: $? = 0 +configure:5668: result: yes +configure:5668: checking numa.h presence +configure:5668: gcc -E conftest.c +configure:5668: $? = 0 +configure:5668: result: yes +configure:5668: checking for numa.h +configure:5668: result: yes +configure:5886: checking that generated files are newer than configure +configure:5892: result: done +configure:5919: creating ./config.status ## ---------------- ## ## Cache variables. ## ## ---------------- ## +ac_cv_build=x86_64-pc-linux-gnu ac_cv_c_compiler_gnu=yes ac_cv_cxx_compiler_gnu=yes ac_cv_env_CCC_set= @@ -392,8 +390,10 @@ ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= +ac_cv_header_fftw3_h=yes ac_cv_header_inttypes_h=yes ac_cv_header_memory_h=yes +ac_cv_header_numa_h=yes ac_cv_header_stdc=yes ac_cv_header_stdint_h=yes ac_cv_header_stdlib_h=yes @@ -403,13 +403,15 @@ ac_cv_header_sys_stat_h=yes ac_cv_header_sys_types_h=yes ac_cv_header_unistd_h=yes ac_cv_header_values_h=yes +ac_cv_host=x86_64-pc-linux-gnu ac_cv_objext=o -ac_cv_path_EGREP='/bin/grep -E' -ac_cv_path_GREP=/bin/grep +ac_cv_path_EGREP='/usr/bin/grep -E' +ac_cv_path_GREP=/usr/bin/grep ac_cv_path_install='/usr/bin/install -c' -ac_cv_path_mkdir=/bin/mkdir +ac_cv_path_mkdir=/usr/bin/mkdir ac_cv_prog_AWK=gawk ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_AR=ar ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_ac_ct_CXX=g++ ac_cv_prog_ac_ct_RANLIB=ranlib @@ -419,6 +421,7 @@ ac_cv_prog_cxx_g=yes ac_cv_prog_make_make_set=yes am_cv_CC_dependencies_compiler_type=gcc3 am_cv_CXX_dependencies_compiler_type=gcc3 +am_cv_ar_interface=ar am_cv_make_support_nested_variables=yes am_cv_prog_cc_c_o=yes @@ -426,7 +429,7 @@ am_cv_prog_cc_c_o=yes ## Output variables. ## ## ----------------- ## -ACLOCAL='${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing aclocal-1.15' +ACLOCAL='${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing aclocal-1.16' AMDEPBACKSLASH='\' AMDEP_FALSE='#' AMDEP_TRUE='' @@ -435,10 +438,16 @@ AM_BACKSLASH='\' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' AM_DEFAULT_VERBOSITY='1' AM_V='$(V)' -AUTOCONF='${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing autoconf' -AUTOHEADER='${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing autoheader' -AUTOMAKE='${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing automake-1.15' +APPLE_FFTW='' +APPLE_NOWARN_CONV='' +APPLE_OMP='' +AR='ar' +AUTOCONF='${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing autoconf' +AUTOHEADER='${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing autoheader' +AUTOMAKE='${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing automake-1.16' AWK='gawk' +BREW_ROOT='' +BUILD_ARCH='haswell' CC='gcc' CCDEPMODE='depmode=gcc3' CFLAGS='-g -O2' @@ -453,19 +462,21 @@ DEPDIR='.deps' ECHO_C='' ECHO_N='-n' ECHO_T='' -EGREP='/bin/grep -E' +EGREP='/usr/bin/grep -E' EXEEXT='' -GREP='/bin/grep' +GREP='/usr/bin/grep' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='$(install_sh) -c -s' LDFLAGS='' +LIB64='64' LIBOBJS='' LIBS='' LTLIBOBJS='' -MAKEINFO='${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing makeinfo' -MKDIR_P='/bin/mkdir -p' +MAKEINFO='${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing makeinfo' +MKDIR_P='/usr/bin/mkdir -p' +NUMA='-lnuma' OBJEXT='o' PACKAGE='libads' PACKAGE_BUGREPORT='botao.peng@parisdescartes.fr' @@ -477,9 +488,10 @@ PACKAGE_VERSION='1.3' PATH_SEPARATOR=':' RANLIB='ranlib' SET_MAKE='' -SHELL='/bin/bash' +SHELL='/bin/sh' STRIP='' VERSION='1.3' +ac_ct_AR='ar' ac_ct_CC='gcc' ac_ct_CXX='g++' am__EXEEXT_FALSE='' @@ -496,19 +508,27 @@ am__quote='' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' bindir='${exec_prefix}/bin' +build='x86_64-pc-linux-gnu' build_alias='' +build_cpu='x86_64' +build_os='linux-gnu' +build_vendor='pc' datadir='${datarootdir}' datarootdir='${prefix}/share' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' dvidir='${docdir}' exec_prefix='${prefix}' +host='x86_64-pc-linux-gnu' host_alias='' +host_cpu='x86_64' +host_os='linux-gnu' +host_vendor='pc' htmldir='${docdir}' includedir='${prefix}/include' infodir='${datarootdir}/info' -install_sh='${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/install-sh' -libdir='${exec_prefix}/lib64' -libexecdir='${exec_prefix}/lib' +install_sh='${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/install-sh' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' localedir='${datarootdir}/locale' localstatedir='${prefix}/var' mandir='${datarootdir}/man' @@ -518,6 +538,7 @@ pdfdir='${docdir}' prefix='/usr/local' program_transform_name='s,x,x,' psdir='${docdir}' +runstatedir='${localstatedir}/run' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' @@ -563,12 +584,17 @@ generated by GNU Autoconf 2.69. Invocation command line was CONFIG_COMMANDS = $ ./config.status -on gruenau2 +on rr075 -config.status:860: creating Makefile -config.status:860: creating config.h -config.status:1041: config.h is unchanged -config.status:1089: executing depfiles commands +config.status:878: creating Makefile +config.status:878: creating config.h +config.status:1059: config.h is unchanged +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 ## ---------------------- ## ## Running config.status. ## @@ -583,10 +609,907 @@ generated by GNU Autoconf 2.69. Invocation command line was CONFIG_COMMANDS = $ ./config.status config.h -on gruenau2 +on rr075 + +config.status:878: creating config.h +config.status:1059: config.h is unchanged + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 + +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ParIS Parallel index of sequence config.status 1.3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status Makefile depfiles + +on rr075 -config.status:860: creating config.h -config.status:1041: config.h is unchanged +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 ## ---------------------- ## ## Running config.status. ## @@ -601,10 +1524,15 @@ generated by GNU Autoconf 2.69. Invocation command line was CONFIG_COMMANDS = $ ./config.status Makefile depfiles -on gruenau2 +on rr075 -config.status:860: creating Makefile -config.status:1089: executing depfiles commands +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 ## ---------------------- ## ## Running config.status. ## @@ -619,7 +1547,12 @@ generated by GNU Autoconf 2.69. Invocation command line was CONFIG_COMMANDS = $ ./config.status Makefile depfiles -on gruenau2 +on rr075 -config.status:860: creating Makefile -config.status:1089: executing depfiles commands +config.status:878: creating Makefile +config.status:1107: executing depfiles commands +config.status:1184: cd . && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make[1]: Entering directory '/home/roadrunner/eclipse-workspace/messi_cpu' +make[1]: Nothing to be done for 'am--depfiles'. +make[1]: Leaving directory '/home/roadrunner/eclipse-workspace/messi_cpu' +config.status:1189: $? = 0 diff --git a/config.status b/config.status index 2b5b7d5a..e8bd880d 100755 --- a/config.status +++ b/config.status @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # Generated by configure. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging @@ -8,7 +8,7 @@ debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=${CONFIG_SHELL-/bin/bash} +SHELL=${CONFIG_SHELL-/bin/sh} export SHELL ## -------------------- ## ## M4sh Initialization. ## @@ -437,10 +437,10 @@ Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -ac_pwd='/vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA' +ac_pwd='/home/roadrunner/eclipse-workspace/messi_cpu' srcdir='.' INSTALL='/usr/bin/install -c' -MKDIR_P='/bin/mkdir -p' +MKDIR_P='/usr/bin/mkdir -p' AWK='gawk' test -n "$AWK" || AWK=awk # The default lists apply if the user does not specify any file. @@ -519,10 +519,10 @@ if $ac_cs_silent; then fi if $ac_cs_recheck; then - set X /bin/bash './configure' $ac_configure_extra_args --no-create --no-recursion + set X /bin/sh './configure' $ac_configure_extra_args --no-create --no-recursion shift - $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6 - CONFIG_SHELL='/bin/bash' + $as_echo "running CONFIG_SHELL=/bin/sh $*" >&6 + CONFIG_SHELL='/bin/sh' export CONFIG_SHELL exec "$@" fi @@ -539,15 +539,15 @@ _ASBOX # # INIT-COMMANDS # -AMDEP_TRUE="" ac_aux_dir="." +AMDEP_TRUE="" MAKE="make" # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -618,37 +618,44 @@ S["am__EXEEXT_FALSE"]="" S["am__EXEEXT_TRUE"]="#" S["LTLIBOBJS"]="" S["LIBOBJS"]="" -S["EGREP"]="/bin/grep -E" -S["GREP"]="/bin/grep" +S["APPLE_NOWARN_CONV"]="" +S["APPLE_FFTW"]="" +S["APPLE_OMP"]="" +S["BREW_ROOT"]="" +S["NUMA"]="-lnuma" +S["BUILD_ARCH"]="haswell" +S["LIB64"]="64" +S["host_os"]="linux-gnu" +S["host_vendor"]="pc" +S["host_cpu"]="x86_64" +S["host"]="x86_64-pc-linux-gnu" +S["build_os"]="linux-gnu" +S["build_vendor"]="pc" +S["build_cpu"]="x86_64" +S["build"]="x86_64-pc-linux-gnu" +S["EGREP"]="/usr/bin/grep -E" +S["GREP"]="/usr/bin/grep" S["CPP"]="gcc -E" -S["RANLIB"]="ranlib" -S["am__fastdepCC_FALSE"]="#" -S["am__fastdepCC_TRUE"]="" -S["CCDEPMODE"]="depmode=gcc3" -S["ac_ct_CC"]="gcc" -S["CFLAGS"]="-g -O2" -S["CC"]="gcc" S["am__fastdepCXX_FALSE"]="#" S["am__fastdepCXX_TRUE"]="" S["CXXDEPMODE"]="depmode=gcc3" -S["am__nodep"]="_no" -S["AMDEPBACKSLASH"]="\\" -S["AMDEP_FALSE"]="#" -S["AMDEP_TRUE"]="" -S["am__quote"]="" -S["am__include"]="include" -S["DEPDIR"]=".deps" -S["OBJEXT"]="o" -S["EXEEXT"]="" S["ac_ct_CXX"]="g++" -S["CPPFLAGS"]="" -S["LDFLAGS"]="" S["CXXFLAGS"]="-g -O2" S["CXX"]="g++" +S["RANLIB"]="ranlib" S["AM_BACKSLASH"]="\\" S["AM_DEFAULT_VERBOSITY"]="1" S["AM_DEFAULT_V"]="$(AM_DEFAULT_VERBOSITY)" S["AM_V"]="$(V)" +S["am__fastdepCC_FALSE"]="#" +S["am__fastdepCC_TRUE"]="" +S["CCDEPMODE"]="depmode=gcc3" +S["am__nodep"]="_no" +S["AMDEPBACKSLASH"]="\\" +S["AMDEP_FALSE"]="#" +S["AMDEP_TRUE"]="" +S["am__include"]="include" +S["DEPDIR"]=".deps" S["am__untar"]="$${TAR-tar} xf -" S["am__tar"]="$${TAR-tar} chof - \"$$tardir\"" S["AMTAR"]="$${TAR-tar}" @@ -656,15 +663,15 @@ S["am__leading_dot"]="." S["SET_MAKE"]="" S["AWK"]="gawk" S["mkdir_p"]="$(MKDIR_P)" -S["MKDIR_P"]="/bin/mkdir -p" +S["MKDIR_P"]="/usr/bin/mkdir -p" S["INSTALL_STRIP_PROGRAM"]="$(install_sh) -c -s" S["STRIP"]="" -S["install_sh"]="${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/install-sh" -S["MAKEINFO"]="${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing makeinfo" -S["AUTOHEADER"]="${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing autoheader" -S["AUTOMAKE"]="${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing automake-1.15" -S["AUTOCONF"]="${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing autoconf" -S["ACLOCAL"]="${SHELL} /vol/fob-wbib-vol2/wbi/schaefpa/MESSI-SFA/missing aclocal-1.15" +S["install_sh"]="${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/install-sh" +S["MAKEINFO"]="${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing makeinfo" +S["AUTOHEADER"]="${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing autoheader" +S["AUTOMAKE"]="${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing automake-1.16" +S["AUTOCONF"]="${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing autoconf" +S["ACLOCAL"]="${SHELL} /home/roadrunner/eclipse-workspace/messi_cpu/missing aclocal-1.16" S["VERSION"]="1.3" S["PACKAGE"]="libads" S["CYGPATH_W"]="echo" @@ -672,6 +679,15 @@ S["am__isrc"]="" S["INSTALL_DATA"]="${INSTALL} -m 644" S["INSTALL_SCRIPT"]="${INSTALL}" S["INSTALL_PROGRAM"]="${INSTALL}" +S["OBJEXT"]="o" +S["EXEEXT"]="" +S["ac_ct_CC"]="gcc" +S["CPPFLAGS"]="" +S["LDFLAGS"]="" +S["CFLAGS"]="-g -O2" +S["CC"]="gcc" +S["ac_ct_AR"]="ar" +S["AR"]="ar" S["target_alias"]="" S["host_alias"]="" S["build_alias"]="" @@ -682,7 +698,7 @@ S["ECHO_C"]="" S["DEFS"]="-DHAVE_CONFIG_H" S["mandir"]="${datarootdir}/man" S["localedir"]="${datarootdir}/locale" -S["libdir"]="${exec_prefix}/lib64" +S["libdir"]="${exec_prefix}/lib" S["psdir"]="${docdir}" S["pdfdir"]="${docdir}" S["dvidir"]="${docdir}" @@ -691,12 +707,13 @@ S["infodir"]="${datarootdir}/info" S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}" S["oldincludedir"]="/usr/include" S["includedir"]="${prefix}/include" +S["runstatedir"]="${localstatedir}/run" S["localstatedir"]="${prefix}/var" S["sharedstatedir"]="${prefix}/com" S["sysconfdir"]="${prefix}/etc" S["datadir"]="${datarootdir}" S["datarootdir"]="${prefix}/share" -S["libexecdir"]="${exec_prefix}/lib" +S["libexecdir"]="${exec_prefix}/libexec" S["sbindir"]="${exec_prefix}/sbin" S["bindir"]="${exec_prefix}/bin" S["program_transform_name"]="s,x,x," @@ -709,7 +726,8 @@ S["PACKAGE_VERSION"]="1.3" S["PACKAGE_TARNAME"]="libads" S["PACKAGE_NAME"]="ParIS Parallel index of sequence" S["PATH_SEPARATOR"]=":" -S["SHELL"]="/bin/bash" +S["SHELL"]="/bin/sh" +S["am__quote"]="" _ACAWK cat >>"$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 @@ -1097,29 +1115,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1137,53 +1161,50 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; diff --git a/configure b/configure index f0811475..73859e3a 100755 --- a/configure +++ b/configure @@ -625,37 +625,44 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +APPLE_NOWARN_CONV +APPLE_FFTW +APPLE_OMP +BREW_ROOT +NUMA +BUILD_ARCH +LIB64 +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build EGREP GREP CPP -RANLIB -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -ac_ct_CC -CFLAGS -CC am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT ac_ct_CXX -CPPFLAGS -LDFLAGS CXXFLAGS CXX +RANLIB AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR am__untar am__tar AMTAR @@ -679,6 +686,15 @@ am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +ac_ct_AR +AR target_alias host_alias build_alias @@ -698,6 +714,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -716,12 +733,13 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking -enable_silent_rules enable_dependency_tracking +enable_silent_rules with_no_benchmarking with_with_debug with_with_clustering @@ -730,14 +748,14 @@ with_verbose ac_precious_vars='build_alias host_alias target_alias -CXX -CXXFLAGS +CC +CFLAGS LDFLAGS LIBS CPPFLAGS +CXX +CXXFLAGS CCC -CC -CFLAGS CPP' @@ -777,6 +795,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1029,6 +1048,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1166,7 +1194,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1319,6 +1347,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1340,6 +1369,10 @@ Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi @@ -1353,12 +1386,12 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1369,15 +1402,15 @@ Optional Packages: --verbose enable stuff Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags + CXX C++ compiler command + CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -1460,10 +1493,10 @@ fi ## Autoconf initialization. ## ## ------------------------ ## -# ac_fn_cxx_try_compile LINENO -# ---------------------------- +# ac_fn_c_try_compile LINENO +# -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () +ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext @@ -1483,7 +1516,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || + test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 @@ -1496,12 +1529,12 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_cxx_try_compile +} # ac_fn_c_try_compile -# ac_fn_c_try_compile LINENO -# -------------------------- +# ac_fn_cxx_try_compile LINENO +# ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () +ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext @@ -1521,7 +1554,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || + test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 @@ -1534,7 +1567,7 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_compile +} # ac_fn_cxx_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- @@ -2089,8 +2122,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.15' - ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -2120,220 +2151,117 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done IFS=$as_save_IFS -rm -rf conftest.one conftest.two conftest.dir - fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2342,7 +2270,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" + ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2352,29 +2280,30 @@ IFS=$as_save_IFS fi fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + fi fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else + ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do @@ -2382,7 +2311,11 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2390,88 +2323,88 @@ done done IFS=$as_save_IFS +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi fi fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done IFS=$as_save_IFS fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -for ac_prog in gawk mawk nawk awk + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2480,7 +2413,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" + ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2490,13 +2423,1133 @@ IFS=$as_save_IFS fi fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac + +am__api_version='1.16' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2534,14 +3587,77 @@ $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' else - am__leading_dot=_ + AMDEP_TRUE='#' + AMDEP_FALSE= fi -rmdir .tst 2>/dev/null + # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : @@ -2625,8 +3741,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -2645,6 +3761,134 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -2667,50 +3911,210 @@ Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + +ac_config_headers="$ac_config_headers config.h" + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_config_headers="$ac_config_headers config.h" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2719,7 +4123,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2729,32 +4133,28 @@ IFS=$as_save_IFS fi fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$CXX" && break - done fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2763,7 +4163,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" + ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2773,21 +4173,17 @@ IFS=$as_save_IFS fi fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -2795,287 +4191,148 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - CXX=$ac_ct_CXX - fi -fi - + RANLIB=$ac_ct_RANLIB fi +else + RANLIB="$ac_cv_prog_RANLIB" fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 -$as_echo_n "checking whether the C++ compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi done -test "$ac_cv_exeext" = no && ac_cv_exeext= + done +IFS=$as_save_IFS +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } else - ac_file='' -fi -if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C++ compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 -$as_echo_n "checking for C++ compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C++ compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac + test $ac_status = 0; } done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : @@ -3191,74 +4448,11 @@ else CXXFLAGS= fi fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= @@ -3863,348 +5057,128 @@ static char *f (char * (*g) (char **, int), char **p, ...) } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done - done -IFS=$as_save_IFS +rm -f conftest.$ac_ext +CC=$ac_save_CC fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi @@ -4611,6 +5585,127 @@ if test "x$ac_cv_header_values_h" = xyes; then : fi +ac_fn_c_check_header_mongrel "$LINENO" "fftw3.h" "ac_cv_header_fftw3_h" "$ac_includes_default" +if test "x$ac_cv_header_fftw3_h" = xyes; then : + +fi + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +CANONICAL_HOST=$host +case $host in + *-*-linux*) + ac_fn_c_check_header_mongrel "$LINENO" "numa.h" "ac_cv_header_numa_h" "$ac_includes_default" +if test "x$ac_cv_header_numa_h" = xyes; then : + +fi + + + LIB64='64' + ;; + *-*-darwin*) + echo "darwin detected, skipping numa.h dep, setting brew environment" + BREW_ROOT=`brew config|grep HOMEBREW_PREFIX|awk '{print $2}'` + APPLE_OMP='-I${BREW_ROOT}/opt/libomp/include' + APPLE_FFTW='-I${BREW_ROOT}/opt/fftw/include' + APPLE_NOWARN_CONV='-Wno-int-conversion' + LDFLAGS='${LD_FLAGS} -L${BREW_ROOT}/opt/fftw/lib' + case $host_cpu in + arm) + BUILD_ARCH='armv8.2-a' + ;; + esac + ;; +esac +case $host_cpu in + x86_64) + echo "x86_64-cpu" + BUILD_ARCH='haswell' + NUMA='-lnuma' + ;; + aarch64) + echo "arm64-cpu" + BUILD_ARCH='armv8.2-a' + ;; +esac + + + + + + + + if test "$ac_cv_header_values_h" == yes then @@ -4804,6 +5899,14 @@ $as_echo_n "checking that generated files are newer than configure... " >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -4812,18 +5915,10 @@ else am__EXEEXT_FALSE= fi -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -5406,7 +6501,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _ACEOF @@ -5416,8 +6511,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -6018,29 +7113,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6058,53 +7159,50 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; diff --git a/configure.ac b/configure.ac index cbf36102..a38e9b5d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,13 +1,57 @@ AC_INIT([ParIS Parallel index of sequence], [1.3], [botao.peng@parisdescartes.fr], [libads]) AC_PREREQ([2.59]) +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AM_INIT_AUTOMAKE([1.10 -Wall no-define]) AC_CONFIG_HEADERS([config.h]) +AM_PROG_AR +AC_PROG_RANLIB AC_PROG_CXX AC_PROG_CC -AC_PROG_RANLIB AM_PROG_CC_C_O + AC_CHECK_HEADER(values.h) +AC_CHECK_HEADER(fftw3.h) +AC_CANONICAL_HOST +CANONICAL_HOST=$host +case $host in + *-*-linux*) + AC_CHECK_HEADER(numa.h) + LIB64='64' + ;; + *-*-darwin*) + echo "darwin detected, skipping numa.h dep, setting brew environment" + BREW_ROOT=`brew config|grep HOMEBREW_PREFIX|awk '{print $2}'` + APPLE_OMP='-I${BREW_ROOT}/opt/libomp/include' + APPLE_FFTW='-I${BREW_ROOT}/opt/fftw/include' + APPLE_NOWARN_CONV='-Wno-int-conversion' + LDFLAGS='${LD_FLAGS} -L${BREW_ROOT}/opt/fftw/lib' + case $host_cpu in + arm) + BUILD_ARCH='armv8.2-a' + ;; + esac + ;; +esac +case $host_cpu in + x86_64) + echo "x86_64-cpu" + BUILD_ARCH='haswell' + NUMA='-lnuma' + ;; + aarch64) + echo "arm64-cpu" + BUILD_ARCH='armv8.2-a' + ;; +esac +AC_SUBST([LIB64]) +AC_SUBST([BUILD_ARCH]) +AC_SUBST([NUMA]) +AC_SUBST([BREW_ROOT]) +AC_SUBST([APPLE_OMP]) +AC_SUBST([APPLE_FFTW]) +AC_SUBST([APPLE_NOWARN_CONV]) +AC_SUBST([LDFLAGS]) if test "$ac_cv_header_values_h" == yes then diff --git a/depcomp b/depcomp old mode 100755 new mode 100644 diff --git a/export.sh b/export.sh old mode 100755 new mode 100644 diff --git a/globals.h b/globals.h index 7400d321..8c1ee16d 100644 --- a/globals.h +++ b/globals.h @@ -5,7 +5,12 @@ // Created by Kostas Zoumpatianos and Botao Peng, March 2020 // #include "config.h" +#include #include +#if defined(__APPLE_CC__) +#include +#include +#endif #ifndef isax_globals_h #define isax_globals_h @@ -34,8 +39,12 @@ typedef unsigned long long root_mask_type; enum response {OUT_OF_MEMORY_FAILURE, FAILURE, SUCCESS}; enum insertion_mode {PARTIAL = 1, TMP = 2, + PARTIAL_OR_TMP = 3, FULL = 4, - NO_TMP = 8}; + TMP_OR_FULL = 6, + NO_TMP = 8, + PARTIAL_OR_NO_TMP = 9, + FULL_OR_NO_TMP = 12}; enum buffer_cleaning_mode {FULL_CLEAN, TMP_ONLY_CLEAN, TMP_AND_TS_CLEAN}; enum node_cleaning_mode {DO_NOT_INCLUDE_CHILDREN = 0, @@ -49,12 +58,41 @@ enum node_cleaning_mode {DO_NOT_INCLUDE_CHILDREN = 0, #define FALSE 0 #define BUFFER_REALLOCATION_RATE 2 +#if defined(__APPLE_CC__) +#ifndef ADS_PTHREAD_BARRIER_COMPAT_H +#define ADS_PTHREAD_BARRIER_COMPAT_H + +#if !(defined(HAVE_PTHREAD_BARRIER) && HAVE_PTHREAD_BARRIER) + +#include "ads/barrier.h" + +#ifndef PTHREAD_BARRIER_SERIAL_THREAD +#define PTHREAD_BARRIER_SERIAL_THREAD 1 +#endif + +#undef pthread_barrier_t +#undef pthread_barrier_init +#undef pthread_barrier_wait +#undef pthread_barrier_destroy + +#define pthread_barrier_t ads_barrier_t +#define pthread_barrier_init(barrier, attr, count) ads_barrier_init((barrier), (unsigned int)(count)) +#define pthread_barrier_destroy(barrier) ads_barrier_destroy((barrier)) +#define pthread_barrier_wait(barrier) ads_barrier_wait((barrier)) + +#endif /* !(HAVE_PTHREAD_BARRIER) */ + +#endif /* ADS_PTHREAD_BARRIER_COMPAT_H */ + +#endif + + ///// GLOBAL VARIABLES ///// int FLUSHES; unsigned long BYTES_ACCESSED; float APPROXIMATE; -void* LOGFILE; +FILE* LOGFILE; #define INCREASE_BYTES_ACCESSED(new_bytes) \ BYTES_ACCESSED += (unsigned long) new_bytes; @@ -194,7 +232,7 @@ void* LOGFILE; loaded_records, APPROXIMATE,\ result_distance, total_time); //#define PRINT_STATS(result_distance) printf("%d\t",loaded_nodes); - #define INIT_INDEX_STATS_FILE(ifile) fprintf(ifile, "binning,indexing total, transformation, indexing,total time,index file size\n%lf,%lf,%ld,%ld,%lf,", total_binning_time, total_indexing_time,\ + #define INIT_INDEX_STATS_FILE(ifile) fprintf(ifile, "binning,indexing total,transformation,indexing,total time,index file size\n%lf,%lf,%ld,%ld,%lf,\n", total_binning_time, total_indexing_time,\ TOTAL_TRANSFORMATION_PART_TIME, TOTAL_INDEXING_PART_TIME, (total_binning_time+total_indexing_time)); #define INIT_SAVE_FILE(ifile) fprintf(ifile, "querying time, init time, tree pass time, pq insert time, pq remove time, lb dist time, real dist time, nodes, checked_nodes, bytes_accessed, loaded_nodes, loaded_records, real dist calc, lb dist calc, approximate_distance, distance, total\n"); #define SAVE_STATS(result_distance) fprintf(LOGFILE,"%lf, %lf, %lf, %lu, %lu, %lu, %lu, %d, %d, %ld, %d, %lld, %lu, %lu, %lf, %lf, %lf\n", \ @@ -233,13 +271,13 @@ void* LOGFILE; TOTAL_REAL_DIST_CALC_TIME=0; #define SAVE_STATS_TOTAL(ifile, queries_size) fprintf(ifile,"%lf, %lf, %lf, %lf, %lf, %lf, %lf, %d, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf\n", \ (total_querying_time_all / queries_size), (total_init_time_all / queries_size),\ - (total_tree_pass_time_all / queries_size), (total_pq_insert_time_all / queries_size),(total_pq_remove_time_all / queries_size),\ + (total_tree_pass_time_all / queries_size), (total_pq_insert_time_all / queries_size), (total_pq_remove_time_all / queries_size),\ (total_lb_dist_calc_time_all / queries_size), (total_real_dist_calc_time_all / queries_size),\ total_tree_nodes, ((double)checked_nodes_all / queries_size), \ ((double)bytes_accessed_all / queries_size), ((double)loaded_nodes_all / queries_size), \ ((double)loaded_records / queries_size), ((double)RDcalculationnumber_all / queries_size), \ ((double)LBDcalculationnumber_all / queries_size), (approximate_all / queries_size),\ - (result_distance_all / queries_size), (total_time_all / queries_size)); + (result_distance_all / queries_size), total_time); #define min(x,y) ( x curr); +static int cmp_pri(double next, double curr) { + return (next > curr); } - -static double -get_pri(void *a) -{ - return (double) ((query_result *) a)->distance; +static double get_pri(void *a) { + return (double) ((query_result *) a)->distance; } - -static void -set_pri(void *a, double pri) -{ - ((query_result *) a)->distance = (float)pri; +static void set_pri(void *a, double pri) { + ((query_result *) a)->distance = (float)pri; } - -static size_t -get_pos(void *a) -{ - return ((query_result *) a)->pqueue_position; +static size_t get_pos(void *a) { + return ((query_result *) a)->pqueue_position; } - -static void -set_pos(void *a, size_t pos) -{ - ((query_result *) a)->pqueue_position = pos; +static void set_pos(void *a, size_t pos) { + ((query_result *) a)->pqueue_position = pos; } - /// VARIOUS QUERY TYPES query_result exact_search_serial(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); pqueue_bsf exact_topk_serial(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, int k); -query_result exact_search (ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); -pqueue_bsf exact_topk (ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, int k); -query_result sanity_check_query (ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); +query_result exact_search(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); +pqueue_bsf exact_topk(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, int k); +query_result sanity_check_query(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); /// HELPE FUNCTIONS ts_type * get_ads_record(unsigned long tid, isax_index *index); -query_result approximate_search (ts_type *ts, ts_type *paa, isax_index *index); -query_result approximate_search_manynode (ts_type *ts, ts_type *paa, isax_index *index); - -void approximate_topk (ts_type *ts, ts_type *paa, isax_index *index, pqueue_bsf *pq_bsf); -query_result approximate_search_SIMD (ts_type *ts, ts_type *paa, isax_index *index); -query_result refine_answer (ts_type *ts, ts_type *paa, isax_index *index, - query_result approximate_bsf_result, - float minimum_distance, int limit); -void refine_topk_answer (ts_type *ts, ts_type *paa, isax_index *index, - pqueue_bsf *pq_bsf, - float minimum_distance, int limit); +query_result approximate_search(ts_type *ts, ts_type *paa, isax_index *index); +query_result approximate_search_manynode(ts_type *ts, ts_type *paa, isax_index *index); + +void approximate_topk(ts_type *ts, ts_type *paa, isax_index *index, pqueue_bsf *pq_bsf); +query_result approximate_search_SIMD(ts_type *ts, ts_type *paa, isax_index *index); +query_result refine_answer(ts_type *ts, ts_type *paa, isax_index *index, + query_result approximate_bsf_result, + float minimum_distance, int limit); +void refine_topk_answer(ts_type *ts, ts_type *paa, isax_index *index, + pqueue_bsf *pq_bsf, + float minimum_distance, int limit); #endif diff --git a/include/ads/isax_visualize_index.h b/include/ads/isax_visualize_index.h index 71f8d46b..e557b1a6 100644 --- a/include/ads/isax_visualize_index.h +++ b/include/ads/isax_visualize_index.h @@ -15,4 +15,5 @@ void bst_print_dot(isax_node* tree, FILE* stream); void isax_print_dot(isax_index* index, FILE *stream); void calculate_average_depth(FILE *ifile, isax_index *index); -void traverse_tree(isax_node *node, unsigned int parent_depth, unsigned int *total_depth, unsigned int *node_count, unsigned int *leaf_count, unsigned long *leaf_size); \ No newline at end of file +void traverse_tree(isax_node *node, unsigned int parent_depth, unsigned int *total_depth, unsigned int *node_count, + unsigned int *leaf_count, unsigned long *leaf_size); diff --git a/include/ads/parallel_index_engine.h b/include/ads/parallel_index_engine.h index 84238a4f..63364c82 100644 --- a/include/ads/parallel_index_engine.h +++ b/include/ads/parallel_index_engine.h @@ -3,7 +3,7 @@ #include "../../config.h" #include "../../globals.h" #include "sax/ts.h" -#include "sax/sax.h" +#include "sax/sax.h" #include #include #include @@ -12,69 +12,68 @@ #include "isax_index.h" #include "isax_query_engine.h" -void isax_index_binary_file_m(const char *ifilename, int ts_num, isax_index *index,int calculate_thread); -void isax_index_binary_file_m_new(const char *ifilename, int ts_num, isax_index *index,int calculate_thread); -void isax_index_binary_file_pRecBuf(const char *ifilename, int ts_num, isax_index *index,int calculate_thread); -void isax_index_binary_file_2RecBuf(const char *ifilename, int ts_num, isax_index *index,int calculate_thread); -void isax_index_binary_file_2nRecBuf(const char *ifilename, int ts_num, isax_index *index,int calculate_thread); +void isax_index_binary_file_m(const char *ifilename, int ts_num, isax_index *index, int calculate_thread); +void isax_index_binary_file_m_new(const char *ifilename, int ts_num, isax_index *index, int calculate_thread); +void isax_index_binary_file_pRecBuf(const char *ifilename, int ts_num, isax_index *index, int calculate_thread); +void isax_index_binary_file_2RecBuf(const char *ifilename, int ts_num, isax_index *index, int calculate_thread); +void isax_index_binary_file_2nRecBuf(const char *ifilename, int ts_num, isax_index *index, int calculate_thread); void* indexbulkloadingworker(void* transferdata); void* indexbulkloadingworker_new(void* transferdata); void* indexbulkloadingworker_new2(void *transferdata); void* indexbulkloadingworker_pRecBuf(void *transferdata); void* indexbulkloadingworker_2RecBuf(void *transferdata); -isax_node * insert_to_fbl_m(first_buffer_layer *fbl, - sax_type *sax, - file_position_type *pos, - root_mask_type mask, - isax_index *index, - pthread_mutex_t *locknode, - pthread_mutex_t *lockfbl); -isax_node * insert_to_fbl_m_new(first_buffer_layer *fbl, - sax_type *sax, - file_position_type *pos, - root_mask_type mask, - isax_index *index, - pthread_mutex_t *locknode, - pthread_mutex_t *lockfbl); +isax_node * insert_to_fbl_m(first_buffer_layer *fbl, + sax_type *sax, + file_position_type *pos, + root_mask_type mask, + isax_index *index, + pthread_mutex_t *locknode, + pthread_mutex_t *lockfbl); +isax_node * insert_to_fbl_m_new(first_buffer_layer *fbl, + sax_type *sax, + file_position_type *pos, + root_mask_type mask, + isax_index *index, + pthread_mutex_t *locknode, + pthread_mutex_t *lockfbl); isax_node * insert_to_pRecBuf(parallel_first_buffer_layer *fbl, - sax_type *sax, - file_position_type *pos, - root_mask_type mask, - isax_index *index, - pthread_mutex_t *lock_firstnode, - int workernumber, - int total_workernumber); + sax_type *sax, + file_position_type *pos, + root_mask_type mask, + isax_index *index, + pthread_mutex_t *lock_firstnode, + int workernumber, + int total_workernumber); isax_node * insert_to_2pRecBuf(parallel_dfirst_buffer_layer *fbl, - sax_type *sax, - file_position_type *pos, - root_mask_type mask, - isax_index *index, - pthread_mutex_t *lock_firstnode, - int workernumber, - int total_workernumber); - + sax_type *sax, + file_position_type *pos, + root_mask_type mask, + isax_index *index, + pthread_mutex_t *lock_firstnode, + int workernumber, + int total_workernumber); enum response indexconstruction(first_buffer_layer *fbl, - isax_index *index, - pthread_mutex_t *lock_index, - pthread_mutex_t *lock_disk, - int calculate_thread); + isax_index *index, + pthread_mutex_t *lock_index, + pthread_mutex_t *lock_disk, + int calculate_thread); enum response indexflush(first_buffer_layer *fbl, - isax_index *index, - pthread_mutex_t *lock_index, - pthread_mutex_t *lock_disk, - int calculate_thread); + isax_index *index, + pthread_mutex_t *lock_index, + pthread_mutex_t *lock_disk, + int calculate_thread); enum response indexpRecBufflush(parallel_first_buffer_layer *fbl, - isax_index *index, - pthread_mutex_t *lock_index, - pthread_mutex_t *lock_disk, - int calculate_thread, - int preworkernumber); + isax_index *index, + pthread_mutex_t *lock_index, + pthread_mutex_t *lock_disk, + int calculate_thread, + int preworkernumber); enum response indexconstruction_pRecBuf(first_buffer_layer *fbl, - isax_index *index, - pthread_mutex_t *lock_index, - int calculate_thread); + isax_index *index, + pthread_mutex_t *lock_index, + int calculate_thread); void* indexconstructionworker(void *input); void* indexflushworker(void *input); void* indexpRecBufflushworker(void *input); @@ -84,63 +83,63 @@ void* indexconstructionworker_pRecBuf_new(void *input); void* indexconstructionworker_2RecBuf(void *input); void* indexconstructionworker_2nRecBuf(void *input); -root_mask_type isax_fbl_index_insert_m(isax_index *index, - sax_type * sax, - file_position_type * pos, - pthread_mutex_t *lock_record, - pthread_mutex_t *lock_fbl, - pthread_mutex_t *lock_cbl, - pthread_mutex_t *lock_firstnode, - pthread_mutex_t *lock_index, - pthread_mutex_t *locdisk); -root_mask_type isax_fbl_index_insert_m_new(isax_index *index, - sax_type * sax, - file_position_type * pos, - pthread_mutex_t *lock_record, - pthread_mutex_t *lock_fbl, - pthread_mutex_t *lock_cbl, - pthread_mutex_t *lock_firstnode, - pthread_mutex_t *lock_index, - pthread_mutex_t *locdisk); - -root_mask_type isax_pRecBuf_index_insert(isax_index *index, - sax_type * sax, - file_position_type * pos, - pthread_mutex_t *lock_record, - pthread_mutex_t *lock_firstnode, - int workernumber, - int total_workernumber); -root_mask_type isax_2pRecBuf_index_insert(isax_index *index, - sax_type * sax, - file_position_type * pos, - pthread_mutex_t *lock_record, - pthread_mutex_t *lock_firstnode, - int workernumber, - int total_workernumber); -typedef struct index_buffer_data -{ - //int ts_num,ts_loaded; - file_position_type pos; - isax_index *index; - ts_type * ts; - sax_type *saxv; - int fin_number,blocid; - pthread_mutex_t *lock_record; - pthread_mutex_t *lock_fbl; - pthread_mutex_t *lock_index; - pthread_mutex_t *lock_cbl; - pthread_mutex_t *lock_firstnode; - pthread_mutex_t *lock_nodeconter; - pthread_mutex_t *lock_disk; - file_position_type *fbl; - int *bufferpresize; - int workernumber; - int total_workernumber; - int *nodecounter; - pthread_barrier_t *lock_barrier1, *lock_barrier2, *lock_barrier3; - bool finished; -}index_buffer_data; +root_mask_type isax_fbl_index_insert_m(isax_index *index, + sax_type * sax, + file_position_type * pos, + pthread_mutex_t *lock_record, + pthread_mutex_t *lock_fbl, + pthread_mutex_t *lock_cbl, + pthread_mutex_t *lock_firstnode, + pthread_mutex_t *lock_index, + pthread_mutex_t *locdisk); +root_mask_type isax_fbl_index_insert_m_new(isax_index *index, + sax_type * sax, + file_position_type * pos, + pthread_mutex_t *lock_record, + pthread_mutex_t *lock_fbl, + pthread_mutex_t *lock_cbl, + pthread_mutex_t *lock_firstnode, + pthread_mutex_t *lock_index, + pthread_mutex_t *locdisk); +root_mask_type isax_pRecBuf_index_insert(isax_index *index, + sax_type * sax, + file_position_type * pos, + pthread_mutex_t *lock_record, + pthread_mutex_t *lock_firstnode, + int workernumber, + int total_workernumber); +root_mask_type isax_2pRecBuf_index_insert(isax_index *index, + sax_type * sax, + file_position_type * pos, + pthread_mutex_t *lock_record, + pthread_mutex_t *lock_firstnode, + int workernumber, + int total_workernumber); +typedef struct index_buffer_data { + file_position_type pos; + isax_index *index; + ts_type * ts; + sax_type *saxv; + int fin_number; + int blocid; + pthread_mutex_t *lock_record; + pthread_mutex_t *lock_fbl; + pthread_mutex_t *lock_index; + pthread_mutex_t *lock_cbl; + pthread_mutex_t *lock_firstnode; + pthread_mutex_t *lock_nodeconter; + pthread_mutex_t *lock_disk; + file_position_type *fbl; + int *bufferpresize; + int workernumber; + int total_workernumber; + int *nodecounter; + pthread_barrier_t *lock_barrier1; + pthread_barrier_t *lock_barrier2; + pthread_barrier_t *lock_barrier3; + bool finished; +} index_buffer_data; -int read_block_length; -#endif \ No newline at end of file +int read_block_length; +#endif diff --git a/include/ads/parallel_inmemory_query_engine.h b/include/ads/parallel_inmemory_query_engine.h index e60f85a9..abc75f15 100644 --- a/include/ads/parallel_inmemory_query_engine.h +++ b/include/ads/parallel_inmemory_query_engine.h @@ -19,81 +19,102 @@ #include "inmemory_index_engine.h" typedef struct localStack { - isax_node **val; + isax_node **val; int top; int bottom; -}localStack; +} localStack; -typedef struct MESSI_workerdata -{ - isax_node *current_root_node; - ts_type *paa,*paaU,*paaL,*ts,*uo,*lo; - pqueue_t *pq; - isax_index *index; - float minimum_distance; - int limit; - pthread_mutex_t *lock_current_root_node; - pthread_mutex_t *lock_queue; - pthread_barrier_t *lock_barrier; - pthread_rwlock_t *lock_bsf; - query_result *bsf_result; - int *node_counter; - isax_node **nodelist; - int amountnode; - localStack *localstk; - localStack *allstk; - pthread_mutex_t *locallock,*alllock; - int *queuelabel,*allqueuelabel; - pqueue_t **allpq; - int startqueuenumber; - int warpWind; - pqueue_bsf *pq_bsf; -}MESSI_workerdata; +typedef struct MESSI_workerdata { + isax_node *current_root_node; + ts_type *paa; + ts_type *paaU; + ts_type *paaL; + ts_type *ts; + ts_type *uo; + ts_type *lo; + pqueue_t *pq; + isax_index *index; + float minimum_distance; + int limit; + pthread_mutex_t *lock_current_root_node; + pthread_mutex_t *lock_queue; + pthread_barrier_t *lock_barrier; + pthread_rwlock_t *lock_bsf; + query_result *bsf_result; + int *node_counter; + isax_node **nodelist; + int amountnode; + localStack *localstk; + localStack *allstk; + pthread_mutex_t *locallock; + pthread_mutex_t *alllock; + int *queuelabel; + int *allqueuelabel; + pqueue_t **allpq; + int startqueuenumber; + int warpWind; + pqueue_bsf *pq_bsf; +} MESSI_workerdata; -float calculate_node_distance_inmemory_m (isax_index *index, isax_node *node, ts_type *query, float bsf); +float calculate_node_distance_inmemory_m(isax_index *index, isax_node *node, ts_type *query, float bsf); -query_result approximate_search_inmemory_m (ts_type *ts, ts_type *paa, isax_index *index); -query_result refine_answer_inmemory_m (ts_type *ts, ts_type *paa, isax_index *index, query_result approximate_bsf_result,float minimum_distance, int limit); +query_result approximate_search_inmemory_m(ts_type *ts, ts_type *paa, isax_index *index); +query_result refine_answer_inmemory_m(ts_type *ts, ts_type *paa, isax_index *index, + query_result approximate_bsf_result, float minimum_distance, int limit); -query_result exact_search_serial_ParIS_nb_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); +query_result exact_search_serial_ParIS_nb_inmemory(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves); void* ParIS_nb_worker_inmemory(void *worker_data); -query_result exact_search_parads_inmemory (ts_type *ts, ts_type *paa, isax_index *index, - float minimum_distance, int min_checked_leaves); +query_result exact_search_parads_inmemory(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves); void* exact_search_old_worker_inmemory(void *rfdata); -query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); -pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves,int k); +query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves); +pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, + int min_checked_leaves, int k); -query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); -query_result exact_search_serial_ParIS_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); -query_result exact_search_serial_ParGISG_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); -query_result exact_search_serial_ParGIS_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); +query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves); +query_result exact_search_serial_ParIS_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves); +query_result exact_search_serial_ParGISG_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves); +query_result exact_search_serial_ParGIS_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves); void* mindistance_worker_inmemory(void *essdata); void* readworker_inmemory(void *read_pointer); void* readworker2_inmemory(void *read_pointer); void* topk_readworker_inmemory(void *read_pointer); -void exact_search_serial_ParIS_nb_batch_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves,int batch_number); -query_result exact_search_inmemory_openmp (ts_type *ts, ts_type *paa, isax_index *index, - float minimum_distance, int min_checked_leaves); -query_result exact_search_ParISnew_inmemory (ts_type *ts, ts_type *paa, isax_index *index,node_list *nodelist, - float minimum_distance, int min_checked_leaves); -query_result exact_search_ParISnew_inmemory_workstealing (ts_type *ts, ts_type *paa, isax_index *index,node_list *nodelist, - float minimum_distance, int min_checked_leaves); -query_result exact_search_MESSI (ts_type *ts, ts_type *paa, isax_index *index,node_list *nodelist, - float minimum_distance, int min_checked_leaves); +void exact_search_serial_ParIS_nb_batch_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, + int min_checked_leaves, int batch_number); +query_result exact_search_inmemory_openmp(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves); +query_result exact_search_ParISnew_inmemory(ts_type *ts, ts_type *paa, isax_index *index, node_list *nodelist, + float minimum_distance, int min_checked_leaves); +query_result exact_search_ParISnew_inmemory_workstealing(ts_type *ts, ts_type *paa, isax_index *index, node_list *nodelist, + float minimum_distance, int min_checked_leaves); +query_result exact_search_MESSI(ts_type *ts, ts_type *paa, isax_index *index, node_list *nodelist, + float minimum_distance, int min_checked_leaves); -query_result exact_search_ParISnew_inmemory_hybrid_workstealing (ts_type *ts, ts_type *paa, isax_index *index,node_list *nodelist, - float minimum_distance, int min_checked_leaves); +query_result exact_search_ParISnew_inmemory_hybrid_workstealing(ts_type *ts, ts_type *paa, isax_index *index, + node_list *nodelist, float minimum_distance, int min_checked_leaves); void* exact_search_worker_inmemory(void *rfdata); void* exact_search_worker_inmemory_workstealing(void *rfdata); void* exact_search_worker_inmemory_hybridpqueue(void *rfdata); void* exact_search_worker_inmemory_hybridpqueue_workstealing(void *rfdata); -void insert_tree_node_m(float *paa,isax_node *node,isax_index *index,float bsf,pqueue_t *pq,pthread_mutex_t *lock_queue); -void insert_tree_node_mgpu(float *paa,isax_node *node,isax_index *index,float bsf,pqueue_bsf *pq,pthread_mutex_t *lock_queue); -void insert_tree_node_m_workstealing(float *paa,isax_node *node,isax_index *index,float bsf,pqueue_t *pq,pthread_mutex_t *lock_queue,localStack* workstack); -void insert_tree_node_m_hybridpqueue(float *paa,isax_node *node,isax_index *index,float bsf,pqueue_t **pq,pthread_mutex_t *lock_queue,int *tnumber); -void insert_tree_node_m_hybridpqueue_time(float *paa,isax_node *node,isax_index *index,float bsf,pqueue_t **pq,pthread_mutex_t *lock_queue,int *tnumber, unsigned long int *time_lb); -void insert_tree_node_m_hybridpqueue_workstealing(float *paa,isax_node *node,isax_index *index,float bsf,pqueue_t **pq,pthread_mutex_t *lock_queue,localStack* workstack,int *tnumber); +void insert_tree_node_m(float *paa, isax_node *node, isax_index *index, float bsf, + pqueue_t *pq, pthread_mutex_t *lock_queue); +void insert_tree_node_mgpu(float *paa, isax_node *node, isax_index *index, float bsf, + pqueue_bsf *pq, pthread_mutex_t *lock_queue); +void insert_tree_node_m_workstealing(float *paa, isax_node *node, isax_index *index, float bsf, + pqueue_t *pq, pthread_mutex_t *lock_queue, localStack* workstack); +void insert_tree_node_m_hybridpqueue(float *paa, isax_node *node, isax_index *index, float bsf, + pqueue_t **pq, pthread_mutex_t *lock_queue, int *tnumber); +void insert_tree_node_m_hybridpqueue_time(float *paa, isax_node *node, isax_index *index, float bsf, + pqueue_t **pq, pthread_mutex_t *lock_queue, int *tnumber, unsigned long int *time_lb); +void insert_tree_node_m_hybridpqueue_workstealing(float *paa, isax_node *node, isax_index *index, float bsf, + pqueue_t **pq, pthread_mutex_t *lock_queue, localStack* workstack, int *tnumber); void pushbottom(localStack *stk, isax_node *node); isax_node* poptop(localStack *stk); isax_node* popbottom(localStack *stk); diff --git a/include/ads/parallel_query_engine.h b/include/ads/parallel_query_engine.h index 016571d9..3baa28c4 100644 --- a/include/ads/parallel_query_engine.h +++ b/include/ads/parallel_query_engine.h @@ -7,99 +7,98 @@ #include "pqueue.h" #include "inmemory_index_engine.h" void isax_query_binary_file_para(const char *ifilename, int q_num, - isax_index *index, float minimum_distance, - int min_checked_leaves, - query_result (*search_function)(ts_type*, ts_type*, isax_index*, float, int)); -query_result exact_search_serial_para(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, pthread_mutex_t *lock_index); + isax_index *index, float minimum_distance, + int min_checked_leaves, + query_result (*search_function)(ts_type*, ts_type*, isax_index*, float, int)); +query_result exact_search_serial_para(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, + int min_checked_leaves, pthread_mutex_t *lock_index); query_result exact_search_serial_ParIS(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); query_result exact_search_serial_ParISnonsort(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); query_result exact_search_serial_ParIS_nb(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); pqueue_bsf exact_topk_serial_ParIS(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, int k); -//query_result exact_search_serial_new(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); -query_result exact_search_m (ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); +query_result exact_search_m(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves); query_result refine_answer_m(ts_type *ts, ts_type *paa, isax_index *index, - query_result *approximate_bsf_result, - float minimum_distance, int limit); + query_result *approximate_bsf_result, + float minimum_distance, int limit); void* exact_search_fonction(void *rfdata); void* refind_answer_fonction(void *rfdata); void* mindistance_worker(void *essdata); void* mindistanceinsert_worker(void *essdata); -//void* mindistance_worker_paradsplus2(void *essdata); void* ParIS_nb_worker(void *essdata); void* read_worker(void *read_pointer); void* topk_read_worker(void *read_pointer); void* para_queries_worker(void *transvector); -//void* readworker_paradsplus2(void *read_pointer); -typedef struct refind_answer_fonction_data -{ - isax_node *current_root_node; - ts_type *paa,*ts; - pqueue_t *pq; - isax_index *index; - float minimum_distance; - int limit; - pthread_mutex_t *lock_current_root_node; - pthread_mutex_t *lock_queue; - pthread_barrier_t *lock_barrier; - pthread_rwlock_t *lock_bsf; - query_result *bsf_result; - int node_counter; - isax_node **nodelist; - int amountnode; - bool lockvalueq; - bool lockvaluebsf; -}refind_answer_fonction_data; +typedef struct refind_answer_fonction_data { + isax_node *current_root_node; + ts_type *paa; + ts_type *ts; + pqueue_t *pq; + isax_index *index; + float minimum_distance; + int limit; + pthread_mutex_t *lock_current_root_node; + pthread_mutex_t *lock_queue; + pthread_barrier_t *lock_barrier; + pthread_rwlock_t *lock_bsf; + query_result *bsf_result; + int node_counter; + isax_node **nodelist; + int amountnode; + bool lockvalueq; + bool lockvaluebsf; +} refind_answer_fonction_data; +typedef struct ParIS_read_worker_data { + ts_type *ts; + ts_type *tsU; + ts_type *tsL; + isax_index *index; + int warpWind; + float bsf; + float *bsf2; + float *minidisvector; + unsigned long *load_point; + int *ts_number; + unsigned long start_number; + unsigned long stop_number; + unsigned long *counter; + unsigned long sum_of_lab; + pthread_rwlock_t *lock_bsf; + float* rawfile; + pqueue_bsf* pq_bsf; +} ParIS_read_worker_data; -typedef struct ParIS_read_worker_data -{ - ts_type *ts,*tsU,*tsL; - isax_index *index; - int warpWind; - float bsf; - float *bsf2; - float *minidisvector; - unsigned long *load_point; - int *ts_number; - unsigned long start_number; - unsigned long stop_number; - unsigned long *counter; - unsigned long sum_of_lab; - pthread_rwlock_t *lock_bsf; - float* rawfile; - pqueue_bsf* pq_bsf; +typedef struct ParIS_LDCW_data { + unsigned long start_number; + unsigned long stop_number; + ts_type *paa; + ts_type *paaU; + ts_type *paaL; + ts_type *ts; + isax_index *index; + float bsfdistance; + pthread_rwlock_t *lock_bsf; + unsigned long *label_number; + unsigned long *currentpositioncounter; + int* ts_number; + float* minidisvector; + int sum_of_lab; + float* rawfile; + unsigned long read_time_conter; +} ParIS_LDCW_data; -}ParIS_read_worker_data; +typedef struct paraquery { + ts_type *ts; + ts_type *paa; + isax_index *index; + float minimum_distance; + int min_checked_leaves; + pthread_mutex_t *lock_index; +} paraquery; -typedef struct ParIS_LDCW_data -{ - unsigned long start_number; - unsigned long stop_number; - ts_type *paa,*paaU,*paaL; - ts_type *ts; - isax_index *index; - float bsfdistance; - pthread_rwlock_t *lock_bsf; - unsigned long *label_number,*currentpositioncounter; - int* ts_number; - float* minidisvector; - int sum_of_lab; - float* rawfile; - unsigned long read_time_conter; -}ParIS_LDCW_data; -typedef struct paraquery -{ - ts_type *ts; - ts_type *paa; - isax_index *index; - float minimum_distance; - int min_checked_leaves; - pthread_mutex_t *lock_index; - -}paraquery; int maxquerythread; int maxreadthread; int bf; -#endif \ No newline at end of file +#endif diff --git a/include/ads/sax/sax.h b/include/ads/sax/sax.h index d34eda96..f249ae99 100644 --- a/include/ads/sax/sax.h +++ b/include/ads/sax/sax.h @@ -11,64 +11,74 @@ #include "../../../globals.h" #include "ts.h" -enum response sax_from_ts(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, - int segments, int cardinality, int bit_cardinality, int timeseries_size); -enum response sax_from_ts_new(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, - int segments, int cardinality, int bit_cardinality, int timeseries_size); -enum response sax_from_ts_SIMD(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, - int segments, int cardinality, int bit_cardinality); +enum response sax_from_ts(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, + int segments, int cardinality, int bit_cardinality, int timeseries_size); + +enum response sax_from_ts_new(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, + int segments, int cardinality, int bit_cardinality, int timeseries_size); + +enum response sax_from_ts_SIMD(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, + int segments, int cardinality, int bit_cardinality); + void sax_print(sax_type *sax, int segments, int cardinality); + void printbin(unsigned long long n, int size); -void serial_printbin (unsigned long long n, int size); + +void serial_printbin(unsigned long long n, int size); + int compare(const void *a, const void *b); + float minidist_paa_to_isax(float *paa, sax_type *sax, sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, int max_val, float ratio_sqrt); - -float minidist_paa_to_isax_SIMD(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt); + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, int max_val, float ratio_sqrt); + +float minidist_paa_to_isax_SIMD(float *paa, sax_type *sax, + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt); + float minidist_paa_to_isax_raw(float *paa, sax_type *sax, sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, int max_val, float ratio_sqrt); -float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt); -float minidist_paa_to_isax_rawa_SIMD(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt); -float minidist_paa_to_isax_raw_e_SIMD(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt, - float bsf); - -enum response paa_from_ts (ts_type *ts_in, ts_type *paa_out, int segments, - int ts_values_per_segment, int timeseries_size); -enum response sax_from_paa (ts_type *paa, sax_type *sax, int segments, - int cardinality, int bit_cardinality); -//float* bsearchsimdpaa(float paaseg, float* sax_breakpoints, int candinalityoffset); + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, int max_val, float ratio_sqrt); + +float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt); + +float minidist_paa_to_isax_rawa_SIMD(float *paa, sax_type *sax, + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt); + +float minidist_paa_to_isax_rawa_SIMD512(float *paa, sax_type *sax, + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt); + +enum response paa_from_ts(ts_type *ts_in, ts_type *paa_out, int segments, + int ts_values_per_segment, int timeseries_size); + +enum response sax_from_paa(ts_type *paa, sax_type *sax, int segments, + int cardinality, int bit_cardinality); #endif diff --git a/include/ads/sax/ts.h b/include/ads/sax/ts.h index ef81bc49..c9088d05 100644 --- a/include/ads/sax/ts.h +++ b/include/ads/sax/ts.h @@ -10,13 +10,17 @@ #include "../../../config.h" #include "../../../globals.h" void ts_parse_str(char ts_str[], ts_type *ts_out, int ts_size, const char * delims); + void ts_print(ts_type *ts, int size); float ts_euclidean_distance_dot_product(ts_type *X, ts_type *Y, int size); + float ts_euclidean_distance_dot_product_SIMD(float *X, float *Y, int size); float ts_euclidean_distance(ts_type * t, ts_type * s, int size, float bound); + float ts_euclidean_distance_SIMD(ts_type * t, ts_type * s, int size, float bound); +float ts_euclidean_distance_SIMD512DQ(ts_type * t, ts_type * s, int size, float bound); float ts_ed(ts_type * t, ts_type * s, int size, float bound, char is_simd, char is_norm); #endif diff --git a/include/ads/sfa/dft.h b/include/ads/sfa/dft.h old mode 100755 new mode 100644 index 1e62af33..048eaafc --- a/include/ads/sfa/dft.h +++ b/include/ads/sfa/dft.h @@ -13,8 +13,14 @@ #include #include +int transform_vec_SIMD512F(ts_type norm_factor, int i, int coeff_number, ts_type *transform); + void fft_from_ts(isax_index *index, ts_type *ts, int coeff_number, int best_only, fftwf_complex *ts_out, ts_type *transform, fftwf_plan plan_forward); + void sfa_from_fft(isax_index *index, ts_type * cur_transform, unsigned char * cur_sfa_word); +void sfa_from_fft_SIMD(isax_index *index, ts_type * cur_transform, unsigned char * cur_sfa_word); +void sfa_from_fft_SIMD512_256b(isax_index *index, ts_type *cur_transform, unsigned char *cur_sfa_word); +void sfa_from_fft_SIMD512_512b(isax_index *index, ts_type *cur_transform, unsigned char *cur_sfa_word); enum response sfa_from_ts(isax_index *index, ts_type *ts_in, sax_type *sax_out, fftwf_complex *ts_out, ts_type *transform, fftwf_plan plan_forward); diff --git a/include/ads/sfa/sfa.h b/include/ads/sfa/sfa.h index c5ca5b1a..23a54f1a 100644 --- a/include/ads/sfa/sfa.h +++ b/include/ads/sfa/sfa.h @@ -15,9 +15,12 @@ enum response sfa_bins_init(isax_index *index); void sfa_free_bins(isax_index *index); + void sfa_set_bins(isax_index *index, const char *ifilename, long int ts_num, int maxquerythread, int filetype_int, int apply_znorm); ts_type** calculate_variance_coeff(isax_index *index, ts_type ** dft_mem_array); +ts_type** calculate_variance_coeff_SIMD(isax_index *index, ts_type ** dft_mem_array); +ts_type** calculate_variance_coeff_SIMD512F(isax_index *index, ts_type ** dft_mem_array); void* set_bins_worker_dft(void *transferdata); void* order_divide_worker(void *transferdata); @@ -26,15 +29,14 @@ void sfa_print_bins(isax_index *index); void free_dft_memory(isax_index *index, int coeff_number, ts_type **dft_mem_array); -int compare_ts_type (const void * a, const void * b); -int compare_var (const void *a, const void *b); -int compare_int (const void *a, const void *b); +int compare_ts_type(const void * a, const void * b); +int compare_var(const void *a, const void *b); +int compare_int(const void *a, const void *b); ts_type minidist_fft_to_sfa(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf); ts_type minidist_fft_to_sfa_raw(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf); -ts_type minidist_fft_to_sfa_raw_SIMD(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf); -ts_type minidist_fft_to_sfa_rawa_SIMD(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf); ts_type minidist_fft_to_sfa_rawe_SIMD(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf); +ts_type minidist_fft_to_sfa_rawe_SIMD512(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf); ts_type get_lb_distance(const ts_type *bins, const float fft, const sax_type v, const sax_type c_c, sax_type c_m, int max_cardinality, float factor); @@ -44,30 +46,28 @@ void sfa_printbin(unsigned long long n, int size); void fft_print(ts_type *fft, int segments); -void sfa_print(sax_type *sax,int segments, int cardinality); +void sfa_print(sax_type *sax, int segments, int cardinality); -typedef struct bins_data_inmemory -{ - isax_index *index; - long int start_number,stop_number; - ts_type ** dft_mem_array; +typedef struct bins_data_inmemory { + isax_index *index; + long int start_number; + long int stop_number; + ts_type ** dft_mem_array; const char *filename; - int workernumber; - long int records; - long int records_offset; - ts_type * ts; - fftwf_complex *ts_out; - fftwf_plan plan_forward; - ts_type * transform; + int workernumber; + long int records; + long int records_offset; + ts_type * ts; + fftwf_complex *ts_out; + fftwf_plan plan_forward; + ts_type * transform; int filetype_int; int apply_znorm; -}bins_data_inmemory; - -typedef struct variance_coeff_index -{ - double variance; - int coeff_index; -}variance_coeff_index; +} bins_data_inmemory; +typedef struct variance_coeff_index { + double variance; + int coeff_index; +} variance_coeff_index; #endif diff --git a/install-sh b/install-sh old mode 100755 new mode 100644 diff --git a/main/hooks/applypatch-msg.sample b/main/hooks/applypatch-msg.sample old mode 100755 new mode 100644 diff --git a/main/hooks/commit-msg.sample b/main/hooks/commit-msg.sample old mode 100755 new mode 100644 diff --git a/main/hooks/fsmonitor-watchman.sample b/main/hooks/fsmonitor-watchman.sample old mode 100755 new mode 100644 diff --git a/main/hooks/post-update.sample b/main/hooks/post-update.sample old mode 100755 new mode 100644 diff --git a/main/hooks/pre-applypatch.sample b/main/hooks/pre-applypatch.sample old mode 100755 new mode 100644 diff --git a/main/hooks/pre-commit.sample b/main/hooks/pre-commit.sample old mode 100755 new mode 100644 diff --git a/main/hooks/pre-push.sample b/main/hooks/pre-push.sample old mode 100755 new mode 100644 diff --git a/main/hooks/pre-rebase.sample b/main/hooks/pre-rebase.sample old mode 100755 new mode 100644 diff --git a/main/hooks/pre-receive.sample b/main/hooks/pre-receive.sample old mode 100755 new mode 100644 diff --git a/main/hooks/prepare-commit-msg.sample b/main/hooks/prepare-commit-msg.sample old mode 100755 new mode 100644 diff --git a/main/hooks/update.sample b/main/hooks/update.sample old mode 100755 new mode 100644 diff --git a/missing b/missing old mode 100755 new mode 100644 diff --git a/notebooks/TLB_Logs/.DS_Store b/notebooks/TLB_Logs/.DS_Store index 3a7f5215..547a054c 100644 Binary files a/notebooks/TLB_Logs/.DS_Store and b/notebooks/TLB_Logs/.DS_Store differ diff --git a/notebooks/logs/rename.sh b/notebooks/logs/rename.sh old mode 100755 new mode 100644 diff --git a/notebooks/queries/SALD_queries.bin b/notebooks/queries/SALD_queries.bin old mode 100755 new mode 100644 diff --git a/notebooks/queries/SCEDC_queries.bin b/notebooks/queries/SCEDC_queries.bin old mode 100755 new mode 100644 diff --git a/notebooks/queries/astro_queries.bin b/notebooks/queries/astro_queries.bin old mode 100755 new mode 100644 diff --git a/notebooks/queries/deep1b_queries.bin b/notebooks/queries/deep1b_queries.bin old mode 100755 new mode 100644 diff --git a/notebooks/queries/sift1b_queries.bin b/notebooks/queries/sift1b_queries.bin old mode 100755 new mode 100644 diff --git a/scripts/copy_files.sh b/scripts/copy_files.sh old mode 100755 new mode 100644 diff --git a/scripts/high_frequency/run_astro.sh b/scripts/high_frequency/run_astro.sh old mode 100755 new mode 100644 diff --git a/scripts/high_frequency/run_bigann_norm.sh b/scripts/high_frequency/run_bigann_norm.sh old mode 100755 new mode 100644 diff --git a/scripts/high_frequency/run_deep1b.sh b/scripts/high_frequency/run_deep1b.sh old mode 100755 new mode 100644 diff --git a/scripts/high_frequency/run_sald.sh b/scripts/high_frequency/run_sald.sh old mode 100755 new mode 100644 diff --git a/scripts/high_frequency/run_scedc.sh b/scripts/high_frequency/run_scedc.sh old mode 100755 new mode 100644 diff --git a/scripts/high_frequency/run_seisbench.sh b/scripts/high_frequency/run_seisbench.sh old mode 100755 new mode 100644 diff --git a/scripts/high_frequency/run_sift1b.sh b/scripts/high_frequency/run_sift1b.sh old mode 100755 new mode 100644 diff --git a/scripts/knns/run_astro_knns.sh b/scripts/knns/run_astro_knns.sh old mode 100755 new mode 100644 diff --git a/scripts/knns/run_bigann_norm_knns.sh b/scripts/knns/run_bigann_norm_knns.sh old mode 100755 new mode 100644 diff --git a/scripts/knns/run_deep1b_knns.sh b/scripts/knns/run_deep1b_knns.sh old mode 100755 new mode 100644 diff --git a/scripts/knns/run_sald_knns.sh b/scripts/knns/run_sald_knns.sh old mode 100755 new mode 100644 diff --git a/scripts/knns/run_scedc_knns.sh b/scripts/knns/run_scedc_knns.sh old mode 100755 new mode 100644 diff --git a/scripts/knns/run_seisbench_knns.sh b/scripts/knns/run_seisbench_knns.sh old mode 100755 new mode 100644 diff --git a/scripts/knns/run_sift1b_knns.sh b/scripts/knns/run_sift1b_knns.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_SimSearchNet_norm.sh b/scripts/old/run_SimSearchNet_norm.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_all.sh b/scripts/old/run_all.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_benchmark_generated_queries.sh b/scripts/old/run_benchmark_generated_queries.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_benchmark_other_queries.sh b/scripts/old/run_benchmark_other_queries.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_benchmark_vector_data.sh b/scripts/old/run_benchmark_vector_data.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_bigann.sh b/scripts/old/run_bigann.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_sald001.sh b/scripts/old/run_sald001.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_sald_new_all_queries.sh b/scripts/old/run_sald_new_all_queries.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_sald_new_workloads.sh b/scripts/old/run_sald_new_workloads.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_sald_sonic.sh b/scripts/old/run_sald_sonic.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_seisbench.sh b/scripts/old/run_seisbench.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_seismic.sh b/scripts/old/run_seismic.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_seismic001.sh b/scripts/old/run_seismic001.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_seismic_new_all_queries.sh b/scripts/old/run_seismic_new_all_queries.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_seismic_new_old.sh b/scripts/old/run_seismic_new_old.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_seismic_new_workloads.sh b/scripts/old/run_seismic_new_workloads.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_seismic_old.sh b/scripts/old/run_seismic_old.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_spaceV1B.sh b/scripts/old/run_spaceV1B.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_spaceV1B_norm.sh b/scripts/old/run_spaceV1B_norm.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_text_to_image.sh b/scripts/old/run_text_to_image.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_text_to_image_norm.sh b/scripts/old/run_text_to_image_norm.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_turingANNs.sh b/scripts/old/run_turingANNs.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_turingANNs_norm.sh b/scripts/old/run_turingANNs_norm.sh old mode 100755 new mode 100644 diff --git a/scripts/old/run_workloads.sh b/scripts/old/run_workloads.sh old mode 100755 new mode 100644 diff --git a/scripts/run_astro.sh b/scripts/run_astro.sh old mode 100755 new mode 100644 diff --git a/scripts/run_benchmark.sh b/scripts/run_benchmark.sh old mode 100755 new mode 100644 diff --git a/scripts/run_benchmark_knn.sh b/scripts/run_benchmark_knn.sh old mode 100755 new mode 100644 diff --git a/scripts/run_benchmark_sampling.sh b/scripts/run_benchmark_sampling.sh old mode 100755 new mode 100644 diff --git a/scripts/run_benchmark_seisbench.sh b/scripts/run_benchmark_seisbench.sh old mode 100755 new mode 100644 diff --git a/scripts/run_benchmark_single_query.sh b/scripts/run_benchmark_single_query.sh old mode 100755 new mode 100644 diff --git a/scripts/run_bigann_norm.sh b/scripts/run_bigann_norm.sh old mode 100755 new mode 100644 diff --git a/scripts/run_cleanup.sh b/scripts/run_cleanup.sh old mode 100755 new mode 100644 diff --git a/scripts/run_deep1b.sh b/scripts/run_deep1b.sh old mode 100755 new mode 100644 diff --git a/scripts/run_sald.sh b/scripts/run_sald.sh old mode 100755 new mode 100644 diff --git a/scripts/run_scedc.sh b/scripts/run_scedc.sh old mode 100755 new mode 100644 diff --git a/scripts/run_seisbench.sh b/scripts/run_seisbench.sh old mode 100755 new mode 100644 diff --git a/scripts/run_sift1b.sh b/scripts/run_sift1b.sh old mode 100755 new mode 100644 diff --git a/scripts/sampling_strategy/run_astro.sh b/scripts/sampling_strategy/run_astro.sh old mode 100755 new mode 100644 diff --git a/scripts/sampling_strategy/run_bigann_norm.sh b/scripts/sampling_strategy/run_bigann_norm.sh old mode 100755 new mode 100644 diff --git a/scripts/sampling_strategy/run_deep1b.sh b/scripts/sampling_strategy/run_deep1b.sh old mode 100755 new mode 100644 diff --git a/scripts/sampling_strategy/run_sald.sh b/scripts/sampling_strategy/run_sald.sh old mode 100755 new mode 100644 diff --git a/scripts/sampling_strategy/run_scedc.sh b/scripts/sampling_strategy/run_scedc.sh old mode 100755 new mode 100644 diff --git a/scripts/sampling_strategy/run_seisbench.sh b/scripts/sampling_strategy/run_seisbench.sh old mode 100755 new mode 100644 diff --git a/scripts/sampling_strategy/run_sift1b.sh b/scripts/sampling_strategy/run_sift1b.sh old mode 100755 new mode 100644 diff --git a/src/ads/DTWfunction.c b/src/ads/DTWfunction.c index ba0049a5..29f40da9 100644 --- a/src/ads/DTWfunction.c +++ b/src/ads/DTWfunction.c @@ -1,13 +1,13 @@ -#include "../../config.h" -#include "../../globals.h" #include #include #include #include "immintrin.h" #ifdef VALUES - #include +#include #endif +#include "../../config.h" +#include "../../globals.h" #include "ads/sax/sax.h" #include "ads/sax/ts.h" @@ -15,377 +15,312 @@ #include "ads/isax_index.h" #include "ads/inmemory_index_engine.h" #include "ads/DTWfunction.h" -#define max(x,y) ((x)>(y)?(x):(y)) -#define dist(x,y) ((x-y)*(x-y)) -void init(deque *d, int capacity) -{ +#define max(x, y) ((x) > (y) ? (x) : (y)) +#define dist(x, y) ((x - y) * (x - y)) + +#ifndef MAXFLOAT +#define MAXFLOAT FLT_MAX +#endif + +void init(deque *d, int capacity) { d->capacity = capacity; d->size = 0; - d->dq = (int *) malloc(sizeof(int)*d->capacity); + d->dq = (int *)malloc(sizeof(int) * d->capacity); d->f = 0; - d->r = d->capacity-1; + d->r = d->capacity - 1; } /// Insert to the queue at the back -void push_back(struct deque *d, int v) -{ +void push_back(struct deque *d, int v) { d->dq[d->r] = v; d->r--; - if (d->r < 0) - d->r = d->capacity-1; + + if (d->r < 0) { + d->r = d->capacity - 1; + } + d->size++; } /// Delete the current (front) element from queue -void pop_front(struct deque *d) -{ +void pop_front(struct deque *d) { d->f--; - if (d->f < 0) - d->f = d->capacity-1; + + if (d->f < 0) { + d->f = d->capacity - 1; + } + d->size--; } /// Delete the last element from queue -void pop_back(struct deque *d) -{ - d->r = (d->r+1)%d->capacity; +void pop_back(struct deque *d) { + d->r = (d->r + 1) % d->capacity; d->size--; } /// Get the value at the current position of the circular queue -int front(struct deque *d) -{ +int front(struct deque *d) { int aux = d->f - 1; - if (aux < 0) - aux = d->capacity-1; + if (aux < 0) { + aux = d->capacity - 1; + } + return d->dq[aux]; } /// Get the value at the last position of the circular queueint back(struct deque *d) -int back(struct deque *d) -{ - int aux = (d->r+1)%d->capacity; +int back(struct deque *d) { + int aux = (d->r + 1) % d->capacity; + return d->dq[aux]; } /// Check whether or not the queue is empty -int empty(struct deque *d) -{ +int empty(struct deque *d) { return d->size == 0; } - /// Destroy the queue -void destroy(deque *d) -{ +void destroy(deque *d) { free(d->dq); } +void lower_upper_lemire(float *t, int len, int r, float *l, float *u) { + struct deque du; + struct deque dl; - -void lower_upper_lemire(float *t, int len, int r, float *l, float *u) -{ - struct deque du, dl; - - init(&du, 2*r+2); - init(&dl, 2*r+2); + init(&du, 2 * r + 2); + init(&dl, 2 * r + 2); push_back(&du, 0); push_back(&dl, 0); - int i; - - for (i = 1; i < len; i++) - { - if (i > r) - { - u[i-r-1] = t[front(&du)]; - l[i-r-1] = t[front(&dl)]; + int count; + + for (count = 1; count < len; count++) { + if (count > r) { + u[count - r - 1] = t[front(&du)]; + l[count - r - 1] = t[front(&dl)]; } - if (t[i] > t[i-1]) - { + + if (t[count] > t[count - 1]) { pop_back(&du); - while (!empty(&du) && t[i] > t[back(&du)]) + + while (!empty(&du) && t[count] > t[back(&du)]) { pop_back(&du); - } - else - { + } + } else { pop_back(&dl); - while (!empty(&dl) && t[i] < t[back(&dl)]) + + while (!empty(&dl) && t[count] < t[back(&dl)]) { pop_back(&dl); + } } - push_back(&du, i); - push_back(&dl, i); - if (i == 2 * r + 1 + front(&du)) + + push_back(&du, count); + push_back(&dl, count); + + if (count == 2 * r + 1 + front(&du)) { pop_front(&du); - else if (i == 2 * r + 1 + front(&dl)) + } else if (count == 2 * r + 1 + front(&dl)) { pop_front(&dl); + } } - for (i= len; i < len+r+1; i++) - { - u[i-r-1] = t[front(&du)]; - l[i-r-1] = t[front(&dl)]; - if (i-front(&du) >= 2 * r + 1) + + for (count = len; count < len + r + 1; count++) { + u[count - r - 1] = t[front(&du)]; + l[count - r - 1] = t[front(&dl)]; + + if (count - front(&du) >= 2 * r + 1) { pop_front(&du); - if (i-front(&dl) >= 2 * r + 1) + } + + if (count - front(&dl) >= 2 * r + 1) { pop_front(&dl); + } } + destroy(&du); destroy(&dl); - - } - - - -float minidist_paa_to_isax_DTW(float *paaU, float *paaL , sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt) -{ - +float minidist_paa_to_isax_DTW(float *paaU, float *paaL , sax_type *sax, + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt) { float distance = 0; - // TODO: Store offset in index settings. and pass index settings as parameter. - + // TODO(somein): Store offset in index settings. and pass index settings as parameter. + int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; - - // For each sax record find the break point - int i; - for (i=0; i paaU[i]) { - distance += pow(breakpoint_lower - paaU[i], 2); - } - else if(breakpoint_upper < paaL[i]) { - distance += pow(breakpoint_upper - paaL[i], 2); + + if (breakpoint_lower > paaU[count]) { + distance += pow(breakpoint_lower - paaU[count], 2); + } else if (breakpoint_upper < paaL[count]) { + distance += pow(breakpoint_upper - paaL[count], 2); } - // else { - // printf("%lf is between: %lf and %lf\n", paa[i], breakpoint_lower, breakpoint_upper); - // } } - - //distance = ratio_sqrt * sqrtf(distance); + distance = ratio_sqrt * distance; + return distance; } - - -float minidist_paa_to_isax_raw_DTW(float *paaU, float *paaL , sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt) -{ - +float minidist_paa_to_isax_raw_DTW(float *paaU, float *paaL , sax_type *sax, + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt) { float distance = 0; - // TODO: Store offset in index settings. and pass index settings as parameter. - + // TODO(someone): Store offset in index settings. and pass index settings as parameter. + int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; // For each sax record find the break point - int i; - for (i=0; i> (c_m - c_c)) << (c_m - c_c);//shift operation + sax_type region_lower = (v >> (c_m - c_c)) << (c_m - c_c); // shift operation sax_type region_upper = (~((int)MAXFLOAT << (c_m - c_c)) | region_lower); - //printf("[%d, %d] %d -- %d\n", sax[i], c_c, region_lower, region_upper); - float breakpoint_lower = 0; // <-- TODO: calculate breakpoints. - float breakpoint_upper = 0; // <-- - || - - - + float breakpoint_lower = 0; // <-- TODO(someone): calculate breakpoints. + float breakpoint_upper = 0; // <-- - || - + if (region_lower == 0) { - breakpoint_lower = min_val; - } - else - { + breakpoint_lower = (float)min_val; + } else { breakpoint_lower = sax_breakpoints[offset + region_lower - 1]; } + if (region_upper == max_cardinality - 1) { - breakpoint_upper = max_val; - } - else - { - breakpoint_upper = sax_breakpoints[offset + region_upper];//search in a list(why?) + breakpoint_upper = (float)max_val; + } else { + breakpoint_upper = sax_breakpoints[offset + region_upper]; // search in a list(why?) } - //printf("\n%d.%d is from %d to %d, %lf - %lf\n", v, c_c, region_lower, region_upper, - // breakpoint_lower, breakpoint_upper); - - //printf("FROM: \n"); - //sax_print(®ion_lower, 1, c_m); - //printf("TO: \n"); - //sax_print(®ion_upper, 1, c_m); - - //printf ("\n---------\n"); - - if (breakpoint_lower > paaU[i] ) { + if (breakpoint_lower > paaU[i]) { distance += pow(breakpoint_lower - paaU[i], 2); - } - else if(breakpoint_upper < paaL[i]) { + } else if (breakpoint_upper < paaL[i]) { distance += pow(breakpoint_upper - paaL[i], 2); } - - -// else { -// printf("%lf is between: %lf and %lf\n", paa[i], breakpoint_lower, breakpoint_upper); -// } } - - //distance = ratio_sqrt * sqrtf(distance); + distance = ratio_sqrt * distance; + return distance; } - - - void isax_DTWquery_binary_file_traditional(const char *ifilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves,int warpWind) - //)query_result (*search_function)(ts_type*, ts_type*, isax_index*,node_list*, float, int)) -{ + float minimum_distance, int min_checked_leaves, int warpWind) { fprintf(stderr, ">>> Performing queries in file: %s\n", ifilename); FILE * ifile; - ifile = fopen (ifilename,"rb"); + ifile = fopen(ifilename, "rb"); + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } fseek(ifile, 0L, SEEK_END); - file_position_type sz = (file_position_type) ftell(ifile); - file_position_type total_records = sz/index->settings->ts_byte_size; + file_position_type sz = (file_position_type)ftell(ifile); + file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } - int q_loaded = 0; - ts_type * ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type * paa = malloc(sizeof(ts_type) * index->settings->paa_segments); - //sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - ts_type * paaUpperLemQuery = malloc(sizeof(ts_type) * index->settings->paa_segments); - ts_type * paaLowerLemQuery = malloc(sizeof(ts_type) * index->settings->paa_segments); - - ts_type * upperLemire = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type * lowerLemire = malloc(sizeof(ts_type) * index->settings->timeseries_size); - + int q_loaded = 0; + ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments); + ts_type *paaUpperLemQuery = malloc(sizeof(ts_type) * index->settings->paa_segments); + ts_type *paaLowerLemQuery = malloc(sizeof(ts_type) * index->settings->paa_segments); + + ts_type *upperLemire = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *lowerLemire = malloc(sizeof(ts_type) * index->settings->timeseries_size); node_list nodelist; - nodelist.nlist=malloc(sizeof(isax_node*)*pow(2, index->settings->paa_segments)); - nodelist.node_amount=0; + nodelist.nlist = malloc(sizeof(isax_node*) * pow(2, index->settings->paa_segments)); + nodelist.node_amount = 0; isax_node *current_root_node = index->first_node; - while(1) - { - if (current_root_node!=NULL) - { - nodelist.nlist[nodelist.node_amount]=current_root_node; - current_root_node=current_root_node->next; + + while (1) { + if (current_root_node != NULL) { + nodelist.nlist[nodelist.node_amount] = current_root_node; + current_root_node = current_root_node->next; nodelist.node_amount++; - } - else - { + } else { break; } - } - //printf("the node node_amount is %d\n",nodelist.node_amount ); - - while (q_loaded < q_num) - { + + while (q_loaded < q_num) { COUNT_INPUT_TIME_START - fread(ts, sizeof(ts_type),index->settings->timeseries_size,ifile); + fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END - lower_upper_lemire(ts,index->settings->timeseries_size,warpWind,lowerLemire,upperLemire); - - - paa_from_ts(upperLemire, paaUpperLemQuery, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); - paa_from_ts(lowerLemire, paaLowerLemQuery, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); - + lower_upper_lemire(ts, index->settings->timeseries_size, warpWind, lowerLemire, upperLemire); + paa_from_ts(upperLemire, paaUpperLemQuery, index->settings->paa_segments, + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); + paa_from_ts(lowerLemire, paaLowerLemQuery, index->settings->paa_segments, + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); - //printf("Querying for: %d\n", index->settings->ts_byte_size * q_loaded); // Parse ts and make PAA representation paa_from_ts(ts, paa, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); COUNT_TOTAL_TIME_START - query_result result = exact_DTW_serial_ParIS_inmemory(ts, paa,paaUpperLemQuery,paaLowerLemQuery, index, minimum_distance, min_checked_leaves,warpWind); - - //query_result result = exact_DTW_serial_ParIS_openmp_inmemory(ts, paa,paaUpperLemQuery,paaLowerLemQuery, index, minimum_distance, min_checked_leaves,warpWind); - // query_result result = exact_DTW_MESSI_inmemory_hybrid(ts, paa,paaUpperLemQuery,paaLowerLemQuery, index,&nodelist, minimum_distance, min_checked_leaves,warpWind); + query_result result = exact_DTW_serial_ParIS_inmemory(ts, paa, paaUpperLemQuery, paaLowerLemQuery, + index, minimum_distance, min_checked_leaves, warpWind); COUNT_TOTAL_TIME_END PRINT_STATS(result.distance) - + fflush(stdout); - #if VERBOSE_LEVEL >= 1 +#if VERBOSE_LEVEL >= 1 printf("[%p]: Distance: %lf\n", result.node, result.distance); - #endif - //sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); - //if (index->settings->timeseries_size * sizeof(ts_type) * q_loaded == 1024) { - // sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); - //} - +#endif q_loaded++; } + free(nodelist.nlist); free(paa); free(ts); @@ -395,586 +330,587 @@ void isax_DTWquery_binary_file_traditional(const char *ifilename, int q_num, isa free(lowerLemire); free(upperLemire); fprintf(stderr, ">>> Finished querying.\n"); - } -float dtw(float* A, float* B,float *cb,int m, int r, float bsf) -{ - +float dtw(float* A, float* B, float *cb, int m, int r, float bsf) { float *cost; float *cost_prev; float *cost_tmp; - int i,j,k; - float x,y,z,min_cost; + int i; + int j; + int k; + float x; + float y; + float z; + float min_cost; /// Instead of using matrix of size O(m^2) or O(mr), we will reuse two array of size O(r). - cost = (float*)malloc(sizeof(float)*(2*r+1)); - for(k=0; k<2*r+1; k++) cost[k]=FLT_MAX; + cost = (float*)malloc(sizeof(float) * (2 * r + 1)); - cost_prev = (float*)malloc(sizeof(float)*(2*r+1)); - for(k=0; k<2*r+1; k++) cost_prev[k]=FLT_MAX; + for (k = 0; k < 2 * r + 1; k++) { + cost[k] = FLT_MAX; + } + + cost_prev = (float*)malloc(sizeof(float) * (2 * r + 1)); + + for (k = 0; k < 2 * r + 1; k++) { + cost_prev[k] = FLT_MAX; + } - for (i=0; i2*r)) x = FLT_MAX; - else x = cost_prev[k+1]; - if ((i-1<0)||(j-1<0)) z = FLT_MAX; - else z = cost_prev[k]; + if ((j - 1 < 0) || (k - 1 < 0)) { + y = FLT_MAX; + } else { + y = cost[k - 1]; + } + + if ((i - 1 < 0) || (k + 1 > 2 * r)) { + x = FLT_MAX; + } else { + x = cost_prev[k + 1]; + } + + if ((i - 1 < 0) || (j - 1 < 0)) { + z = FLT_MAX; + } else { + z = cost_prev[k]; + } /// Classic DTW calculation - cost[k] = min( min( x, y) , z) + dist(A[i],B[j]); + cost[k] = min(min(x, y), z) + dist(A[i], B[j]); /// Find minimum cost in row for early abandoning (possibly to use column instead of row). - if (cost[k] < min_cost) - { min_cost = cost[k]; + if (cost[k] < min_cost) { + min_cost = cost[k]; } } /// We can abandon early if the current cummulative distace with lower bound together are larger than bsf - if (i+r < m-1 && min_cost + cb[i+r+1] >= bsf) - { free(cost); + if (i + r < m - 1 && min_cost + cb[i + r + 1] >= bsf) { + free(cost); free(cost_prev); - return min_cost + cb[i+r+1]; + + return min_cost + cb[i + r + 1]; } + /// Move current array to previous array. cost_tmp = cost; cost = cost_prev; cost_prev = cost_tmp; } + k--; /// the DTW distance is in the last cell in the matrix of size O(m^2) or at the middle of our array. float final_dtw = cost_prev[k]; + free(cost); free(cost_prev); + return final_dtw; } -float dtwsimd(float* A, float* B, float *cb, int m, int r, float bsf, float* tSum, float* pCost, float* rDist) -{ - int length = 2*r + 1; - int start, end, k, ij, i; - float minCost = 0.0f; - for(k=0; k<=r; k++) - { - rDist[k] = dist(A[0],B[k]); - } - tSum[0] = rDist[0]; - for(ij=1; ij<=r; ij++) - { - tSum[ij] = tSum[ij-1] + rDist[ij]; - } - pCost[0] = tSum[0]; - for(ij=1; ij<=r; ij++) - pCost[ij] = min(tSum[ij-1],tSum[ij]); - pCost[r+1] = tSum[r]; - - for(i=1; i= bsf) - { - return minCost + cb[i+r+1]; - } - if((end-start+1)= bsf) - { - return minCost + cb[i+r+1]; - } - - if((end-start+1) < length && start == 0) - { - pCost[start-start] = tSum[start-start]; - for(int ij= start+1; ij<=end; ij++) - { - pCost[ij-start] = min(tSum[ij-1-start],tSum[ij-start]); - } - pCost[end+1-start] = tSum[end-start]; - } - else - { - for(int ij= start+1; ij<=end; ij++) - { - pCost[ij-1-start] = min(tSum[ij-1-start],tSum[ij-start]); - } - pCost[end-start] = tSum[end-start]; - } - } - - // the last line - start = m-1-r; - end = m-1; - - for(int k=start; k<=end; k++) - { - rDist[k-start] = (A[m-1]-B[k])*(A[m-1]-B[k]); - } - - for(int k=start; k<=end; k++) - { - tSum[k-start] = pCost[k-start] + rDist[k-start]; - } - for(int k=start+1; k<=end; k++) - { - if(tSum[k-1-start]= bsf) { + return minCost + cb[i+r+1]; + } + + if ((end - start + 1) < length && start == 0) { + pCost[0] = tSum[0]; + + for (ij = start + 1; ij <= end; ij++) { + pCost[ij - start] = min(tSum[ij - 1 - start], tSum[ij - start]); + } + + pCost[end + 1 - start] = tSum[end - start]; + } else { + for (ij = start + 1; ij < end; ij++) { + pCost[ij - 1 - start] = min(tSum[ij - 1 - start], tSum[ij - 1 - start]); + } + + pCost[end - start] = tSum[end - start]; + } + } + + for (k = start; k <= end; k++) { + rDist[k - start] = dist(A[m - 1], B[k]); + tSum[k - start] = pCost[k - start] + rDist[k - start]; + } + + for (k = start + 1; k <= end; k++) { + if (tSum[k - 1 - start] < pCost[k - start]) { + tSum[k - start] = tSum[k - 1 - start] + rDist[k - start]; + } + } + + float ret = tSum[r]; + + return ret; } +float dtwsimdPruned(float* A, float* B, float* cb, int m, int r, float bsf, float* tSum, float* pCost, float* rDist) { + int length = 2 * r + 1; + int start; + int end; + float minCost = 0.0f; + + // the first line + for (int k = 0; k <= r; k++) { + rDist[k] = (A[0] - B[k]) * (A[0] - B[k]); + } + + tSum[0] = rDist[0]; + + for (int ij = 1; ij <= r; ij++) { + tSum[ij] = tSum[ij - 1] + rDist[ij]; + } + + pCost[0] = tSum[0]; + + for (int ij = 1; ij <= r; ij++) { + pCost[ij] = min(tSum[ij - 1], tSum[ij]); + } + + pCost[r + 1] = tSum[r]; + + for (int i = 1; i < m - 1; i++) { + start = max(0, i - r); + end = min(m - 1, i + r); + + for (int k = start; k <= end; k++) { + rDist[k - start] = (A[i] - B[k]) * (A[i] - B[k]); + } + + for (int k = start; k <= end; k++) { + tSum[k - start] = pCost[k - start] + rDist[k - start]; + } + minCost = tSum[0]; + for (int k = start + 1; k <= end; k++) { + if (tSum[k - 1 - start] < pCost[k - start]) { + tSum[k - start] = tSum[k - 1 - start] + rDist[k - start]; + } -query_result exact_DTW_serial_ParIS_openmp_inmemory(ts_type *ts,ts_type *paa, ts_type *paaU, ts_type *paaL,isax_index *index, float minimum_distance, int min_checked_leaves,int warpWind) -{ + if (tSum[k - start] < minCost) { + minCost = tSum[k - start]; + } + } + if (i + r < m - 1 && minCost + cb[i + r + 1] >= bsf) { + return minCost + cb[i + r + 1]; + } + + if ((end - start + 1) < length && start == 0) { + pCost[0] = tSum[0]; + + for (int ij= start + 1; ij <= end; ij++) { + pCost[ij - start] = min(tSum[ij - 1 - start], tSum[ij - start]); + } + + pCost[end + 1 - start] = tSum[end - start]; + } else { + for (int ij = start + 1; ij <= end; ij++) { + pCost[ij - 1 - start] = min(tSum[ij - 1 - start], tSum[ij - start]); + } + + pCost[end - start] = tSum[end - start]; + } + } + + // the last line + start = m - 1 - r; + end = m - 1; + + for (int k = start; k <= end; k++) { + rDist[k - start] = (A[m - 1] - B[k]) * (A[m - 1] - B[k]); + } + + for (int k = start; k <= end; k++) { + tSum[k - start] = pCost[k - start] + rDist[k - start]; + } + + for (int k = start + 1; k <= end; k++) { + if (tSum[k - 1 - start] < pCost[k - start]) { + tSum[k - start] = tSum[k - 1 - start] + rDist[k - start]; + } + } + + float ret = tSum[r]; + + return ret; +} + +query_result exact_DTW_serial_ParIS_openmp_inmemory(ts_type *ts, ts_type *paa, ts_type *paaU, ts_type *paaL, + isax_index *index, float minimum_distance, int min_checked_leaves, int warpWind) { RESET_BYTES_ACCESSED - //LBDcalculationnumber=0; - //RDcalculationnumber=0; pthread_t threadid[maxquerythread]; COUNT_INPUT_TIME_START - query_result approximate_result = approximate_DTW_inmemory_pRecBuf(ts, paa, index,warpWind); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + query_result approximate_result = approximate_DTW_inmemory_pRecBuf(ts, paa, index, warpWind); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; - int sum_of_lab=0; + int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; float bsf_distance; - unsigned long j; - float* cb=(float *)calloc(index->settings->timeseries_size,sizeof(float)); + uint64_t j; + float* cb = (float *)calloc(index->settings->timeseries_size, sizeof(float)); omp_lock_t bsflock; - //omp_init_lock(&bsflock); + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - //approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); - } - - COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); + COUNT_INPUT_TIME_END - #ifdef AUTO_TUNE +#ifdef AUTO_TUNE float *mindists = malloc(sizeof(float) * index->sax_cache_size); - #endif - +#endif + SET_APPROXIMATE(approximate_result.distance); - bsf_distance=approximate_result.distance; + bsf_distance = approximate_result.distance; COUNT_CAL_TIME_START - //LBDcalculationnumber=index->sax_cache_size; - #pragma omp parallel for num_threads(maxquerythread) reduction(min : bsf_distance) - for(unsigned long j=0; jsax_cache_size; j++) { +#pragma omp parallel for num_threads(maxquerythread) reduction(min : bsf_distance) + for (uint64_t j = 0; j < index->sax_cache_size; j++) { sax_type *sax = &index->sax_cache[j * index->settings->paa_segments]; - if(minidist_paa_to_isax_raw_DTW_SIMD(paaU,paaL, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt) <= bsf_distance) { - ts_buffer=&rawfile[j*index->settings->timeseries_size]; - - float dist = dtw(ts, ts_buffer,cb, index->settings->timeseries_size, warpWind, bsf_distance); - //ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf_distance); - //__sync_fetch_and_add(&RDcalculationnumber,1); - if(dist < bsf_distance) { - //omp_set_lock(&bsflock); + + if (minidist_paa_to_isax_raw_DTW_SIMD(paaU, paaL, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= bsf_distance) { + ts_buffer = &rawfile[j * index->settings->timeseries_size]; + + float dist = dtw(ts, ts_buffer, cb, index->settings->timeseries_size, warpWind, bsf_distance); + + if (dist < bsf_distance) { bsf_distance = dist; - //omp_unset_lock(&bsflock); } } } - approximate_result.distance=bsf_distance; + + approximate_result.distance = bsf_distance; COUNT_CAL_TIME_END free(cb); - // printf("the number of LB distance calculation is %ld\t\t and the Real distance calculation is %ld\n ",LBDcalculationnumber,RDcalculationnumber); return approximate_result; } -query_result exact_DTW_serial_ParIS_inmemory(ts_type *ts,ts_type *paa, ts_type *paaU, ts_type *paaL,isax_index *index, float minimum_distance, int min_checked_leaves,int warpWind) -{ +query_result exact_DTW_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, ts_type *paaU, + ts_type *paaL, isax_index *index, float minimum_distance, int min_checked_leaves, int warpWind) { RESET_BYTES_ACCESSED - pthread_t threadid[maxquerythread]; COUNT_INPUT_TIME_START - query_result approximate_result = approximate_DTW_inmemory_pRecBuf(ts, paa, index,warpWind); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + query_result approximate_result = approximate_DTW_inmemory_pRecBuf(ts, paa, index, warpWind); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; - - float *lowerLemire= malloc(sizeof(float)*index->settings->timeseries_size); - float *upperLemire= malloc(sizeof(float)*index->settings->timeseries_size); - lower_upper_lemire(ts,index->settings->timeseries_size,warpWind,lowerLemire,upperLemire); - int sum_of_lab=0; + + float *lowerLemire = (float*)malloc(sizeof(float)*index->settings->timeseries_size); + float *upperLemire = (float*)malloc(sizeof(float)*index->settings->timeseries_size); + lower_upper_lemire(ts, index->settings->timeseries_size, warpWind, lowerLemire, upperLemire); + int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; float bsf_distance; - unsigned long j; + uint64_t j; // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - //approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); - } - + COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); - unsigned long i; + uint64_t i; + +#ifdef AUTO_TUNE + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); +#endif - #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); - #endif - SET_APPROXIMATE(approximate_result.distance); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - ParIS_LDCW_data *essdata=malloc(sizeof(ParIS_LDCW_data)*(maxquerythread)); - pthread_rwlock_t lock_bsf=PTHREAD_RWLOCK_INITIALIZER; - //pthread_mutex_t lock_bsf2=PTHREAD_MUTEX_INITIALIZER; - + ParIS_LDCW_data *essdata = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); + pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; + COUNT_CAL_TIME_START - for (i = 0; i < (maxquerythread-1); i++) - { - essdata[i].index=index; - essdata[i].lock_bsf=&lock_bsf; - essdata[i].start_number=i*(index->sax_cache_size/maxquerythread); - essdata[i].stop_number=(i+1)*(index->sax_cache_size/maxquerythread); - essdata[i].paa=paa; - essdata[i].paaU=paaU; - essdata[i].paaL=paaL; - essdata[i].ts=ts; - essdata[i].bsfdistance=approximate_result.distance; - essdata[i].sum_of_lab=0; + + for (i = 0; i < (maxquerythread - 1); i++) { + essdata[i].index = index; + essdata[i].lock_bsf = &lock_bsf; + essdata[i].start_number = i * (index->sax_cache_size / maxquerythread); + essdata[i].stop_number = (i + 1) * (index->sax_cache_size / maxquerythread); + essdata[i].paa = paa; + essdata[i].paaU = paaU; + essdata[i].paaL = paaL; + essdata[i].ts = ts; + essdata[i].bsfdistance = approximate_result.distance; + essdata[i].sum_of_lab = 0; } - essdata[maxquerythread-1].index=index; - essdata[maxquerythread-1].lock_bsf=&lock_bsf; - essdata[maxquerythread-1].start_number=(maxquerythread-1)*(index->sax_cache_size/maxquerythread); - essdata[maxquerythread-1].stop_number=index->sax_cache_size; - essdata[maxquerythread-1].paa=paa; - essdata[maxquerythread-1].paaU=paaU; - essdata[maxquerythread-1].paaL=paaL; - essdata[maxquerythread-1].ts=ts; - essdata[maxquerythread-1].bsfdistance=approximate_result.distance; - essdata[maxquerythread-1].sum_of_lab=0; - - for(i=0; isax_cache_size / maxquerythread); + essdata[maxquerythread - 1].stop_number = index->sax_cache_size; + essdata[maxquerythread - 1].paa = paa; + essdata[maxquerythread - 1].paaU = paaU; + essdata[maxquerythread - 1].paaL = paaL; + essdata[maxquerythread - 1].ts = ts; + essdata[maxquerythread - 1].bsfdistance = approximate_result.distance; + essdata[maxquerythread - 1].sum_of_lab = 0; + + for (i = 0; i < maxquerythread; i++) { + pthread_create(&(threadid[i]), NULL, mindtwdistance_worker_inmemory, (void*)&(essdata[i])); } - for (i = 0; i < maxquerythread; i++) - { - pthread_join(threadid[i],NULL); - sum_of_lab+=essdata[i].sum_of_lab; + + for (i = 0; i < maxquerythread; i++) { + pthread_join(threadid[i], NULL); + sum_of_lab += essdata[i].sum_of_lab; } + COUNT_CAL_TIME_END - unsigned long* label_number=malloc(sizeof(unsigned long)*(sum_of_lab)); - float* minidisvector=malloc(sizeof(float)*(sum_of_lab)); - sum_of_lab=0; + + uint64_t* label_number = (uint64_t*)malloc(sizeof(uint64_t) * (sum_of_lab)); + float* minidisvector = (float*)malloc(sizeof(float) * (sum_of_lab)); + sum_of_lab = 0; + COUNT_OUTPUT_TIME_START - for (i = 0; i < maxquerythread; i++) - { - memcpy(&(label_number[sum_of_lab]),essdata[i].label_number,sizeof(unsigned long)*essdata[i].sum_of_lab); - memcpy(&(minidisvector[sum_of_lab]),essdata[i].minidisvector,sizeof(float)*essdata[i].sum_of_lab); + + for (i = 0; i < maxquerythread; i++) { + memcpy(&(label_number[sum_of_lab]), essdata[i].label_number, sizeof(uint64_t) * essdata[i].sum_of_lab); + memcpy(&(minidisvector[sum_of_lab]), essdata[i].minidisvector, sizeof(float)*essdata[i].sum_of_lab); free(essdata[i].label_number); free(essdata[i].minidisvector); - sum_of_lab+=essdata[i].sum_of_lab; - //printf("sum is %ld\n",index->sax_cache_size); + sum_of_lab += essdata[i].sum_of_lab; } - pthread_t readthread[maxquerythread*maxreadthread]; + + pthread_t readthread[maxquerythread * maxreadthread]; ParIS_read_worker_data readpointer; - unsigned long readcounter=0; - float bsfdistance=(approximate_result.distance); - - - readpointer.ts=ts; - readpointer.tsU=upperLemire; - readpointer.tsL=lowerLemire; - readpointer.index=index; - readpointer.counter=&readcounter; - readpointer.bsf=approximate_result.distance; - readpointer.load_point=label_number; - readpointer.lock_bsf=&lock_bsf; - readpointer.bsf2=&bsfdistance; - readpointer.minidisvector=minidisvector; - readpointer.sum_of_lab=sum_of_lab; - readpointer.rawfile=rawfile; - readpointer.warpWind=warpWind; - for (i = 0; i < maxquerythread*maxreadthread; i++) - { - pthread_create(&(readthread[i]),NULL,dtwreadworker_inmemory,(void*)&(readpointer)); + uint64_t readcounter = 0; + float bsfdistance = (approximate_result.distance); + + readpointer.ts = ts; + readpointer.tsU = upperLemire; + readpointer.tsL = lowerLemire; + readpointer.index = index; + readpointer.counter = &readcounter; + readpointer.bsf = approximate_result.distance; + readpointer.load_point = label_number; + readpointer.lock_bsf = &lock_bsf; + readpointer.bsf2 = &bsfdistance; + readpointer.minidisvector = minidisvector; + readpointer.sum_of_lab = sum_of_lab; + readpointer.rawfile = rawfile; + readpointer.warpWind = warpWind; + + for (i = 0; i < maxquerythread * maxreadthread; i++) { + pthread_create(&(readthread[i]), NULL, dtwreadworker_inmemory, (void*) & (readpointer)); } - for (i = 0; i < maxquerythread*maxreadthread; i++) - { - pthread_join(readthread[i],NULL); + for (i = 0; i < maxquerythread * maxreadthread; i++) { + pthread_join(readthread[i], NULL); } + COUNT_OUTPUT_TIME_END - approximate_result.distance=bsfdistance; + approximate_result.distance = bsfdistance; free(essdata); free(minidisvector); free(label_number); free(lowerLemire); free(upperLemire); - //printf("I need to check: %2.2lf%% of the data.\n", (double)tocheck*100/(double)index->sax_cache_size); - /*bit_array_free(bitarray);*/ - //printf("the new distance is: %f \n",approximate_result.distance); - //.sax_type *sax = &index->sax_cache[1 * index->settings->paa_segments]; + return approximate_result; } -void* mindtwdistance_worker_inmemory(void *essdata) -{ - - unsigned long i; - float bsfdistance,mindist; - isax_index *index=((ParIS_LDCW_data*)essdata)->index; - unsigned long start_number=((ParIS_LDCW_data*)essdata)->start_number; - unsigned long stop_number=((ParIS_LDCW_data*)essdata)->stop_number; - ts_type *paa=((ParIS_LDCW_data*)essdata)->paa; - ts_type *paaU=((ParIS_LDCW_data*)essdata)->paaU; - ts_type *paaL=((ParIS_LDCW_data*)essdata)->paaL; - ts_type *ts=((ParIS_LDCW_data*)essdata)->ts; - ((ParIS_LDCW_data*)essdata)->label_number=malloc(sizeof(unsigned long)*10000); - ((ParIS_LDCW_data*)essdata)->minidisvector=malloc(sizeof(float)*10000); - - unsigned long max_number=10000; - - for(i=start_number;iindex; + uint64_t start_number = ((ParIS_LDCW_data*)essdata)->start_number; + uint64_t stop_number = ((ParIS_LDCW_data*)essdata)->stop_number; + ts_type *paa = ((ParIS_LDCW_data*)essdata)->paa; + ts_type *paaU = ((ParIS_LDCW_data*)essdata)->paaU; + ts_type *paaL = ((ParIS_LDCW_data*)essdata)->paaL; + ts_type *ts = ((ParIS_LDCW_data*)essdata)->ts; + ((ParIS_LDCW_data*)essdata)->label_number = (ParIS_LDCW_data*)malloc(sizeof(uint64_t) * 10000); + ((ParIS_LDCW_data*)essdata)->minidisvector = (ParIS_LDCW_data*)malloc(sizeof(float) * 10000); + + uint64_t max_number = 10000; + + for (uint64_t i = start_number; i < stop_number; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - mindist = minidist_paa_to_isax_raw_DTW_SIMD(paaU,paaL, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - if(mindist <= ((ParIS_LDCW_data*)essdata)->bsfdistance) - { - if ( ((ParIS_LDCW_data*)essdata)->sum_of_lab>=max_number) - { - max_number=(max_number+10000); - ((ParIS_LDCW_data*)essdata)->label_number = (unsigned long*) realloc(((ParIS_LDCW_data*)essdata)->label_number, sizeof(unsigned long)*max_number); - ((ParIS_LDCW_data*)essdata)->minidisvector = (float*) realloc(((ParIS_LDCW_data*)essdata)->minidisvector, sizeof(float)*max_number); - + mindist = minidist_paa_to_isax_raw_DTW_SIMD(paaU, paaL, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); + + if (mindist <= ((ParIS_LDCW_data*)essdata)->bsfdistance) { + if (((ParIS_LDCW_data*)essdata)->sum_of_lab >= max_number) { + max_number = (max_number + 10000); + ((ParIS_LDCW_data*)essdata)->label_number = + (uint64_t*) realloc(((ParIS_LDCW_data*)essdata)->label_number, sizeof(uint64_t) * max_number); + ((ParIS_LDCW_data*)essdata)->minidisvector = + (float*) realloc(((ParIS_LDCW_data*)essdata)->minidisvector, sizeof(float) * max_number); } - ((ParIS_LDCW_data*)essdata)->label_number[((ParIS_LDCW_data*)essdata)->sum_of_lab]=i; - ((ParIS_LDCW_data*)essdata)->minidisvector[((ParIS_LDCW_data*)essdata)->sum_of_lab]=mindist; + + ((ParIS_LDCW_data*)essdata)->label_number[((ParIS_LDCW_data*)essdata)->sum_of_lab] = i; + ((ParIS_LDCW_data*)essdata)->minidisvector[((ParIS_LDCW_data*)essdata)->sum_of_lab] = mindist; ((ParIS_LDCW_data*)essdata)->sum_of_lab++; } } } -void* dtwreadworker_inmemory(void *read_pointer) -{ - isax_index *index=((ParIS_read_worker_data*)read_pointer)->index; - float bsf,dist,dist2; - float* cb=calloc(index->settings->timeseries_size,sizeof(float)); - float* cb1=calloc(index->settings->timeseries_size,sizeof(float)); +void* dtwreadworker_inmemory(void *read_pointer) { + isax_index *index = ((ParIS_read_worker_data*)read_pointer)->index; + float bsf; + float dist; + float dist2; + float* cb = (float*)calloc(index->settings->timeseries_size, sizeof(float)); + float* cb1 = (float*)calloc(index->settings->timeseries_size, sizeof(float)); ts_type *ts_buffer; - ts_type *ts =((ParIS_read_worker_data*)read_pointer)->ts; - unsigned long t=0,p; - unsigned long sum_of_lab=((ParIS_read_worker_data*)read_pointer)->sum_of_lab; - int warpWind=((ParIS_read_worker_data*)read_pointer)->warpWind; - float *minidisvector=((ParIS_read_worker_data*)read_pointer)->minidisvector; - bsf= *(((ParIS_read_worker_data*)read_pointer)->bsf2); - float *lowerLemire= ((ParIS_read_worker_data*)read_pointer)->tsL; - float *upperLemire= ((ParIS_read_worker_data*)read_pointer)->tsU; - int length = 2*warpWind+1; - float* tSum = (float*) malloc(sizeof(float)*length); - // pre_cost - float* pCost = (float*) malloc(sizeof(float)*length); - // raw distance - float* rDist = (float*) malloc(sizeof(float)*length); - while(1) - { - pthread_rwlock_rdlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - bsf= *(((ParIS_read_worker_data*)read_pointer)->bsf2); - pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - t=__sync_fetch_and_add(((ParIS_read_worker_data*)read_pointer)->counter,1); - if (t>=sum_of_lab) - { - break; - } - p=((ParIS_read_worker_data*)read_pointer)->load_point[t]; - if (minidisvector[t]rawfile[p*index->settings->ts_byte_size/sizeof(ts_type)]; - - dist2=lb_keogh_data_bound(ts_buffer, upperLemire,lowerLemire,cb1, index->settings->timeseries_size,bsf); - - - if(dist2settings->timeseries_size-1] = cb1[index->settings->timeseries_size-1]; - for(int k=index->settings->timeseries_size-2;k>=0; k--) - cb[k] = cb[k+1] + cb1[k]; - dist =dtwsimdPruned(ts,ts_buffer,cb, index->settings->timeseries_size, warpWind,bsf, tSum, pCost, rDist); - //dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf); - if(dist < bsf) - { - pthread_rwlock_wrlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - if (dist<*(((ParIS_read_worker_data*)read_pointer)->bsf2)) - { - *(((ParIS_read_worker_data*)read_pointer)->bsf2)= dist; - } - pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + ts_type *ts = ((ParIS_read_worker_data*)read_pointer)->ts; + uint64_t t = 0; + uint64_t p; + uint64_t sum_of_lab = ((ParIS_read_worker_data*)read_pointer)->sum_of_lab; + int warpWind = ((ParIS_read_worker_data*)read_pointer)->warpWind; + float *minidisvector = ((ParIS_read_worker_data*)read_pointer)->minidisvector; + bsf = *(((ParIS_read_worker_data*)read_pointer)->bsf2); + float *lowerLemire = ((ParIS_read_worker_data*)read_pointer)->tsL; + float *upperLemire = ((ParIS_read_worker_data*)read_pointer)->tsU; + int length = 2 * warpWind + 1; + float* tSum = (float*)malloc(sizeof(float) * length); + // pre_cost + float* pCost = (float*)malloc(sizeof(float) * length); + // raw distance + float* rDist = (float*)malloc(sizeof(float) * length); + + while (1) { + pthread_rwlock_rdlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + bsf = *(((ParIS_read_worker_data*)read_pointer)->bsf2); + pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + t = __sync_fetch_and_add(((ParIS_read_worker_data*)read_pointer)->counter, 1); + + if (t >= sum_of_lab) { + break; + } + + p = ((ParIS_read_worker_data*)read_pointer)->load_point[t]; + + if (minidisvector[t] < bsf) { + ts_buffer = &((ParIS_read_worker_data*)read_pointer)->rawfile[p*index->settings->ts_byte_size / sizeof(ts_type)]; + dist2 = lb_keogh_data_bound(ts_buffer, upperLemire, lowerLemire, cb1, index->settings->timeseries_size, bsf); + + if (dist2 < bsf) { + cb[index->settings->timeseries_size - 1] = cb1[index->settings->timeseries_size - 1]; + + for (int k = index->settings->timeseries_size - 2; k >= 0; k--) { + cb[k] = cb[k + 1] + cb1[k]; + } + + dist = dtwsimdPruned(ts, ts_buffer, cb, index->settings->timeseries_size, warpWind, bsf, tSum, pCost, rDist); + + if (dist < bsf) { + pthread_rwlock_wrlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + + if (dist < *(((ParIS_read_worker_data*)read_pointer)->bsf2)) { + *(((ParIS_read_worker_data*)read_pointer)->bsf2) = dist; + } + + pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); } - } - } + } + } } + free(tSum); free(pCost); - free(cb); + free(cb); free(cb1); free(rDist); } -query_result exact_DTW_MESSI_inmemory_hybrid (ts_type *ts,ts_type *paa, ts_type *paaU, ts_type *paaL, isax_index *index,node_list *nodelist, - float minimum_distance, int min_checked_leaves,int warpWind) -{ - // RDcalculationnumber=0; - //LBDcalculationnumber=0; - query_result approximate_result = approximate_DTW_inmemory_pRecBuf(ts, paa, index,warpWind); - //query_result approximate_result = approximate_search_inmemory(ts, paa, index); +query_result exact_DTW_MESSI_inmemory_hybrid(ts_type *ts, ts_type *paa, ts_type *paaU, ts_type *paaL, + isax_index *index, node_list *nodelist, + float minimum_distance, int min_checked_leaves, int warpWind) { + query_result approximate_result = approximate_DTW_inmemory_pRecBuf(ts, paa, index, warpWind); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; - int node_counter=0; + int node_counter = 0; + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - //approximate_result = refine_answer_inmemory_m(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); - } - pqueue_t **allpq=malloc(sizeof(pqueue_t*)*N_PQUEUE); - - ts_type * upperLemire = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type * lowerLemire = malloc(sizeof(ts_type) * index->settings->timeseries_size); - lower_upper_lemire(ts,index->settings->timeseries_size,warpWind,lowerLemire,upperLemire); + pqueue_t **allpq = (pqueue_t**)malloc(sizeof(pqueue_t*) * N_PQUEUE); + + ts_type * upperLemire = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type * lowerLemire = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + lower_upper_lemire(ts, index->settings->timeseries_size, warpWind, lowerLemire, upperLemire); pthread_mutex_t ququelock[N_PQUEUE]; int queuelabel[N_PQUEUE]; @@ -983,328 +919,279 @@ query_result exact_DTW_MESSI_inmemory_hybrid (ts_type *ts,ts_type *paa, ts_type SET_APPROXIMATE(approximate_result.distance); - - if(approximate_result.node != NULL) { + if (approximate_result.node != NULL) { // Insert approximate result in heap. - //pqueue_insert(pq, &approximate_result); - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // pqueue_insert(pq, &approximate_result); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } + // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; pthread_t threadid[maxquerythread]; MESSI_workerdata workerdata[maxquerythread]; - pthread_mutex_t lock_queue=PTHREAD_MUTEX_INITIALIZER,lock_current_root_node=PTHREAD_MUTEX_INITIALIZER; - pthread_rwlock_t lock_bsf=PTHREAD_RWLOCK_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER, lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, maxquerythread); - - - for (int i = 0; i < N_PQUEUE; i++) - { - allpq[i]=pqueue_init(index->settings->root_nodes_size/N_PQUEUE, - cmp_pri, get_pri, set_pri, get_pos, set_pos); - pthread_mutex_init(&ququelock[i], NULL); - queuelabel[i]=1; + + for (int i = 0; i < N_PQUEUE; i++) { + allpq[i] = pqueue_init(index->settings->root_nodes_size / N_PQUEUE, + cmp_pri, get_pri, set_pri, get_pos, set_pos); + pthread_mutex_init(&ququelock[i], NULL); + queuelabel[i] = 1; } - for (int i = 0; i < maxquerythread; i++) - { - workerdata[i].paa=paa; - workerdata[i].paaU=paaU; - workerdata[i].paaL=paaL; - workerdata[i].ts=ts; - workerdata[i].uo=upperLemire; - workerdata[i].lo=lowerLemire; - workerdata[i].lock_queue=&lock_queue; - workerdata[i].lock_current_root_node=&lock_current_root_node; - workerdata[i].lock_bsf=&lock_bsf; - workerdata[i].nodelist=nodelist->nlist; - workerdata[i].amountnode=nodelist->node_amount; - workerdata[i].index=index; - workerdata[i].minimum_distance=minimum_distance; - workerdata[i].node_counter=&node_counter; - workerdata[i].pq=allpq[i]; + for (int i = 0; i < maxquerythread; i++) { + workerdata[i].paa = paa; + workerdata[i].paaU = paaU; + workerdata[i].paaL = paaL; + workerdata[i].ts = ts; + workerdata[i].uo = upperLemire; + workerdata[i].lo = lowerLemire; + workerdata[i].lock_queue = &lock_queue; + workerdata[i].lock_current_root_node = &lock_current_root_node; + workerdata[i].lock_bsf = &lock_bsf; + workerdata[i].nodelist = nodelist->nlist; + workerdata[i].amountnode = nodelist->node_amount; + workerdata[i].index = index; + workerdata[i].minimum_distance = minimum_distance; + workerdata[i].node_counter = &node_counter; + workerdata[i].pq = allpq[i]; workerdata[i].bsf_result = &bsf_result; - workerdata[i].lock_barrier=&lock_barrier; - workerdata[i].alllock=ququelock; - workerdata[i].allqueuelabel=queuelabel; - workerdata[i].allpq=allpq; - workerdata[i].startqueuenumber=i%N_PQUEUE; - workerdata[i].warpWind=warpWind; + workerdata[i].lock_barrier = &lock_barrier; + workerdata[i].alllock = ququelock; + workerdata[i].allqueuelabel = queuelabel; + workerdata[i].allpq = allpq; + workerdata[i].startqueuenumber = i % N_PQUEUE; + workerdata[i].warpWind = warpWind; } - - for (int i = 0; i < maxquerythread; i++) - { - pthread_create(&(threadid[i]),NULL,exact_DTW_worker_inmemory_hybridpqueue,(void*)&(workerdata[i])); + + for (int i = 0; i < maxquerythread; i++) { + pthread_create(&(threadid[i]), NULL, exact_DTW_worker_inmemory_hybridpqueue, (void*) & (workerdata[i])); } - for (int i = 0; i < maxquerythread; i++) - { - pthread_join(threadid[i],NULL); + + for (int i = 0; i < maxquerythread; i++) { + pthread_join(threadid[i], NULL); } // Free the nodes that where not popped. // Free the priority queue. pthread_barrier_destroy(&lock_barrier); - //pqueue_free(pq); - for (int i = 0; i < N_PQUEUE; i++) - { + for (int i = 0; i < N_PQUEUE; i++) { pqueue_free(allpq[i]); } + free(allpq); - bsf_result=bsf_result; - //free(rfdata); - // printf("the number of LB distance calculation is %ld\t\t and the Real distance calculation is %ld\n ",LBDcalculationnumber,RDcalculationnumber); return bsf_result; - - // Free the nodes that where not popped. - } -void* exact_DTW_worker_inmemory_hybridpqueue(void *rfdata) -{ - +void* exact_DTW_worker_inmemory_hybridpqueue(void *rfdata) { isax_node *current_root_node; query_result *n; - isax_index *index=((MESSI_workerdata*)rfdata)->index; - ts_type *paa=((MESSI_workerdata*)rfdata)->paa; - ts_type *paaU=((MESSI_workerdata*)rfdata)->paaU; - ts_type *paaL=((MESSI_workerdata*)rfdata)->paaL; - int warpWind=((MESSI_workerdata*)rfdata)->warpWind; - ts_type *ts=((MESSI_workerdata*)rfdata)->ts; - ts_type *uo=((MESSI_workerdata*)rfdata)->uo; - ts_type *lo=((MESSI_workerdata*)rfdata)->lo; - pqueue_t *pq=((MESSI_workerdata*)rfdata)->pq; + isax_index *index = ((MESSI_workerdata*)rfdata)->index; + ts_type *paa = ((MESSI_workerdata*)rfdata)->paa; + ts_type *paaU = ((MESSI_workerdata*)rfdata)->paaU; + ts_type *paaL = ((MESSI_workerdata*)rfdata)->paaL; + int warpWind = ((MESSI_workerdata*)rfdata)->warpWind; + ts_type *ts = ((MESSI_workerdata*)rfdata)->ts; + ts_type *uo = ((MESSI_workerdata*)rfdata)->uo; + ts_type *lo = ((MESSI_workerdata*)rfdata)->lo; + pqueue_t *pq = ((MESSI_workerdata*)rfdata)->pq; query_result *do_not_remove = ((MESSI_workerdata*)rfdata)->bsf_result; - float minimum_distance=((MESSI_workerdata*)rfdata)->minimum_distance; - int limit=((MESSI_workerdata*)rfdata)->limit; + float minimum_distance = ((MESSI_workerdata*)rfdata)->minimum_distance; + int limit = ((MESSI_workerdata*)rfdata)->limit; int checks = 0; - bool finished=true; + bool finished = true; int current_root_node_number; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; - query_result *bsf_result=(((MESSI_workerdata*)rfdata)->bsf_result); - float bsfdisntance=bsf_result->distance; - int calculate_node=0,calculate_node_quque=0; - int tnumber=rand()% N_PQUEUE; - int startqueuenumber=((MESSI_workerdata*)rfdata)->startqueuenumber; - //COUNT_QUEUE_TIME_START - - while (1) - { - current_root_node_number=__sync_fetch_and_add(((MESSI_workerdata*)rfdata)->node_counter,1); - //printf("the number is %d\n",current_root_node_number ); - if(current_root_node_number>= ((MESSI_workerdata*)rfdata)->amountnode) + query_result *bsf_result = (((MESSI_workerdata*)rfdata)->bsf_result); + float bsfdisntance = bsf_result->distance; + int calculate_node = 0; + int calculate_node_quque = 0; + int tnumber = rand() % N_PQUEUE; + int startqueuenumber = ((MESSI_workerdata*)rfdata)->startqueuenumber; + // COUNT_QUEUE_TIME_START + + while (1) { + current_root_node_number = __sync_fetch_and_add(((MESSI_workerdata*)rfdata)->node_counter, 1); + + if (current_root_node_number >= ((MESSI_workerdata*)rfdata)->amountnode) { break; - current_root_node=((MESSI_workerdata*)rfdata)->nodelist[current_root_node_number]; - //insert_tree_node_m_hybridpqueue(paaU,current_root_node,index,bsfdisntance,((MESSI_workerdata*)rfdata)->allpq,((MESSI_workerdata*)rfdata)->alllock,&tnumber); - insert_tree_node_m_hybridpqueue_DTW(paaU,paaL,current_root_node,index,bsfdisntance,((MESSI_workerdata*)rfdata)->allpq,((MESSI_workerdata*)rfdata)->alllock,&tnumber); - //insert_tree_node_mW(paa,current_root_node,index,bsfdisntance,pq,((MESSI_workerdata*)rfdata)->lock_queue); + } - + current_root_node = ((MESSI_workerdata*)rfdata)->nodelist[current_root_node_number]; + insert_tree_node_m_hybridpqueue_DTW(paaU, paaL, current_root_node, index, + bsfdisntance, ((MESSI_workerdata*)rfdata)->allpq, ((MESSI_workerdata*)rfdata)->alllock, &tnumber); } - //COUNT_QUEUE_TIME_END - //calculate_node_quque=pq->size; - pthread_barrier_wait(((MESSI_workerdata*)rfdata)->lock_barrier); - //printf("the size of quque is %d \n",pq->size); - while (1) - { + + while (1) { pthread_mutex_lock(&(((MESSI_workerdata*)rfdata)->alllock[startqueuenumber])); n = pqueue_pop(((MESSI_workerdata*)rfdata)->allpq[startqueuenumber]); pthread_mutex_unlock(&(((MESSI_workerdata*)rfdata)->alllock[startqueuenumber])); - if(n==NULL) + + if (n == NULL) { break; - //pthread_rwlock_rdlock(((MESSI_workerdata*)rfdata)->lock_bsf); - bsfdisntance=bsf_result->distance; - //pthread_rwlock_unlock(((MESSI_workerdata*)rfdata)->lock_bsf); - // The best node has a worse mindist, so search is finished! + } + bsfdisntance = bsf_result->distance; + + // The best node has a worse mindist, so search is finished! if (n->distance > bsfdisntance || n->distance > minimum_distance) { break; - } - else - { + } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { - checks++; + float distance = calculate_node_DTW2_inmemory(index, n->node, ts, uo, lo, paa, paaU, paaL, bsfdisntance, warpWind); - float distance = calculate_node_DTW2_inmemory(index, n->node, ts,uo,lo,paa,paaU,paaL, bsfdisntance,warpWind); - if (distance < bsfdisntance) - { + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((MESSI_workerdata*)rfdata)->lock_bsf); - if(distance < bsf_result->distance) - { + + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((MESSI_workerdata*)rfdata)->lock_bsf); } - } - } - free(n); + + free(n); } - if( (((MESSI_workerdata*)rfdata)->allqueuelabel[startqueuenumber])==1) - { - (((MESSI_workerdata*)rfdata)->allqueuelabel[startqueuenumber])=0; + if ((((MESSI_workerdata*)rfdata)->allqueuelabel[startqueuenumber]) == 1) { + (((MESSI_workerdata*)rfdata)->allqueuelabel[startqueuenumber]) = 0; pthread_mutex_lock(&(((MESSI_workerdata*)rfdata)->alllock[startqueuenumber])); - while(n = pqueue_pop(((MESSI_workerdata*)rfdata)->allpq[startqueuenumber])) - { + + while (n = pqueue_pop(((MESSI_workerdata*)rfdata)->allpq[startqueuenumber])) { free(n); } + pthread_mutex_unlock(&(((MESSI_workerdata*)rfdata)->alllock[startqueuenumber])); } - while(1) - { - int offset=rand()% N_PQUEUE; - finished=true; - for (int i = 0; i < N_PQUEUE; i++) - { - if((((MESSI_workerdata*)rfdata)->allqueuelabel[i])==1) - { - finished=false; - while(1) - { + while (1) { + int offset = rand() % N_PQUEUE; + finished = true; + + for (int i = 0; i < N_PQUEUE; i++) { + if ((((MESSI_workerdata*)rfdata)->allqueuelabel[i]) == 1) { + finished = false; + + while (1) { pthread_mutex_lock(&(((MESSI_workerdata*)rfdata)->alllock[i])); n = pqueue_pop(((MESSI_workerdata*)rfdata)->allpq[i]); pthread_mutex_unlock(&(((MESSI_workerdata*)rfdata)->alllock[i])); - if(n==NULL) - break; + + if (n == NULL) { + break; + } + if (n->distance > bsfdisntance || n->distance > minimum_distance) { break; - } - else - { + } else { // If it is a leaf, check its real distance. - if (n->node->is_leaf) - { + if (n->node->is_leaf) { checks++; - float distance = calculate_node_DTW2_inmemory(index, n->node, ts,uo,lo,paa,paaU,paaL, bsfdisntance,warpWind); - if (distance < bsfdisntance) - { + float distance = calculate_node_DTW2_inmemory(index, n->node, ts, uo, lo, + paa, paaU, paaL, bsfdisntance, warpWind); + + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((MESSI_workerdata*)rfdata)->lock_bsf); - if(distance < bsf_result->distance) - { + + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((MESSI_workerdata*)rfdata)->lock_bsf); } - } - } - //add - free(n); - } + // add + free(n); + } } } - if (finished) - { + + if (finished) { break; } } - - - //pthread_barrier_wait(((MESSI_workerdata*)rfdata)->lock_barrier); - //while(n=pqueue_pop(pq)) - //{ - //free(n); - //} - //pqueue_free(pq); - // - - - //printf("create pq time is %f \n",worker_total_time ); - //printf("the check's node is\t %d\tthe local queue's node is\t%d\n",checks,calculate_node_quque); } -void insert_tree_node_m_hybridpqueue_DTW(float *paaU,float *paaL,isax_node *node,isax_index *index,float bsf,pqueue_t **pq,pthread_mutex_t *lock_queue,int *tnumber) -{ - //COUNT_CAL_TIME_START - float distance = minidist_paa_to_isax_DTW(paaU,paaL, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - //COUNT_CAL_TIME_END - if(distance < bsf) - { - if (node->is_leaf) - { - query_result * mindist_result = malloc(sizeof(query_result)); +void insert_tree_node_m_hybridpqueue_DTW(float *paaU, float *paaL, isax_node *node, + isax_index *index, float bsf, pqueue_t **pq, pthread_mutex_t *lock_queue, int *tnumber) { + // COUNT_CAL_TIME_START + float distance = minidist_paa_to_isax_DTW(paaU, paaL, node->isax_values, + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + // COUNT_CAL_TIME_END + + if (distance < bsf) { + if (node->is_leaf) { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->node = node; - mindist_result->distance=distance; + mindist_result->distance = distance; pthread_mutex_lock(&lock_queue[*tnumber]); pqueue_insert(pq[*tnumber], mindist_result); pthread_mutex_unlock(&lock_queue[*tnumber]); - *tnumber=(*tnumber+1)%N_PQUEUE; + *tnumber = (*tnumber + 1) % N_PQUEUE; added_tree_node++; - } - else - { - if (node->left_child->isax_cardinalities != NULL) - { - insert_tree_node_m_hybridpqueue_DTW(paaU,paaL,node->left_child,index, bsf,pq,lock_queue,tnumber); + } else { + if (node->left_child->isax_cardinalities != NULL) { + insert_tree_node_m_hybridpqueue_DTW(paaU, paaL, node->left_child, index, bsf, pq, lock_queue, tnumber); } - if (node->right_child->isax_cardinalities != NULL) - { - insert_tree_node_m_hybridpqueue_DTW(paaU,paaL,node->right_child,index,bsf,pq,lock_queue,tnumber); + + if (node->right_child->isax_cardinalities != NULL) { + insert_tree_node_m_hybridpqueue_DTW(paaU, paaL, node->right_child, index, bsf, pq, lock_queue, tnumber); } } } } -query_result approximate_DTW_inmemory_messi (ts_type *ts, ts_type *paa, isax_index *index) -{ +query_result approximate_DTW_inmemory_messi(ts_type *ts, ts_type *paa, isax_index *index) { query_result result; - - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); - + index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality); root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); - - if ((&((first_buffer_layer2*)(index->fbl))->soft_buffers[(int) root_mask])->initialized) { - isax_node *node = (&((first_buffer_layer2*)(index->fbl))->soft_buffers[(int) root_mask])->node; + if ((&((first_buffer_layer2*)(index->fbl))->soft_buffers[(int)root_mask])->initialized) { + isax_node *node = (&((first_buffer_layer2*)(index->fbl))->soft_buffers[(int)root_mask])->node; // Traverse tree // Adaptive splitting - while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; - if(sax[node->split_data->splitpoint] & mask) - { + if (sax[node->split_data->splitpoint] & mask) { node = node->right_child; - } - else - { + } else { node = node->left_child; } - // Adaptive splitting } + result.distance = calculate_node_distance_inmemory(index, node, ts, FLT_MAX); result.node = node; - } - else { + } else { result.node = NULL; result.distance = FLT_MAX; } @@ -1315,141 +1202,105 @@ query_result approximate_DTW_inmemory_messi (ts_type *ts, ts_type *paa, isax_in } -float calculate_node_DTW_inmemory (isax_index *index, isax_node *node, ts_type *query, float bsf,int warpWind) -{ +float calculate_node_DTW_inmemory(isax_index *index, isax_node *node, ts_type *query, float bsf, int warpWind) { COUNT_CHECKED_NODE() // If node has buffered data - - if (node->buffer != NULL) - { - float* cb=(float *)calloc(index->settings->timeseries_size,sizeof(float)); + + if (node->buffer != NULL) { + float* cb = (float *)calloc(index->settings->timeseries_size, sizeof(float)); int i; - for (i=0; ibuffer->full_buffer_size; i++) - { - float dist = ts_euclidean_distance(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, bsf); + + for (i = 0; i < node->buffer->full_buffer_size; i++) { + float dist = ts_euclidean_distance(query, node->buffer->full_ts_buffer[i], + index->settings->timeseries_size, bsf); + if (dist < bsf) { bsf = dist; } } - for (i=0; ibuffer->tmp_full_buffer_size; i++) { - float dist = ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, bsf); - if (dist < bsf ) { + for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { + float dist = ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], + index->settings->timeseries_size, bsf); + if (dist < bsf) { bsf = dist; } } - // RDcalculationnumber=RDcalculationnumber+node->buffer->partial_buffer_size; - for (i=0; ibuffer->partial_buffer_size; i++) { - - float dist = dtw(query, &(rawfile[*node->buffer->partial_position_buffer[i]]),cb, index->settings->timeseries_size, warpWind, bsf); - // ts_euclidean_distance_SIMD(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - // index->settings->timeseries_size, bsf); + for (i = 0; i < node->buffer->partial_buffer_size; i++) { + float dist = dtw(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), cb, + index->settings->timeseries_size, warpWind, bsf); if (dist < bsf) { bsf = dist; - } } + free(cb); } - + return bsf; } -float calculate_node_DTW2_inmemory (isax_index *index, isax_node *node, ts_type *query,float *uo, float *lo,ts_type *paa,ts_type *paaU,ts_type *paaL, float bsf,int warpWind) -{ - //COUNT_CHECKED_NODE() + +float calculate_node_DTW2_inmemory(isax_index *index, isax_node *node, ts_type *query, + float *uo, float *lo, ts_type *paa, ts_type *paaU, ts_type *paaL, float bsf, int warpWind) { float distmin; int k; - float* cb = (float *)malloc(sizeof(float)*index->settings->timeseries_size); + float* cb = (float *)malloc(sizeof(float)*index->settings->timeseries_size); float* cb1 = (float *)malloc(sizeof(float)*index->settings->timeseries_size); - //float* cb2 = (float *)malloc(sizeof(float)*index->settings->timeseries_size); - //float* datauper = (float *)malloc(sizeof(float)*index->settings->timeseries_size); - //float* datalower = (float *)malloc(sizeof(float)*index->settings->timeseries_size); - // tempral sum - int length = 2*warpWind+1; - float* tSum = (float*) malloc(sizeof(float)*length); - // pre_cost - float* pCost = (float*) malloc(sizeof(float)*length); - // raw distance - float* rDist = (float*) malloc(sizeof(float)*length); - - // If node has buffered data - if (node->buffer != NULL) - { - //#pragma omp parallel for num_threads(2) reduction(min : bsf) - - // __sync_fetch_and_add(&LBDcalculationnumber,node->buffer->partial_buffer_size); - for (int i=0; ibuffer->partial_buffer_size; i++) - { - - distmin=minidist_paa_to_isax_raw_DTW_SIMD(paaU,paaL, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - - if (distminbuffer->partial_position_buffer[i]]), uo,lo,cb1, index->settings->timeseries_size,bsf); - //if (distmin1buffer->partial_position_buffer[i]]),index->settings->timeseries_size,warpWind,datalower,datauper); - //distmin2=lb_keogh_data_bound(query, datauper,datalower,cb2, index->settings->timeseries_size,bsf); - - //if (distmin2 distmin2) - // { - cb[index->settings->timeseries_size-1] = cb1[index->settings->timeseries_size-1]; - for(k=index->settings->timeseries_size-2;k>=0; k--) - cb[k] = cb[k+1] + cb1[k]; - //} - // else - //{ - // cb[index->settings->timeseries_size-1] = cb2[index->settings->timeseries_size-1]; - //for(k=index->settings->timeseries_size-2;k>=0; k--) - //cb[k] = cb[k+1] + cb2[k]; - //} - - float dist =dtwsimdPruned(query, &(rawfile[*node->buffer->partial_position_buffer[i]]),cb, index->settings->timeseries_size, warpWind,bsf, tSum, pCost, rDist); - //float dist = dtw(query, &(rawfile[*node->buffer->partial_position_buffer[i]]),cb, index->settings->timeseries_size, warpWind, bsf); - //float dist = ts_euclidean_distance_SIMD(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - // index->settings->timeseries_size, bsf); - //__sync_fetch_and_add(&RDcalculationnumber,1); - if (dist < bsf) { - bsf = dist; - } - } + int length = 2 * warpWind + 1; + float* tSum = (float*)malloc(sizeof(float) * length); + // pre_cost + float* pCost = (float*)malloc(sizeof(float) * length); + // raw distance + float* rDist = (float*)malloc(sizeof(float) * length); + + // If node has buffered data + if (node->buffer != NULL) { + for (int i = 0; i < node->buffer->partial_buffer_size; i++) { + distmin = minidist_paa_to_isax_raw_DTW_SIMD(paaU, paaL, node->buffer->partial_sax_buffer[i], + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); + + if (distmin < bsf) { + distmin = lb_keogh_data_bound(&(rawfile[*node->buffer->partial_position_buffer[i]]), + uo, lo, cb1, index->settings->timeseries_size, bsf); + cb[index->settings->timeseries_size-1] = cb1[index->settings->timeseries_size - 1]; + + for (k = index->settings->timeseries_size - 2; k >= 0; k--) { + cb[k] = cb[k + 1] + cb1[k]; + } + + float dist = dtwsimdPruned(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), + cb, index->settings->timeseries_size, warpWind, bsf, tSum, pCost, rDist); + + if (dist < bsf) { + bsf = dist; } } } } + free(tSum); - free(pCost); - free(rDist); + free(pCost); + free(rDist); free(cb); free(cb1); -// free(cb2); - // free(datauper); - //free(datalower); + return bsf; } -query_result approximate_DTW_inmemory_pRecBuf (ts_type *ts, ts_type *paa, isax_index *index,int warpWind) -{ +query_result approximate_DTW_inmemory_pRecBuf(ts_type *ts, ts_type *paa, isax_index *index, int warpWind) { query_result result; - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); - + index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality); root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); @@ -1458,27 +1309,22 @@ query_result approximate_DTW_inmemory_pRecBuf (ts_type *ts, ts_type *paa, isax_ // Traverse tree // Adaptive splitting - while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; - if(sax[node->split_data->splitpoint] & mask) - { + if (sax[node->split_data->splitpoint] & mask) { node = node->right_child; - } - else - { + } else { node = node->left_child; } - // Adaptive splitting } - result.distance = calculate_node_DTW_inmemory(index, node, ts, FLT_MAX,warpWind); + + result.distance = calculate_node_DTW_inmemory(index, node, ts, FLT_MAX, warpWind); result.node = node; - } - else { + } else { result.node = NULL; result.distance = FLT_MAX; } @@ -1488,284 +1334,227 @@ query_result approximate_DTW_inmemory_pRecBuf (ts_type *ts, ts_type *paa, isax_ return result; } - - - - -float minidist_paa_to_isax_raw_DTW_SIMD(float *paaU,float *paaL, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt) -{ - - int region_upper[16],region_lower[16]; +float minidist_paa_to_isax_raw_DTW_SIMD(float *paaU, float *paaL, sax_type *sax, + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt) { + int region_upper[16]; + int region_lower[16]; float distancef[16]; int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; - __m256i vectorsignbit = _mm256_set1_epi32 (0xffffffff); - __m256i vloweroffset = _mm256_set1_epi32 (offset-1); - __m256i vupperoffset = _mm256_set1_epi32 (offset); - - //__m256i c_cv_0 = _mm256_set_epi32 ( sax_cardinalities[7] , sax_cardinalities[6] ,sax_cardinalities[5] ,sax_cardinalities[4] , sax_cardinalities[3] ,sax_cardinalities[2] ,sax_cardinalities[1],sax_cardinalities[0]); - //__m256i c_cv_1 = _mm256_set_epi32 ( sax_cardinalities[15], sax_cardinalities[14],sax_cardinalities[13],sax_cardinalities[12], sax_cardinalities[11],sax_cardinalities[10],sax_cardinalities[9],sax_cardinalities[8]); - __m128i sax_cardinalitiesv8 = _mm_lddqu_si128 ((const void*)sax_cardinalities); - __m256i sax_cardinalitiesv16= _mm256_cvtepu8_epi16 (sax_cardinalitiesv8); - __m128i sax_cardinalitiesv16_0=_mm256_extractf128_si256 (sax_cardinalitiesv16,0); - __m128i sax_cardinalitiesv16_1=_mm256_extractf128_si256 (sax_cardinalitiesv16,1); - __m256i c_cv_0 = _mm256_cvtepu16_epi32 (sax_cardinalitiesv16_0); - __m256i c_cv_1 = _mm256_cvtepu16_epi32 (sax_cardinalitiesv16_1); - - //__m256i v_0 = _mm256_set_epi32 (sax[7],sax[6],sax[5],sax[4],sax[3],sax[2],sax[1],sax[0]); - //__m256i v_1 = _mm256_set_epi32 (sax[15],sax[14],sax[13],sax[12],sax[11],sax[10],sax[9],sax[8]); - __m128i saxv8= _mm_lddqu_si128 ((const void*)sax); - __m256i saxv16= _mm256_cvtepu8_epi16 (saxv8); - __m128i saxv16_0 =_mm256_extractf128_si256 (saxv16,0); - __m128i saxv16_1=_mm256_extractf128_si256 (saxv16,1); - __m256i v_0= _mm256_cvtepu16_epi32 (saxv16_0); - __m256i v_1 = _mm256_cvtepu16_epi32 (saxv16_1); - - - __m256i c_m = _mm256_set1_epi32 (max_bit_cardinality); - __m256i cm_ccv_0 = _mm256_sub_epi32 (c_m, c_cv_0); - __m256i cm_ccv_1 = _mm256_sub_epi32 (c_m, c_cv_1); - - //__m256i _mm256_set_epi32 (int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0) - // __m256i _mm256_set1_epi32 (int a) - __m256i region_lowerv_0 = _mm256_srlv_epi32 (v_0, cm_ccv_0); - __m256i region_lowerv_1 = _mm256_srlv_epi32 (v_1, cm_ccv_1); - region_lowerv_0 = _mm256_sllv_epi32 (region_lowerv_0, cm_ccv_0); - region_lowerv_1 = _mm256_sllv_epi32 (region_lowerv_1, cm_ccv_1); - - - __m256i v1= _mm256_andnot_si256 (_mm256_setzero_si256 (), vectorsignbit); - - __m256i region_upperv_0 = _mm256_sllv_epi32 (v1,cm_ccv_0); - __m256i region_upperv_1 = _mm256_sllv_epi32 (v1,cm_ccv_1); - region_upperv_0 = _mm256_andnot_si256 (region_upperv_0, vectorsignbit); - region_upperv_1 = _mm256_andnot_si256 (region_upperv_1, vectorsignbit); - - region_upperv_0 = _mm256_or_si256 (region_upperv_0, region_lowerv_0); - - region_upperv_1 = _mm256_or_si256 (region_upperv_1, region_lowerv_1); - - region_lowerv_0 = _mm256_add_epi32 (region_lowerv_0, vloweroffset); - region_lowerv_1 = _mm256_add_epi32 (region_lowerv_1, vloweroffset); - region_upperv_0 = _mm256_add_epi32 (region_upperv_0, vupperoffset); - region_upperv_1 = _mm256_add_epi32 (region_upperv_1, vupperoffset); - _mm256_storeu_si256 ((void*)&(region_lower[0]),region_lowerv_0); - _mm256_storeu_si256 ((void*)&(region_lower[8]),region_lowerv_1); - _mm256_storeu_si256 ((void*)&(region_upper[0]),region_upperv_0); - _mm256_storeu_si256 ((void*)&(region_upper[8]),region_upperv_1); - - - //lower - - __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32 (region_lowerv_0, _mm256_setzero_si256 ()); - __m256i lower_juge_zerov_1 = _mm256_cmpeq_epi32 (region_lowerv_1, _mm256_setzero_si256 ()); - - __m256i lower_juge_nzerov_0 = _mm256_andnot_si256 (lower_juge_zerov_0, vectorsignbit); - __m256i lower_juge_nzerov_1 = _mm256_andnot_si256 (lower_juge_zerov_1, vectorsignbit); - - __m256 minvalv = _mm256_set1_ps (min_val); - - - - - __m256 lsax_breakpoints_shiftv_0 =_mm256_i32gather_ps (sax_breakpoints,region_lowerv_0, 4); - //__m256 lsax_breakpoints_shiftv_0= _mm256_set_ps (sax_breakpoints[region_lower[7]], - //sax_breakpoints[region_lower[6]], - //sax_breakpoints[region_lower[5]], - //sax_breakpoints[region_lower[4]], - //sax_breakpoints[region_lower[3]], - //sax_breakpoints[region_lower[2]], - //sax_breakpoints[region_lower[1]], - //sax_breakpoints[region_lower[0]]); - __m256 lsax_breakpoints_shiftv_1 =_mm256_i32gather_ps (sax_breakpoints,region_lowerv_1, 4); - //__m256 lsax_breakpoints_shiftv_1= _mm256_set_ps (sax_breakpoints[region_lower[15]], - //sax_breakpoints[region_lower[14]], - //sax_breakpoints[region_lower[13]], - //sax_breakpoints[region_lower[12]], - //sax_breakpoints[region_lower[11]], - //sax_breakpoints[region_lower[10]], - //sax_breakpoints[region_lower[9]], - //sax_breakpoints[region_lower[8]]); - - - __m256 breakpoint_lowerv_0 = (__m256)_mm256_or_si256 (_mm256_and_si256(lower_juge_zerov_0,(__m256i)minvalv),_mm256_and_si256(lower_juge_nzerov_0,(__m256i)lsax_breakpoints_shiftv_0)); - __m256 breakpoint_lowerv_1 = (__m256)_mm256_or_si256 (_mm256_and_si256(lower_juge_zerov_1,(__m256i)minvalv),_mm256_and_si256(lower_juge_nzerov_1,(__m256i)lsax_breakpoints_shiftv_1)); + __m256i vectorsignbit = _mm256_set1_epi32(0xffffffff); + __m256i vloweroffset = _mm256_set1_epi32(offset - 1); + __m256i vupperoffset = _mm256_set1_epi32(offset); + + __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const void*)sax_cardinalities); + __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); + __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); + __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); + __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); + __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); + + __m128i saxv8 = _mm_lddqu_si128((const void*)sax); + __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); + __m128i saxv16_0 = _mm256_extractf128_si256(saxv16, 0); + __m128i saxv16_1 = _mm256_extractf128_si256(saxv16, 1); + __m256i v_0 = _mm256_cvtepu16_epi32(saxv16_0); + __m256i v_1 = _mm256_cvtepu16_epi32(saxv16_1); + + __m256i c_m = _mm256_set1_epi32(max_bit_cardinality); + __m256i cm_ccv_0 = _mm256_sub_epi32(c_m, c_cv_0); + __m256i cm_ccv_1 = _mm256_sub_epi32(c_m, c_cv_1); + + __m256i region_lowerv_0 = _mm256_srlv_epi32(v_0, cm_ccv_0); + __m256i region_lowerv_1 = _mm256_srlv_epi32(v_1, cm_ccv_1); + region_lowerv_0 = _mm256_sllv_epi32(region_lowerv_0, cm_ccv_0); + region_lowerv_1 = _mm256_sllv_epi32(region_lowerv_1, cm_ccv_1); + + __m256i v1 = _mm256_andnot_si256(_mm256_setzero_si256(), vectorsignbit); + + __m256i region_upperv_0 = _mm256_sllv_epi32(v1, cm_ccv_0); + __m256i region_upperv_1 = _mm256_sllv_epi32(v1, cm_ccv_1); + region_upperv_0 = _mm256_andnot_si256(region_upperv_0, vectorsignbit); + region_upperv_1 = _mm256_andnot_si256(region_upperv_1, vectorsignbit); + + region_upperv_0 = _mm256_or_si256(region_upperv_0, region_lowerv_0); + region_upperv_1 = _mm256_or_si256(region_upperv_1, region_lowerv_1); + + region_lowerv_0 = _mm256_add_epi32(region_lowerv_0, vloweroffset); + region_lowerv_1 = _mm256_add_epi32(region_lowerv_1, vloweroffset); + region_upperv_0 = _mm256_add_epi32(region_upperv_0, vupperoffset); + region_upperv_1 = _mm256_add_epi32(region_upperv_1, vupperoffset); + _mm256_storeu_si256((void*)&(region_lower[0]), region_lowerv_0); + _mm256_storeu_si256((void*)&(region_lower[8]), region_lowerv_1); + _mm256_storeu_si256((void*)&(region_upper[0]), region_upperv_0); + _mm256_storeu_si256((void*)&(region_upper[8]), region_upperv_1); + + // lower + __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32(region_lowerv_0, _mm256_setzero_si256()); + __m256i lower_juge_zerov_1 = _mm256_cmpeq_epi32(region_lowerv_1, _mm256_setzero_si256()); + + __m256i lower_juge_nzerov_0 = _mm256_andnot_si256(lower_juge_zerov_0, vectorsignbit); + __m256i lower_juge_nzerov_1 = _mm256_andnot_si256(lower_juge_zerov_1, vectorsignbit); + + __m256 minvalv = _mm256_set1_ps(min_val); + + __m256 lsax_breakpoints_shiftv_0 = _mm256_i32gather_ps(sax_breakpoints, region_lowerv_0, 4); + __m256 lsax_breakpoints_shiftv_1 = _mm256_i32gather_ps(sax_breakpoints, region_lowerv_1, 4); + + + __m256 breakpoint_lowerv_0 = (__m256)_mm256_or_si256(_mm256_and_si256(lower_juge_zerov_0, + (__m256i)minvalv), _mm256_and_si256(lower_juge_nzerov_0, (__m256i)lsax_breakpoints_shiftv_0)); + __m256 breakpoint_lowerv_1 = (__m256)_mm256_or_si256(_mm256_and_si256(lower_juge_zerov_1, + (__m256i)minvalv), _mm256_and_si256(lower_juge_nzerov_1, (__m256i)lsax_breakpoints_shiftv_1)); + + // uper + __m256 usax_breakpoints_shiftv_0 = _mm256_i32gather_ps(sax_breakpoints, region_upperv_0, 4); + __m256 usax_breakpoints_shiftv_1 = _mm256_i32gather_ps(sax_breakpoints, region_upperv_1, 4); + + __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(max_cardinality - 1)); + __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32(region_upperv_1, _mm256_set1_epi32(max_cardinality - 1)); + + __m256i upper_juge_nmaxv_0 = _mm256_andnot_si256(upper_juge_maxv_0, vectorsignbit); + __m256i upper_juge_nmaxv_1 = _mm256_andnot_si256(upper_juge_maxv_1, vectorsignbit); + + __m256 breakpoint_upperv_0 = (__m256)_mm256_or_si256(_mm256_and_si256(upper_juge_maxv_0, + (__m256i)_mm256_set1_ps(max_val)), _mm256_and_si256(upper_juge_nmaxv_0, (__m256i)usax_breakpoints_shiftv_0)); + __m256 breakpoint_upperv_1 = (__m256)_mm256_or_si256(_mm256_and_si256(upper_juge_maxv_1, + (__m256i)_mm256_set1_ps(max_val)), _mm256_and_si256(upper_juge_nmaxv_1, (__m256i)usax_breakpoints_shiftv_1)); + + // dis + __m256 paaUv_0; + __m256 paaUv_1; + __m256 paaLv_0; + __m256 paaLv_1; + + paaUv_0 = _mm256_loadu_ps(paaU); + paaUv_1 = _mm256_loadu_ps(&(paaU[8])); + paaLv_0 = _mm256_loadu_ps(paaL); + paaLv_1 = _mm256_loadu_ps(&(paaL[8])); + + __m256 dis_juge_upv_0 = _mm256_cmp_ps(breakpoint_lowerv_0, paaUv_0, _CMP_GT_OS); + __m256 dis_juge_upv_1 = _mm256_cmp_ps(breakpoint_lowerv_1, paaUv_1, _CMP_GT_OS); + + __m256 dis_juge_lov_0 = _mm256_cmp_ps(breakpoint_upperv_0, paaLv_0, _CMP_LT_OS); + __m256 dis_juge_lov_1 = _mm256_cmp_ps(breakpoint_upperv_1, paaLv_1, _CMP_LT_OS); + + __m256 dis_juge_elv_0 = (__m256)_mm256_andnot_si256(_mm256_or_si256((__m256i)dis_juge_upv_0, + (__m256i)dis_juge_lov_0), vectorsignbit); + __m256 dis_juge_elv_1 = (__m256)_mm256_andnot_si256(_mm256_or_si256((__m256i)dis_juge_upv_1, + (__m256i)dis_juge_lov_1), vectorsignbit); + + __m256 dis_lowv_0 = _mm256_sub_ps(breakpoint_lowerv_0, paaUv_0); + __m256 dis_lowv_1 = _mm256_sub_ps(breakpoint_lowerv_1, paaUv_1); + __m256 dis_uppv_0 = _mm256_sub_ps(breakpoint_upperv_0, paaLv_0); + __m256 dis_uppv_1 = _mm256_sub_ps(breakpoint_upperv_1, paaLv_1); + + __m256 distancev_0 = (__m256)_mm256_or_si256(_mm256_or_si256(_mm256_and_si256((__m256i)dis_juge_upv_0, + (__m256i)dis_lowv_0), _mm256_and_si256((__m256i)dis_juge_lov_0, (__m256i)dis_uppv_0)), + _mm256_and_si256((__m256i)dis_juge_elv_0, (__m256i)_mm256_set1_ps(0.0))); + __m256 distancev_1 = (__m256)_mm256_or_si256(_mm256_or_si256(_mm256_and_si256((__m256i)dis_juge_upv_1, + (__m256i)dis_lowv_1), _mm256_and_si256((__m256i)dis_juge_lov_1, (__m256i)dis_uppv_1)), + _mm256_and_si256((__m256i)dis_juge_elv_1, (__m256i)_mm256_set1_ps(0.0))); + + __m256 distancesum_0 = _mm256_dp_ps(distancev_0, distancev_0, 0xff); + __m256 distancesum_1 = _mm256_dp_ps(distancev_1, distancev_1, 0xff); + __m256 distancevf = _mm256_add_ps(distancesum_0, distancesum_1); - //uper - __m256 usax_breakpoints_shiftv_0 =_mm256_i32gather_ps (sax_breakpoints,region_upperv_0, 4); - //__m256 usax_breakpoints_shiftv_0= _mm256_set_ps (sax_breakpoints[region_upper[7]], - //sax_breakpoints[region_upper[6]], - //sax_breakpoints[region_upper[5]], - //sax_breakpoints[region_upper[4]], - //sax_breakpoints[region_upper[3]], - //sax_breakpoints[region_upper[2]], - //sax_breakpoints[region_upper[1]], - //sax_breakpoints[region_upper[0]]); - __m256 usax_breakpoints_shiftv_1 =_mm256_i32gather_ps (sax_breakpoints,region_upperv_1, 4); - //__m256 usax_breakpoints_shiftv_1= _mm256_set_ps (sax_breakpoints[region_upper[15]], - //sax_breakpoints[region_upper[14]], - //sax_breakpoints[region_upper[13]], - //sax_breakpoints[region_upper[12]], - //sax_breakpoints[region_upper[11]], - //sax_breakpoints[region_upper[10]], - //sax_breakpoints[region_upper[9]], - //sax_breakpoints[region_upper[8]]); - - - __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32 (region_upperv_0, _mm256_set1_epi32 (max_cardinality - 1)); - __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32 (region_upperv_1, _mm256_set1_epi32 (max_cardinality - 1)); - - __m256i upper_juge_nmaxv_0 = _mm256_andnot_si256 (upper_juge_maxv_0, vectorsignbit); - __m256i upper_juge_nmaxv_1 = _mm256_andnot_si256 (upper_juge_maxv_1, vectorsignbit); - - __m256 breakpoint_upperv_0 = (__m256)_mm256_or_si256 (_mm256_and_si256(upper_juge_maxv_0,(__m256i)_mm256_set1_ps (max_val)),_mm256_and_si256(upper_juge_nmaxv_0,(__m256i)usax_breakpoints_shiftv_0)); - __m256 breakpoint_upperv_1 = (__m256)_mm256_or_si256 (_mm256_and_si256(upper_juge_maxv_1,(__m256i)_mm256_set1_ps (max_val)),_mm256_and_si256(upper_juge_nmaxv_1,(__m256i)usax_breakpoints_shiftv_1)); - - - - - - - - //dis - __m256 paaUv_0,paaUv_1,paaLv_0,paaLv_1; - - - - ///paav_0 =_mm256_loadu_ps (paa); - // paav_1 =_mm256_loadu_ps (&(paa[8])); - paaUv_0 =_mm256_loadu_ps (paaU); - paaUv_1 =_mm256_loadu_ps (&(paaU[8])); - paaLv_0 =_mm256_loadu_ps (paaL); - paaLv_1 =_mm256_loadu_ps (&(paaL[8])); - - - __m256 dis_juge_upv_0=_mm256_cmp_ps (breakpoint_lowerv_0, paaUv_0, _CMP_GT_OS); - __m256 dis_juge_upv_1=_mm256_cmp_ps (breakpoint_lowerv_1, paaUv_1, _CMP_GT_OS); - - __m256 dis_juge_lov_0=_mm256_cmp_ps (breakpoint_upperv_0, paaLv_0, _CMP_LT_OS); - __m256 dis_juge_lov_1=_mm256_cmp_ps (breakpoint_upperv_1, paaLv_1, _CMP_LT_OS); - - - - //__m256 dis_juge_lov_0=(__m256)_mm256_and_si256 ((__m256i)_mm256_cmp_ps (breakpoint_lowerv_0, paaUv_0, _CMP_NGT_US),(__m256i)_mm256_cmp_ps (breakpoint_upperv_0, paav_0, _CMP_LT_OS)) ; - //__m256 dis_juge_lov_1=(__m256)_mm256_and_si256 ((__m256i)_mm256_cmp_ps (breakpoint_lowerv_1, paaUv_1, _CMP_NGT_US),(__m256i)_mm256_cmp_ps (breakpoint_upperv_1, paav_1, _CMP_LT_OS)); - - __m256 dis_juge_elv_0=(__m256)_mm256_andnot_si256 (_mm256_or_si256 ((__m256i)dis_juge_upv_0, (__m256i)dis_juge_lov_0),vectorsignbit); - __m256 dis_juge_elv_1=(__m256)_mm256_andnot_si256 (_mm256_or_si256 ((__m256i)dis_juge_upv_1, (__m256i)dis_juge_lov_1),vectorsignbit); - - __m256 dis_lowv_0 =_mm256_sub_ps (breakpoint_lowerv_0, paaUv_0); - __m256 dis_lowv_1 =_mm256_sub_ps (breakpoint_lowerv_1, paaUv_1); - __m256 dis_uppv_0 =_mm256_sub_ps (breakpoint_upperv_0, paaLv_0); - __m256 dis_uppv_1 =_mm256_sub_ps (breakpoint_upperv_1, paaLv_1); + _mm256_storeu_ps(distancef, distancevf); + return (distancef[0] + distancef[4]) * ratio_sqrt; +} - __m256 distancev_0=(__m256)_mm256_or_si256(_mm256_or_si256(_mm256_and_si256((__m256i)dis_juge_upv_0,(__m256i)dis_lowv_0),_mm256_and_si256((__m256i)dis_juge_lov_0,(__m256i)dis_uppv_0)),_mm256_and_si256((__m256i)dis_juge_elv_0,(__m256i)_mm256_set1_ps (0.0))); - __m256 distancev_1=(__m256)_mm256_or_si256(_mm256_or_si256(_mm256_and_si256((__m256i)dis_juge_upv_1,(__m256i)dis_lowv_1),_mm256_and_si256((__m256i)dis_juge_lov_1,(__m256i)dis_uppv_1)),_mm256_and_si256((__m256i)dis_juge_elv_1,(__m256i)_mm256_set1_ps (0.0))); +// lb_ keogh, given a query series (ordered) with its lower - upper lemire envelope +// it computes the lb of the dtw. Moreover it keeps the comulative bound, which is then used for early abandoning the computation +float lb_keogh_cumulative_norm(float *qs, float *uo, float *lo, float *cb, + int len, float mean, float std, float best_so_far) { + float lb = 0; + float x; + float d; + int i; - __m256 distancesum_0 = _mm256_dp_ps (distancev_0, distancev_0, 0xff); - __m256 distancesum_1 = _mm256_dp_ps (distancev_1, distancev_1, 0xff); - __m256 distancevf = _mm256_add_ps (distancesum_0, distancesum_1); - //__m256 distancev2 = _mm256_hadd_ps (distancev, distancev); - //__m256 distancevf = _mm256_hadd_ps (distancev2, distancev2); - //__m256 _mm256_dp_ps (__m256 a, __m256 b, const int imm8); + for (i = 0; i < len && lb < best_so_far; i++) { + x = qs[(i)]; + d = 0; - _mm256_storeu_ps (distancef ,distancevf); - //_mm256_storeu_ps (&checkvalue[8] ,distancev_1); + if (x > uo[i]) { + d = dist(x, uo[i]); + } else if (x < lo[i]) { + d = dist(x, lo[i]); + } + lb += d; + cb[i] = d; + } - return (distancef[0]+distancef[4])*ratio_sqrt ; + return lb; } +float lb_keogh_data_bound(float* qo, float* tu, float* tl, float* cb, int len, float bsf) { + float lb = 0; + float uu = 0; + float ll = 0; + float d = 0; + int i = 0; + + int len1 = (len / 8) * 8; + __m256 tu256, tl256, cb256, Q, calc1, calc2; + __m128 temp1, temp2; + float *cbtmp = malloc(sizeof(float) * 8); + + for (i = 0; i < len1 && lb < bsf; i += 8) { + Q = _mm256_loadu_ps(&qo[i]); + tu256 = _mm256_loadu_ps(&tu[i]); + tl256 = _mm256_loadu_ps(&tl[i]); + calc1 = _mm256_min_ps(Q, tu256); + calc1 = _mm256_sub_ps(Q, calc1); + + calc2 = _mm256_max_ps(Q, tl256); + calc2 = _mm256_sub_ps(calc2, Q); + calc1 = _mm256_add_ps(calc1, calc2); + + calc1 = _mm256_mul_ps(calc1, calc1); + + _mm256_storeu_ps(cbtmp, calc1); + + calc1 = _mm256_hadd_ps(calc1, calc1); + calc1 = _mm256_hadd_ps(calc1, calc1); + temp1 = _mm256_extractf128_ps(calc1, 1); + temp2 = _mm_add_ss(_mm256_castps256_ps128(calc1), temp1); + lb += _mm_cvtss_f32(temp2); + + cb[i] = cbtmp[0]; + cb[i + 1] = cbtmp[1]; + cb[i + 2] = cbtmp[2]; + cb[i + 3] = cbtmp[3]; + cb[i + 4] = cbtmp[4]; + cb[i + 5] = cbtmp[5]; + cb[i + 6] = cbtmp[6]; + cb[i + 7] = cbtmp[7]; + } + for (; i < len && lb < bsf; i++) { + uu = tu[i]; + ll = tl[i]; + d = 0; + if (qo[i] > uu) { + d = dist(qo[i], uu); + } else if (qo[i] < ll) { + d = dist(qo[i], ll); + } -// lb_ keogh, given a query series (ordered) with its lower - upper lemire envelope -// it computes the lb of the dtw. Moreover it keeps the comulative bound, which is then used for early abandoning the computation - -float lb_keogh_cumulative_norm(float *qs, float *uo, float *lo, float *cb,int len, float mean, float std, float best_so_far) -{ - float lb = 0; - float x, d; - int i; - for (i = 0; i < len && lb < best_so_far; i++) - { - x = qs[(i)]; - d = 0; - if (x > uo[i]) - d = dist(x,uo[i]); - else if(x < lo[i]) - d = dist(x,lo[i]); lb += d; cb[i] = d; } - return lb; -} -float lb_keogh_data_bound( float* qo,float* tu, float* tl, float* cb, int len, float bsf) -{ - float lb = 0; - float uu=0,ll=0,d=0; - int i=0; - - int len1 = (len/8)*8; - __m256 tu256, tl256, cb256, Q, calc1, calc2; - __m128 temp1, temp2; - float *cbtmp = malloc(sizeof(float)*8); - - for(i=0; i uu) - { - d = dist(qo[i],uu); - } - else if(qo[i] < ll) - { - d = dist(qo[i],ll); - } - lb += d; - cb[i] = d; - } - - free( cbtmp); - return lb; + free(cbtmp); + + return lb; } diff --git a/src/ads/calc_utils.c b/src/ads/calc_utils.c index c8aa9f8a..f4c79a11 100644 --- a/src/ads/calc_utils.c +++ b/src/ads/calc_utils.c @@ -3,32 +3,131 @@ #include #include "math.h" +#if defined(__x86_64__) +#include "immintrin.h" +#endif #include "ads/calc_utils.h" - ////// Utility functions //// // Function to calculate mean of an array of floats float calculateMean(ts_type *data, int n) { float sum = 0.0; + for (int i = 0; i < n; i++) { sum += data[i]; } + return sum / n; } +#if defined(__x86_64__) +float calculateMean_SIMD(ts_type *data, int n) { + float sum = 0.0; + float sum_a[8]; + __m256 sum_v = _mm256_setzero_ps(); + + int i = 0; + + for (; i < n - (n % 8); i += 8) { + sum_v = _mm256_add_ps(_mm256_loadu_ps(&data[i]), sum_v); + } + + _mm256_storeu_ps(sum_a, sum_v); + sum = sum_a[0] + sum_a[1] + sum_a[2] + sum_a[3] + sum_a[4] + sum_a[5] + sum_a[6] + sum_a[7]; + + for (; i < n; i++) { + sum += data[i]; + } + + return sum / n; +} +#endif + // Function to calculate standard deviation of an array of floats float calculateStdDev(ts_type *data, int n, ts_type mean) { ts_type sumSquaredDiffs = 0.0; + for (int i = 0; i < n; i++) { sumSquaredDiffs += (data[i] - mean) * (data[i] - mean); } + + return sqrt(sumSquaredDiffs / n); +} + +#if defined(__x86_64__) +float calculateStdDev_SIMD(ts_type *data, int n, ts_type mean) { + ts_type sumSquaredDiffs = 0.0; + int i = 0; + + __m256 datavec; + __m256 meanvec = _mm256_set1_ps(mean); + __m256 squaredDiffVec = _mm256_setzero_ps(); + float sumSquaredDiffVec[8]; + + for (; i < n - (n % 8); i += 8) { + datavec = _mm256_loadu_ps(&data[i]); + datavec = _mm256_sub_ps(datavec, meanvec); + squaredDiffVec = _mm256_fmadd_ps(datavec, datavec, squaredDiffVec); + } + + squaredDiffVec = _mm256_hadd_ps(squaredDiffVec, squaredDiffVec); + _mm256_storeu_ps(sumSquaredDiffVec, + _mm256_hadd_ps(squaredDiffVec, squaredDiffVec)); + sumSquaredDiffs = sumSquaredDiffVec[0] + sumSquaredDiffVec[4]; + + for (; i < n; i++) { + sumSquaredDiffs += (data[i] - mean) * (data[i] - mean); + } + return sqrt(sumSquaredDiffs / n); } +#endif + +#if defined(__x86_64__) +__attribute__((target("avx512f"))) +float calculateStdDev_SIMD512F(ts_type *data, int n, ts_type mean) { + ts_type sumSquaredDiffs = 0.0; + int i = 0; + + __m512 datavec_v; + __m512 meanvec_v = _mm512_set1_ps(mean); + __m512 squaredDiffVec_v = _mm512_setzero_ps(); + + for (; i < n - (n % 16); i += 16) { + datavec_v = _mm512_loadu_ps(&data[i]); + datavec_v = _mm512_sub_ps(datavec_v, meanvec_v); + squaredDiffVec_v = _mm512_fmadd_ps(datavec_v, datavec_v, squaredDiffVec_v); + } + + sumSquaredDiffs = _mm512_reduce_add_ps(squaredDiffVec_v); + + __m256 datavec; + __m256 meanvec = _mm256_set1_ps(mean); + __m256 squaredDiffVec = _mm256_setzero_ps(); + float sumSquaredDiffVec[8]; + + for (; i < n - (n % 8); i += 8) { + datavec = _mm256_loadu_ps(&data[i]); + datavec = _mm256_sub_ps(datavec, meanvec); + squaredDiffVec = _mm256_fmadd_ps(datavec, datavec, squaredDiffVec); + } + + squaredDiffVec = _mm256_hadd_ps(squaredDiffVec, squaredDiffVec); + _mm256_storeu_ps(sumSquaredDiffVec, + _mm256_hadd_ps(squaredDiffVec, squaredDiffVec)); + sumSquaredDiffs += sumSquaredDiffVec[0] + sumSquaredDiffVec[4]; + + for (; i < n; i++) { + sumSquaredDiffs += (data[i] - mean) * (data[i] - mean); + } + + return sqrt(sumSquaredDiffs / n); +} +#endif // Function to perform zero mean normalization void znorm(ts_type *data, int n) { - // printf("No nor applied"); // Calculate mean ts_type mean = calculateMean(data, n); @@ -43,4 +142,68 @@ void znorm(ts_type *data, int n) { for (int i = 0; i < n; i++) { data[i] = (data[i] - mean) / stdDev; } -} \ No newline at end of file +} + +#if defined(__x86_64__) +void znorm_SIMD(ts_type *data, int n) { + // Calculate mean + ts_type mean = calculateMean_SIMD(data, n); + + // Calculate standard deviation + ts_type stdDev = calculateStdDev_SIMD(data, n, mean); + + // Normalize each data point + if (stdDev < 1e-8) { + stdDev = 1.0; + } + + int i = 0; + + __m256 stdDev_v = _mm256_set1_ps(stdDev); + __m256 mean_v = _mm256_set1_ps(mean); + + for (; i < n - (n % 8); i += 8) { + _mm256_storeu_ps(&data[i], _mm256_div_ps(_mm256_sub_ps(_mm256_loadu_ps(&data[i]), mean_v), stdDev_v)); + } + + for (; i < n; i++) { + data[i] = (data[i] - mean) / stdDev; + } +} +#endif + +#if defined(__x86_64__) +__attribute__((target("avx512f"))) +void znorm_SIMD512F(ts_type *data, int n) { + // Calculate mean + ts_type mean = calculateMean_SIMD(data, n); + + // Calculate standard deviation + ts_type stdDev = calculateStdDev_SIMD512F(data, n, mean); + + // Normalize each data point + if (stdDev < 1e-8) { + stdDev = 1.0; + } + + int i = 0; + + __m512 stdDev_vv = _mm512_set1_ps(stdDev); + __m512 mean_vv = _mm512_set1_ps(mean); + + for (; i < n - (n % 16); i += 16) { + _mm512_storeu_ps(&data[i], _mm512_div_ps(_mm512_sub_ps(_mm512_loadu_ps(&data[i]), mean_vv), stdDev_vv)); + } + + __m256 stdDev_v = _mm256_set1_ps(stdDev); + __m256 mean_v = _mm256_set1_ps(mean); + + for (; i < n - (n % 8); i += 8) { + _mm256_storeu_ps(&data[i], _mm256_div_ps(_mm256_sub_ps(_mm256_loadu_ps(&data[i]), mean_v), stdDev_v)); + } + + for (; i < n; i++) { + data[i] = (data[i] - mean) / stdDev; + } +} +#endif diff --git a/src/ads/inmemory_index_engine.c b/src/ads/inmemory_index_engine.c index a0689b59..0ac5831d 100644 --- a/src/ads/inmemory_index_engine.c +++ b/src/ads/inmemory_index_engine.c @@ -12,6 +12,9 @@ #include #include #include +#if defined(__x86_64__) +#include "immintrin.h" +#endif #include "ads/isax_query_engine.h" #include "ads/calc_utils.h" #include "ads/inmemory_index_engine.h" @@ -24,17 +27,19 @@ #include "ads/isax_node_split.h" #include "ads/sfa/dft.h" - void index_generate_inmemory(const char *ifilename, long int ts_num, isax_index *index) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE *ifile; COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -42,48 +47,67 @@ void index_generate_inmemory(const char *ifilename, long int ts_num, isax_index if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } long int ts_loaded = 0; - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - file_position_type *pos = malloc(sizeof(file_position_type)); - index->settings->raw_filename = malloc(256); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START int read_number = fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); COUNT_INPUT_TIME_END COUNT_OUTPUT_TIME_START - while (ts_loaded < ts_num) { - - *pos = (file_position_type) (ts_loaded * index->settings->timeseries_size); - //printf("the position is: %lld\n",*pos); - memcpy(ts, &(rawfile[ts_loaded * index->settings->timeseries_size]), - sizeof(float) * index->settings->timeseries_size); +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + while (ts_loaded < ts_num) { + memcpy(ts, &(rawfile[ts_loaded * index->settings->timeseries_size]), + sizeof(float) * index->settings->timeseries_size); + + if (sax_from_ts_SIMD(ts, sax, index->settings->ts_values_per_paa_segment, + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality) == SUCCESS) { + memcpy(&(index->sax_cache[ts_loaded * index->settings->paa_segments]), sax, + sizeof(sax_type) * index->settings->paa_segments); + isax_fbl_index_insert_inmemory(index, sax, pos); + ts_loaded++; + } else { + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); + } + } + } else { +#endif + while (ts_loaded < ts_num) { + memcpy(ts, &(rawfile[ts_loaded * index->settings->timeseries_size]), + sizeof(float) * index->settings->timeseries_size); - if (sax_from_ts(ts, sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) { - memcpy(&(index->sax_cache[ts_loaded * index->settings->paa_segments]), sax, - sizeof(sax_type) * index->settings->paa_segments); - isax_fbl_index_insert_inmemory(index, sax, pos); - ts_loaded++; - } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + if (sax_from_ts(ts, sax, index->settings->ts_values_per_paa_segment, + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { + memcpy(&(index->sax_cache[ts_loaded * index->settings->paa_segments]), sax, + sizeof(sax_type) * index->settings->paa_segments); + isax_fbl_index_insert_inmemory(index, sax, pos); + ts_loaded++; + } else { + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); + } } +#if defined(__x86_64__) } +#endif + free(ts); free(sax); free(pos); fclose(ifile); fprintf(stderr, ">>> Finished indexing\n"); - //printf(" the sax point is %d\n",index->first_node->isax_cardinalities[0]); COUNT_OUTPUT_TIME_END } @@ -93,10 +117,13 @@ void index_generate_inmemory_m(const char *ifilename, long int ts_num, isax_inde COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -104,35 +131,37 @@ void index_generate_inmemory_m(const char *ifilename, long int ts_num, isax_inde if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + index->sax_file = NULL; long int ts_loaded = 0; int i; pthread_t threadid[maxquerythread]; - buffer_data_inmemory *input_data = malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); - - - index->settings->raw_filename = malloc(256); + buffer_data_inmemory *input_data = (buffer_data_inmemory*)malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START int read_number = fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); COUNT_INPUT_TIME_END - pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER, lockfbl = PTHREAD_MUTEX_INITIALIZER, lock_index = PTHREAD_MUTEX_INITIALIZER, - lock_firstnode = PTHREAD_MUTEX_INITIALIZER, lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t *lockcbl; // set the thread on decided cpu COUNT_OUTPUT_TIME_START - lockcbl = malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); for (i = 0; i < LOCK_SIZE; i++) { pthread_mutex_init(&lockcbl[i], NULL); } - for (i = 0; i < maxquerythread; i++) { input_data[i].index = index; input_data[i].lock_fbl = &lockfbl; @@ -148,18 +177,20 @@ void index_generate_inmemory_m(const char *ifilename, long int ts_num, isax_inde input_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (ts_num / maxquerythread); input_data[maxquerythread - 1].stop_number = ts_num; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, indexbulkloadingworker_inmemory, (void *) &(input_data[i])); } - //wait for the finish of other threads + + // wait for the finish of other threads for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } + fclose(ifile); fprintf(stderr, ">>> Finished indexing\n"); free(lockcbl); free(input_data); - //printf(" the sax point is %d\n",index->first_node->isax_cardinalities[0]); COUNT_OUTPUT_TIME_END } @@ -169,10 +200,13 @@ void index_creation_m(const char *ifilename, long int ts_num, isax_index *index) COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -180,31 +214,35 @@ void index_creation_m(const char *ifilename, long int ts_num, isax_index *index) if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + index->sax_file = NULL; long int ts_loaded = 0; - int i, node_counter = 0; + int i; + int node_counter = 0; pthread_t threadid[maxquerythread]; - buffer_data_inmemory *input_data = malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); - - - index->settings->raw_filename = malloc(256); + buffer_data_inmemory *input_data = (buffer_data_inmemory*)malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START int read_number = fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); COUNT_INPUT_TIME_END - pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER, lockfbl = PTHREAD_MUTEX_INITIALIZER, lock_index = PTHREAD_MUTEX_INITIALIZER, - lock_firstnode = PTHREAD_MUTEX_INITIALIZER, lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t *lockcbl; pthread_barrier_t lock_barrier1; pthread_barrier_init(&lock_barrier1, NULL, maxquerythread); - // set the thread on decided cpu - lockcbl = malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + // set the thread on decided cpu + lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); for (i = 0; i < LOCK_SIZE; i++) { pthread_mutex_init(&lockcbl[i], NULL); @@ -212,7 +250,6 @@ void index_creation_m(const char *ifilename, long int ts_num, isax_index *index) COUNT_OUTPUT_TIME_START - for (i = 0; i < maxquerythread; i++) { input_data[i].index = index; input_data[i].lock_fbl = &lockfbl; @@ -230,19 +267,21 @@ void index_creation_m(const char *ifilename, long int ts_num, isax_index *index) input_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (ts_num / maxquerythread); input_data[maxquerythread - 1].stop_number = ts_num; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, index_creation_worker_inmemory, (void *) &(input_data[i])); } - //wait for the finish of other threads + + // wait for the finish of other threads for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } + fclose(ifile); fprintf(stderr, ">>> Finished indexing\n"); free(lockcbl); free(input_data); pthread_barrier_destroy(&lock_barrier1); - //printf(" the sax point is %d\n",index->first_node->isax_cardinalities[0]); COUNT_OUTPUT_TIME_END } @@ -252,10 +291,13 @@ void index_creation_m_new(const char *ifilename, long int ts_num, isax_index *in COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -263,31 +305,35 @@ void index_creation_m_new(const char *ifilename, long int ts_num, isax_index *in if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + index->sax_file = NULL; unsigned long shared_start_number = 0; long int ts_loaded = 0; - int i, node_counter = 0; + int i; + int node_counter = 0; pthread_t threadid[maxquerythread]; - buffer_data_inmemory *input_data = malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); - - - index->settings->raw_filename = malloc(256); + buffer_data_inmemory *input_data = (buffer_data_inmemory*)malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START int read_number = fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); COUNT_INPUT_TIME_END - pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER, lockfbl = PTHREAD_MUTEX_INITIALIZER, lock_index = PTHREAD_MUTEX_INITIALIZER, - lock_firstnode = PTHREAD_MUTEX_INITIALIZER, lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t *lockcbl; pthread_barrier_t lock_barrier1; pthread_barrier_init(&lock_barrier1, NULL, maxquerythread); - // set the thread on decided cpu - lockcbl = malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + // set the thread on decided cpu + lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); for (i = 0; i < LOCK_SIZE; i++) { pthread_mutex_init(&lockcbl[i], NULL); @@ -295,7 +341,6 @@ void index_creation_m_new(const char *ifilename, long int ts_num, isax_index *in COUNT_OUTPUT_TIME_START - for (i = 0; i < maxquerythread; i++) { input_data[i].index = index; input_data[i].lock_fbl = &lockfbl; @@ -310,36 +355,38 @@ void index_creation_m_new(const char *ifilename, long int ts_num, isax_index *in input_data[i].node_counter = &node_counter; input_data[i].lock_barrier1 = &lock_barrier1; input_data[i].shared_start_number = &shared_start_number; - } for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, index_creation_worker_inmemory_new, (void *) &(input_data[i])); } - //wait for the finish of other threads + + // wait for the finish of other threads for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } + fclose(ifile); fprintf(stderr, ">>> Finished indexing\n"); free(lockcbl); free(input_data); pthread_barrier_destroy(&lock_barrier1); - //printf(" the sax point is %d\n",index->first_node->isax_cardinalities[0]); COUNT_OUTPUT_TIME_END } - void index_creation_m2(const char *ifilename, long int ts_num, isax_index *index) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE *ifile; COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -347,28 +394,33 @@ void index_creation_m2(const char *ifilename, long int ts_num, isax_index *index if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + index->sax_file = NULL; long int ts_loaded = 0; - int i, node_counter = 0; + int i; + int node_counter = 0; pthread_t threadid[maxquerythread]; - buffer_data_inmemory *input_data = malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); - - - index->settings->raw_filename = malloc(256); + buffer_data_inmemory *input_data = (buffer_data_inmemory*)malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START int read_number = fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); COUNT_INPUT_TIME_END - pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER, lockfbl = PTHREAD_MUTEX_INITIALIZER, lock_index = PTHREAD_MUTEX_INITIALIZER, - lock_firstnode = PTHREAD_MUTEX_INITIALIZER, lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t *lockcbl; pthread_barrier_t lock_barrier1; pthread_barrier_init(&lock_barrier1, NULL, maxquerythread); + // set the thread on decided cpu destroy_fbl(index->fbl); index->fbl = (first_buffer_layer *) initialize_simrec(index->settings->initial_fbl_buffer_size, @@ -376,7 +428,7 @@ void index_creation_m2(const char *ifilename, long int ts_num, isax_index *index index->settings->max_total_buffer_size + DISK_BUFFER_SIZE * (PROGRESS_CALCULATE_THREAD_NUMBER - 1), index); - lockcbl = malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); for (i = 0; i < LOCK_SIZE; i++) { pthread_mutex_init(&lockcbl[i], NULL); @@ -393,52 +445,38 @@ void index_creation_m2(const char *ifilename, long int ts_num, isax_index *index index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality, index->settings->timeseries_size) == SUCCESS) { - //file_position_type *pos = (file_position_type)(j*index->settings->timeseries_size); - //memcpy(&(index->sax_cache[j*index->settings->paa_segments]),sax, sizeof(sax_type)* index->settings->paa_segments); - //memcpy(&(index->sax_cache[j*index->settings->paa_segments]),sax, sizeof(sax_type)* index->settings->paa_segments); - root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); - //printf("the number is fjlweoifwjioefwjioe %d \n",(int)first_bit_mask); - //fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2* (index->fbl->soft_buffers)[(int) first_bit_mask]; - fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 * )( + fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 *)( index->fbl))->soft_buffers[(int) first_bit_mask]; - - //current_buffer->initialized = 1; - //current_buffer->max_buffer_size; __sync_fetch_and_add(&(current_buffer->max_buffer_size), 1); - } } #pragma omp parallel for num_threads(maxquerythread) - for (int i = 0; i < ((first_buffer_layer2 * )(index->fbl))->number_of_buffers; i++) { - fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 * )(index->fbl))->soft_buffers[i]; + for (int i = 0; i < ((first_buffer_layer2 *)(index->fbl))->number_of_buffers; i++) { + fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 *)(index->fbl))->soft_buffers[i]; + if (current_buffer->max_buffer_size != 0) { current_buffer->initialized = 1; - - current_buffer->pos_records = malloc(sizeof(file_position_type) * + current_buffer->pos_records = (file_position_type*)malloc(sizeof(file_position_type) * current_buffer->max_buffer_size); current_buffer->node = isax_root_node_init((root_mask_type) i, index->settings->initial_leaf_buffer_size); current_buffer->node->is_leaf = 1; } - } - #pragma omp parallel for num_threads(maxquerythread) for (unsigned long j = 0; j < ts_num; j++) { root_mask_type first_bit_mask = 0x00; sax_type *sax = &(index->sax_cache[j * index->settings->paa_segments]); - CREATE_MASK(first_bit_mask, index, sax); - fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 * )(index->fbl))->soft_buffers[(int) first_bit_mask]; + fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 *)(index->fbl))->soft_buffers[(int) first_bit_mask]; int buffersize = __sync_fetch_and_add(&(current_buffer->buffer_size), 1); current_buffer->pos_records[buffersize] = (file_position_type) (j * index->settings->timeseries_size); } - for (i = 0; i < maxquerythread; i++) { input_data[i].index = index; input_data[i].lock_fbl = &lockfbl; @@ -456,19 +494,21 @@ void index_creation_m2(const char *ifilename, long int ts_num, isax_index *index input_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (ts_num / maxquerythread); input_data[maxquerythread - 1].stop_number = ts_num; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, index_creation_worker2_inmemory, (void *) &(input_data[i])); } - //wait for the finish of other threads + + // wait for the finish of other threads for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } + fclose(ifile); fprintf(stderr, ">>> Finished indexing\n"); free(lockcbl); free(input_data); pthread_barrier_destroy(&lock_barrier1); - //printf(" the sax point is %d\n",index->first_node->isax_cardinalities[0]); COUNT_OUTPUT_TIME_END } @@ -478,10 +518,13 @@ void index_creation_gpu(const char *ifilename, long int ts_num, isax_index *inde COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -489,36 +532,41 @@ void index_creation_gpu(const char *ifilename, long int ts_num, isax_index *inde if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + index->sax_file = NULL; long int ts_loaded = 0; - int i, node_counter = 0; + int i; + int node_counter = 0; pthread_t threadid[maxquerythread]; - buffer_data_inmemory *input_data = malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); - - - index->settings->raw_filename = malloc(256); + buffer_data_inmemory *input_data = (buffer_data_inmemory*)malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START int read_number = fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); COUNT_INPUT_TIME_END - pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER, lockfbl = PTHREAD_MUTEX_INITIALIZER, lock_index = PTHREAD_MUTEX_INITIALIZER, - lock_firstnode = PTHREAD_MUTEX_INITIALIZER, lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t *lockcbl; pthread_barrier_t lock_barrier1; pthread_barrier_init(&lock_barrier1, NULL, maxquerythread); + // set the thread on decided cpu destroy_fbl(index->fbl); - index->fbl = (first_buffer_layer *) initialize_simrec(index->settings->initial_fbl_buffer_size, + index->fbl = (first_buffer_layer*) initialize_simrec(index->settings->initial_fbl_buffer_size, pow(2, index->settings->paa_segments), index->settings->max_total_buffer_size + DISK_BUFFER_SIZE * (PROGRESS_CALCULATE_THREAD_NUMBER - 1), index); - lockcbl = malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); for (i = 0; i < LOCK_SIZE; i++) { pthread_mutex_init(&lockcbl[i], NULL); @@ -535,32 +583,23 @@ void index_creation_gpu(const char *ifilename, long int ts_num, isax_index *inde index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality, index->settings->timeseries_size) == SUCCESS) { - //file_position_type *pos = (file_position_type)(j*index->settings->timeseries_size); - //memcpy(&(index->sax_cache[j*index->settings->paa_segments]),sax, sizeof(sax_type)* index->settings->paa_segments); - //memcpy(&(index->sax_cache[j*index->settings->paa_segments]),sax, sizeof(sax_type)* index->settings->paa_segments); - root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); - //printf("the number is fjlweoifwjioefwjioe %d \n",(int)first_bit_mask); - //fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2* (index->fbl->soft_buffers)[(int) first_bit_mask]; - fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 * )( + fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 *)( index->fbl))->soft_buffers[(int) first_bit_mask]; - - //current_buffer->initialized = 1; - //current_buffer->max_buffer_size; __sync_fetch_and_add(&(current_buffer->max_buffer_size), 1); - } } #pragma omp parallel for num_threads(maxquerythread) for (int i = 0; i < ((first_buffer_layer2 * )(index->fbl))->number_of_buffers; i++) { - fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 * )(index->fbl))->soft_buffers[i]; + fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 *)(index->fbl))->soft_buffers[i]; + if (current_buffer->max_buffer_size != 0) { current_buffer->initialized = 1; - current_buffer->sax_records = malloc(sizeof(sax_type) * index->settings->paa_segments * + current_buffer->sax_records = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * current_buffer->max_buffer_size); - current_buffer->pos_records = malloc(sizeof(file_position_type) * + current_buffer->pos_records = (file_position_type*)malloc(sizeof(file_position_type) * current_buffer->max_buffer_size); current_buffer->node = isax_root_node_init((root_mask_type) i, index->settings->initial_leaf_buffer_size); @@ -568,19 +607,18 @@ void index_creation_gpu(const char *ifilename, long int ts_num, isax_index *inde } } - #pragma omp parallel for num_threads(maxquerythread) for (unsigned long j = 0; j < ts_num; j++) { root_mask_type first_bit_mask = 0x00; sax_type *sax = &(index->sax_cache[j * index->settings->paa_segments]); - CREATE_MASK(first_bit_mask, index, sax); - fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 * )(index->fbl))->soft_buffers[(int) first_bit_mask]; + fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 *)(index->fbl))->soft_buffers[(int) first_bit_mask]; int buffersize = __sync_fetch_and_add(&(current_buffer->buffer_size), 1); memcpy(¤t_buffer->sax_records[buffersize * index->settings->paa_segments], sax, sizeof(sax_type) * index->settings->paa_segments); current_buffer->pos_records[buffersize] = (file_position_type) (j * index->settings->timeseries_size); } + for (i = 0; i < maxquerythread; i++) { input_data[i].index = index; input_data[i].lock_fbl = &lockfbl; @@ -598,20 +636,22 @@ void index_creation_gpu(const char *ifilename, long int ts_num, isax_index *inde input_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (ts_num / maxquerythread); input_data[maxquerythread - 1].stop_number = ts_num; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, index_creation_worker2_inmemory, (void *) &(input_data[i])); } - //wait for the finish of other threads + + // wait for the finish of other threads for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } + index->sax_cache_size = ts_num; fclose(ifile); fprintf(stderr, ">>> Finished indexing\n"); free(lockcbl); free(input_data); pthread_barrier_destroy(&lock_barrier1); - //printf(" the sax point is %d\n",index->first_node->isax_cardinalities[0]); COUNT_OUTPUT_TIME_END } @@ -621,10 +661,13 @@ void index_creation_mix(const char *ifilename, long int ts_num, isax_index *inde COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -632,31 +675,35 @@ void index_creation_mix(const char *ifilename, long int ts_num, isax_index *inde if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + index->sax_file = NULL; long int ts_loaded = 0; - int i, node_counter = 0; + int i; + int node_counter = 0; pthread_t threadid[maxquerythread]; - buffer_data_inmemory *input_data = malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); - - - index->settings->raw_filename = malloc(256); + buffer_data_inmemory *input_data = (buffer_data_inmemory*)malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START int read_number = fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); COUNT_INPUT_TIME_END - pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER, lockfbl = PTHREAD_MUTEX_INITIALIZER, lock_index = PTHREAD_MUTEX_INITIALIZER, - lock_firstnode = PTHREAD_MUTEX_INITIALIZER, lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t *lockcbl; pthread_barrier_t lock_barrier1; pthread_barrier_init(&lock_barrier1, NULL, maxquerythread); - // set the thread on decided cpu - lockcbl = malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + // set the thread on decided cpu + lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); for (i = 0; i < LOCK_SIZE; i++) { pthread_mutex_init(&lockcbl[i], NULL); @@ -664,7 +711,6 @@ void index_creation_mix(const char *ifilename, long int ts_num, isax_index *inde COUNT_OUTPUT_TIME_START - for (i = 0; i < maxquerythread; i++) { input_data[i].index = index; input_data[i].lock_fbl = &lockfbl; @@ -682,19 +728,21 @@ void index_creation_mix(const char *ifilename, long int ts_num, isax_index *inde input_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (ts_num / maxquerythread); input_data[maxquerythread - 1].stop_number = ts_num; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, index_creation_mix_worker_inmemory, (void *) &(input_data[i])); } - //wait for the finish of other threads + + // wait for the finish of other threads for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } + fclose(ifile); fprintf(stderr, ">>> Finished indexing\n"); free(lockcbl); free(input_data); pthread_barrier_destroy(&lock_barrier1); - //printf(" the sax point is %d\n",index->first_node->isax_cardinalities[0]); COUNT_OUTPUT_TIME_END } @@ -704,10 +752,13 @@ void index_generate_inmemory_pRecBuf(const char *ifilename, long int ts_num, isa COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -715,25 +766,28 @@ void index_generate_inmemory_pRecBuf(const char *ifilename, long int ts_num, isa if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + index->sax_file = NULL; long int ts_loaded = 0; int i; pthread_t threadid[maxquerythread]; - buffer_data_inmemory *input_data = malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); - - - index->settings->raw_filename = malloc(256); + buffer_data_inmemory *input_data = (buffer_data_inmemory*)malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START int read_number = fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); COUNT_INPUT_TIME_END - pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER, lockfbl = PTHREAD_MUTEX_INITIALIZER, lock_index = PTHREAD_MUTEX_INITIALIZER, - lock_firstnode = PTHREAD_MUTEX_INITIALIZER, lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; destroy_fbl(index->fbl); index->fbl = (first_buffer_layer *) initialize_pRecBuf(index->settings->initial_fbl_buffer_size, @@ -741,13 +795,10 @@ void index_generate_inmemory_pRecBuf(const char *ifilename, long int ts_num, isa index->settings->max_total_buffer_size + DISK_BUFFER_SIZE * (PROGRESS_CALCULATE_THREAD_NUMBER - 1), index); - // set the thread on decided cpu - - + // set the thread on decided cpu COUNT_OUTPUT_TIME_START - for (i = 0; i < maxquerythread; i++) { input_data[i].index = index; input_data[i].lock_fbl = &lockfbl; @@ -764,19 +815,21 @@ void index_generate_inmemory_pRecBuf(const char *ifilename, long int ts_num, isa input_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (ts_num / maxquerythread); input_data[maxquerythread - 1].stop_number = ts_num; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, indexbulkloadingworker_pRecBuf_inmemory, (void *) &(input_data[i])); } - //wait for the finish of other threads + + // wait for the finish of other threads for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } + __sync_fetch_and_add(&(index->total_records), ts_num); fclose(ifile); fprintf(stderr, ">>> Finished indexing\n"); free(input_data); - //printf(" the sax point is %d\n",index->first_node->isax_cardinalities[0]); COUNT_OUTPUT_TIME_END } @@ -787,10 +840,13 @@ void index_creation_pRecBuf(const char *ifilename, long int ts_num, int filetype COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; @@ -798,40 +854,42 @@ void index_creation_pRecBuf(const char *ifilename, long int ts_num, int filetype if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + index->sax_file = NULL; - // long int ts_loaded = 0; int i; int node_counter = 0; pthread_t threadid[maxquerythread]; - buffer_data_inmemory *input_data = malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); - + buffer_data_inmemory *input_data = (buffer_data_inmemory*)malloc(sizeof(buffer_data_inmemory) * (maxquerythread)); file_type *rawfile_int32; + if (filetype_int) { - rawfile_int32 = malloc(sizeof(file_type) * index->settings->timeseries_size * ts_num); + rawfile_int32 = (file_type*)malloc(sizeof(file_type) * index->settings->timeseries_size * ts_num); } - rawfile = malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); - index->sax_cache = malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); + rawfile = (float*)malloc(sizeof(ts_type) * index->settings->timeseries_size * ts_num); + index->sax_cache = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments * ts_num); pthread_barrier_t lock_barrier1; pthread_barrier_init(&lock_barrier1, NULL, maxquerythread); - index->settings->raw_filename = malloc(256); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); COUNT_INPUT_TIME_START - if (filetype_int) { + if (filetype_int) { fprintf(stderr, ">>> Reading file as int8\n"); fread(rawfile_int32, sizeof(file_type), index->settings->timeseries_size * ts_num, ifile); - fprintf(stderr, ">>> Converting int8 to float\n"); + for (long int i = 0; i < index->settings->timeseries_size * ts_num; i++) { // Convert int to float type rawfile[i] = (ts_type) rawfile_int32[i]; } + fprintf(stderr, ">>> Conversions done.\n"); } else { fread(rawfile, sizeof(ts_type), index->settings->timeseries_size * ts_num, ifile); @@ -840,15 +898,37 @@ void index_creation_pRecBuf(const char *ifilename, long int ts_num, int filetype // apply z-normalization if (apply_znorm) { fprintf(stderr, ">>> Applying z-norm\n"); - for (long int i = 0; i < index->settings->timeseries_size * ts_num; i += index->settings->timeseries_size) { - znorm(&rawfile[i], index->settings->timeseries_size); + +#if defined(__x86_64__) + if (index->settings->SIMD_flag && __builtin_cpu_supports("avx512f")) { + for (long int i = 0; i < index->settings->timeseries_size * ts_num; + i += index->settings->timeseries_size) { + znorm_SIMD512F(&rawfile[i], index->settings->timeseries_size); + } + } else if (index->settings->SIMD_flag) { + for (long int i = 0; i < index->settings->timeseries_size * ts_num; + i += index->settings->timeseries_size) { + znorm_SIMD(&rawfile[i], index->settings->timeseries_size); + } + } else { +#endif + for (long int i = 0; i < index->settings->timeseries_size * ts_num; + i += index->settings->timeseries_size) { + znorm(&rawfile[i], index->settings->timeseries_size); + } +#if defined(__x86_64__) } +#endif } - COUNT_INPUT_TIME_END + COUNT_INPUT_TIME_END COUNT_INDEXING_TIME_START - pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER, lockfbl = PTHREAD_MUTEX_INITIALIZER, lock_index = PTHREAD_MUTEX_INITIALIZER, - lock_firstnode = PTHREAD_MUTEX_INITIALIZER, lock_disk = PTHREAD_MUTEX_INITIALIZER, lock_fft_plan = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_fft_plan = PTHREAD_MUTEX_INITIALIZER; destroy_fbl(index->fbl); index->fbl = (first_buffer_layer *) initialize_pRecBuf(index->settings->initial_fbl_buffer_size, @@ -878,13 +958,16 @@ void index_creation_pRecBuf(const char *ifilename, long int ts_num, int filetype input_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (ts_num / maxquerythread); input_data[maxquerythread - 1].stop_number = ts_num; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, index_creation_pRecBuf_worker, (void *) &(input_data[i])); } + // wait for the finish of other threads for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } + __sync_fetch_and_add(&(index->total_records), ts_num); index->sax_cache_size = index->total_records; fclose(ifile); @@ -900,30 +983,20 @@ void index_creation_pRecBuf(const char *ifilename, long int ts_num, int filetype COUNT_OUTPUT_TIME_END } - void *indexbulkloadingworker_inmemory(void *transferdata) { - sax_type *sax = malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,tee,tss; - //gettimeofday(&workertimestart, NULL); - - + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); unsigned long start_number = ((buffer_data_inmemory *) transferdata)->start_number; unsigned long stop_number = ((buffer_data_inmemory *) transferdata)->stop_number; - file_position_type *pos = malloc(sizeof(file_position_type)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); isax_index *index = ((buffer_data_inmemory *) transferdata)->index; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int paa_segments = ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments; - unsigned long i = 0; float *raw_file = ((buffer_data_inmemory *) transferdata)->ts; - for (i = start_number; i < stop_number; i++) { + for (unsigned long i = start_number; i < stop_number; i++) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(i + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (i + 1)); #endif #endif @@ -934,52 +1007,36 @@ void *indexbulkloadingworker_inmemory(void *transferdata) { index->settings->sax_bit_cardinality, index->settings->timeseries_size) == SUCCESS) { *pos = (file_position_type) (i * index->settings->timeseries_size); - memcpy(&(index->sax_cache[i * index->settings->paa_segments]), sax, sizeof(sax_type) * index->settings->paa_segments); - isax_fbl_index_insert_inmemory_para(index, sax, pos, ((buffer_data_inmemory *) transferdata)->lock_fbl, ((buffer_data_inmemory *) transferdata)->lock_cbl, ((buffer_data_inmemory *) transferdata)->lock_firstnode, ((buffer_data_inmemory *) transferdata)->lock_index); } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } free(pos); free(sax); free(ts); - //gettimeofday(&workercurenttime, NULL); - //tss = workertimestart.tv_sec*1000000 + (workertimestart.tv_usec); - //tee = workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec); - //worker_total_time += (tee - tss); - //printf("the worker time is %f\n",worker_total_time ); } void *index_creation_worker_inmemory(void *transferdata) { - sax_type *sax = malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,tee,tss; - //gettimeofday(&workertimestart, NULL); - - + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); unsigned long start_number = ((buffer_data_inmemory *) transferdata)->start_number; unsigned long stop_number = ((buffer_data_inmemory *) transferdata)->stop_number; - file_position_type *pos = malloc(sizeof(file_position_type)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); isax_index *index = ((buffer_data_inmemory *) transferdata)->index; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int paa_segments = ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments; - unsigned long i = 0; float *raw_file = ((buffer_data_inmemory *) transferdata)->ts; + for (i = start_number; i < stop_number; i++) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(i + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (i + 1)); #endif #endif @@ -990,50 +1047,50 @@ void *index_creation_worker_inmemory(void *transferdata) { index->settings->sax_bit_cardinality, index->settings->timeseries_size) == SUCCESS) { *pos = (file_position_type) (i * index->settings->timeseries_size); - memcpy(&(index->sax_cache[i * index->settings->paa_segments]), sax, sizeof(sax_type) * index->settings->paa_segments); - isax_fbl_index_insert_inmemory_para(index, sax, pos, ((buffer_data_inmemory *) transferdata)->lock_fbl, ((buffer_data_inmemory *) transferdata)->lock_cbl, ((buffer_data_inmemory *) transferdata)->lock_firstnode, ((buffer_data_inmemory *) transferdata)->lock_index); } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } + free(pos); free(sax); free(ts); pthread_barrier_wait(((buffer_data_inmemory *) transferdata)->lock_barrier1); - int j, c = 1, k; - isax_node_record *r = malloc(sizeof(isax_node_record)); - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) - while (1) { + int j; + int c = 1; + int k; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + while (1) { j = __sync_fetch_and_add(((buffer_data_inmemory *) transferdata)->node_counter, 1); + if (j >= index->fbl->number_of_buffers) { break; } + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } if (current_fbl_node->buffer_size > 0) { - for (k = 0; k < current_fbl_node->buffer_size; k++) { r->sax = (sax_type *) current_fbl_node->sax_records[k]; r->position = (file_position_type *) current_fbl_node->pos_records[k]; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; // Add record to index - //printf("the position 1 is %d\n",*(r->position)); - //sleep(1); add_record_to_node(index, current_fbl_node->node, r, 1); } + flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); // clear FBL records moved in LBL buffers @@ -1041,34 +1098,27 @@ void *index_creation_worker_inmemory(void *transferdata) { free(current_fbl_node->pos_records); // clear records read from files (free only prev sax buffers) } - } - free(r); + free(r); } void *index_creation_worker_inmemory_new(void *transferdata) { - sax_type *sax = malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,tee,tss; - //gettimeofday(&workertimestart, NULL); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); unsigned long roundfinishednumber; unsigned long start_number; - unsigned long stop_number = ((buffer_data_inmemory *) transferdata)->stop_number; - file_position_type *pos = malloc(sizeof(file_position_type)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); isax_index *index = ((buffer_data_inmemory *) transferdata)->index; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int paa_segments = ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments; - unsigned long i = 0; float *raw_file = ((buffer_data_inmemory *) transferdata)->ts; + while (1) { start_number = __sync_fetch_and_add(((buffer_data_inmemory *) transferdata)->shared_start_number, read_block_length); + if (start_number > stop_number) { break; } else if (start_number > stop_number - read_block_length) { @@ -1076,10 +1126,11 @@ void *index_creation_worker_inmemory_new(void *transferdata) { } else { roundfinishednumber = start_number + read_block_length; } + for (i = start_number; i < roundfinishednumber; i++) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(i + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (i + 1)); #endif #endif @@ -1091,51 +1142,50 @@ void *index_creation_worker_inmemory_new(void *transferdata) { index->settings->sax_bit_cardinality, index->settings->timeseries_size) == SUCCESS) { *pos = (file_position_type) (i * index->settings->timeseries_size); - memcpy(&(index->sax_cache[i * index->settings->paa_segments]), sax, sizeof(sax_type) * index->settings->paa_segments); - isax_fbl_index_insert_inmemory_para(index, sax, pos, ((buffer_data_inmemory *) transferdata)->lock_fbl, ((buffer_data_inmemory *) transferdata)->lock_cbl, ((buffer_data_inmemory *) transferdata)->lock_firstnode, ((buffer_data_inmemory *) transferdata)->lock_index); } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } } + free(pos); free(sax); free(ts); pthread_barrier_wait(((buffer_data_inmemory *) transferdata)->lock_barrier1); - int j, c = 1, k; - isax_node_record *r = malloc(sizeof(isax_node_record)); - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) - while (1) { + int j; + int c = 1; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + while (1) { j = __sync_fetch_and_add(((buffer_data_inmemory *) transferdata)->node_counter, 1); + if (j >= index->fbl->number_of_buffers) { break; } + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } if (current_fbl_node->buffer_size > 0) { - - for (k = 0; k < current_fbl_node->buffer_size; k++) { + for (int k = 0; k < current_fbl_node->buffer_size; k++) { r->sax = (sax_type *) current_fbl_node->sax_records[k]; r->position = (file_position_type *) current_fbl_node->pos_records[k]; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; // Add record to index - //printf("the position 1 is %d\n",*(r->position)); - //sleep(1); add_record_to_node(index, current_fbl_node->node, r, 1); } + flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); // clear FBL records moved in LBL buffers @@ -1143,27 +1193,18 @@ void *index_creation_worker_inmemory_new(void *transferdata) { free(current_fbl_node->pos_records); // clear records read from files (free only prev sax buffers) } - } - free(r); + free(r); } void *index_creation_worker2_inmemory(void *transferdata) { - sax_type *sax = malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,tee,tss; - //gettimeofday(&workertimestart, NULL); - - + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); unsigned long start_number = ((buffer_data_inmemory *) transferdata)->start_number; unsigned long stop_number = ((buffer_data_inmemory *) transferdata)->stop_number; - file_position_type *pos = malloc(sizeof(file_position_type)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); isax_index *index = ((buffer_data_inmemory *) transferdata)->index; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int paa_segments = ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments; unsigned long i = 0; @@ -1173,71 +1214,58 @@ void *index_creation_worker2_inmemory(void *transferdata) { free(sax); free(ts); + int j; + int c = 1; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); - int j, c = 1, k; - isax_node_record *r = malloc(sizeof(isax_node_record)); - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) while (1) { - j = __sync_fetch_and_add(((buffer_data_inmemory *) transferdata)->node_counter, 1); + if (j >= index->fbl->number_of_buffers) { break; } - fbl_soft_buffer2 *current_fbl_node = &((first_buffer_layer2 * )(index->fbl))->soft_buffers[j]; + + fbl_soft_buffer2 *current_fbl_node = &((first_buffer_layer2 *)(index->fbl))->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } - if (current_fbl_node->buffer_size > 0) {//index->settings->timeseries_size - - for (k = 0; k < current_fbl_node->buffer_size; k++) { - //memcpy(sax,&(index->sax_cache[(((file_position_type *) current_fbl_node->pos_records)[k])/index->settings->timeseries_size]),sizeof(sax_type) * ((buffer_data_inmemory*)transferdata)->index->settings->paa_segments); + if (current_fbl_node->buffer_size > 0) { // index->settings->timeseries_size + for (int k = 0; k < current_fbl_node->buffer_size; k++) { r->sax = &(index->sax_cache[current_fbl_node->pos_records[k] / index->settings->timeseries_size * index->settings->paa_segments]); r->position = ¤t_fbl_node->pos_records[k]; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; // Add record to index - //printf("the position 1 is %d\n",*(r->position)); - //sleep(1); add_record_to_node(index, current_fbl_node->node, r, 1); } - flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); - // clear FBL records moved in LBL buffers - //free(current_fbl_node->sax_records); - //free(current_fbl_node->pos_records); - // clear records read from files (free only prev sax buffers) + flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); } } - free(r); + free(r); } void *index_creation_mix_worker_inmemory(void *transferdata) { - - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,tee,tss; - //gettimeofday(&workertimestart, NULL); - - sax_type *sax = malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); unsigned long start_number = ((buffer_data_inmemory *) transferdata)->start_number; unsigned long stop_number = ((buffer_data_inmemory *) transferdata)->stop_number; - file_position_type *pos = malloc(sizeof(file_position_type)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); isax_index *index = ((buffer_data_inmemory *) transferdata)->index; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int paa_segments = ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments; root_mask_type first_bit_mask = 0x00; fbl_soft_buffer *current_buffer; - isax_node_record *r = malloc(sizeof(isax_node_record)); + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); unsigned long i = 0; float *raw_file = ((buffer_data_inmemory *) transferdata)->ts; + for (i = start_number; i < stop_number; i++) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(i + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (i + 1)); #endif #endif @@ -1248,126 +1276,93 @@ void *index_creation_mix_worker_inmemory(void *transferdata) { index->settings->sax_bit_cardinality, index->settings->timeseries_size) == SUCCESS) { *pos = (file_position_type) (i * index->settings->timeseries_size); - memcpy(&(index->sax_cache[i * index->settings->paa_segments]), sax, sizeof(sax_type) * index->settings->paa_segments); r->sax = sax; r->position = pos; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; CREATE_MASK(first_bit_mask, index, sax); current_buffer = &index->fbl->soft_buffers[(int) first_bit_mask]; // Check if this buffer is initialized pthread_mutex_lock(&(((buffer_data_inmemory *) transferdata)->lock_cbl[first_bit_mask])); + if (!current_buffer->initialized) { current_buffer->initialized = 1; current_buffer->max_buffer_size = 0; current_buffer->buffer_size = 0; - current_buffer->node = isax_root_node_init(first_bit_mask, index->settings->initial_leaf_buffer_size); - current_buffer->node->is_leaf = 1; - - index->root_nodes++;//counter - + index->root_nodes++; // counter if (index->first_node == NULL) { index->first_node = current_buffer->node; current_buffer->node->next = NULL; current_buffer->node->previous = NULL; - } else { isax_node *prev_first = index->first_node; index->first_node = current_buffer->node; index->first_node->next = prev_first; - prev_first->previous = current_buffer->node; } } - add_record_to_node(index, current_buffer->node, r, 1); pthread_mutex_unlock(&((buffer_data_inmemory *) transferdata)->lock_cbl[first_bit_mask]); - - //isax_fbl_index_insert_inmemory_para(index, sax, pos, ((buffer_data_inmemory*)transferdata)->lock_fbl, - //((buffer_data_inmemory*)transferdata)->lock_cbl,((buffer_data_inmemory*)transferdata)->lock_firstnode,((buffer_data_inmemory*)transferdata)->lock_index); } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } + free(pos); free(sax); free(ts); pthread_barrier_wait(((buffer_data_inmemory *) transferdata)->lock_barrier1); - int j, c = 1, k; + int j; + int c = 1; - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) while (1) { - j = __sync_fetch_and_add(((buffer_data_inmemory *) transferdata)->node_counter, 1); + if (j >= index->fbl->number_of_buffers) { break; } + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } if (current_fbl_node->buffer_size > 0) { - - //for (k=0; kbuffer_size; k++) { - // r->sax = (sax_type *) current_fbl_node->sax_records[k]; - // r->position = (file_position_type *) current_fbl_node->pos_records[k]; - // r->insertion_mode = NO_TMP | PARTIAL; - // Add record to index - //printf("the position 1 is %d\n",*(r->position)); - //sleep(1); - // add_record_to_node(index, current_fbl_node->node, r, 1); - // } flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); - - // clear FBL records moved in LBL buffers - //free(current_fbl_node->sax_records); - //free(current_fbl_node->pos_records); - // clear records read from files (free only prev sax buffers) } - } - free(r); + free(r); } void *indexbulkloadingworker_pRecBuf_inmemory(void *transferdata) { - sax_type *sax = malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,tee,tss; - //gettimeofday(&workertimestart, NULL); - - + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); unsigned long start_number = ((buffer_data_inmemory *) transferdata)->start_number; unsigned long stop_number = ((buffer_data_inmemory *) transferdata)->stop_number; - file_position_type *pos = malloc(sizeof(file_position_type)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); isax_index *index = ((buffer_data_inmemory *) transferdata)->index; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int paa_segments = ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments; - unsigned long i = 0; float *raw_file = ((buffer_data_inmemory *) transferdata)->ts; for (i = start_number; i < stop_number; i++) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(i + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (i + 1)); #endif #endif memcpy(ts, &(raw_file[i * index->settings->timeseries_size]), sizeof(float) * index->settings->timeseries_size); @@ -1377,29 +1372,34 @@ void *indexbulkloadingworker_pRecBuf_inmemory(void *transferdata) { index->settings->sax_bit_cardinality, index->settings->timeseries_size) == SUCCESS) { *pos = (file_position_type) (i * index->settings->timeseries_size); - memcpy(&(index->sax_cache[i * index->settings->paa_segments]), sax, sizeof(sax_type) * index->settings->paa_segments); - isax_pRecBuf_index_insert_inmemory(index, sax, pos, ((buffer_data_inmemory *) transferdata)->lock_firstnode, ((buffer_data_inmemory *) transferdata)->workernumber, ((buffer_data_inmemory *) transferdata)->total_workernumber); - } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } + free(pos); free(sax); free(ts); - //gettimeofday(&workercurenttime, NULL); - //tss = workertimestart.tv_sec*1000000 + (workertimestart.tv_usec); - //tee = workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec); - //worker_total_time += (tee - tss); - //printf("the worker time is %f\n",worker_total_time ); } +#if defined(__x86_64__) +__attribute__((target("avx512f"))) +unsigned long cpy_ts_to_fftw_SIMD512F(unsigned long todo, ts_type *ts_fftw, int *j, ts_type *ts) { + while (todo >= 16) { + todo -= 16; + _mm512_storeu_ps(&ts_fftw[*j], _mm512_loadu_ps(&ts[*j])); + *j += 16; + } + + return todo; +} +#endif + void *index_creation_pRecBuf_worker(void *transferdata) { unsigned long int transformation_time = 0.0; unsigned long int indexing_time = 0.0; @@ -1408,13 +1408,12 @@ void *index_creation_pRecBuf_worker(void *transferdata) { struct timeval transformation_time_start; struct timeval indexing_time_start; - sax_type *sax = malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); - + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); unsigned long start_number = ((buffer_data_inmemory *) transferdata)->start_number; unsigned long stop_number = ((buffer_data_inmemory *) transferdata)->stop_number; - file_position_type *pos = malloc(sizeof(file_position_type)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); isax_index *index = ((buffer_data_inmemory *) transferdata)->index; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int paa_segments = ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments; unsigned long i = 0; @@ -1427,33 +1426,49 @@ void *index_creation_pRecBuf_worker(void *transferdata) { if (index->settings->function_type == 4) { unsigned long ts_length = index->settings->timeseries_size; - pthread_mutex_lock(((buffer_data_inmemory *) transferdata)->lock_fft_plan); - ts_fftw = fftwf_malloc(sizeof(ts_type) * ts_length); - - ts_out = (fftwf_complex *) fftwf_malloc(sizeof(fftwf_complex) * (ts_length / 2 + 1)); + ts_fftw = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); + ts_out = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * (ts_length / 2 + 1)); - //create fftw plan + // create fftw plan plan_forward = fftwf_plan_dft_r2c_1d(ts_length, ts_fftw, ts_out, FFTW_ESTIMATE); - - transform = fftwf_malloc(sizeof(ts_type) * ts_length); - + transform = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); pthread_mutex_unlock(((buffer_data_inmemory *) transferdata)->lock_fft_plan); } for (i = start_number; i < stop_number; i++) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(i + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (i + 1)); #endif #endif memcpy(ts, &(raw_file[i * index->settings->timeseries_size]), sizeof(float) * index->settings->timeseries_size); - //SFA - //store result in index + // SFA + // store result in index if (index->settings->function_type == 4) { gettimeofday(&transformation_time_start, NULL); - for (int j = 0; j < index->settings->timeseries_size; ++j) { + unsigned long ts_length = index->settings->timeseries_size; + + int j = 0; + +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + unsigned long todo = ts_length; + + if (__builtin_cpu_supports("avx512f")) { + todo = cpy_ts_to_fftw_SIMD512F(todo, ts_fftw, &j, ts); + } + + while (todo >= 8) { + todo -= 8; + _mm256_storeu_ps(&ts_fftw[j], _mm256_loadu_ps(&ts[j])); + j += 8; + } + } +#endif + + for (; j < ts_length; j++) { ts_fftw[j] = ts[j]; } @@ -1462,30 +1477,23 @@ void *index_creation_pRecBuf_worker(void *transferdata) { transformation_time += ((current_time.tv_sec * 1000000 + (current_time.tv_usec)) - (transformation_time_start.tv_sec * 1000000 + (transformation_time_start.tv_usec))); - gettimeofday(&indexing_time_start, NULL); - *pos = (file_position_type) (i * index->settings->timeseries_size); - + *pos = (file_position_type) (i * ts_length); memcpy(&(index->sax_cache[i * index->settings->paa_segments]), sax, sizeof(sax_type) * index->settings->paa_segments); - isax_pRecBuf_index_insert_inmemory(index, sax, pos, ((buffer_data_inmemory *) transferdata)->lock_firstnode, ((buffer_data_inmemory *) transferdata)->workernumber, ((buffer_data_inmemory *) transferdata)->total_workernumber); - gettimeofday(¤t_time, NULL); indexing_time += ((current_time.tv_sec * 1000000 + (current_time.tv_usec)) - (indexing_time_start.tv_sec * 1000000 + (indexing_time_start.tv_usec))); } else { - fprintf(stderr, "error: cannot insert record in index, since sfa representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sfa representation failed to be created"); } - } - - //MESSI iSAX - else { + } else { // MESSI iSAX gettimeofday(&transformation_time_start, NULL); + if (sax_from_ts(ts, sax, index->settings->ts_values_per_paa_segment, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality, @@ -1494,24 +1502,19 @@ void *index_creation_pRecBuf_worker(void *transferdata) { transformation_time += ((current_time.tv_sec * 1000000 + (current_time.tv_usec)) - (transformation_time_start.tv_sec * 1000000 + (transformation_time_start.tv_usec))); - gettimeofday(&indexing_time_start, NULL); *pos = (file_position_type) (i * index->settings->timeseries_size); - memcpy(&(index->sax_cache[i * index->settings->paa_segments]), sax, sizeof(sax_type) * index->settings->paa_segments); - isax_pRecBuf_index_insert_inmemory(index, sax, pos, ((buffer_data_inmemory *) transferdata)->lock_firstnode, ((buffer_data_inmemory *) transferdata)->workernumber, ((buffer_data_inmemory *) transferdata)->total_workernumber); - gettimeofday(¤t_time, NULL); indexing_time += ((current_time.tv_sec * 1000000 + (current_time.tv_usec)) - (indexing_time_start.tv_sec * 1000000 + (indexing_time_start.tv_usec))); } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } } @@ -1533,53 +1536,50 @@ void *index_creation_pRecBuf_worker(void *transferdata) { bool have_record = false; int j; - isax_node_record *r = malloc(sizeof(isax_node_record)); + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); gettimeofday(&indexing_time_start, NULL); while (1) { - j = __sync_fetch_and_add(((buffer_data_inmemory *) transferdata)->node_counter, 1); if (j >= index->fbl->number_of_buffers) { break; } - //fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; - parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer * )(index->fbl))->soft_buffers[j]; + + parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer *)(index->fbl))->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } int i; have_record = false; + for (int k = 0; k < ((buffer_data_inmemory *) transferdata)->total_workernumber; k++) { - if (current_fbl_node->buffer_size[k] > 0) + if (current_fbl_node->buffer_size[k] > 0) { have_record = true; + } for (i = 0; i < current_fbl_node->buffer_size[k]; i++) { r->sax = (sax_type *) &(((current_fbl_node->sax_records[k]))[i * index->settings->paa_segments]); r->position = (file_position_type *) &((file_position_type *) (current_fbl_node->pos_records[k]))[i]; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; // Add record to index - //printf("the position 1 is %d\n",*(r->position)); - //sleep(1); add_record_to_node(index, current_fbl_node->node, r, 1); } } + if (have_record) { flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); - // clear FBL records moved in LBL buffers - // clear records read from files (free only prev sax buffers) } - } gettimeofday(¤t_time, NULL); indexing_time += ((current_time.tv_sec * 1000000 + (current_time.tv_usec)) - (indexing_time_start.tv_sec * 1000000 + (indexing_time_start.tv_usec))); - __sync_fetch_and_add(&TOTAL_INDEXING_PART_TIME, (int) indexing_time); __sync_fetch_and_add(&TOTAL_TRANSFORMATION_PART_TIME, (int) transformation_time); @@ -1587,24 +1587,18 @@ void *index_creation_pRecBuf_worker(void *transferdata) { } void *index_creation_pRecBuf_worker_new(void *transferdata) { - sax_type *sax = malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,tee,tss; - //gettimeofday(&workertimestart, NULL); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments); unsigned long roundfinishednumber; - unsigned long start_number; unsigned long stop_number = ((buffer_data_inmemory *) transferdata)->stop_number; - file_position_type *pos = malloc(sizeof(file_position_type)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); isax_index *index = ((buffer_data_inmemory *) transferdata)->index; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int paa_segments = ((buffer_data_inmemory *) transferdata)->index->settings->paa_segments; unsigned long i = 0; float *raw_file = ((buffer_data_inmemory *) transferdata)->ts; + while (1) { start_number = __sync_fetch_and_add(((buffer_data_inmemory *) transferdata)->shared_start_number, read_block_length); @@ -1615,6 +1609,7 @@ void *index_creation_pRecBuf_worker_new(void *transferdata) { } else { roundfinishednumber = start_number + read_block_length; } + for (i = start_number; i < roundfinishednumber; i++) { memcpy(ts, &(raw_file[i * index->settings->timeseries_size]), sizeof(float) * index->settings->timeseries_size); @@ -1625,82 +1620,69 @@ void *index_creation_pRecBuf_worker_new(void *transferdata) { *pos = (file_position_type) (i * index->settings->timeseries_size); memcpy(&(index->sax_cache[i * index->settings->paa_segments]), sax, sizeof(sax_type) * index->settings->paa_segments); - isax_pRecBuf_index_insert_inmemory(index, sax, pos, ((buffer_data_inmemory *) transferdata)->lock_firstnode, ((buffer_data_inmemory *) transferdata)->workernumber, ((buffer_data_inmemory *) transferdata)->total_workernumber); - // TODO Progress + // TODO(someone): Progress if (i % 1000000) { fprintf(stderr, "."); } } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } - } free(pos); free(sax); free(ts); - //gettimeofday(&workercurenttime, NULL); - //tss = workertimestart.tv_sec*1000000 + (workertimestart.tv_usec); - //tee = workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec); - //worker_total_time += (tee - tss); - //printf("the worker time is %f\n",worker_total_time ); pthread_barrier_wait(((buffer_data_inmemory *) transferdata)->lock_barrier1); pthread_barrier_wait(((buffer_data_inmemory *) transferdata)->lock_barrier2); bool have_record = false; int j; - isax_node_record *r = malloc(sizeof(isax_node_record)); - //int preworkernumber=((buffer_data_inmemory*)transferdata)->total_workernumber; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) while (1) { - j = __sync_fetch_and_add(((buffer_data_inmemory *) transferdata)->node_counter, 1); if (j >= index->fbl->number_of_buffers) { break; } - //fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; - parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer * )(index->fbl))->soft_buffers[j]; + + parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer *)(index->fbl))->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } int i; have_record = false; + for (int k = 0; k < ((buffer_data_inmemory *) transferdata)->total_workernumber; k++) { - if (current_fbl_node->buffer_size[k] > 0) + if (current_fbl_node->buffer_size[k] > 0) { have_record = true; + } + for (i = 0; i < current_fbl_node->buffer_size[k]; i++) { r->sax = (sax_type *) &(((current_fbl_node->sax_records[k]))[i * index->settings->paa_segments]); r->position = (file_position_type *) &((file_position_type *) (current_fbl_node->pos_records[k]))[i]; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; // Add record to index - //printf("the position 1 is %d\n",*(r->position)); - //sleep(1); add_record_to_node(index, current_fbl_node->node, r, 1); } } + if (have_record) { flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); - // clear FBL records moved in LBL buffers - // clear records read from files (free only prev sax buffers) - - - - } } + free(r); } @@ -1709,70 +1691,59 @@ root_mask_type isax_fbl_index_insert_inmemory_para(isax_index *index, file_position_type *pos, pthread_mutex_t *lock_fbl, pthread_mutex_t *lock_cbl, pthread_mutex_t *lock_firstnode, pthread_mutex_t *lock_index) { - int i, t; + int i; + int t; int totalsize = index->settings->max_total_buffer_size; // Create mask for the first bit of the sax representation - // Step 1: Check if there is a root node that represents the + // Step 1: Check if there is a root node that represents the // current node's sax representation - // TODO: Create INSERTION SHORT AND BINARY SEARCH METHODS. - + // TODO(someone): Create INSERTION SHORT AND BINARY SEARCH METHODS. root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); - - //__sync_fetch_and_add(&(index->total_records),1); - pthread_mutex_lock(&(lock_cbl[first_bit_mask % LOCK_SIZE])); insert_to_fbl_m(index->fbl, sax, pos, first_bit_mask, index, lock_firstnode, lock_fbl); - pthread_mutex_unlock(&(lock_cbl[first_bit_mask % LOCK_SIZE])); return first_bit_mask; } root_mask_type isax_pRecBuf_index_insert_inmemory(isax_index *index, - sax_type *sax, - file_position_type *pos, pthread_mutex_t *lock_firstnode, - int workernumber, int total_workernumber) { - int i, t; + sax_type *sax, file_position_type *pos, pthread_mutex_t *lock_firstnode, + int workernumber, int total_workernumber) { + int i; + int t; int totalsize = index->settings->max_total_buffer_size; // Create mask for the first bit of the sax representation - // Step 1: Check if there is a root node that represents the + // Step 1: Check if there is a root node that represents the // current node's sax representation - // TODO: Create INSERTION SHORT AND BINARY SEARCH METHODS. - + // TODO(someone): Create INSERTION SHORT AND BINARY SEARCH METHODS. root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); - - - //insert_to_fbl_m(index->fbl, sax, pos,first_bit_mask, index,lock_firstnode,lock_fbl); - insert_to_pRecBuf((parallel_first_buffer_layer * )(index->fbl), sax, pos, first_bit_mask, index, lock_firstnode, + insert_to_pRecBuf((parallel_first_buffer_layer *)(index->fbl), sax, pos, first_bit_mask, index, lock_firstnode, workernumber, total_workernumber); return first_bit_mask; } root_mask_type isax_fbl_index_insert_inmemory(isax_index *index, - sax_type *sax, - file_position_type *pos) { - + sax_type *sax, file_position_type *pos) { // Create mask for the first bit of the sax representation - // Step 1: Check if there is a root node that represents the + // Step 1: Check if there is a root node that represents the // current node's sax representation - // TODO: Create INSERTION SHORT AND BINARY SEARCH METHODS. + // TODO(someone): Create INSERTION SHORT AND BINARY SEARCH METHODS. root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); - insert_to_fbl(index->fbl, sax, pos, - first_bit_mask, index); + insert_to_fbl(index->fbl, sax, pos, first_bit_mask, index); index->total_records++; return first_bit_mask; } @@ -1784,16 +1755,17 @@ enum response flush_fbl_inmemory_m(first_buffer_layer *fbl, isax_index *index) { #if VERBOSE_LEVEL == 2 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); #endif #if VERBOSE_LEVEL == 1 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "Flushing...\n"); #endif #endif + int j; transferfblinmemory input_data; pthread_t threadid[maxquerythread]; @@ -1802,7 +1774,7 @@ enum response flush_fbl_inmemory_m(first_buffer_layer *fbl, isax_index *index) { input_data.index = index; input_data.conternumber = 0; input_data.stop_number = fbl->number_of_buffers; - //input_data.nodeid=nodeid; + for (int k = 0; k < maxquerythread; k++) { pthread_create(&(threadid[k]), NULL, flush_fbl_inmemory_worker, (void *) &(input_data)); } @@ -1825,16 +1797,17 @@ enum response flush_pRecBuf_inmemory(parallel_first_buffer_layer *fbl, isax_inde #if VERBOSE_LEVEL == 2 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); #endif #if VERBOSE_LEVEL == 1 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "Flushing...\n"); #endif #endif + int j; transferfblinmemory input_data; pthread_t threadid[maxquerythread]; @@ -1844,6 +1817,7 @@ enum response flush_pRecBuf_inmemory(parallel_first_buffer_layer *fbl, isax_inde input_data.conternumber = 0; input_data.stop_number = fbl->number_of_buffers; input_data.preworkernumber = maxquerythread; + for (int k = 0; k < maxquerythread; k++) { pthread_create(&(threadid[k]), NULL, flush_pRecBuf_inmemory_worker, (void *) &(input_data)); } @@ -1860,65 +1834,57 @@ enum response flush_pRecBuf_inmemory(parallel_first_buffer_layer *fbl, isax_inde } void *flush_fbl_inmemory_worker(void *input) { - //gettimeofday(&writecurenttime, NULL); - //write_total_time += writecurenttime.tv_sec*1000000 + (writecurenttime.tv_usec)-writetiemstart.tv_sec*1000000 - (writetiemstart.tv_usec); - //COUNT_CAL_TIME_END // clear FBL records moved in LBL buffers struct timeval workertimestart; - //struct timeval writetiemstart; struct timeval workercurenttime; - //s//truct timeval writecurenttime; - double worker_total_time, tee, tss; - //gettimeofday(&workertimestart, NULL); + double worker_total_time; + double tee; + double tss; gettimeofday(&workertimestart, NULL); // flush index node - //COUNT_CAL_TIME_START - //gettimeofday(&writetiemstart, NULL); - isax_index *index = ((transferfblinmemory *) input)->index; - int j, c = 1; - isax_node_record *r = malloc(sizeof(isax_node_record)); - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) - while (1) { + int j; + int c = 1; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + while (1) { j = __sync_fetch_and_add(&((transferfblinmemory *) input)->conternumber, 1); + if (j >= ((transferfblinmemory *) input)->stop_number) { break; } + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } #ifndef DEBUG #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); c++; fflush(stdout); #endif #endif + int i; + if (current_fbl_node->buffer_size > 0) { for (i = 0; i < current_fbl_node->buffer_size; i++) { r->sax = (sax_type *) current_fbl_node->sax_records[i]; r->position = (file_position_type *) current_fbl_node->pos_records[i]; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; // Add record to index - //printf("the position 1 is %d\n",*(r->position)); - //sleep(1); add_record_to_node(index, current_fbl_node->node, r, 1); } - flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); - // clear FBL records moved in LBL buffers - //free(current_fbl_node->sax_records); - //free(current_fbl_node->pos_records); - // clear records read from files (free only prev sax buffers) + flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); } - } + free(r); gettimeofday(&workercurenttime, NULL); tss = workertimestart.tv_sec * 1000000 + (workertimestart.tv_usec); @@ -1928,42 +1894,37 @@ void *flush_fbl_inmemory_worker(void *input) { } void *flush_pRecBuf_inmemory_worker(void *input) { - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,tss,tee; - //gettimeofday(&workertimestart, NULL); - isax_index *index = ((transferfblinmemory *) input)->index; bool have_record = false; - int j, c = 1; - isax_node_record *r = malloc(sizeof(isax_node_record)); + int j; + int c = 1; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); int preworkernumber = ((transferfblinmemory *) input)->preworkernumber; - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) while (1) { - j = __sync_fetch_and_add(&((transferfblinmemory *) input)->conternumber, 1); if (j >= ((transferfblinmemory *) input)->stop_number) { break; } - //fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; - parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer * )(index->fbl))->soft_buffers[j]; + + parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer *)(index->fbl))->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } #ifndef DEBUG #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); c++; fflush(stdout); #endif #endif + int i; have_record = false; + for (int k = 0; k < preworkernumber; k++) { if (current_fbl_node->buffer_size[k] > 0) have_record = true; @@ -1971,28 +1932,20 @@ void *flush_pRecBuf_inmemory_worker(void *input) { for (i = 0; i < current_fbl_node->buffer_size[k]; i++) { r->sax = (sax_type *) &(((current_fbl_node->sax_records[k]))[i * index->settings->paa_segments]); r->position = (file_position_type *) &((file_position_type *) (current_fbl_node->pos_records[k]))[i]; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; // Add record to index - //printf("the position 1 is %d\n",*(r->position)); - //sleep(1); add_record_to_node(index, current_fbl_node->node, r, 1); } } - if (have_record) { - flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); + if (have_record) { // clear FBL records moved in LBL buffers - // clear records read from files (free only prev sax buffers) + flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); } - } + free(r); - //gettimeofday(&workercurenttime, NULL); - //tss = workertimestart.tv_sec*1000000 + (workertimestart.tv_usec); - //tee = workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec); - //worker_total_time += (tee - tss); - //printf("the worker time is %f\n",worker_total_time ); } enum response flush_fbl_inmemory(first_buffer_layer *fbl, isax_index *index) { @@ -2002,48 +1955,47 @@ enum response flush_fbl_inmemory(first_buffer_layer *fbl, isax_index *index) { #if VERBOSE_LEVEL == 2 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); #endif #if VERBOSE_LEVEL == 1 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "Flushing...\n"); #endif #endif int c = 1; int j; - isax_node_record *r = malloc(sizeof(isax_node_record)); - for (j = 0; j < fbl->number_of_buffers; j++) { + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + for (j = 0; j < fbl->number_of_buffers; j++) { fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; if (!current_fbl_node->initialized) { continue; } - int i; + if (current_fbl_node->buffer_size > 0) { - // For all records in this buffer - //COUNT_CAL_TIME_START + // For all records in this buffer for (i = 0; i < current_fbl_node->buffer_size; i++) { r->sax = (sax_type *) current_fbl_node->sax_records[i]; r->position = (file_position_type *) current_fbl_node->pos_records[i]; - r->insertion_mode = NO_TMP | PARTIAL; + r->insertion_mode = PARTIAL_OR_NO_TMP; // Add record to index add_record_to_node(index, current_fbl_node->node, r, 1); } + + // flush index node flush_subtree_leaf_buffers_inmemory(index, current_fbl_node->node); free(current_fbl_node->sax_records); free(current_fbl_node->pos_records); - // flush index node - //COUNT_CAL_TIME_START } - } + free(r); fbl->current_record_index = 0; fbl->current_record = fbl->hard_buffer; @@ -2053,9 +2005,7 @@ enum response flush_fbl_inmemory(first_buffer_layer *fbl, isax_index *index) { } isax_node *add_record_to_node_inmemory(isax_index *index, - isax_node *tree_node, - isax_node_record *record, - const char leaf_size_check) { + isax_node *tree_node, isax_node_record *record, const char leaf_size_check) { #ifdef DEBUG printf("*** Adding to node ***\n\n"); #endif @@ -2065,14 +2015,15 @@ isax_node *add_record_to_node_inmemory(isax_index *index, while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - node->split_data->split_mask[node->split_data->splitpoint]; - root_mask_type mask = index->settings->bit_masks[location]; + if (record->sax[node->split_data->splitpoint] & mask) { node = node->right_child; } else { node = node->left_child; } } + // Check if split needed if ((node->leaf_size) >= index->settings->max_leaf_size && leaf_size_check) { #ifdef DEBUG @@ -2084,26 +2035,24 @@ isax_node *add_record_to_node_inmemory(isax_index *index, if (node->filename == NULL) { create_node_filename(index, node, record); } + add_to_node_buffer(node->buffer, record, index->settings->paa_segments, index->settings->timeseries_size); node->leaf_size++; - } + return node; } - enum response flush_subtree_leaf_buffers_inmemory(isax_index *index, isax_node *node) { - if (node->is_leaf && node->filename != NULL) { // Set that unloaded data exist in disk - if (node->buffer->partial_buffer_size > 0 - || node->buffer->tmp_partial_buffer_size > 0) { + if (node->buffer->partial_buffer_size > 0 || node->buffer->tmp_partial_buffer_size > 0) { node->has_partial_data_file = 1; } + // Set that the node has flushed full data in the disk - if (node->buffer->full_buffer_size > 0 - || node->buffer->tmp_full_buffer_size > 0) { + if (node->buffer->full_buffer_size > 0 || node->buffer->tmp_full_buffer_size > 0) { node->has_full_data_file = 1; } @@ -2116,34 +2065,26 @@ enum response flush_subtree_leaf_buffers_inmemory(isax_index *index, isax_node * int current_page_size = ceil( (float) (node->leaf_size * index->settings->full_record_size) / (float) PAGE_SIZE); __sync_fetch_and_add(&(index->memory_info.disk_data_full), (current_page_size - previous_page_size)); - //index->memory_info.disk_data_full += (current_page_size - previous_page_size); } + if (node->has_partial_data_file) { int prev_rec_count = node->leaf_size - (node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size); - int previous_page_size = ceil( (float) (prev_rec_count * index->settings->partial_record_size) / (float) PAGE_SIZE); + int current_page_size = ceil( (float) (node->leaf_size * index->settings->partial_record_size) / (float) PAGE_SIZE); - - //index->memory_info.disk_data_partial += (current_page_size - previous_page_size); __sync_fetch_and_add(&(index->memory_info.disk_data_partial), (current_page_size - previous_page_size)); } if (node->has_full_data_file && node->has_partial_data_file) { printf("WARNING: (Mem size counting) this leaf has both partial and full data.\n"); } - //index->memory_info.disk_data_full += (node->buffer->full_buffer_size + - //node->buffer->tmp_full_buffer_size); + __sync_fetch_and_add(&(index->memory_info.disk_data_full), (node->buffer->full_buffer_size + node->buffer->tmp_full_buffer_size)); - //index->memory_info.disk_data_partial += (node->buffer->partial_buffer_size + - //node->buffer->tmp_partial_buffer_size); __sync_fetch_and_add(&(index->memory_info.disk_data_partial), (node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size)); - //flush_node_buffer(node->buffer, index->settings->paa_segments, - //index->settings->timeseries_size, - //node->filename); } else if (!node->is_leaf) { flush_subtree_leaf_buffers_inmemory(index, node->left_child); flush_subtree_leaf_buffers_inmemory(index, node->right_child); @@ -2153,39 +2094,33 @@ enum response flush_subtree_leaf_buffers_inmemory(isax_index *index, isax_node * } isax_index *isax_index_init_inmemory(isax_index_settings *settings) { - isax_index *index = malloc(sizeof(isax_index)); + isax_index *index = (isax_index*)malloc(sizeof(isax_index)); + if (index == NULL) { fprintf(stderr, "error: could not allocate memory for index structure.\n"); + return NULL; } + index->memory_info.mem_tree_structure = 0; index->memory_info.mem_data = 0; index->memory_info.mem_summaries = 0; index->memory_info.disk_data_full = 0; index->memory_info.disk_data_partial = 0; - index->settings = settings; index->first_node = NULL; index->fbl = initialize_fbl(settings->initial_fbl_buffer_size, pow(2, settings->paa_segments), settings->max_total_buffer_size + DISK_BUFFER_SIZE * (PROGRESS_CALCULATE_THREAD_NUMBER - 1), index); - - index->sax_cache = NULL; - index->total_records = 0; index->loaded_records = 0; - index->root_nodes = 0; index->allocated_memory = 0; index->has_wedges = 0; - //index->locations = malloc(sizeof(int) * settings->timeseries_size); - - index->answer = malloc(sizeof(ts_type) * settings->timeseries_size); - + index->answer = (ts_type*)malloc(sizeof(ts_type) * settings->timeseries_size); index->norm_factor = ((ts_type) 1) / (sqrtf(settings->timeseries_size)); return index; } - diff --git a/src/ads/inmemory_query_engine.c b/src/ads/inmemory_query_engine.c index 7314935d..5843c02c 100644 --- a/src/ads/inmemory_query_engine.c +++ b/src/ads/inmemory_query_engine.c @@ -11,10 +11,8 @@ #include #include #include - #include #include - #include "ads/isax_query_engine.h" #include "ads/inmemory_query_engine.h" #include "ads/parallel_query_engine.h" @@ -28,21 +26,27 @@ #include "ads/sfa/sfa.h" #define NTHREADS 4 +#define SET_TO_SMALLER(dst, src) src < dst ? src : dst int checkts = 0; float *MINDISTS; void *compute_mindists_in(void *ptr) { struct args_in *arguments = (struct args_in *) ptr; - unsigned long i; - - for (i = arguments->from; i < arguments->to; i++) { - sax_type *sax = &(arguments->index->sax_cache[i * arguments->index->settings->paa_segments]); - MINDISTS[i] = minidist_paa_to_isax_rawa_SIMD(arguments->paa, sax, - arguments->index->settings->max_sax_cardinalities, - arguments->index->settings->sax_bit_cardinality, - arguments->index->settings->sax_alphabet_cardinality, - arguments->index->settings->paa_segments, MINVAL, MAXVAL, - arguments->index->settings->mindist_sqrt); + unsigned long count; + + for (count = arguments->from; count < arguments->to; count++) { + sax_type *sax = &(arguments->index->sax_cache[count * arguments->index->settings->paa_segments]); +#if defined(__x86_64__) + MINDISTS[count] = minidist_paa_to_isax_rawa_SIMD(arguments->paa, sax, + arguments->index->settings->max_sax_cardinalities, arguments->index->settings->sax_bit_cardinality, + arguments->index->settings->sax_alphabet_cardinality, arguments->index->settings->paa_segments, + MINVAL, MAXVAL, arguments->index->settings->mindist_sqrt); +#else + MINDISTS[count] = minidist_paa_to_isax_raw(arguments->paa, sax, + arguments->index->settings->max_sax_cardinalities, arguments->index->settings->sax_bit_cardinality, + arguments->index->settings->sax_alphabet_cardinality, arguments->index->settings->paa_segments, + MINVAL, MAXVAL, arguments->index->settings->mindist_sqrt); +#endif } return NULL; @@ -51,10 +55,9 @@ void *compute_mindists_in(void *ptr) { query_result approximate_search_inmemory(ts_type *ts, ts_type *paa, isax_index *index) { query_result result; - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality); root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); @@ -67,7 +70,7 @@ query_result approximate_search_inmemory(ts_type *ts, ts_type *paa, isax_index * while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; if (sax[node->split_data->splitpoint] & mask) { @@ -78,6 +81,7 @@ query_result approximate_search_inmemory(ts_type *ts, ts_type *paa, isax_index * // Adaptive splitting } + result.distance = calculate_node_distance_inmemory(index, node, ts, FLT_MAX); result.node = node; } else { @@ -92,33 +96,27 @@ query_result approximate_search_inmemory(ts_type *ts, ts_type *paa, isax_index * query_result approximate_search_inmemory_messi(ts_type *ts, ts_type *paa, isax_index *index) { query_result result; + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - + // SFA if (index->settings->function_type == 4) { sfa_from_fft(index, paa, sax); - } - - //SAX - else { - sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + } else { // SAX + sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality); } root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); - - if ((&((first_buffer_layer2 * )(index->fbl))->soft_buffers[(int) root_mask])->initialized) { + if ((&((first_buffer_layer2 *)(index->fbl))->soft_buffers[(int) root_mask])->initialized) { isax_node *node = (&((first_buffer_layer2 * )(index->fbl))->soft_buffers[(int) root_mask])->node; // Traverse tree // Adaptive splitting - while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; if (sax[node->split_data->splitpoint] & mask) { @@ -126,9 +124,8 @@ query_result approximate_search_inmemory_messi(ts_type *ts, ts_type *paa, isax_i } else { node = node->left_child; } - - // Adaptive splitting } + result.distance = calculate_node_distance_inmemory(index, node, ts, FLT_MAX); result.node = node; } else { @@ -143,38 +140,31 @@ query_result approximate_search_inmemory_messi(ts_type *ts, ts_type *paa, isax_i query_result approximate_search_inmemory_pRecBuf(ts_type *ts, ts_type *paa, isax_index *index) { query_result result; + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - - - //SFA + // SFA if (index->settings->function_type == 4) { sfa_from_fft(index, paa, sax); - } - - //SAX - else { + } else { // SAX sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality); } root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); COUNT_INIT_TIME_END - COUNT_TREE_PASS_TIME_START - if ((&((parallel_first_buffer_layer * )(index->fbl))->soft_buffers[(int) root_mask])->initialized) { - isax_node *node = (&((parallel_first_buffer_layer * )(index->fbl))->soft_buffers[(int) root_mask])->node; + if ((&((parallel_first_buffer_layer *)(index->fbl))->soft_buffers[(int) root_mask])->initialized) { + isax_node *node = (&((parallel_first_buffer_layer *)(index->fbl))->soft_buffers[(int) root_mask])->node; // Traverse tree // Adaptive splitting - while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; if (sax[node->split_data->splitpoint] & mask) { @@ -182,8 +172,6 @@ query_result approximate_search_inmemory_pRecBuf(ts_type *ts, ts_type *paa, isax } else { node = node->left_child; } - - // Adaptive splitting } result.distance = calculate_node_distance_inmemory(index, node, ts, FLT_MAX); @@ -192,6 +180,7 @@ query_result approximate_search_inmemory_pRecBuf(ts_type *ts, ts_type *paa, isax result.node = NULL; result.distance = FLT_MAX; } + COUNT_TREE_PASS_TIME_END free(sax); @@ -201,45 +190,39 @@ query_result approximate_search_inmemory_pRecBuf(ts_type *ts, ts_type *paa, isax float calculate_node_distance_inmemory(isax_index *index, isax_node *node, ts_type *query, float bsf) { COUNT_CHECKED_NODE() - // If node has buffered data + // If node has buffered data if (node->buffer != NULL) { - int i; + int count; RDcalculationnumber = RDcalculationnumber + node->buffer->full_buffer_size; - for (i = 0; i < node->buffer->full_buffer_size; i++) { - float dist = ts_ed(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); - if (dist < bsf) { - bsf = dist; - } + + for (count = 0; count < node->buffer->full_buffer_size; count++) { + float dist = ts_ed(query, node->buffer->full_ts_buffer[count], + index->settings->timeseries_size, bsf, index->settings->SIMD_flag, index->settings->is_norm); + bsf = SET_TO_SMALLER(bsf, dist); } + RDcalculationnumber = RDcalculationnumber + node->buffer->tmp_full_buffer_size; - for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { - float dist = ts_ed(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); - if (dist < bsf) { - bsf = dist; - } - } - RDcalculationnumber = RDcalculationnumber + node->buffer->partial_buffer_size; - for (i = 0; i < node->buffer->partial_buffer_size; i++) { - float dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + for (count = 0; count < node->buffer->tmp_full_buffer_size; count++) { + float dist = ts_ed(query, node->buffer->tmp_full_ts_buffer[count], + index->settings->timeseries_size, bsf, index->settings->SIMD_flag, index->settings->is_norm); + bsf = SET_TO_SMALLER(bsf, dist); + } - if (dist < bsf) { - bsf = dist; + RDcalculationnumber = RDcalculationnumber + node->buffer->partial_buffer_size; - } + for (count = 0; count < node->buffer->partial_buffer_size; count++) { + float dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, bsf, index->settings->SIMD_flag, index->settings->is_norm); + bsf = SET_TO_SMALLER(bsf, dist); } } + return bsf; } -//debugging only!!! +// debugging only!!! ts_type *calculate_node_ts_distance_inmemory(isax_index *index, isax_node *node, ts_type *query, float bsf) { ts_type *result = NULL; @@ -247,181 +230,248 @@ ts_type *calculate_node_ts_distance_inmemory(isax_index *index, isax_node *node, // If node has buffered data if (node->buffer != NULL) { - int i; - for (i = 0; i < node->buffer->full_buffer_size; i++) { - float dist = ts_ed(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + int count; + + for (count = 0; count < node->buffer->full_buffer_size; count++) { + float dist = ts_ed(query, node->buffer->full_ts_buffer[count], + index->settings->timeseries_size, bsf, index->settings->SIMD_flag, index->settings->is_norm); if (dist <= bsf) { bsf = dist; - result = node->buffer->full_ts_buffer[i]; + result = node->buffer->full_ts_buffer[count]; } } - for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { - float dist = ts_ed(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + for (count = 0; count < node->buffer->tmp_full_buffer_size; count++) { + float dist = ts_ed(query, node->buffer->tmp_full_ts_buffer[count], + index->settings->timeseries_size, bsf, index->settings->SIMD_flag, index->settings->is_norm); + if (dist <= bsf) { bsf = dist; - result = node->buffer->tmp_full_ts_buffer[i]; + result = node->buffer->tmp_full_ts_buffer[count]; } } - // RDcalculationnumber=RDcalculationnumber+node->buffer->partial_buffer_size; - for (i = 0; i < node->buffer->partial_buffer_size; i++) { - float dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + for (count = 0; count < node->buffer->partial_buffer_size; count++) { + float dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, bsf, index->settings->SIMD_flag, index->settings->is_norm); if (dist <= bsf) { bsf = dist; - result = &(rawfile[*node->buffer->partial_position_buffer[i]]); + result = &(rawfile[*node->buffer->partial_position_buffer[count]]); } } } + return result; } float calculate_node_distance2_inmemory(isax_index *index, isax_node *node, ts_type *query, ts_type *paa, float bsf) { COUNT_CHECKED_NODE() float distmin; + // If node has buffered data if (node->buffer != NULL) { - int i; - - //__sync_fetch_and_add(&LBDcalculationnumber,node->buffer->partial_buffer_size); - for (i = 0; i < node->buffer->partial_buffer_size; i++) { - - if (index->settings->SIMD_flag) { - distmin = minidist_paa_to_isax_rawa_SIMD( - paa, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); +#if defined(__x86_64__) + if (index->settings->SIMD_flag && __builtin_cpu_supports("avx512dq")) { + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_paa_to_isax_rawa_SIMD512(paa, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, index->settings->paa_segments, + MINVAL, MAXVAL, index->settings->mindist_sqrt); if (distmin < bsf) { - float dist = ts_ed(query, - &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); - - //__sync_fetch_and_add(&RDcalculationnumber,1); - if (dist < bsf) { - bsf = dist; - } + float dist = ts_euclidean_distance_SIMD512DQ(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, bsf); + bsf = SET_TO_SMALLER(bsf, dist); } - } else { - distmin = minidist_paa_to_isax_raw(paa, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); + } + } else if (index->settings->SIMD_flag) { + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_paa_to_isax_rawa_SIMD(paa, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, index->settings->paa_segments, + MINVAL, MAXVAL, index->settings->mindist_sqrt); + if (distmin < bsf) { - float dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + float dist = ts_euclidean_distance_SIMD(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, bsf); + bsf = SET_TO_SMALLER(bsf, dist); + } + } + } else { +#endif + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_paa_to_isax_raw(paa, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, index->settings->paa_segments, + MINVAL, MAXVAL, index->settings->mindist_sqrt); - //__sync_fetch_and_add(&RDcalculationnumber,1); - if (dist < bsf) { - bsf = dist; - } + if (distmin < bsf) { + float dist = ts_euclidean_distance(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, bsf); + bsf = SET_TO_SMALLER(bsf, dist); } } +#if defined(__x86_64__) } +#endif } + return bsf; } float calculate_node_distance2_inmemory_SFA(isax_index *index, isax_node *node, ts_type *query, ts_type *query_fft, - float bsf) { + float bsf) { COUNT_CHECKED_NODE() float distmin; // If node has buffered data - if (node->buffer != NULL) { - int i; - - //__sync_fetch_and_add(&LBDcalculationnumber,node->buffer->partial_buffer_size); - for (i = 0; i < node->buffer->partial_buffer_size; i++) { - if (index->settings->SIMD_flag) { - distmin = minidist_fft_to_sfa_rawe_SIMD(index, query_fft, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, bsf); - } else { - distmin = minidist_fft_to_sfa_raw(index, query_fft, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, bsf); - } + if (node->buffer != NULL) { + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_fft_to_sfa_raw(index, query_fft, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, bsf); if (distmin < bsf) { float dist; - dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); - - //__sync_fetch_and_add(&RDcalculationnumber,1); - - if (dist < bsf) { - bsf = dist; - } + dist = ts_euclidean_distance(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, bsf); + bsf = SET_TO_SMALLER(bsf, dist); } } } + return bsf; } -void calculate_node_topk_inmemory_SFA (isax_index *index, isax_node *node, ts_type *query,ts_type *query_fft, pqueue_bsf *pq_bsf, pthread_rwlock_t *lock_queue ) -{ +#if defined(__x86_64__) +float calculate_node_distance2_inmemory_SFA_SIMD(isax_index *index, isax_node *node, ts_type *query, ts_type *query_fft, + float bsf) { COUNT_CHECKED_NODE() float distmin; // If node has buffered data + if (node->buffer != NULL) { - int i; + if (__builtin_cpu_supports("avx512vl")) { + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_fft_to_sfa_rawe_SIMD512(index, query_fft, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, bsf); - //__sync_fetch_and_add(&LBDcalculationnumber,node->buffer->partial_buffer_size); - for (i = 0; i < node->buffer->partial_buffer_size; i++) { + if (distmin < bsf) { + float dist; + dist = ts_euclidean_distance_SIMD512DQ(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, bsf); + bsf = SET_TO_SMALLER(bsf, dist); + } + } + } else { + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_fft_to_sfa_rawe_SIMD(index, query_fft, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, bsf); - if (index->settings->SIMD_flag) { - distmin = minidist_fft_to_sfa_rawe_SIMD(index, query_fft, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, pq_bsf->knn[pq_bsf->k-1]); - } else { - distmin = minidist_fft_to_sfa_raw(index, query_fft, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, pq_bsf->knn[pq_bsf->k-1]); + if (distmin < bsf) { + float dist; + dist = ts_euclidean_distance_SIMD(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, bsf); + bsf = SET_TO_SMALLER(bsf, dist); + } } + } + } + + return bsf; +} +#endif + +void calculate_node_topk_inmemory_SFA(isax_index *index, isax_node *node, ts_type *query, ts_type *query_fft, + pqueue_bsf *pq_bsf, pthread_rwlock_t *lock_queue) { + COUNT_CHECKED_NODE() + float distmin; + + // If node has buffered data + if (node->buffer != NULL) { + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_fft_to_sfa_raw(index, query_fft, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, pq_bsf->knn[pq_bsf->k - 1]); - if (distmin < pq_bsf->knn[pq_bsf->k-1]) { + if (distmin < pq_bsf->knn[pq_bsf->k - 1]) { float dist; - dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1], - index->settings->SIMD_flag, index->settings->is_norm); + dist = ts_euclidean_distance(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); + + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { + pthread_rwlock_wrlock(lock_queue); + pqueue_bsf_insert(pq_bsf, dist, + *node->buffer->partial_position_buffer[count] / index->settings->timeseries_size, node); + pthread_rwlock_unlock(lock_queue); + } + } + } + } +} - //__sync_fetch_and_add(&RDcalculationnumber,1); +#if defined(__x86_64__) +void calculate_node_topk_inmemory_SFA_SIMD(isax_index *index, isax_node *node, ts_type *query, ts_type *query_fft, + pqueue_bsf *pq_bsf, pthread_rwlock_t *lock_queue) { + COUNT_CHECKED_NODE() + float distmin; - if (dist <= pq_bsf->knn[pq_bsf->k-1]) { - pthread_rwlock_wrlock(lock_queue); - pqueue_bsf_insert(pq_bsf,dist,*node->buffer->partial_position_buffer[i]/index->settings->timeseries_size,node); - pthread_rwlock_unlock(lock_queue); + // If node has buffered data + if (node->buffer != NULL) { + if (__builtin_cpu_supports("avx512vl")) { + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_fft_to_sfa_rawe_SIMD512(index, query_fft, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, pq_bsf->knn[pq_bsf->k - 1]); + + if (distmin < pq_bsf->knn[pq_bsf->k - 1]) { + float dist; + dist = ts_euclidean_distance_SIMD512DQ(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); + + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { + pthread_rwlock_wrlock(lock_queue); + pqueue_bsf_insert(pq_bsf, dist, + *node->buffer->partial_position_buffer[count] / index->settings->timeseries_size, node); + pthread_rwlock_unlock(lock_queue); + } + } } + } else { + for (int count = 0; count < node->buffer->partial_buffer_size; count++) { + distmin = minidist_fft_to_sfa_rawe_SIMD(index, query_fft, node->buffer->partial_sax_buffer[count], + index->settings->max_sax_cardinalities, pq_bsf->knn[pq_bsf->k - 1]); + + if (distmin < pq_bsf->knn[pq_bsf->k - 1]) { + float dist; + dist = ts_euclidean_distance_SIMD(query, &(rawfile[*node->buffer->partial_position_buffer[count]]), + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); + + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { + pthread_rwlock_wrlock(lock_queue); + pqueue_bsf_insert(pq_bsf, dist, + *node->buffer->partial_position_buffer[count] / index->settings->timeseries_size, node); + pthread_rwlock_unlock(lock_queue); + } + } } } } } - +#endif query_result exact_search_serial_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves) { + int min_checked_leaves) { checkts = 0; RESET_BYTES_ACCESSED // FOR THREAD USE - MINDISTS = malloc(sizeof(float) * index->sax_cache_size); - unsigned long j; - for (j = 0; j < index->sax_cache_size; j++) + MINDISTS = (float*)malloc(sizeof(float) * index->sax_cache_size); + + for (unsigned long j = 0; j < index->sax_cache_size; j++) { MINDISTS[j] = FLT_MAX; + } + // END COUNT_INPUT_TIME_START query_result approximate_result = approximate_search_inmemory_pRecBuf(ts, paa, index); @@ -436,134 +486,134 @@ query_result exact_search_serial_inmemory(ts_type *ts, ts_type *paa, isax_index } if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); } COUNT_INPUT_TIME_END + unsigned long count; - unsigned long i; - - //FILE *raw_file = fopen(index->settings->raw_filename, "rb"); - //fseek(raw_file, 0, SEEK_SET); ts_type *ts_buffer; - SET_APPROXIMATE(approximate_result.distance); // THREADED pthread_t thread[1]; struct args_in arguments[1]; COUNT_CAL_TIME_START - for (i = 0; i < 1; i++) { - arguments[i].i = i; - arguments[i].from = i * (index->sax_cache_size / 1); - arguments[i].bsf = approximate_result.distance; - if (i < (1 - 1)) { - arguments[i].to = (i + 1) * (index->sax_cache_size / 1); - } else { - arguments[i].to = index->sax_cache_size; + for (count = 0; count < 1; count++) { + arguments[count].i = count; + arguments[count].from = count * (index->sax_cache_size / 1); + arguments[count].bsf = approximate_result.distance; + + if (count < (1 - 1)) { + arguments[count].to = (count + 1) * (index->sax_cache_size / 1); + } else { + arguments[count].to = index->sax_cache_size; } - arguments[i].paa = paa; - arguments[i].index = index; - int ret = pthread_create(&thread[i], NULL, compute_mindists_in, &arguments[i]); + + arguments[count].paa = paa; + arguments[count].index = index; + int ret = pthread_create(&thread[count], NULL, compute_mindists_in, &arguments[count]); } - for (i = 0; i < 1; i++) { - pthread_join(thread[i], NULL); + for (count = 0; count < 1; count++) { + pthread_join(thread[count], NULL); } + // END COUNT_CAL_TIME_END - //printf("the min distance 0 is %f\n",MINDISTS[0] ); COUNT_OUTPUT_TIME_START - for (i = 0; i < index->sax_cache_size; i++) { - sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - if (MINDISTS[i] <= approximate_result.distance) { - ts_buffer = &rawfile[i * index->settings->timeseries_size]; + + for (count = 0; count < index->sax_cache_size; count++) { + sax_type *sax = &index->sax_cache[count * index->settings->paa_segments]; + + if (MINDISTS[count] <= approximate_result.distance) { + ts_buffer = &rawfile[count * index->settings->timeseries_size]; checkts++; - float dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, FLT_MAX); +#if defined(__x86_64__) + float dist = __builtin_cpu_supports("avx512dq") ? + ts_euclidean_distance_SIMD512DQ(ts, ts_buffer, index->settings->timeseries_size, FLT_MAX) : + ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, FLT_MAX); +#else + float dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, FLT_MAX); +#endif + if (dist < approximate_result.distance) { approximate_result.distance = dist; - #ifdef STORE_ANSWER memcpy(index->answer, ts_buffer, index->settings->timeseries_size * sizeof(ts_type)); #endif } } } + COUNT_OUTPUT_TIME_END free(MINDISTS); - //FILE *pfile = fopen("hhhehehehf.bin", "a+"); - //float kkkkkk=approximate_result.distance; - //fwrite(&kkkkkk, sizeof(float), 1, pfile); - //fclose(pfile); return approximate_result; } query_result exact_search_serial_1bsf_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves, float bsf) { - + int min_checked_leaves, float bsf) { RESET_BYTES_ACCESSED - // FOR THREAD USE - MINDISTS = malloc(sizeof(float) * index->sax_cache_size); - unsigned long j; - unsigned long diskconter = 0, bsfupdate = 0; + MINDISTS = (float*)malloc(sizeof(float) * index->sax_cache_size); + unsigned long diskconter = 0; + unsigned long bsfupdate = 0; - for (j = 0; j < index->sax_cache_size; j++) + for (unsigned long j = 0; j < index->sax_cache_size; j++) { MINDISTS[j] = FLT_MAX; + } + // END COUNT_INPUT_TIME_START query_result approximate_result; + if (bsf == FLT_MAX) { approximate_result = approximate_search_inmemory(ts, paa, index); + if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + min_checked_leaves); } } else { approximate_result.distance = bsf; } - - // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - COUNT_INPUT_TIME_END - - unsigned long i; - //FILE *raw_file = fopen(index->settings->raw_filename, "rb"); - //fseek(raw_file, 0, SEEK_SET); ts_type *ts_buffer; - SET_APPROXIMATE(approximate_result.distance); // THREADED pthread_t thread[maxquerythread]; struct args_in arguments[maxquerythread]; COUNT_CAL_TIME_START + for (i = 0; i < maxquerythread; i++) { arguments[i].i = i; arguments[i].from = i * (index->sax_cache_size / maxquerythread); + if (i < (maxquerythread - 1)) { arguments[i].to = (i + 1) * (index->sax_cache_size / maxquerythread); } else { arguments[i].to = index->sax_cache_size; } + arguments[i].paa = paa; arguments[i].index = index; int ret = pthread_create(&thread[i], NULL, compute_mindists_in, &arguments[i]); @@ -572,17 +622,21 @@ query_result exact_search_serial_1bsf_inmemory(ts_type *ts, ts_type *paa, isax_i for (i = 0; i < maxquerythread; i++) { pthread_join(thread[i], NULL); } + // END COUNT_CAL_TIME_END COUNT_OUTPUT_TIME_START + for (i = 0; i < index->sax_cache_size; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; + if (MINDISTS[i] <= approximate_result.distance) { ts_buffer = &rawfile[i * index->settings->timeseries_size]; diskconter++; float dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, - approximate_result.distance); + approximate_result.distance); + if (dist < approximate_result.distance) { approximate_result.distance = dist; bsfupdate++; @@ -592,16 +646,17 @@ query_result exact_search_serial_1bsf_inmemory(ts_type *ts, ts_type *paa, isax_i } } } + COUNT_OUTPUT_TIME_END free(MINDISTS); - //printf("the bsf update time is: %ld\n",bsfupdate); + return approximate_result; } query_result refine_answer_inmemory(ts_type *ts, ts_type *paa, isax_index *index, - query_result approximate_bsf_result, - float minimum_distance, int limit) { + query_result approximate_bsf_result, + float minimum_distance, int limit) { query_result bsf_result = approximate_bsf_result; int tight_bound = index->settings->tight_bound; @@ -609,43 +664,48 @@ query_result refine_answer_inmemory(ts_type *ts, ts_type *paa, isax_index *index int j = 0; pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; while (current_root_node != NULL) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = current_root_node; pqueue_insert(pq, mindist_result); current_root_node = current_root_node->next; } + query_result *n; int checks = 0; - while ((n = pqueue_pop(pq))) { + + while ((n = (query_result*)pqueue_pop(pq))) { // The best node has a worse mindist, so search is finished! if (n->distance >= bsf_result.distance || n->distance > minimum_distance) { pqueue_insert(pq, n); + break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) { + (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue - //split_node(index, n->node); - //pqueue_insert(pq, n); + // split_node(index, n->node); + // pqueue_insert(pq, n); + continue; } + // *** EXTRA BOUNDING *** if (tight_bound) { j++; @@ -653,18 +713,22 @@ query_result refine_answer_inmemory(ts_type *ts, ts_type *paa, isax_index *index if (mindistance >= bsf_result.distance) { free(n); + continue; } } // *** REAL DISTANCE *** checks++; float distance = calculate_node_distance_inmemory(index, n->node, ts, bsf_result.distance); + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node; } + if (checks > limit) { pqueue_insert(pq, n); + break; } } else { @@ -672,44 +736,47 @@ query_result refine_answer_inmemory(ts_type *ts, ts_type *paa, isax_index *index // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { if (n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + aggressive_check) { float distance = calculate_node_distance_inmemory(index, n->node->left_child, ts, - bsf_result.distance); + bsf_result.distance); + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->left_child; } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = n->node->left_child; pqueue_insert(pq, mindist_result); } } + if (n->node->right_child->isax_cardinalities != NULL) { if (n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + aggressive_check) { float distance = calculate_node_distance_inmemory(index, n->node->right_child, ts, - bsf_result.distance); + bsf_result.distance); + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->right_child; } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = n->node->right_child; pqueue_insert(pq, mindist_result); } @@ -720,56 +787,72 @@ query_result refine_answer_inmemory(ts_type *ts, ts_type *paa, isax_index *index free(n); } } + // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { + while ((n = (query_result*)pqueue_pop(pq))) { free(n); } + // Free the priority queue. pqueue_free(pq); + return bsf_result; } float calculate_minimum_distance_inmemory(isax_index *index, isax_node *node, ts_type *raw_query, ts_type *query) { - //printf("Calculating minimum distance...\n"); float bsfLeaf = minidist_paa_to_isax(query, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); float bsfRecord = FLT_MAX; - //printf("---> Distance: %lf\n", bsfLeaf); - //sax_print(node->isax_values, 1, index->settings->sax_bit_cardinality); if (!index->has_wedges) { - // printf("--------------\n"); int i = 0; - if (node->buffer != NULL) { for (i = 0; i < node->buffer->partial_buffer_size; i++) { +#if defined(__x86_64__) float mindist = minidist_paa_to_isax_raw_SIMD(query, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - // printf("+[PARTIAL] %lf\n", mindist); + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + float mindist = minidist_paa_to_isax_raw(query, node->buffer->partial_sax_buffer[i], + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + if (mindist < bsfRecord) { bsfRecord = mindist; } } for (i = 0; i < node->buffer->tmp_partial_buffer_size; i++) { +#if defined(__x86_64__) float mindist = minidist_paa_to_isax_raw_SIMD(query, node->buffer->tmp_partial_sax_buffer[i], - index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - // printf("+[TMP_PARTIAL] %lf\n", mindist); + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + float mindist = minidist_paa_to_isax_raw(query, node->buffer->tmp_partial_sax_buffer[i], + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + if (mindist < bsfRecord) { bsfRecord = mindist; } @@ -777,54 +860,52 @@ float calculate_minimum_distance_inmemory(isax_index *index, isax_node *node, ts } } else { int i = 0; + if (node->wedges[0] == FLT_MIN) { bsfRecord = FLT_MAX; } else { bsfRecord = 0; ts_type *min_wedge = &node->wedges[0]; ts_type *max_wedge = &node->wedges[index->settings->timeseries_size]; + if (raw_query[i] > max_wedge[i]) { bsfRecord += (raw_query[i] - max_wedge[i]) * (raw_query[i] - max_wedge[i]); } else if (raw_query[i] < max_wedge[i] && raw_query[i] > min_wedge[i]) { - //bound += 0; + // bound += 0; } else { bsfRecord += (min_wedge[i] - raw_query[i]) * (min_wedge[i] - raw_query[i]); } - //bsfRecord = sqrtf(bsfRecord); } - } - float bsf = (bsfRecord == FLT_MAX) ? bsfLeaf : bsfRecord; - // printf("\t%.2lf - %d [%d] : %s.%s\n",bsfRecord, node->leaf_size, node->is_leaf, node->filename, node->has_full_data_file ? ".full" : ".part"); + float bsf = (bsfRecord == FLT_MAX) ? bsfLeaf : bsfRecord; - //printf("---> Final: %lf\n", bsf); return bsf; } query_result exact_search_inmemory(ts_type *ts, ts_type *paa, isax_index *index, - float minimum_distance, int min_checked_leaves) { + float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_inmemory(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; - // Early termination... if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + min_checked_leaves); } + COUNT_QUEUE_TIME_START pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); COUNT_QUEUE_TIME_END - query_result *do_not_remove = &approximate_result; SET_APPROXIMATE(approximate_result.distance); @@ -836,123 +917,120 @@ query_result exact_search_inmemory(ts_type *ts, ts_type *paa, isax_index *index, COUNT_QUEUE_TIME_START pqueue_insert(pq, &approximate_result); COUNT_QUEUE_TIME_END - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; + while (current_root_node != NULL) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = current_root_node; COUNT_QUEUE_TIME_START pqueue_insert(pq, mindist_result); COUNT_QUEUE_TIME_END current_root_node = current_root_node->next; } + query_result *n; int checks = 0; - while ((n = pqueue_pop(pq))) { + + while ((n = (query_result*)pqueue_pop(pq))) { // The best node has a worse mindist, so search is finished! - //printf("this is the check point of e s !!!\n"); if (n->distance >= bsf_result.distance || n->distance > minimum_distance) { COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) { + (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue split_node(index, n->node); COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + continue; } - // *** EXTRA BOUNDING *** - /* if(tight_bound) { - COUNT_CAL_TIME_START - float mindistance = calculate_minimum_distance_inmemory(index, n->node, ts, paa); - COUNT_CAL_TIME_END - if(mindistance >= bsf_result.distance) - { - if(n != do_not_remove)//add - free(n); - continue; - } - }*/ + // *** REAL DISTANCE *** checks++; COUNT_CAL_TIME_START float distance = calculate_node_distance_inmemory(index, n->node, ts, bsf_result.distance); COUNT_CAL_TIME_END + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node; } - //no check limit juge + // no check limit juge } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { if (n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + aggressive_check) { COUNT_CAL_TIME_START float distance = calculate_node_distance_inmemory(index, n->node->left_child, ts, - bsf_result.distance); + bsf_result.distance); COUNT_CAL_TIME_END + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->left_child; } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = n->node->left_child; COUNT_QUEUE_TIME_START pqueue_insert(pq, mindist_result); COUNT_QUEUE_TIME_END } } + if (n->node->right_child->isax_cardinalities != NULL) { if (n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + aggressive_check) { COUNT_CAL_TIME_START float distance = calculate_node_distance_inmemory(index, n->node->right_child, ts, - bsf_result.distance); + bsf_result.distance); COUNT_CAL_TIME_END + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->right_child; } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = n->node->right_child; COUNT_QUEUE_TIME_START pqueue_insert(pq, mindist_result); @@ -962,45 +1040,50 @@ query_result exact_search_inmemory(ts_type *ts, ts_type *paa, isax_index *index, } // Free the node currently popped. - if (n != do_not_remove)//add + if (n != do_not_remove) { // add free(n); + } } } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { - if (n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. COUNT_QUEUE_TIME_START pqueue_free(pq); COUNT_QUEUE_TIME_END - //PRINT_BYTES_ACCESSED + return bsf_result; } query_result exact_search_inmemory2(ts_type *ts, ts_type *paa, isax_index *index, - float minimum_distance, int min_checked_leaves) { + float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_inmemory(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; // Early termination... checkts = 0; + if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + min_checked_leaves); } + COUNT_QUEUE_TIME_START pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); COUNT_QUEUE_TIME_END - query_result *do_not_remove = &approximate_result; SET_APPROXIMATE(approximate_result.distance); @@ -1012,105 +1095,124 @@ query_result exact_search_inmemory2(ts_type *ts, ts_type *paa, isax_index *index COUNT_QUEUE_TIME_START pqueue_insert(pq, &approximate_result); COUNT_QUEUE_TIME_END - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; while (current_root_node != NULL) { - COUNT_QUEUE_TIME_START insert_tree_node(paa, current_root_node, index, bsf_result.distance, pq); COUNT_QUEUE_TIME_END current_root_node = current_root_node->next; } + query_result *n; int checks = 0; - while ((n = pqueue_pop(pq))) { + + while ((n = (query_result*)pqueue_pop(pq))) { // The best node has a worse mindist, so search is finished! - //printf("this is the check point of e s !!!\n"); if (n->distance >= bsf_result.distance || n->distance > minimum_distance) { COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) { - // Split and push again in the queue + (n->node->leaf_size > index->settings->min_leaf_size)) { + // Split and push again in the queue split_node(index, n->node); COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + continue; } + // *** EXTRA BOUNDING *** if (tight_bound) { - //COUNT_CAL_TIME_START + // COUNT_CAL_TIME_START float mindistance = calculate_minimum_distance_inmemory(index, n->node, ts, paa); - //COUNT_CAL_TIME_END + // COUNT_CAL_TIME_END + if (mindistance >= bsf_result.distance) { - if (n != do_not_remove)//add + if (n != do_not_remove) { // add free(n); + } + continue; } } // *** REAL DISTANCE *** checks++; - //COUNT_CAL_TIME_START - //float distance = calculate_node_distance_inmemory(index, n->node, ts, bsf_result.distance); + // COUNT_CAL_TIME_START float distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsf_result.distance); - //COUNT_CAL_TIME_END + // COUNT_CAL_TIME_END + if (distance < bsf_result.distance) { - //printf("node distance is %f\n",n->distance ); bsf_result.distance = distance; bsf_result.node = n->node; } - //no check limit juge + // no check limit juge } - // Free the node currently popped. - if (n != do_not_remove)//add + if (n != do_not_remove) { // add free(n); + } } } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { - if (n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. printf("the check ts is %d\n", checkts); COUNT_QUEUE_TIME_START pqueue_free(pq); COUNT_QUEUE_TIME_END - //PRINT_BYTES_ACCESSED + // PRINT_BYTES_ACCESSED + return bsf_result; } void insert_tree_node(float *paa, isax_node *node, isax_index *index, float bsf, pqueue_t *pq) { - //COUNT_CAL_TIME_START - float distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - //COUNT_CAL_TIME_END + // COUNT_CAL_TIME_START + float distance; +#if defined(__x86_64__) + if (index->settings->SIMD_flag && __builtin_cpu_supports("avx512dq")) { + distance = minidist_paa_to_isax_rawa_SIMD512(paa, node->isax_values, node->isax_cardinalities, + index->settings->sax_bit_cardinality, index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, index->settings->mindist_sqrt); + } else if (index->settings->SIMD_flag) { + distance = minidist_paa_to_isax_rawa_SIMD(paa, node->isax_values, node->isax_cardinalities, + index->settings->sax_bit_cardinality, index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, index->settings->mindist_sqrt); + } else { +#endif + distance = minidist_paa_to_isax(paa, node->isax_values, node->isax_cardinalities, + index->settings->sax_bit_cardinality, index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, index->settings->mindist_sqrt); +#if defined(__x86_64__) + } +#endif + // COUNT_CAL_TIME_END if (distance < bsf) { if (node->is_leaf) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->node = node; mindist_result->distance = distance; pqueue_insert(pq, mindist_result); @@ -1119,12 +1221,10 @@ void insert_tree_node(float *paa, isax_node *node, isax_index *index, float bsf, if (node->left_child->isax_cardinalities != NULL) { insert_tree_node(paa, node->left_child, index, bsf, pq); } + if (node->right_child->isax_cardinalities != NULL) { insert_tree_node(paa, node->right_child, index, bsf, pq); } } } } - - - diff --git a/src/ads/inmemory_topk_engine.c b/src/ads/inmemory_topk_engine.c index 64bf07db..80a92f29 100644 --- a/src/ads/inmemory_topk_engine.c +++ b/src/ads/inmemory_topk_engine.c @@ -24,32 +24,35 @@ float *MINDISTS; #define NTHREADS 4 void approximate_topk_inmemory(ts_type *ts, ts_type *paa, isax_index *index, pqueue_bsf *pq_bsf) { - - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); if (index->settings->function_type == 4) { - sfa_from_fft(index, paa, sax); - } - - //SAX - else { +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + sfa_from_fft_SIMD(index, paa, sax); + } else { +#endif + sfa_from_fft(index, paa, sax); +#if defined(__x86_64__) + } +#endif + } else { // SAX sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality); } + root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); if ((&((parallel_first_buffer_layer *) (index->fbl))->soft_buffers[(int) root_mask])->initialized) { isax_node *node = (&((parallel_first_buffer_layer *) (index->fbl))->soft_buffers[(int) root_mask])->node; - // Traverse tree + // Traverse tree // Adaptive splitting - while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; if (sax[node->split_data->splitpoint] & mask) { @@ -57,70 +60,73 @@ void approximate_topk_inmemory(ts_type *ts, ts_type *paa, isax_index *index, pqu } else { node = node->left_child; } - - // Adaptive splitting } - calculate_node_topk_inmemory(index, node, ts, pq_bsf); - } else { + calculate_node_topk_inmemory(index, node, ts, pq_bsf); } + for (int i = 0; i < pq_bsf->k - 1; ++i) { pq_bsf->knn[i] = pq_bsf->knn[pq_bsf->k - 1]; } + free(sax); } void refine_topk_answer_inmemory(ts_type *ts, ts_type *paa, isax_index *index, pqueue_bsf *pq_bsf, - float minimum_distance, int limit) { - + float minimum_distance, int limit) { int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; int j = 0; pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; while (current_root_node != NULL) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); if (index->settings->function_type == 4) { mindist_result->distance = minidist_fft_to_sfa(index, paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, minimum_distance); + current_root_node->isax_cardinalities, minimum_distance); } else { mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); } + mindist_result->node = current_root_node; pqueue_insert(pq, mindist_result); current_root_node = current_root_node->next; } + query_result *n; int checks = 0; - while ((n = pqueue_pop(pq))) { + + while ((n = (query_result*)pqueue_pop(pq))) { // The best node has a worse mindist, so search is finished! if (n->distance >= pq_bsf->knn[pq_bsf->k - 1] || n->distance > minimum_distance) { pqueue_insert(pq, n); + break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** - if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) { - //Split and push again in the queue + if (!n->node->has_full_data_file && (n->node->leaf_size > index->settings->min_leaf_size)) { + // Split and push again in the queue split_node(index, n->node); pqueue_insert(pq, n); + continue; } + // *** EXTRA BOUNDING *** if (tight_bound) { j++; @@ -128,64 +134,72 @@ void refine_topk_answer_inmemory(ts_type *ts, ts_type *paa, isax_index *index, p if (mindistance >= pq_bsf->knn[pq_bsf->k - 1]) { free(n); + continue; } } + // *** REAL DISTANCE *** checks++; calculate_node_topk_inmemory(index, n->node, ts, pq_bsf); if (pq_bsf->knn[pq_bsf->k - 1] < FLT_MAX) { pqueue_insert(pq, n); + break; } } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { - if (n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + if (n->node->left_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { calculate_node_topk_inmemory(index, n->node->left_child, ts, pq_bsf); } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); + if (index->settings->function_type == 4) { mindist_result->distance = minidist_fft_to_sfa(index, paa, - n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - minimum_distance); + n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + minimum_distance); } else { mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); } + mindist_result->node = n->node->left_child; pqueue_insert(pq, mindist_result); } } + if (n->node->right_child->isax_cardinalities != NULL) { - if (n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + if (n->node->right_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { calculate_node_topk_inmemory(index, n->node->right_child, ts, pq_bsf); } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); + if (index->settings->function_type == 4) { mindist_result->distance = minidist_fft_to_sfa(index, paa, - n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - minimum_distance); + n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + minimum_distance); } else { mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); } + mindist_result->node = n->node->right_child; pqueue_insert(pq, mindist_result); } @@ -196,69 +210,82 @@ void refine_topk_answer_inmemory(ts_type *ts, ts_type *paa, isax_index *index, p free(n); } } + // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { + while ((n = (query_result*)pqueue_pop(pq))) { free(n); } + for (int i = 0; i < pq_bsf->k - 1; ++i) { pq_bsf->knn[i] = pq_bsf->knn[pq_bsf->k - 1]; } - // Free the priority queue. + // Free the priority queue. pqueue_free(pq); } - void calculate_node_topk_inmemory(isax_index *index, isax_node *node, ts_type *query, pqueue_bsf *pq_bsf) { COUNT_CHECKED_NODE() - // If node has buffered data - + // If node has buffered data if (node->buffer != NULL) { int i; RDcalculationnumber = RDcalculationnumber + node->buffer->full_buffer_size; + for (i = 0; i < node->buffer->full_buffer_size; i++) { float dist = ts_ed(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1], - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1], + index->settings->SIMD_flag, index->settings->is_norm); + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { pqueue_bsf_insert(pq_bsf, dist, 0, node); } } + RDcalculationnumber = RDcalculationnumber + node->buffer->tmp_full_buffer_size; + for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { float dist = ts_ed(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1], - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1], + index->settings->SIMD_flag, index->settings->is_norm); + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { pqueue_bsf_insert(pq_bsf, dist, 0, node); } } + RDcalculationnumber = RDcalculationnumber + node->buffer->partial_buffer_size; - for (i = 0; i < node->buffer->partial_buffer_size; i++) { + for (i = 0; i < node->buffer->partial_buffer_size; i++) { float dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1], - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1], + index->settings->SIMD_flag, index->settings->is_norm); if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { pqueue_bsf_insert(pq_bsf, dist, - *node->buffer->partial_position_buffer[i] / index->settings->timeseries_size, node); + *node->buffer->partial_position_buffer[i] / index->settings->timeseries_size, node); } } } - ////////////////////////////////////// - } void calculate_node2_topk_inmemory(isax_index *index, isax_node *node, ts_type *query, ts_type *paa, pqueue_bsf *pq_bsf, - pthread_rwlock_t *lock_queue) { + pthread_rwlock_t *lock_queue) { COUNT_CHECKED_NODE() + // If node has buffered data if (node->buffer != NULL) { int i; + for (i = 0; i < node->buffer->full_buffer_size; i++) { - float dist = ts_euclidean_distance_SIMD(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); + float dist = +#if defined(__x86_64__) + ts_euclidean_distance_SIMD(query, node->buffer->full_ts_buffer[i], + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); +#else + ts_euclidean_distance(query, node->buffer->full_ts_buffer[i], + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); +#endif + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { pthread_rwlock_wrlock(lock_queue); pqueue_bsf_insert(pq_bsf, dist, 0, node); @@ -267,51 +294,76 @@ void calculate_node2_topk_inmemory(isax_index *index, isax_node *node, ts_type * } for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { - float dist = ts_euclidean_distance_SIMD(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); + float dist = +#if defined(__x86_64__) + ts_euclidean_distance_SIMD(query, node->buffer->tmp_full_ts_buffer[i], + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); +#else + ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); +#endif + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { pthread_rwlock_wrlock(lock_queue); pqueue_bsf_insert(pq_bsf, dist, 0, node); pthread_rwlock_unlock(lock_queue); } } + for (i = 0; i < node->buffer->partial_buffer_size; i++) { - float distmin = minidist_paa_to_isax_rawa_SIMD(paa, node->buffer->partial_sax_buffer[i], - index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); + float distmin = +#if defined(__x86_64__) + minidist_paa_to_isax_rawa_SIMD(paa, node->buffer->partial_sax_buffer[i], + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + minidist_paa_to_isax_raw(paa, node->buffer->partial_sax_buffer[i], + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + if (distmin <= pq_bsf->knn[pq_bsf->k - 1]) { - float dist = ts_euclidean_distance_SIMD(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); + float dist = +#if defined(__x86_64__) + ts_euclidean_distance_SIMD(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); +#else + ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k - 1]); +#endif + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { pthread_rwlock_wrlock(lock_queue); pqueue_bsf_insert(pq_bsf, dist, - *node->buffer->partial_position_buffer[i] / index->settings->timeseries_size, - node); + *node->buffer->partial_position_buffer[i] / index->settings->timeseries_size, + node); pthread_rwlock_unlock(lock_queue); } } } } - ////////////////////////////////////// - } -pqueue_bsf exact_search_serial_topk_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves, int k) { - +pqueue_bsf exact_search_serial_topk_inmemory(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves, int k) { RESET_BYTES_ACCESSED // FOR THREAD USE COUNT_INPUT_TIME_START - MINDISTS = malloc(sizeof(float) * index->sax_cache_size); + MINDISTS = (float*)malloc(sizeof(float) * index->sax_cache_size); pqueue_bsf *pq_bsf = pqueue_bsf_init(k); unsigned long j; - for (j = 0; j < index->sax_cache_size; j++) + + for (j = 0; j < index->sax_cache_size; j++) { MINDISTS[j] = FLT_MAX; + } // END approximate_topk_inmemory(ts, paa, index, pq_bsf); @@ -320,22 +372,17 @@ pqueue_bsf exact_search_serial_topk_inmemory(ts_type *ts, ts_type *paa, isax_ind int aggressive_check = index->settings->aggressive_check; // Early termination... - if (pq_bsf->knn[k - 1] == FLT_MAX || min_checked_leaves > 1) { refine_topk_answer_inmemory(ts, paa, index, pq_bsf, minimum_distance, min_checked_leaves); } + printf("the bsf is %f\n", pq_bsf->knn[k - 1]); COUNT_INPUT_TIME_END - unsigned long i; - //FILE *raw_file = fopen(index->settings->raw_filename, "rb"); - //fseek(raw_file, 0, SEEK_SET); ts_type *ts_buffer; COUNT_INPUT_TIME_END - //SET_APPROXIMATE(approximate_result.distance); - // THREADED COUNT_CAL_TIME_START pthread_t thread[NTHREADS]; @@ -344,11 +391,13 @@ pqueue_bsf exact_search_serial_topk_inmemory(ts_type *ts, ts_type *paa, isax_ind for (i = 0; i < NTHREADS; i++) { arguments[i].i = i; arguments[i].from = i * (index->sax_cache_size / NTHREADS); + if (i < (NTHREADS - 1)) { arguments[i].to = (i + 1) * (index->sax_cache_size / NTHREADS); } else { arguments[i].to = index->sax_cache_size; } + arguments[i].paa = paa; arguments[i].index = index; int ret = pthread_create(&thread[i], NULL, compute_mindists_in, &arguments[i]); @@ -357,43 +406,47 @@ pqueue_bsf exact_search_serial_topk_inmemory(ts_type *ts, ts_type *paa, isax_ind for (i = 0; i < NTHREADS; i++) { pthread_join(thread[i], NULL); } + COUNT_CAL_TIME_END // END COUNT_OUTPUT_TIME_START + for (i = 0; i < index->sax_cache_size; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; + if (MINDISTS[i] <= pq_bsf->knn[k - 1]) { ts_buffer = &rawfile[i * index->settings->timeseries_size]; float dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, - pq_bsf->knn[pq_bsf->k - 1]); + pq_bsf->knn[pq_bsf->k - 1]); INCREASE_BYTES_ACCESSED(1) + if (dist < pq_bsf->knn[pq_bsf->k - 1]) { pqueue_bsf_insert(pq_bsf, dist, i, NULL); } } } + free(MINDISTS); COUNT_OUTPUT_TIME_END + return *pq_bsf; } - pqueue_bsf exact_topk_MESSImq_inmemory(ts_type *ts, ts_type *paa, isax_index *index, node_list *nodelist, - float minimum_distance, int min_checked_leaves, int k) { + float minimum_distance, int min_checked_leaves, int k) { RDcalculationnumber = 0; - pqueue_bsf *pq_bsf = pqueue_bsf_init(k); approximate_topk_inmemory(ts, paa, index, pq_bsf); - int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; int node_counter = 0; - // Early termination... + // Early termination... if (pq_bsf->knn[k - 1] == FLT_MAX || min_checked_leaves > 1) { refine_topk_answer_inmemory(ts, paa, index, pq_bsf, minimum_distance, min_checked_leaves); } - pqueue_t **allpq = malloc(sizeof(pqueue_t *) * N_PQUEUE); + + pqueue_t **allpq = (pqueue_t**)malloc(sizeof(pqueue_t *) * N_PQUEUE); pthread_mutex_t ququelock[N_PQUEUE]; int queuelabel[N_PQUEUE]; @@ -407,14 +460,15 @@ pqueue_bsf exact_topk_MESSImq_inmemory(ts_type *ts, ts_type *paa, isax_index *in pthread_t threadid[maxquerythread]; MESSI_workerdata workerdata[maxquerythread]; - pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER, lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, maxquerythread); for (int i = 0; i < N_PQUEUE; i++) { allpq[i] = pqueue_init(index->settings->root_nodes_size / N_PQUEUE, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); pthread_mutex_init(&ququelock[i], NULL); queuelabel[i] = 1; } @@ -439,12 +493,12 @@ pqueue_bsf exact_topk_MESSImq_inmemory(ts_type *ts, ts_type *paa, isax_index *in workerdata[i].pq_bsf = pq_bsf; } - query_result *n; for (int i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, exact_topk_worker_inmemory_hybridpqueue, (void *) &(workerdata[i])); } + for (int i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } @@ -453,20 +507,15 @@ pqueue_bsf exact_topk_MESSImq_inmemory(ts_type *ts, ts_type *paa, isax_index *in // Free the priority queue. pthread_barrier_destroy(&lock_barrier); - //pqueue_free(pq); for (int i = 0; i < N_PQUEUE; i++) { pqueue_free(allpq[i]); } + free(allpq); - //free(rfdata); return *pq_bsf; - - // Free the nodes that where not popped. - } - void *exact_topk_worker_inmemory_hybridpqueue(void *rfdata) { isax_node *current_root_node; query_result *n; @@ -487,126 +536,123 @@ void *exact_topk_worker_inmemory_hybridpqueue(void *rfdata) { int calculate_node = 0, calculate_node_quque = 0; int tnumber = rand() % N_PQUEUE; int startqueuenumber = ((MESSI_workerdata *) rfdata)->startqueuenumber; - //COUNT_QUEUE_TIME_START - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,write_total_time; - //gettimeofday(&workertimestart, NULL); + while (1) { current_root_node_number = __sync_fetch_and_add(((MESSI_workerdata *) rfdata)->node_counter, 1); - //printf("the number is %d\n",current_root_node_number ); - if (current_root_node_number >= ((MESSI_workerdata *) rfdata)->amountnode) + + if (current_root_node_number >= ((MESSI_workerdata *) rfdata)->amountnode) { break; - current_root_node = ((MESSI_workerdata *) rfdata)->nodelist[current_root_node_number]; + } + current_root_node = ((MESSI_workerdata *) rfdata)->nodelist[current_root_node_number]; insert_tree_node_m_hybridpqueue(paa, current_root_node, index, bsfdisntance, - ((MESSI_workerdata *) rfdata)->allpq, ((MESSI_workerdata *) rfdata)->alllock, - &tnumber); - //insert_tree_node_mW(paa,current_root_node,index,bsfdisntance,pq,((MESSI_workerdata*)rfdata)->lock_queue); - - + ((MESSI_workerdata *) rfdata)->allpq, ((MESSI_workerdata *) rfdata)->alllock, + &tnumber); } - //COUNT_QUEUE_TIME_END - //calculate_node_quque=pq->size; - //gettimeofday(&workercurenttime, NULL); pthread_barrier_wait(((MESSI_workerdata *) rfdata)->lock_barrier); - //printf("the size of quque is %d \n",pq->size); + while (1) { pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber]); + n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber]); pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - if (n == NULL) + + if (n == NULL) { break; - //pthread_rwlock_rdlock(((MESSI_workerdata*)rfdata)->lock_bsf); + } bsfdisntance = pq_bsf->knn[pq_bsf->k - 1]; - //pthread_rwlock_unlock(((MESSI_workerdata*)rfdata)->lock_bsf); - // The best node has a worse mindist, so search is finished! + // The best node has a worse mindist, so search is finished! if (n->distance > bsfdisntance || n->distance > minimum_distance) { break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { - checks++; - //float distance = calculate_node_distance2_inmemory(index, n->node, ts,paa, bsfdisntance); + if (index->settings->function_type == 4) { - calculate_node_topk_inmemory_SFA(index, n->node, ts, paa, pq_bsf, - ((MESSI_workerdata *) rfdata)->lock_bsf); +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + calculate_node_topk_inmemory_SFA_SIMD(index, n->node, ts, paa, pq_bsf, + ((MESSI_workerdata *) rfdata)->lock_bsf); + } else { +#endif + calculate_node_topk_inmemory_SFA(index, n->node, ts, paa, pq_bsf, + ((MESSI_workerdata *) rfdata)->lock_bsf); +#if defined(__x86_64__) + } +#endif } else { calculate_node2_topk_inmemory(index, n->node, ts, paa, pq_bsf, - ((MESSI_workerdata *) rfdata)->lock_bsf); + ((MESSI_workerdata *) rfdata)->lock_bsf); } - - } - } + free(n); } if ((((MESSI_workerdata *) rfdata)->allqueuelabel[startqueuenumber]) == 1) { (((MESSI_workerdata *) rfdata)->allqueuelabel[startqueuenumber]) = 0; pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - while (n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber])) { + + while (n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber])) { free(n); } + pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); } while (1) { int offset = rand() % N_PQUEUE; finished = true; + for (int i = 0; i < N_PQUEUE; i++) { if ((((MESSI_workerdata *) rfdata)->allqueuelabel[i]) == 1) { finished = false; + while (1) { pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[i])); - n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[i]); + n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[i]); pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[i])); - if (n == NULL) + + if (n == NULL) { break; + } + if (n->distance > bsfdisntance || n->distance > minimum_distance) { break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { checks++; - //float distance = calculate_node_distance2_inmemory(index, n->node, ts,paa, bsfdisntance); + if (index->settings->function_type == 4) { - calculate_node_topk_inmemory_SFA(index, n->node, ts, paa, pq_bsf, - ((MESSI_workerdata *) rfdata)->lock_bsf); +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + calculate_node_topk_inmemory_SFA_SIMD(index, n->node, ts, paa, pq_bsf, + ((MESSI_workerdata *) rfdata)->lock_bsf); + } else { +#endif + calculate_node_topk_inmemory_SFA(index, n->node, ts, paa, pq_bsf, + ((MESSI_workerdata *) rfdata)->lock_bsf); +#if defined(__x86_64__) + } +#endif } else { calculate_node2_topk_inmemory(index, n->node, ts, paa, pq_bsf, - ((MESSI_workerdata *) rfdata)->lock_bsf); + ((MESSI_workerdata *) rfdata)->lock_bsf); } - } - } - //add + free(n); } - } } + if (finished) { break; } } - - - //pthread_barrier_wait(((MESSI_workerdata*)rfdata)->lock_barrier); - //while(n=pqueue_pop(pq)) - //{ - //free(n); - //} - //pqueue_free(pq); - //worker_total_time += workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec)-workertimestart.tv_sec*1000000 - (workertimestart.tv_usec); - //printf("create pq time is %f \n",worker_total_time ); - //printf("the worker's write time is %f \n",worker_total_time ); - //printf("the check's node is\t %d\tthe local queue's node is\t%d\n",checks,calculate_node_quque); -} \ No newline at end of file +} diff --git a/src/ads/isax_file_loaders.c b/src/ads/isax_file_loaders.c index 16a46ac9..910d1ad5 100644 --- a/src/ads/isax_file_loaders.c +++ b/src/ads/isax_file_loaders.c @@ -5,11 +5,9 @@ // Created by Kostas Zoumpatianos and Botao Peng, March 2020 // - #include "../../config.h" #include "../../globals.h" #include -#include #include #include #include @@ -20,6 +18,7 @@ #include #include #include +#include #include "ads/calc_utils.h" #include "ads/isax_node.h" @@ -34,13 +33,15 @@ #include "ads/sfa/dft.h" void isax_query_binary_file(const char *ifilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves, - query_result (*search_function)(ts_type *, ts_type *, isax_index *, float, int)) { + float minimum_distance, int min_checked_leaves, + query_result (*search_function)(ts_type *, ts_type *, isax_index *, float, int)) { fprintf(stderr, ">>> Performing queries in file: %s\n", ifilename); FILE *ifile; ifile = fopen(ifilename, "rb"); + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } @@ -48,87 +49,76 @@ void isax_query_binary_file(const char *ifilename, int q_num, isax_index *index, file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } int q_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments); - //sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments); - //SFA + // SFA ts_type *ts_fftw = NULL; fftwf_complex *ts_out = NULL; fftwf_plan plan_forward = NULL; ts_type *transform = NULL; if (index->settings->function_type == 4) { - unsigned long ts_length = index->settings->timeseries_size; - - ts_fftw = fftwf_malloc(sizeof(ts_type) * ts_length); + int32_t ts_length = index->settings->timeseries_size; + ts_fftw = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); ts_out = (fftwf_complex *) fftwf_malloc(sizeof(fftwf_complex) * (ts_length / 2 + 1)); - //create fftw plan + // create fftw plan plan_forward = fftwf_plan_dft_r2c_1d(ts_length, ts_fftw, ts_out, FFTW_ESTIMATE); - - transform = fftwf_malloc(sizeof(ts_type) * ts_length); + transform = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); } - while (q_loaded < q_num) { COUNT_INPUT_TIME_START fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END - //printf("Querying for: %d\n", index->settings->ts_byte_size * q_loaded); - //Parse TS and make FFT representation + // Parse TS and make FFT representation if (index->settings->function_type == 4) { for (int j = 0; j < index->settings->timeseries_size; ++j) { ts_fftw[j] = ts[j]; } + int use_best = index->settings->coeff_number != 0; fft_from_ts(index, ts_fftw, index->settings->paa_segments, use_best, ts_out, transform, plan_forward); for (int i = 0; i < index->settings->paa_segments; ++i) { paa[i] = (ts_type) transform[i]; } - } - - - // Parse ts and make PAA representation - else { + } else { // Parse ts and make PAA representation paa_from_ts(ts, paa, - index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); + index->settings->paa_segments, + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); } COUNT_TOTAL_TIME_START - //COUNT_OUTPUT2_TIME_START query_result result = search_function(ts, paa, index, minimum_distance, min_checked_leaves); - //COUNT_OUTPUT2_TIME_END COUNT_TOTAL_TIME_END PRINT_STATS(result.distance) fflush(stdout); + #if VERBOSE_LEVEL >= 1 printf("[%p]: Distance: %lf\n", result.node, result.distance); #endif - //sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); - //if (index->settings->timeseries_size * sizeof(ts_type) * q_loaded == 1024) { - // sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); - //} q_loaded++; } + free(paa); free(ts); fclose(ifile); fprintf(stderr, ">>> Finished querying.\n"); - } void isax_query_binary_file_traditional( @@ -136,12 +126,13 @@ void isax_query_binary_file_traditional( float minimum_distance, int min_checked_leaves, int filetype_int, int apply_znorm, query_result (*search_function)(ts_type *, ts_type *, isax_index *, node_list *, float, int)) { - fprintf(stderr, ">>> Performing queries in file: %s\n", ifilename); FILE *ifile; ifile = fopen(ifilename, "rb"); + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } @@ -149,17 +140,20 @@ void isax_query_binary_file_traditional( file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } int q_loaded = 0; node_list nodelist; - nodelist.nlist = malloc(sizeof(isax_node *) * pow(2, index->settings->paa_segments)); + nodelist.nlist = (isax_node**)malloc(sizeof(isax_node *) * pow(2, index->settings->paa_segments)); nodelist.node_amount = 0; isax_node *current_root_node = index->first_node; + while (1) { if (current_root_node != NULL) { nodelist.nlist[nodelist.node_amount] = current_root_node; @@ -168,7 +162,6 @@ void isax_query_binary_file_traditional( } else { break; } - } fprintf(stderr, ">>> node_amount is %d\n", nodelist.node_amount); @@ -178,40 +171,39 @@ void isax_query_binary_file_traditional( fftwf_plan plan_forward; ts_type *transform; - // ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); file_type *ts_int32; + if (filetype_int) { - ts_int32 = malloc(sizeof(file_type) * index->settings->timeseries_size); + ts_int32 = (file_type*)malloc(sizeof(file_type) * index->settings->timeseries_size); } - ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments); - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); + + ts_type *paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); int ts_length = index->settings->timeseries_size; // create fftw plan if (index->settings->function_type == 4) { - ts_fftw = fftwf_malloc(sizeof(ts_type) * ts_length); + ts_fftw = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); ts_out = (fftwf_complex *) fftwf_malloc(sizeof(fftwf_complex) * (ts_length / 2 + 1)); plan_forward = fftwf_plan_dft_r2c_1d(ts_length, ts, ts_out, FFTW_ESTIMATE); - transform = fftwf_malloc(sizeof(ts_type) * ts_length); + transform = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); } while (q_loaded < q_num) { COUNT_INPUT_TIME_START if (filetype_int) { - // fprintf(stderr, ">>> Converting queries int8 to float\n"); fread(ts_int32, sizeof(file_type), ts_length, ifile); + for (int i = 0; i < ts_length; ++i) { ts[i] = (ts_type) ts_int32[i]; } - } else { fread(ts, sizeof(ts_type), ts_length, ifile); } // apply z-normalization if (apply_znorm) { - //fprintf(stderr, ">>> Applying z-norm\n"); znorm(ts, ts_length); } @@ -222,7 +214,7 @@ void isax_query_binary_file_traditional( COUNT_INIT_TIME_START if (index->settings->function_type == 4) { - //SFA: parse ts and make fft representation + // SFA: parse ts and make fft representation for (int i = 0; i < ts_length; ++i) { ts_fftw[i] = ts[i]; } @@ -231,13 +223,13 @@ void isax_query_binary_file_traditional( fft_from_ts(index, ts_fftw, index->settings->paa_segments, use_best, ts_out, transform, plan_forward); for (int i = 0; i < index->settings->paa_segments; ++i) { - paa[i] = (ts_type) transform[i]; + paa[i] = transform[i]; } } else { // Parse ts and make PAA representation paa_from_ts(ts, paa, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); } COUNT_TOTAL_TIME_START @@ -249,9 +241,11 @@ void isax_query_binary_file_traditional( SAVE_STATS(result.distance) fflush(stdout); + #if VERBOSE_LEVEL >= 1 printf("[%p]: Distance: %lf\n", result.node, result.distance); #endif + q_loaded++; } @@ -269,22 +263,23 @@ void isax_query_binary_file_traditional( if (filetype_int) { free(ts_int32); } - fclose(ifile); + fclose(ifile); fprintf(stderr, ">>> Finished querying.\n"); - } void isax_query_binary_fixbsf_file(const char *ifilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves, - query_result (*search_function)(ts_type *, ts_type *, isax_index *, float, int, - float)) { + float minimum_distance, int min_checked_leaves, + query_result (*search_function)(ts_type *, ts_type *, isax_index *, float, int, + float)) { fprintf(stderr, ">>> Performing queries in file: %s\n", ifilename); FILE *ifile; ifile = fopen(ifilename, "rb"); + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } @@ -292,25 +287,25 @@ void isax_query_binary_fixbsf_file(const char *ifilename, int q_num, isax_index file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } int q_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments); - //sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments); while (q_loaded < q_num) { COUNT_INPUT_TIME_START fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END - //printf("Querying for: %d\n", index->settings->ts_byte_size * q_loaded); // Parse ts and make PAA representation paa_from_ts(ts, paa, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); query_result bsf = search_function(ts, paa, index, minimum_distance, min_checked_leaves, FLT_MAX); COUNT_TOTAL_TIME_START query_result result = search_function(ts, paa, index, minimum_distance, min_checked_leaves, bsf.distance); @@ -318,96 +313,98 @@ void isax_query_binary_fixbsf_file(const char *ifilename, int q_num, isax_index PRINT_STATS(result.distance) fflush(stdout); + #if VERBOSE_LEVEL >= 1 printf("[%p]: Distance: %lf\n", result.node, result.distance); #endif - //sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); - //if (index->settings->timeseries_size * sizeof(ts_type) * q_loaded == 1024) { - // sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); - //} q_loaded++; } + free(paa); free(ts); fclose(ifile); fprintf(stderr, ">>> Finished querying.\n"); - } void isax_topk_query_binary_file(const char *ifilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves, int k, - pqueue_bsf (*search_function)(ts_type *, ts_type *, isax_index *, float, int, int)) { + float minimum_distance, int min_checked_leaves, int k, + pqueue_bsf (*search_function)(ts_type *, ts_type *, isax_index *, float, int, int)) { fprintf(stderr, ">>> Performing queries in file: %s\n", ifilename); FILE *ifile; ifile = fopen(ifilename, "rb"); + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } int q_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments); - //sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments); while (q_loaded < q_num) { COUNT_INPUT_TIME_START fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END - //printf("Querying for: %d\n", index->settings->ts_byte_size * q_loaded); // Parse ts and make PAA representation paa_from_ts(ts, paa, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); COUNT_TOTAL_TIME_START COUNT_OUTPUT2_TIME_START pqueue_bsf result = search_function(ts, paa, index, minimum_distance, min_checked_leaves, k); COUNT_OUTPUT2_TIME_END COUNT_TOTAL_TIME_END + for (int i = 0; i < result.k; i++) { printf(" the [%d] query [%d] NN is %f at %ld\n", q_loaded, i, result.knn[i], result.position[i]); } + PRINT_STATS(result.knn[result.k - 1]) fflush(stdout); - - //sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); - //if (index->settings->timeseries_size * sizeof(ts_type) * q_loaded == 1024) { - // sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); - //} q_loaded++; } + free(paa); free(ts); fclose(ifile); fprintf(stderr, ">>> Finished querying.\n"); - } void isax_knn_query_binary_file(const char *ifilename, const char *labelfilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves, int k, long int classlength, - pqueue_bsf (*search_function)(ts_type *, ts_type *, isax_index *, float, int, int)) { + float minimum_distance, int min_checked_leaves, int k, long int classlength, + pqueue_bsf (*search_function)(ts_type *, ts_type *, isax_index *, float, int, int)) { fprintf(stderr, ">>> Performing queries in file: %s and label in file %s\n", ifilename, labelfilename); - FILE *ifile, *lfile; + FILE *ifile; + FILE *lfile; ifile = fopen(ifilename, "rb"); lfile = fopen(labelfilename, "rb"); - long int *datalabel; + int32_t *datalabel; + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + if (lfile == NULL) { fprintf(stderr, "File %s not found!\n", labelfilename); + exit(-1); } @@ -418,76 +415,72 @@ void isax_knn_query_binary_file(const char *ifilename, const char *labelfilename if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } - datalabel = malloc(sizeof(long int) * index->sax_cache_size); - fread(datalabel, sizeof(long int), index->sax_cache_size, lfile); + datalabel = (int32_t*)malloc(sizeof(int32_t) * index->sax_cache_size); + fread(datalabel, sizeof(int32_t), index->sax_cache_size, lfile); int q_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments); - //sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments); while (q_loaded < q_num) { COUNT_INPUT_TIME_START fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END - //printf("Querying for: %d\n", index->settings->ts_byte_size * q_loaded); // Parse ts and make PAA representation paa_from_ts(ts, paa, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); COUNT_TOTAL_TIME_START COUNT_OUTPUT2_TIME_START pqueue_bsf result = search_function(ts, paa, index, minimum_distance, min_checked_leaves, k); COUNT_OUTPUT2_TIME_END COUNT_TOTAL_TIME_END - long int *classcounter = malloc(sizeof(long int) * classlength); - long int classeposition = 0, classtmp = 0; + int32_t *classcounter = (int32_t*)malloc(sizeof(int32_t) * classlength); + int32_t classeposition = 0; + int32_t classtmp = 0; + for (int i = 0; i < classlength; i++) { classcounter[i] = 0; } + for (int i = 0; i < result.k; i++) { - //printf("datalabel[result.position[i]] is %ld\n",datalabel[result.position[i]] ); classcounter[datalabel[result.position[i]]]++; - //printf("the class conter is %ld\n",classcounter[datalabel[result.position[i]]] ); + if (classtmp < classcounter[datalabel[result.position[i]]]) { classtmp = classcounter[datalabel[result.position[i]]]; classeposition = datalabel[result.position[i]]; - } - //printf(" the [%d] query [%d] NN is %f at %ld label is %ld and now classeposition is %ld\n",q_loaded,i,result.knn[i],result.position[i],datalabel[result.position[i]],classeposition); } - printf(" the [%d] query's label is %ld \n", q_loaded, classeposition); - //PRINT_STATS(result.knn[result.k-1]) + printf(" the [%d] query's label is %ld \n", q_loaded, classeposition); fflush(stdout); - - //sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); - //if (index->settings->timeseries_size * sizeof(ts_type) * q_loaded == 1024) { - // sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); - //} q_loaded++; free(classcounter); } + free(paa); free(ts); fclose(ifile); + fclose(lfile); fprintf(stderr, ">>> Finished querying.\n"); - } void isax_topk_query_binary_file_traditional(const char *ifilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves, int k, int filetype_int, - int apply_znorm, - pqueue_bsf (*search_function)(ts_type *, ts_type *, isax_index *, - node_list *, float, int, int)) { + float minimum_distance, int min_checked_leaves, int k, int filetype_int, + int apply_znorm, + pqueue_bsf (*search_function)(ts_type *, ts_type *, isax_index *, + node_list *, float, int, int)) { fprintf(stderr, ">>> Performing queries in file: %s\n", ifilename); FILE *ifile; ifile = fopen(ifilename, "rb"); + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } @@ -495,17 +488,20 @@ void isax_topk_query_binary_file_traditional(const char *ifilename, int q_num, i file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } int q_loaded = 0; node_list nodelist; - nodelist.nlist = malloc(sizeof(isax_node *) * pow(2, index->settings->paa_segments)); + nodelist.nlist = (isax_node**)malloc(sizeof(isax_node *) * pow(2, index->settings->paa_segments)); nodelist.node_amount = 0; isax_node *current_root_node = index->first_node; + while (1) { if (current_root_node != NULL) { nodelist.nlist[nodelist.node_amount] = current_root_node; @@ -514,7 +510,6 @@ void isax_topk_query_binary_file_traditional(const char *ifilename, int q_num, i } else { break; } - } fprintf(stderr, ">>> node_amount is %d\n", nodelist.node_amount); @@ -523,40 +518,38 @@ void isax_topk_query_binary_file_traditional(const char *ifilename, int q_num, i fftwf_complex *ts_out; fftwf_plan plan_forward; ts_type *transform; - - // ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); file_type *ts_int32; + if (filetype_int) { - ts_int32 = malloc(sizeof(file_type) * index->settings->timeseries_size); + ts_int32 = (file_type*)malloc(sizeof(file_type) * index->settings->timeseries_size); } - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments); + + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments); int ts_length = index->settings->timeseries_size; if (index->settings->function_type == 4) { - ts_fftw = fftwf_malloc(sizeof(ts_type) * ts_length); + ts_fftw = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); ts_out = (fftwf_complex *) fftwf_malloc(sizeof(fftwf_complex) * (ts_length / 2 + 1)); plan_forward = fftwf_plan_dft_r2c_1d(ts_length, ts, ts_out, FFTW_ESTIMATE); - transform = fftwf_malloc(sizeof(ts_type) * ts_length); + transform = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); } while (q_loaded < q_num) { COUNT_INPUT_TIME_START if (filetype_int) { - // fprintf(stderr, ">>> Converting queries int8 to float\n"); fread(ts_int32, sizeof(file_type), ts_length, ifile); + for (int i = 0; i < ts_length; ++i) { ts[i] = (ts_type) ts_int32[i]; } - } else { fread(ts, sizeof(ts_type), ts_length, ifile); } // apply z-normalization if (apply_znorm) { - //fprintf(stderr, ">>> Applying z-norm\n"); znorm(ts, ts_length); } @@ -566,7 +559,7 @@ void isax_topk_query_binary_file_traditional(const char *ifilename, int q_num, i COUNT_INIT_TIME_START if (index->settings->function_type == 4) { - //SFA: parse ts and make fft representation + // SFA: parse ts and make fft representation for (int i = 0; i < ts_length; ++i) { ts_fftw[i] = ts[i]; } @@ -580,55 +573,53 @@ void isax_topk_query_binary_file_traditional(const char *ifilename, int q_num, i } else { // Parse ts and make PAA representation paa_from_ts(ts, paa, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); } COUNT_TOTAL_TIME_START pqueue_bsf result = search_function(ts, paa, index, &nodelist, minimum_distance, min_checked_leaves, k); COUNT_TOTAL_TIME_END COUNT_QUERYING_TIME_END - - /*for (int i = 0; i < result.k; i++) { - printf(" the [%d] query [%d] NN is %f at %ld\n", q_loaded, i, result.knn[i], result.position[i]); - }*/ - PRINT_STATS(result.knn[result.k - 1]) SAVE_STATS(result.knn[result.k - 1]) - fflush(stdout); q_loaded++; } + free(paa); free(ts); if (filetype_int) { free(ts_int32); } - fclose(ifile); + fclose(ifile); fprintf(stderr, ">>> Finished querying.\n"); - } -void -isax_knn_query_binary_file_traditional(const char *ifilename, const char *labelfilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves, int k, long int classlength, - pqueue_bsf (*search_function)(ts_type *, ts_type *, isax_index *, node_list *, - float, int, int)) { +void isax_knn_query_binary_file_traditional(const char *ifilename, const char *labelfilename, int q_num, isax_index *index, + float minimum_distance, int min_checked_leaves, int k, long int classlength, + pqueue_bsf (*search_function)(ts_type *, ts_type *, isax_index *, node_list *, + float, int, int)) { fprintf(stderr, ">>> Performing queries in file: %s and label in file %s\n", ifilename, labelfilename); - FILE *ifile, *lfile; + FILE *ifile; + FILE *lfile; ifile = fopen(ifilename, "rb"); lfile = fopen(labelfilename, "rb"); - long int *datalabel; + uint32_t *datalabel; + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + if (lfile == NULL) { fprintf(stderr, "File %s not found!\n", labelfilename); + exit(-1); } @@ -639,20 +630,21 @@ isax_knn_query_binary_file_traditional(const char *ifilename, const char *labelf if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } - datalabel = malloc(sizeof(long int) * index->sax_cache_size); - fread(datalabel, sizeof(long int), index->sax_cache_size, lfile); + datalabel = (uint32_t*)malloc(sizeof(uint32_t) * index->sax_cache_size); + fread(datalabel, sizeof(uint32_t), index->sax_cache_size, lfile); int q_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments); - //sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + ts_type *paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments); node_list nodelist; - nodelist.nlist = malloc(sizeof(isax_node *) * pow(2, index->settings->paa_segments)); + nodelist.nlist = (isax_node**)malloc(sizeof(isax_node *) * pow(2, index->settings->paa_segments)); nodelist.node_amount = 0; isax_node *current_root_node = index->first_node; + while (1) { if (current_root_node != NULL) { nodelist.nlist[nodelist.node_amount] = current_root_node; @@ -661,71 +653,63 @@ isax_knn_query_binary_file_traditional(const char *ifilename, const char *labelf } else { break; } - } while (q_loaded < q_num) { COUNT_INPUT_TIME_START fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END - // printf("Querying for: %d\n", index->settings->ts_byte_size * q_loaded); - // printf("Querying for: %d\n", q_loaded); printf("%d: ", q_loaded); // Parse ts and make PAA representation paa_from_ts(ts, paa, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); COUNT_TOTAL_TIME_START - //COUNT_OUTPUT2_TIME_START pqueue_bsf result = search_function(ts, paa, index, &nodelist, minimum_distance, min_checked_leaves, k); - //COUNT_OUTPUT2_TIME_END COUNT_TOTAL_TIME_END - long int *classcounter = malloc(sizeof(long int) * classlength); - long int classeposition = 0, classtmp = 0; + int32_t *classcounter = (int32_t*)malloc(sizeof(int32_t) * classlength); + int32_t classeposition = 0; + int32_t classtmp = 0; + for (int i = 0; i < classlength; i++) { classcounter[i] = 0; } + for (int i = 0; i < result.k; i++) { - //printf("datalabel[result.position[i]] is %ld\n",datalabel[result.position[i]] ); classcounter[datalabel[result.position[i]]]++; - //printf("the class conter is %ld\n",classcounter[datalabel[result.position[i]]] ); + if (classtmp < classcounter[datalabel[result.position[i]]]) { classtmp = classcounter[datalabel[result.position[i]]]; classeposition = datalabel[result.position[i]]; - } - //printf(" the [%d] query [%d] NN is %f at %ld label is %ld and now classeposition is %ld\n",q_loaded,i,result.knn[i],result.position[i],datalabel[result.position[i]],classeposition); } - printf(" the [%d] query's label is %ld \n", q_loaded, classeposition); - //PRINT_STATS(result.knn[result.k-1]) + printf(" the [%d] query's label is %ld \n", q_loaded, classeposition); fflush(stdout); - - //sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); - //if (index->settings->timeseries_size * sizeof(ts_type) * q_loaded == 1024) { - // sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); - //} q_loaded++; free(classcounter); } + free(paa); free(ts); fclose(ifile); + fclose(lfile); fprintf(stderr, ">>> Finished querying.\n"); - } void isax_query_binary_file_batch(const char *ifilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves, - void (*search_function)(ts_type *, ts_type *, isax_index *, float, int, int)) { + float minimum_distance, int min_checked_leaves, + void (*search_function)(ts_type *, ts_type *, isax_index *, float, int, int)) { fprintf(stderr, ">>> Performing queries in file: %s\n", ifilename); FILE *ifile; ifile = fopen(ifilename, "rb"); + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } @@ -733,34 +717,29 @@ void isax_query_binary_file_batch(const char *ifilename, int q_num, isax_index * file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } int q_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size * q_num); - ts_type *paa = malloc(sizeof(ts_type) * index->settings->paa_segments * q_num); - //sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size * q_num); + ts_type *paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments * q_num); fread(ts, sizeof(ts_type), index->settings->timeseries_size * q_num, ifile); + while (q_loaded < q_num) { - //printf("Querying for: %d\n", index->settings->ts_byte_size * q_loaded); // Parse ts and make PAA representation paa_from_ts(&(ts[index->settings->timeseries_size * q_loaded]), - &(paa[index->settings->paa_segments * q_loaded]), index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); - - + &(paa[index->settings->paa_segments * q_loaded]), index->settings->paa_segments, + index->settings->ts_values_per_paa_segment, + index->settings->timeseries_size); fflush(stdout); + #if VERBOSE_LEVEL >= 1 printf("[%p]: Distance: %lf\n", result.node, result.distance); #endif - //sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); - //if (index->settings->timeseries_size * sizeof(ts_type) * q_loaded == 1024) { - // sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); - //} - q_loaded++; } @@ -773,37 +752,39 @@ void isax_query_binary_file_batch(const char *ifilename, int q_num, isax_index * free(ts); fclose(ifile); fprintf(stderr, ">>> Finished querying.\n"); - } - void isax_index_binary_file(const char *ifilename, int ts_num, isax_index *index) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE *ifile; COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } - int ts_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - file_position_type *pos = malloc(sizeof(file_position_type)); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); - index->settings->raw_filename = malloc(256); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); #ifdef BENCHMARK @@ -813,52 +794,38 @@ void isax_index_binary_file(const char *ifilename, int ts_num, isax_index *index while (ts_loaded < ts_num) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(ts_loaded + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (ts_loaded + 1)); #endif #endif + *pos = ftell(ifile); COUNT_INPUT_TIME_START int read_number = fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); - //printf("the pos is %lld\n",*pos); COUNT_INPUT_TIME_END if (sax_from_ts(ts, sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) { + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { #ifdef CLUSTERED root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); char* pfilename = malloc(255); - snprintf(pfilename, 255, "%s.%llu",index->settings->raw_filename,first_bit_mask); + snprintf(pfilename, sizeof(pfilename), "%s.%llu", index->settings->raw_filename, first_bit_mask); FILE *pfile = fopen(pfilename, "a+"); *pos = ftell(pfile); fwrite(ts, sizeof(ts_type), index->settings->timeseries_size, pfile); fclose(pfile); free(pfilename); #endif + isax_fbl_index_insert(index, sax, pos); ts_loaded++; - - /*if(percentage == 0) { - float distance = 0; - printf("%d ", ts_loaded); - PRINT_STATS(distance); - fflush(stdout); - } - else if(ts_loaded % percentage == 0) - { - float distance = 0; - printf("%d ", ts_loaded); - PRINT_STATS(distance) - - fflush(stdout); - }*/ } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } + free(ts); free(sax); free(pos); @@ -866,15 +833,14 @@ void isax_index_binary_file(const char *ifilename, int ts_num, isax_index *index fclose(ifile); COUNT_INPUT_TIME_END fprintf(stderr, ">>> Finished indexing\n"); - } /* * -** Using documented GCC type unsigned __int128 instead of undocumented -** obsolescent typedef name __uint128_t. Works with GCC 4.7.1 but not -** GCC 4.1.2 (but __uint128_t works with GCC 4.1.2) on Mac OS X 10.7.4. -*/ + ** Using documented GCC type unsigned __int128 instead of undocumented + ** obsolescent typedef name __uint128_t. Works with GCC 4.7.1 but not + ** GCC 4.1.2 (but __uint128_t works with GCC 4.1.2) on Mac OS X 10.7.4. + */ typedef unsigned __int128 uint128_t; /* UINT64_MAX 18446744073709551615ULL */ @@ -886,17 +852,18 @@ typedef unsigned __int128 uint128_t; static int print_u128_u(uint128_t u128) { int rc; + if (u128 > UINT64_MAX) { uint128_t leading = u128 / P10_UINT64; uint64_t trailing = u128 % P10_UINT64; rc = print_u128_u(leading); - rc += printf("%." TO_STRING(E10_UINT64) - PRIu64, trailing); + rc += printf("%." TO_STRING(E10_UINT64) PRIu64, trailing); } else { uint64_t u64 = u128; rc = printf("%" - PRIu64, u64); + PRIu64, u64); } + return rc; } @@ -911,8 +878,7 @@ typedef struct { } sax_vector; /** Return returns 1 if a>b, -1 if b>a, 0 if a == b */ -int -uint128_compare(const void *a_or, const void *b_or) { +int uint128_compare(const void *a_or, const void *b_or) { my_uint128_t *a = (my_uint128_t *) &((sax_vector *) a_or)->sax; my_uint128_t *b = (my_uint128_t *) &((sax_vector *) b_or)->sax; @@ -920,36 +886,41 @@ uint128_compare(const void *a_or, const void *b_or) { if (a->hi < b->hi) return 1; if (a->lo > b->lo) return -1; if (a->lo < b->lo) return 1; + return 0; } - void isax_sorted_index_binary_file(const char *ifilename, int ts_num, isax_index *index) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE *ifile; COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } int ts_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - sax_vector *sax_vectors = malloc(sizeof(sax_vector) * ts_num); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + sax_vector *sax_vectors = (sax_vector*)malloc(sizeof(sax_vector) * ts_num); - index->settings->raw_filename = malloc(256); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); #ifdef BENCHMARK @@ -959,23 +930,24 @@ void isax_sorted_index_binary_file(const char *ifilename, int ts_num, isax_index while (ts_loaded < ts_num) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(ts_loaded + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (ts_loaded + 1)); #endif #endif + file_position_type pos = ftell(ifile); COUNT_INPUT_TIME_START fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END if (sax_from_ts(ts, (sax_type *) &(sax_vectors[ts_loaded].sax), index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) { + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { #ifdef CLUSTERED root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); char* pfilename = malloc(255); - snprintf(pfilename, 255, "%s.%llu",index->settings->raw_filename,first_bit_mask); + snprintf(pfilename, sizeof(pfilename), "%s.%llu", index->settings->raw_filename, first_bit_mask); FILE *pfile = fopen(pfilename, "a+"); *pos = ftell(pfile); fwrite(ts, sizeof(ts_type), index->settings->timeseries_size, pfile); @@ -984,7 +956,6 @@ void isax_sorted_index_binary_file(const char *ifilename, int ts_num, isax_index #endif sax_vectors[ts_loaded].pos = pos; - ts_loaded++; if (percentage == 0) { @@ -995,14 +966,13 @@ void isax_sorted_index_binary_file(const char *ifilename, int ts_num, isax_index PRINT_STATS(distance) } } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } qsort(sax_vectors, sizeof(sax_vector), ts_num, uint128_compare); - int i; + for (i = 0; i < ts_num; i++) { isax_fbl_index_insert(index, (sax_type *) &(sax_vectors[i].sax), &(sax_vectors[i].pos)); } @@ -1013,36 +983,38 @@ void isax_sorted_index_binary_file(const char *ifilename, int ts_num, isax_index fclose(ifile); COUNT_INPUT_TIME_END fprintf(stderr, ">>> Finished indexing\n"); - } - void isax_merge_sorted_index_binary_file(const char *ifilename, int ts_num, isax_index *index) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE *ifile; COUNT_INPUT_TIME_START ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } - int ts_loaded = 0; - ts_type *ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - sax_vector *sax_vectors = malloc(sizeof(sax_vector) * ts_num); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + sax_vector *sax_vectors = (sax_vector*)malloc(sizeof(sax_vector) * ts_num); - index->settings->raw_filename = malloc(256); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); #ifdef BENCHMARK @@ -1052,23 +1024,24 @@ void isax_merge_sorted_index_binary_file(const char *ifilename, int ts_num, isax while (ts_loaded < ts_num) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(ts_loaded + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (ts_loaded + 1)); #endif #endif + file_position_type pos = ftell(ifile); COUNT_INPUT_TIME_START fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END if (sax_from_ts(ts, (sax_type *) &(sax_vectors[ts_loaded].sax), index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) { + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { #ifdef CLUSTERED root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); char* pfilename = malloc(255); - snprintf(pfilename, 255, "%s.%llu",index->settings->raw_filename,first_bit_mask); + snprintf(pfilename, sizeof(pfilename), "%s.%llu", index->settings->raw_filename, first_bit_mask); FILE *pfile = fopen(pfilename, "a+"); *pos = ftell(pfile); fwrite(ts, sizeof(ts_type), index->settings->timeseries_size, pfile); @@ -1077,7 +1050,6 @@ void isax_merge_sorted_index_binary_file(const char *ifilename, int ts_num, isax #endif sax_vectors[ts_loaded].pos = pos; - ts_loaded++; if (percentage == 0) { @@ -1088,45 +1060,43 @@ void isax_merge_sorted_index_binary_file(const char *ifilename, int ts_num, isax PRINT_STATS(distance) } } else { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } } - //qsort(sax_vectors, sizeof(sax_vector), ts_num, uint128_compare); - int j; - unsigned long i; + uint32_t i; int segment; - sax_type *removals = malloc(sizeof(sax_type) * index->settings->paa_segments); + sax_type *removals = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + for (i = 0; i < index->settings->paa_segments; i++) { removals[i] = 0; } - int prev_best_segment = -1; float current_utilization = 0; - sax_vector *new_dataset = malloc(sizeof(sax_vector) * ts_num); + sax_vector *new_dataset = (sax_vector*)malloc(sizeof(sax_vector) * ts_num); do { // If I remove 1 bit from a segment what is the average page utilization? int best_segment = prev_best_segment + 1; + if (best_segment >= index->settings->paa_segments) { best_segment = 0; } + prev_best_segment = best_segment; int best_segment_pages = ts_num; float best_segment_average_utilization = 0; float best_segment_min_page_utilization = 0; char updated = 0; - //printf("Starting with: %d\n", best_segment); for (segment = 0; segment < index->settings->paa_segments; segment++) { - for (i = 0; i < ts_num; i++) { memcpy(&new_dataset[i], &sax_vectors[i], sizeof(sax_vector)); sax_type *sax_cpy = (sax_type *) &(new_dataset[i].sax); int k; + for (k = 0; k < index->settings->paa_segments; k++) { if (k == segment) { sax_cpy[k] = (sax_cpy[k] >> (removals[k] + 1)); @@ -1143,20 +1113,24 @@ void isax_merge_sorted_index_binary_file(const char *ifilename, int ts_num, isax int pid = 1; float page_utilization = 0; float min_page_utilization = 10000000000; + for (i = 1; i < ts_num; i++) { uint128_t *prev_sax = (uint128_t *) &(prev.sax); uint128_t *this_sax = (uint128_t *) &(new_dataset[i].sax); + if (*prev_sax != *this_sax) { float d = (float) (counter * index->settings->ts_byte_size) / 4096; page_utilization += d; counter = 1; pid++; + if (page_utilization < min_page_utilization) { min_page_utilization = page_utilization; } } else { counter++; } + prev = new_dataset[i]; } @@ -1171,28 +1145,22 @@ void isax_merge_sorted_index_binary_file(const char *ifilename, int ts_num, isax best_segment_min_page_utilization = min_page_utilization; } - if (!updated) { best_segment_pages = pid; best_segment_average_utilization = page_utilization / (float) pid; best_segment_min_page_utilization = min_page_utilization; } - - //printf("%d has %d\n", segment, pid); } - //printf("Chosing: %d (%d pages %lf utilized on average, min: %lf)\n", best_segment, best_segment_pages, best_segment_average_utilization, best_segment_min_page_utilization); current_utilization = best_segment_average_utilization; removals[best_segment]++; } while (current_utilization < 1.2); - for (i = 0; i < ts_num; i++) { j = new_dataset[i].pos / index->settings->ts_byte_size; isax_fbl_index_insert(index, (sax_type *) &(sax_vectors[j].sax), &(sax_vectors[j].pos)); } - free(new_dataset); free(removals); @@ -1202,5 +1170,4 @@ void isax_merge_sorted_index_binary_file(const char *ifilename, int ts_num, isax fclose(ifile); COUNT_INPUT_TIME_END fprintf(stderr, ">>> Finished indexing\n"); - } diff --git a/src/ads/isax_first_buffer_layer.c b/src/ads/isax_first_buffer_layer.c index b6273d66..8de42886 100644 --- a/src/ads/isax_first_buffer_layer.c +++ b/src/ads/isax_first_buffer_layer.c @@ -14,318 +14,293 @@ #include "ads/isax_first_buffer_layer.h" struct first_buffer_layer * initialize_fbl(int initial_buffer_size, int number_of_buffers, - int max_total_buffers_size, isax_index *index) -{ - struct first_buffer_layer *fbl = malloc(sizeof(first_buffer_layer)); - + int max_total_buffers_size, isax_index *index) { + struct first_buffer_layer *fbl = (first_buffer_layer*)malloc(sizeof(first_buffer_layer)); + fbl->max_total_size = max_total_buffers_size; fbl->initial_buffer_size = initial_buffer_size; fbl->number_of_buffers = number_of_buffers; - + // Allocate a big chunk of memory to store sax data and positions - long long hard_buffer_size = (long long)(index->settings->sax_byte_size + index->settings->position_byte_size) * (long long) max_total_buffers_size; - fbl->hard_buffer = malloc(hard_buffer_size); - - if(fbl->hard_buffer == NULL) { - fprintf(stderr, "Could not initialize hard buffer of size: %lld\n", hard_buffer_size); - exit(-1); - } - + int64_t hard_buffer_size = (int64_t)(index->settings->sax_byte_size + index->settings->position_byte_size) * (int64_t) max_total_buffers_size; + fbl->hard_buffer = (char*)malloc(hard_buffer_size); + + if (fbl->hard_buffer == NULL) { + fprintf(stderr, "Could not initialize hard buffer of size: %lld\n", hard_buffer_size); + + exit(-1); + } + // Allocate a set of soft buffers to hold pointers to the hard buffer - fbl->soft_buffers = malloc(sizeof(fbl_soft_buffer) * number_of_buffers); + fbl->soft_buffers = (fbl_soft_buffer*)malloc(sizeof(fbl_soft_buffer) * number_of_buffers); fbl->current_record_index = 0; fbl->current_record = fbl->hard_buffer; - int i; - for (i=0; isoft_buffers[i].initialized = 0; - fbl->soft_buffers[i].max_buffer_size = 0; - fbl->soft_buffers[i].buffer_size = 0; + + for (int count = 0; count < number_of_buffers; count++) { + fbl->soft_buffers[count].initialized = 0; + fbl->soft_buffers[count].max_buffer_size = 0; + fbl->soft_buffers[count].buffer_size = 0; } + return fbl; } + struct parallel_first_buffer_layer * initialize_pRecBuf(int initial_buffer_size, int number_of_buffers, - int max_total_buffers_size, isax_index *index) -{ - struct parallel_first_buffer_layer *fbl = malloc(sizeof(parallel_first_buffer_layer)); - + int max_total_buffers_size, isax_index *index) { + struct parallel_first_buffer_layer *fbl = (parallel_first_buffer_layer*)malloc(sizeof(parallel_first_buffer_layer)); + fbl->max_total_size = max_total_buffers_size; fbl->initial_buffer_size = initial_buffer_size; fbl->number_of_buffers = number_of_buffers; - + // Allocate a big chunk of memory to store sax data and positions - long long hard_buffer_size = (long long)(index->settings->sax_byte_size + index->settings->position_byte_size) * (long long) max_total_buffers_size; - //fbl->hard_buffer = malloc(hard_buffer_size); - + int64_t hard_buffer_size = (int64_t)(index->settings->sax_byte_size + index->settings->position_byte_size) * (int64_t) max_total_buffers_size; + // Allocate a set of soft buffers to hold pointers to the hard buffer - fbl->soft_buffers = malloc(sizeof(parallel_fbl_soft_buffer) * number_of_buffers); + fbl->soft_buffers = (parallel_fbl_soft_buffer*)malloc(sizeof(parallel_fbl_soft_buffer) * number_of_buffers); fbl->current_record_index = 0; - int i; - for (i=0; isoft_buffers[i].initialized = 0; - fbl->soft_buffers[i].finished = 0; + + for (int count = 0; count < number_of_buffers; count++) { + fbl->soft_buffers[count].initialized = 0; + fbl->soft_buffers[count].finished = 0; } + return fbl; } + struct first_buffer_layer2 * initialize_simrec(int initial_buffer_size, int number_of_buffers, - int max_total_buffers_size, isax_index *index) -{ - struct first_buffer_layer2 *fbl = malloc(sizeof(first_buffer_layer2)); - + int max_total_buffers_size, isax_index *index) { + struct first_buffer_layer2 *fbl = (first_buffer_layer2*)malloc(sizeof(first_buffer_layer2)); + fbl->max_total_size = max_total_buffers_size; fbl->initial_buffer_size = initial_buffer_size; fbl->number_of_buffers = number_of_buffers; - + // Allocate a big chunk of memory to store sax data and positions - long long hard_buffer_size = (long long)(index->settings->sax_byte_size + index->settings->position_byte_size) * (long long) max_total_buffers_size; - //fbl->hard_buffer = malloc(hard_buffer_size); - + int64_t hard_buffer_size = (int64_t)(index->settings->sax_byte_size + index->settings->position_byte_size) * (int64_t) max_total_buffers_size; + // Allocate a set of soft buffers to hold pointers to the hard buffer - fbl->soft_buffers = malloc(sizeof(fbl_soft_buffer2) * number_of_buffers); + fbl->soft_buffers = (fbl_soft_buffer2*)malloc(sizeof(fbl_soft_buffer2) * number_of_buffers); fbl->current_record_index = 0; - int i; - for (i=0; isoft_buffers[i].initialized = 0; - fbl->soft_buffers[i].max_buffer_size=0; - fbl->soft_buffers[i].buffer_size = 0; - //fbl->soft_buffers[i].finished = 0; + + for (int count = 0; count < number_of_buffers; count++) { + fbl->soft_buffers[count].initialized = 0; + fbl->soft_buffers[count].max_buffer_size = 0; + fbl->soft_buffers[count].buffer_size = 0; } + return fbl; } + struct parallel_dfirst_buffer_layer * initialize_2pRecBuf(int initial_buffer_size, int number_of_buffers, - int max_total_buffers_size, isax_index *index) -{ - struct parallel_dfirst_buffer_layer *fbl = malloc(sizeof(parallel_dfirst_buffer_layer)); - + int max_total_buffers_size, isax_index *index) { + struct parallel_dfirst_buffer_layer *fbl = (parallel_dfirst_buffer_layer*)malloc(sizeof(parallel_dfirst_buffer_layer)); + fbl->max_total_size = max_total_buffers_size; fbl->initial_buffer_size = initial_buffer_size; fbl->number_of_buffers = number_of_buffers; - + // Allocate a big chunk of memory to store sax data and positions - long long hard_buffer_size = (long long)(index->settings->sax_byte_size + index->settings->position_byte_size) * (long long) max_total_buffers_size; - fbl->hard_buffer = malloc(hard_buffer_size); - + int64_t hard_buffer_size = (int64_t)(index->settings->sax_byte_size + index->settings->position_byte_size) * (int64_t) max_total_buffers_size; + fbl->hard_buffer = (char*)malloc(hard_buffer_size); + // Allocate a set of soft buffers to hold pointers to the hard buffer - fbl->soft_buffers = malloc(sizeof(parallel_dfbl_soft_buffer) * number_of_buffers); + fbl->soft_buffers = (parallel_dfbl_soft_buffer*)malloc(sizeof(parallel_dfbl_soft_buffer) * number_of_buffers); fbl->current_record_index = 0; - int i; - for (i=0; isoft_buffers[i].initialized = 0; - fbl->soft_buffers[i].finished = 0; + + for (int count = 0; count < number_of_buffers; count++) { + fbl->soft_buffers[count].initialized = 0; + fbl->soft_buffers[count].finished = 0; } + return fbl; } + isax_node * insert_to_fbl(first_buffer_layer *fbl, sax_type *sax, - file_position_type *pos,root_mask_type mask, - isax_index *index) -{ - + file_position_type *pos, root_mask_type mask, isax_index *index) { fbl_soft_buffer *current_buffer = &fbl->soft_buffers[(int) mask]; - + // Check if this buffer is initialized if (!current_buffer->initialized) { - #ifdef DEBUG +#ifdef DEBUG printf("*** Creating new FBL node. ***\n\n"); - #endif +#endif current_buffer->initialized = 1; current_buffer->max_buffer_size = 0; current_buffer->buffer_size = 0; - - current_buffer->node = isax_root_node_init(mask, - index->settings->initial_leaf_buffer_size); + + current_buffer->node = isax_root_node_init(mask, index->settings->initial_leaf_buffer_size); index->root_nodes++; current_buffer->node->is_leaf = 1; - - if(index->first_node == NULL) - { + + if (index->first_node == NULL) { index->first_node = current_buffer->node; current_buffer->node->next = NULL; current_buffer->node->previous = NULL; - } - else - { + } else { isax_node * prev_first = index->first_node; index->first_node = current_buffer->node; index->first_node->next = prev_first; prev_first->previous = current_buffer->node; } - } + } + // Check if this buffer is not full! if (current_buffer->buffer_size >= current_buffer->max_buffer_size) { - - if(current_buffer->max_buffer_size == 0) { - current_buffer->max_buffer_size = fbl->initial_buffer_size; - + if (current_buffer->max_buffer_size == 0) { current_buffer->max_buffer_size = fbl->initial_buffer_size; - - current_buffer->sax_records = malloc(sizeof(sax_type *) * - current_buffer->max_buffer_size); - current_buffer->pos_records = malloc(sizeof(file_position_type *) * - current_buffer->max_buffer_size); - } - else { + current_buffer->sax_records = (sax_type**)malloc(sizeof(sax_type *) * + current_buffer->max_buffer_size); + current_buffer->pos_records = (file_position_type**)malloc(sizeof(file_position_type *) * + current_buffer->max_buffer_size); + } else { current_buffer->max_buffer_size *= BUFFER_REALLOCATION_RATE; - - current_buffer->sax_records = realloc(current_buffer->sax_records, - sizeof(sax_type *) * - current_buffer->max_buffer_size); - current_buffer->pos_records = realloc(current_buffer->pos_records, - sizeof(file_position_type *) * - current_buffer->max_buffer_size); - + current_buffer->sax_records = (sax_type**)realloc(current_buffer->sax_records, + sizeof(sax_type *) * current_buffer->max_buffer_size); + current_buffer->pos_records = (file_position_type**)realloc(current_buffer->pos_records, + sizeof(file_position_type *) * + current_buffer->max_buffer_size); } } + if (current_buffer->sax_records == NULL || current_buffer->pos_records == NULL) { fprintf(stderr, "error: Could not allocate memory in FBL."); - return OUT_OF_MEMORY_FAILURE; + + exit(-1); } // Copy data to hard buffer and make current buffer point to the hard one - current_buffer->sax_records[current_buffer->buffer_size] = (sax_type*) fbl->current_record; + current_buffer->sax_records[current_buffer->buffer_size] = (sax_type*) fbl->current_record; memcpy((void *) fbl->current_record, (void *) sax, index->settings->sax_byte_size); fbl->current_record += index->settings->sax_byte_size; - - current_buffer->pos_records[current_buffer->buffer_size] = (file_position_type*) fbl->current_record; + current_buffer->pos_records[current_buffer->buffer_size] = (file_position_type*) fbl->current_record; memcpy((void *) fbl->current_record, (void *) pos, index->settings->position_byte_size); fbl->current_record += index->settings->position_byte_size; - - #ifdef DEBUG + +#ifdef DEBUG printf("*** Added to node ***\n\n"); - #ifdef TOY - sax_print(sax, index->settings->paa_segments, - index->settings->sax_bit_cardinality); - #endif - #endif +#ifdef TOY + sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); +#endif +#endif current_buffer->buffer_size++; fbl->current_record_index++; return current_buffer->node; } - - -enum response flush_fbl(first_buffer_layer *fbl, isax_index *index) -{ - #ifdef DEBUG +enum response flush_fbl(first_buffer_layer *fbl, isax_index *index) { +#ifdef DEBUG printf("*** FLUSHING ***\n\n"); - #else - #if VERBOSE_LEVEL == 2 +#else +#if VERBOSE_LEVEL == 2 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); - #endif - #if VERBOSE_LEVEL == 1 +#endif +#if VERBOSE_LEVEL == 1 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "Flushing...\n"); - #endif - #endif - +#endif +#endif + int c = 1; int j; - isax_node_record *r = malloc(sizeof(isax_node_record)); - for (j=0; jnumber_of_buffers; j++) - { - + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + + for (j = 0; j < fbl->number_of_buffers; j++) { fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } - - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); + +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes) * 100); c++; fflush(stdout); - #endif - #endif - int i; - if (current_fbl_node->buffer_size > 0) - { - // For all records in this buffer - //COUNT_CAL_TIME_START - for (i=0; ibuffer_size; i++) { - r->sax = (sax_type *) current_fbl_node->sax_records[i]; - r->position = (file_position_type *) current_fbl_node->pos_records[i]; - r->insertion_mode = NO_TMP | PARTIAL; +#endif +#endif + + if (current_fbl_node->buffer_size > 0) { + // For all records in this buffer + for (int count = 0; count < current_fbl_node->buffer_size; count++) { + r->sax = current_fbl_node->sax_records[count]; + r->position = current_fbl_node->pos_records[count]; + r->insertion_mode = PARTIAL_OR_NO_TMP; + // Add record to index - add_record_to_node(index, current_fbl_node->node, r, 1); - } - + // flush index node - //COUNT_CAL_TIME_START flush_subtree_leaf_buffers(index, current_fbl_node->node); - //COUNT_CAL_TIME_END // clear FBL records moved in LBL buffers free(current_fbl_node->sax_records); free(current_fbl_node->pos_records); // clear records read from files (free only prev sax buffers) - - isax_index_clear_node_buffers(index, current_fbl_node->node, - INCLUDE_CHILDREN, - TMP_AND_TS_CLEAN); - + + isax_index_clear_node_buffers(index, current_fbl_node->node, + INCLUDE_CHILDREN, TMP_AND_TS_CLEAN); + index->allocated_memory = 0; // Set to 0 in order to re-allocate original space for buffers. current_fbl_node->buffer_size = 0; current_fbl_node->max_buffer_size = 0; } - } free(r); fbl->current_record_index = 0; fbl->current_record = fbl->hard_buffer; - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 printf("\n"); - #endif - #endif - - return SUCCESS; -} +#endif +#endif + return SUCCESS; +} void destroy_fbl(first_buffer_layer *fbl) { - free(fbl->hard_buffer); free(fbl->soft_buffers); free(fbl); } -void destroy_fbl2(first_buffer_layer2 *fbl) { - //free(fbl->hard_buffer); +void destroy_fbl2(first_buffer_layer2 *fbl) { + // free(fbl->hard_buffer); free(fbl->soft_buffers); free(fbl); } +void destroy_pRecBuf(parallel_first_buffer_layer *fbl, int prewokernumber) { + for (int j = 0; j < fbl->number_of_buffers; j++) { + parallel_fbl_soft_buffer *current_fbl_node = &fbl->soft_buffers[j]; -void destroy_pRecBuf(parallel_first_buffer_layer *fbl,int prewokernumber) { - - for (int j=0; jnumber_of_buffers; j++) - { - parallel_fbl_soft_buffer *current_fbl_node = &fbl->soft_buffers[j]; if (!current_fbl_node->initialized) { continue; } - for (int k = 0; k < prewokernumber; k++) - { - if(current_fbl_node->sax_records[k]!=NULL) - { + + for (int k = 0; k < prewokernumber; k++) { + if (current_fbl_node->sax_records[k] != NULL) { free((current_fbl_node->sax_records[k])); free((current_fbl_node->pos_records[k])); - current_fbl_node->sax_records[k]=NULL; - current_fbl_node->pos_records[k]=NULL; - } + current_fbl_node->sax_records[k] = NULL; + current_fbl_node->pos_records[k] = NULL; + } } + free(current_fbl_node->buffer_size); free(current_fbl_node->max_buffer_size); free(current_fbl_node->sax_records); free(current_fbl_node->pos_records); } + free(fbl->soft_buffers); free(fbl); } diff --git a/src/ads/isax_index.c b/src/ads/isax_index.c index 805b04d9..63029e81 100644 --- a/src/ads/isax_index.c +++ b/src/ads/isax_index.c @@ -18,7 +18,7 @@ 01 10 11 - + How to build a mask for the FIRST bit of this word (root), I use do: R = 00000000 @@ -31,22 +31,23 @@ IF(10 AND 10) R = R OR 00000010 IF(11 AND 10) R = R OR 00000001 result: R = 00001011 - + *** IN ORDER TO CALCULATE LOCATION BITMAP MASKS ***: - + m = 2^NUMBER_OF_MASKS (e.g for 2^3=8 = 100) m>> for the second mask (e.g. 010) m>>>> for the third ... (e.g. 001) -*/ + */ #ifdef VALUES #include #endif #include "../../config.h" #include "../../globals.h" - + #include +#include #include #include #include @@ -64,156 +65,148 @@ #include "ads/isax_node_buffer.h" #include "ads/isax_node_split.h" #include "ads/isax_first_buffer_layer.h" - #include "ads/inmemory_query_engine.h" +#include "ads/inmemory_query_engine.h" #include "ads/pqueue.h" /** This function initializes the settings of an isax index */ -isax_index_settings * isax_index_settings_init(const char * root_directory, int timeseries_size, - int paa_segments, int sax_bit_cardinality, - int max_leaf_size, int min_leaf_size, - int initial_leaf_buffer_size, - int max_total_buffer_size, int initial_fbl_buffer_size, - int total_loaded_leaves, int tight_bound, int aggressive_check, int new_index, - int function_type, char inmemory_flag, char SIMD_flag, int sample_size, - char is_norm, int histogram_type, int sample_type, int coeff_number) -{ +isax_index_settings * isax_index_settings_init(const char * root_directory, int timeseries_size, + int paa_segments, int sax_bit_cardinality, + int max_leaf_size, int min_leaf_size, + int initial_leaf_buffer_size, + int max_total_buffer_size, int initial_fbl_buffer_size, + int total_loaded_leaves, int tight_bound, int aggressive_check, int new_index, + int function_type, char inmemory_flag, char SIMD_flag, int sample_size, + char is_norm, int histogram_type, int sample_type, int coeff_number) { int i; - isax_index_settings *settings = malloc(sizeof(isax_index_settings)); - if(settings == NULL) { - fprintf(stderr,"error: could not allocate memory for index settings.\n"); + isax_index_settings *settings = (isax_index_settings*)malloc(sizeof(isax_index_settings)); + + if (settings == NULL) { + fprintf(stderr, "error: could not allocate memory for index settings.\n"); + return NULL; } - - if(new_index) { - if(chdir(root_directory) == 0) - { - fprintf(stderr, "WARNING! Target index directory already exists. Please delete or choose a new one.\n"); - } - if (!inmemory_flag) - { + + if (new_index) { + if (chdir(root_directory) == 0) { + fprintf(stderr, "WARNING! Target index directory already exists. Please delete or choose a new one.\n"); + } + + if (!inmemory_flag) { mkdir(root_directory, 0777); } - + settings->max_total_full_buffer_size = max_total_buffer_size; settings->initial_fbl_buffer_size = initial_fbl_buffer_size; - } - else { - if(chdir(root_directory) != 0) - { - fprintf(stderr, "WARNING! Target index directory does not exist!\n"); - } - else { - chdir("../"); - } + } else { + if (chdir(root_directory) != 0) { + fprintf(stderr, "WARNING! Target index directory does not exist!\n"); + } else { + chdir("../"); + } + settings->max_total_full_buffer_size = max_total_buffer_size; settings->initial_fbl_buffer_size = initial_fbl_buffer_size; - //settings->max_total_full_buffer_size = 0; - //settings->initial_fbl_buffer_size = 0; } - if(paa_segments > (int)(8 * (int)sizeof(root_mask_type))){ - fprintf(stderr,"error: Too many paa segments. The maximum value is %zu.\n", - 8 * sizeof(root_mask_type)); + if (paa_segments > (int)(8 * (int)sizeof(root_mask_type))) { + fprintf(stderr, "error: Too many paa segments. The maximum value is %zu.\n", 8 * sizeof(root_mask_type)); + return NULL; } - if(paa_segments>timeseries_size) - { - fprintf(stderr,"error: Too many paa-segments. Using timeseries-size as paa-segments instead.\n"); + + if (paa_segments > timeseries_size) { + fprintf(stderr, "error: Too many paa-segments. Using timeseries-size as paa-segments instead.\n"); paa_segments = timeseries_size; } - - if(initial_leaf_buffer_size < max_leaf_size) - { - fprintf(stderr,"error: Leaf buffers should be at least as big as leafs.\n"); + + if (initial_leaf_buffer_size < max_leaf_size) { + fprintf(stderr, "error: Leaf buffers should be at least as big as leafs.\n"); + return NULL; } + settings->total_loaded_leaves = total_loaded_leaves; settings->root_directory = root_directory; settings->raw_filename = NULL; settings->timeseries_size = timeseries_size; settings->paa_segments = paa_segments; - // settings->ts_values_per_paa_segment = ceil((float) timeseries_size/ (float) paa_segments); - settings->ts_values_per_paa_segment =timeseries_size/ paa_segments; + settings->ts_values_per_paa_segment = timeseries_size / paa_segments; settings->max_leaf_size = max_leaf_size; settings->min_leaf_size = min_leaf_size; settings->initial_leaf_buffer_size = initial_leaf_buffer_size; - // settings->filetype_int = filetype_int; - settings->tight_bound = tight_bound; + settings->tight_bound = tight_bound; settings->aggressive_check = aggressive_check; - + settings->sax_byte_size = (sizeof(sax_type) * paa_segments); settings->ts_byte_size = (sizeof(ts_type) * timeseries_size); settings->position_byte_size = sizeof(file_position_type); - - settings->full_record_size = settings->sax_byte_size - + settings->position_byte_size - + settings->ts_byte_size; - settings->partial_record_size = settings->sax_byte_size - + settings->position_byte_size; - + + settings->full_record_size = settings->sax_byte_size + + settings->position_byte_size + settings->ts_byte_size; + settings->partial_record_size = settings->sax_byte_size + settings->position_byte_size; + settings->sax_bit_cardinality = sax_bit_cardinality; settings->sax_alphabet_cardinality = pow(2, sax_bit_cardinality); - - settings->max_sax_cardinalities = malloc(sizeof(sax_type) * settings->paa_segments); - for(i=0; ipaa_segments;i++) - settings->max_sax_cardinalities[i] = settings->sax_bit_cardinality; - - //settings->mindist_sqrt = sqrtf((float) settings->timeseries_size / - // (float) settings->paa_segments); - settings->mindist_sqrt = ((float) settings->timeseries_size / - (float) settings->paa_segments); + + settings->max_sax_cardinalities = (sax_type*)malloc(sizeof(sax_type) * settings->paa_segments); + for (i = 0; i < settings->paa_segments; i++) { + settings->max_sax_cardinalities[i] = settings->sax_bit_cardinality; + } + + settings->mindist_sqrt = ((float) settings->timeseries_size / (float) settings->paa_segments); settings->root_nodes_size = pow(2, settings->paa_segments); - + // SEGMENTS * (CARDINALITY) float c_size = ceil(log10(settings->sax_alphabet_cardinality + 1)); - settings->max_filename_size = settings->paa_segments * - ((c_size * 2) + 2) - + 5 + strlen(root_directory); - - - if(paa_segments > sax_bit_cardinality) - { - settings->bit_masks = malloc(sizeof(root_mask_type) * (paa_segments+1)); - if(settings->bit_masks == NULL) { - fprintf(stderr,"error: could not allocate memory for bit masks.\n"); + settings->max_filename_size = settings->paa_segments * ((c_size * 2) + 2) + 5 + strlen(root_directory); + + if (paa_segments > sax_bit_cardinality) { + settings->bit_masks = (root_mask_type*)malloc(sizeof(root_mask_type) * (paa_segments+1)); + + if (settings->bit_masks == NULL) { + fprintf(stderr, "error: could not allocate memory for bit masks.\n"); + return NULL; } - - for (; paa_segments>=0; paa_segments--) - { + + for (; paa_segments >= 0; paa_segments--) { settings->bit_masks[paa_segments] = pow(2, paa_segments); } - } - else - { - settings->bit_masks = malloc(sizeof(root_mask_type) * (sax_bit_cardinality+1)); - if(settings->bit_masks == NULL) { - fprintf(stderr,"error: could not allocate memory for bit masks.\n"); + } else { + settings->bit_masks = (root_mask_type*)malloc(sizeof(root_mask_type) * (sax_bit_cardinality+1)); + + if (settings->bit_masks == NULL) { + fprintf(stderr, "error: could not allocate memory for bit masks.\n"); + return NULL; } - - for (; sax_bit_cardinality>=0; sax_bit_cardinality--) - { + + for (; sax_bit_cardinality >= 0; sax_bit_cardinality--) { settings->bit_masks[sax_bit_cardinality] = pow(2, sax_bit_cardinality); } } - - if(new_index) { - settings->max_total_buffer_size = (int) ((float)(settings->full_record_size/ - (float)settings->partial_record_size) * settings->max_total_full_buffer_size); + + if (new_index) { + settings->max_total_buffer_size = (int) ((float)(settings->full_record_size/ + (float)settings->partial_record_size) * settings->max_total_full_buffer_size); + } else { + settings->max_total_buffer_size = settings->max_total_full_buffer_size; } - else { - settings->max_total_buffer_size = settings->max_total_full_buffer_size; + + if (SIMD_flag) { + settings->SIMD_flag = '1'; + } else { + settings->SIMD_flag = false; } - - if(SIMD_flag) settings->SIMD_flag='1'; - else settings->SIMD_flag=false; - if(is_norm) settings->is_norm='1'; - else settings->is_norm=false; + if (is_norm) { + settings->is_norm = '1'; + } else { + settings->is_norm = false; + } settings->sample_size = sample_size; settings->sample_type = sample_type; @@ -224,76 +217,68 @@ isax_index_settings * isax_index_settings_init(const char * root_directory, int return settings; } - /** This function initializes an isax index @param isax_index_settings *settings @return isax_index */ -isax_index * isax_index_init(isax_index_settings *settings) -{ - isax_index *index = malloc(sizeof(isax_index)); - if(index == NULL) { - fprintf(stderr,"error: could not allocate memory for index structure.\n"); +isax_index * isax_index_init(isax_index_settings *settings) { + isax_index *index = (isax_index*)malloc(sizeof(isax_index)); + + if (index == NULL) { + fprintf(stderr, "error: could not allocate memory for index structure.\n"); + return NULL; } + index->memory_info.mem_tree_structure = 0; index->memory_info.mem_data = 0; index->memory_info.mem_summaries = 0; index->memory_info.disk_data_full = 0; index->memory_info.disk_data_partial = 0; - index->settings = settings; index->first_node = NULL; - index->fbl = initialize_fbl(settings->initial_fbl_buffer_size, - pow(2, settings->paa_segments), - settings->max_total_buffer_size+DISK_BUFFER_SIZE*(PROGRESS_CALCULATE_THREAD_NUMBER-1), index); - char *sax_filename = malloc((strlen(settings->root_directory) + 15) * sizeof(char)); + index->fbl = initialize_fbl(settings->initial_fbl_buffer_size, pow(2, settings->paa_segments), + settings->max_total_buffer_size+DISK_BUFFER_SIZE * (PROGRESS_CALCULATE_THREAD_NUMBER - 1), index); + char *sax_filename = (char*)malloc((strlen(settings->root_directory) + 15) * sizeof(char)); sax_filename = strcpy(sax_filename, settings->root_directory); sax_filename = strcat(sax_filename, "isax_file.sax"); - if( access( sax_filename, F_OK ) != -1 ) { - index->sax_file = fopen(sax_filename, "rb"); + if (access(sax_filename, F_OK) != -1) { + index->sax_file = fopen(sax_filename, "rb"); } else { - index->sax_file = fopen(sax_filename, "w+b"); + index->sax_file = fopen(sax_filename, "w+b"); } free(sax_filename); index->sax_cache = NULL; - index->total_records = 0; index->loaded_records = 0; - index->root_nodes = 0; index->allocated_memory = 0; index->has_wedges = 0; - //index->locations = malloc(sizeof(int) * settings->timeseries_size); - - index->answer = malloc(sizeof(ts_type) * settings->timeseries_size); + index->answer = (ts_type*)malloc(sizeof(ts_type) * settings->timeseries_size); return index; } - /** This function destroys an index. @param isax_index *index @param isax_ndoe *node */ -void isax_index_destroy(isax_index *index, isax_node *node) -{ +void isax_index_destroy(isax_index *index, isax_node *node) { if (node == NULL) { free(index->answer); - free(index->settings->bit_masks); - free(index->settings->raw_filename); - free(index->settings->max_sax_cardinalities); - free(index->settings); + free(index->settings->bit_masks); + free(index->settings->raw_filename); + free(index->settings->max_sax_cardinalities); + free(index->settings); - // TODO: OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! + // TODO(someone): OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! isax_node *subtree_root = index->first_node; - - while (subtree_root != NULL) - { + + while (subtree_root != NULL) { isax_node *next = subtree_root->next; isax_index_destroy(index, subtree_root); subtree_root = next; @@ -301,117 +286,118 @@ void isax_index_destroy(isax_index *index, isax_node *node) destroy_fbl(index->fbl); destroy_fbl(index->fbl); - #ifdef CLUSTERED - free(index->locations); - #endif - if (index->sax_file !=NULL) - { +#ifdef CLUSTERED + free(index->locations); +#endif + if (index->sax_file !=NULL) { fclose(index->sax_file); } - if(index->sax_cache != NULL) + + if (index->sax_cache != NULL) { free(index->sax_cache); + } + free(index); - } - else { + } else { // Traverse tree - if(!node->is_leaf) { - if(node->right_child !=NULL) + if (!node->is_leaf) { + if (node->right_child !=NULL) { isax_index_destroy(index, node->right_child); - if(node->left_child !=NULL) - isax_index_destroy(index, node->left_child); + } + + if (node->left_child !=NULL) { + isax_index_destroy(index, node->left_child); + } } - - if(node->split_data != NULL) - { + + if (node->split_data != NULL) { free(node->split_data->split_mask); free(node->split_data); } - if(node->filename != NULL) - { + + if (node->filename != NULL) { free(node->filename); } - if(node->isax_cardinalities != NULL) - { + + if (node->isax_cardinalities != NULL) { free(node->isax_cardinalities); } - if(node->isax_values != NULL) - { + + if (node->isax_values != NULL) { free(node->isax_values); } - if(node->buffer != NULL) - { + + if (node->buffer != NULL) { destroy_node_buffer(node->buffer); } + free(node); } } - -void MESSI2_index_destroy(isax_index *index, isax_node *node) -{ +void MESSI2_index_destroy(isax_index *index, isax_node *node) { if (node == NULL) { free(index->answer); - free(index->settings->bit_masks); - free(index->settings->raw_filename); - free(index->settings->max_sax_cardinalities); - free(index->settings); - - // TODO: OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! - //isax_node *subtree_root = index->first_node; - - for (int i=0;i<((first_buffer_layer2*)(index->fbl))->number_of_buffers;i++) - { - fbl_soft_buffer2 * subnode= &((first_buffer_layer2*)(index->fbl))->soft_buffers[i]; - if(subnode->initialized) + free(index->settings->bit_masks); + free(index->settings->raw_filename); + free(index->settings->max_sax_cardinalities); + free(index->settings); + + // TODO(someone): OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! + for (int i = 0; i < ((first_buffer_layer2*)(index->fbl))->number_of_buffers; i++) { + fbl_soft_buffer2 * subnode = &((first_buffer_layer2*)(index->fbl))->soft_buffers[i]; + + if (subnode->initialized) { isax_index_destroy(index, subnode->node); + } } + destroy_fbl2((first_buffer_layer2*)index->fbl); - #ifdef CLUSTERED - free(index->locations); - #endif - if (index->sax_file !=NULL) - { +#ifdef CLUSTERED + free(index->locations); +#endif + if (index->sax_file !=NULL) { fclose(index->sax_file); } - if(index->sax_cache != NULL) + + if (index->sax_cache != NULL) { free(index->sax_cache); + } + free(index); - } - else { + } else { // Traverse tree - if(!node->is_leaf) { + if (!node->is_leaf) { isax_index_destroy(index, node->right_child); isax_index_destroy(index, node->left_child); } - - if(node->split_data != NULL) - { + + if (node->split_data != NULL) { free(node->split_data->split_mask); free(node->split_data); } - if(node->filename != NULL) - { + + if (node->filename != NULL) { free(node->filename); } - if(node->isax_cardinalities != NULL) - { + + if (node->isax_cardinalities != NULL) { free(node->isax_cardinalities); } - if(node->isax_values != NULL) - { + + if (node->isax_values != NULL) { free(node->isax_values); } - if(node->buffer != NULL) - { + + if (node->buffer != NULL) { destroy_node_buffer(node->buffer); } + free(node); } } - -void isax_index_pRecBuf_destroy(isax_index *index, isax_node *node,int prewokernumber) -{ +void isax_index_pRecBuf_destroy(isax_index *index, isax_node *node, int prewokernumber) { if (node == NULL) { free(index->answer); free(index->settings->bit_masks); @@ -419,325 +405,289 @@ void isax_index_pRecBuf_destroy(isax_index *index, isax_node *node,int prewokern free(index->settings->max_sax_cardinalities); free(index->settings); - // TODO: OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! + // TODO(someone): OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! isax_node *subtree_root = index->first_node; - - while (subtree_root != NULL) - { + + while (subtree_root != NULL) { isax_node *next = subtree_root->next; isax_index_destroy(index, subtree_root); subtree_root = next; } - destroy_pRecBuf((parallel_first_buffer_layer*)(index->fbl),prewokernumber); - #ifdef CLUSTERED - free(index->locations); - #endif - if (index->sax_file !=NULL) - { + + destroy_pRecBuf((parallel_first_buffer_layer*)(index->fbl), prewokernumber); +#ifdef CLUSTERED + free(index->locations); +#endif + if (index->sax_file != NULL) { fclose(index->sax_file); } - - if(index->sax_cache != NULL) + + if (index->sax_cache != NULL) { free(index->sax_cache); + } free(index); - } - else { + } else { // Traverse tree - if(!node->is_leaf) { + if (!node->is_leaf) { isax_index_destroy(index, node->right_child); isax_index_destroy(index, node->left_child); } - - if(node->split_data != NULL) - { + + if (node->split_data != NULL) { free(node->split_data->split_mask); free(node->split_data); } - if(node->filename != NULL) - { + + if (node->filename != NULL) { free(node->filename); } - if(node->isax_cardinalities != NULL) - { + + if (node->isax_cardinalities != NULL) { free(node->isax_cardinalities); } - if(node->isax_values != NULL) - { + + if (node->isax_values != NULL) { free(node->isax_values); } - if(node->buffer != NULL) - { + + if (node->buffer != NULL) { destroy_node_buffer(node->buffer); } - + free(node); } } - /** This function inserts an isax_node_record in an isax index with an fbl @param isax_index *index @param isax_node_record *record */ -root_mask_type isax_fbl_index_insert(isax_index *index, - sax_type * sax, - file_position_type * pos) -{ - COUNT_OUTPUT_TIME_START - fwrite(sax, index->settings->sax_byte_size, 1, index->sax_file); - COUNT_OUTPUT_TIME_END +root_mask_type isax_fbl_index_insert(isax_index *index, sax_type * sax, file_position_type * pos) { + COUNT_OUTPUT_TIME_START + fwrite(sax, index->settings->sax_byte_size, 1, index->sax_file); + COUNT_OUTPUT_TIME_END // Create mask for the first bit of the sax representation - - // Step 1: Check if there is a root node that represents the + + // Step 1: Check if there is a root node that represents the // current node's sax representation - - // TODO: Create INSERTION SHORT AND BINARY SEARCH METHODS. + + // TODO(someone): Create INSERTION SHORT AND BINARY SEARCH METHODS. root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); - //printf("sax is %d\n",first_bit_mask ); - insert_to_fbl(index->fbl, sax, pos, - first_bit_mask, index); + insert_to_fbl(index->fbl, sax, pos, first_bit_mask, index); index->total_records++; - - if((index->total_records % index->settings->max_total_buffer_size) == 0) { + + if ((index->total_records % index->settings->max_total_buffer_size) == 0) { FLUSHES++; flush_fbl(index->fbl, index); } - + return first_bit_mask; } - - /** This function inserts an isax_node_record in an isax index. @param isax_index *index @param isax_node_record *record */ -enum response isax_index_insert(isax_index *index, sax_type *sax, file_position_type *pos) -{ +enum response isax_index_insert(isax_index *index, sax_type *sax, file_position_type *pos) { // Create mask for the first bit of the sax representation - // Step 1: Check if there is a root node that represents the + // Step 1: Check if there is a root node that represents the // current node's sax representation - - // TODO: Create INSERTION SHORT AND BINARY SEARCH METHODS. + + // TODO(someone): Create INSERTION SHORT AND BINARY SEARCH METHODS. root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); isax_node *curr_node = index->first_node; isax_node *last_node = NULL; + while (curr_node != NULL) { - if(first_bit_mask == curr_node->mask) - { - break; + if (first_bit_mask == curr_node->mask) { + break; } + last_node = curr_node; curr_node = curr_node->next; } - - + // No appropriate root node has been found for this record - if(curr_node == NULL) { + if (curr_node == NULL) { #ifdef DEBUG // Create node printf("*** Creating new root node. ***\n\n"); #endif - isax_node *new_node = isax_root_node_init(first_bit_mask, - index->settings->initial_leaf_buffer_size); + isax_node *new_node = isax_root_node_init(first_bit_mask, index->settings->initial_leaf_buffer_size); index->root_nodes++; - + new_node->is_leaf = 1; - - if(index->first_node == NULL) - { + + if (index->first_node == NULL) { index->first_node = new_node; - } - else - { + } else { last_node->next = new_node; new_node->previous = last_node; } - + curr_node = new_node; } - isax_node_record * record = isax_node_record_init(index->settings->paa_segments, - index->settings->timeseries_size, - NO_TMP | PARTIAL); - + + isax_node_record * record = isax_node_record_init(index->settings->paa_segments, + index->settings->timeseries_size, PARTIAL_OR_NO_TMP); memcpy((void *)record->sax, sax, index->settings->sax_byte_size); memcpy((void *)record->position, pos, index->settings->position_byte_size); - + add_record_to_node(index, curr_node, record, 1); - + free(record); - + index->total_records++; - - - // TODO: use total buffered records, also increased from LEAF LOADS and SPLITS - // and flush using this one as a flush limit counter. Reset to 0 when flushed. - + + // TODO(someone): use total buffered records, also increased from LEAF LOADS and SPLITS + // and flush using this one as a flush limit counter. Reset to 0 when flushed. + // Check if flush to disk is needed - if((index->total_records % index->settings->max_total_buffer_size) == 0) { + if ((index->total_records % index->settings->max_total_buffer_size) == 0) { FLUSHES++; - flush_all_leaf_buffers(index, 1); +// flush_all_leaf_buffers(index, 1); + flush_all_leaf_buffers(index, TMP_ONLY_CLEAN); } - + return SUCCESS; } - -enum response create_node_filename(isax_index *index, - isax_node *node, - isax_node_record *record) -{ +enum response create_node_filename(isax_index *index, isax_node *node, isax_node_record *record) { int i; - node->filename = malloc(sizeof(char) * index->settings->max_filename_size); + node->filename = (char*)malloc(sizeof(char) * index->settings->max_filename_size); sprintf(node->filename, "%s", index->settings->root_directory); int l = (int) strlen(index->settings->root_directory); - - // If this has a parent then it is not a root node and as such it does have some + + // If this has a parent then it is not a root node and as such it does have some // split data on its parent about the cardinalities. - node->isax_values = malloc(sizeof(sax_type) * index->settings->paa_segments); - node->isax_cardinalities = malloc(sizeof(sax_type) * index->settings->paa_segments); - + node->isax_values = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + node->isax_cardinalities = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + if (node->parent) { - for (i=0; isettings->paa_segments; i++) { + for (i = 0; i < index->settings->paa_segments; i++) { root_mask_type mask = 0x00; - int k; - for (k=0; k <= node->parent->split_data->split_mask[i]; k++) - { - mask |= (index->settings->bit_masks[index->settings->sax_bit_cardinality - 1 - k] & - record->sax[i]); + + for (int k = 0; k <= node->parent->split_data->split_mask[i]; k++) { + mask |= (index->settings->bit_masks[index->settings->sax_bit_cardinality - 1 - k] & + record->sax[i]); } + mask = mask >> index->settings->sax_bit_cardinality - node->parent->split_data->split_mask[i] - 1; - + node->isax_values[i] = (int) mask; node->isax_cardinalities[i] = node->parent->split_data->split_mask[i]+1; - - if (i==0) { - l += sprintf(node->filename+l ,"%d.%d", node->isax_values[i], node->isax_cardinalities[i]); + + if (i == 0) { + l += sprintf(node->filename+l, "%d.%d", node->isax_values[i], node->isax_cardinalities[i]); + } else { + l += sprintf(node->filename+l, "_%d.%d", node->isax_values[i], node->isax_cardinalities[i]); } - else { - l += sprintf(node->filename+l ,"_%d.%d", node->isax_values[i], node->isax_cardinalities[i]); - } - } - } - // If it has no parent it is root node and as such it's cardinality is 1. - else - { + } else { // If it has no parent it is root node and as such it's cardinality is 1. root_mask_type mask = 0x00; - - for (i=0; isettings->paa_segments; i++) { - + + for (i = 0; i < index->settings->paa_segments; i++) { mask = (index->settings->bit_masks[index->settings->sax_bit_cardinality - 1] & record->sax[i]); mask = mask >> index->settings->sax_bit_cardinality - 1; - + node->isax_values[i] = (int) mask; node->isax_cardinalities[i] = 1; - - if (i==0) { - l += sprintf(node->filename+l ,"%d.1", (int) mask); + + if (i == 0) { + l += sprintf(node->filename+l, "%d.1", (int) mask); + } else { + l += sprintf(node->filename+l, "_%d.1", (int) mask); } - else { - l += sprintf(node->filename+l ,"_%d.1", (int) mask); - } } } - + #ifdef DEBUG printf("\tCreated filename:\t\t %s\n\n", node->filename); #endif - + return SUCCESS; } - -isax_node * add_record_to_node(isax_index *index, - isax_node *tree_node, - isax_node_record *record, - const char leaf_size_check) -{ - #ifdef DEBUG +isax_node * add_record_to_node(isax_index *index, isax_node *tree_node, + isax_node_record *record, const char leaf_size_check) { +#ifdef DEBUG printf("*** Adding to node ***\n\n"); - #endif +#endif isax_node *node = tree_node; // Traverse tree while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; - + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; - if(record->sax[node->split_data->splitpoint] & mask) - { + + if (record->sax[node->split_data->splitpoint] & mask) { node = node->right_child; - } - else - { + } else { node = node->left_child; } } + // Check if split needed if ((node->leaf_size) >= index->settings->max_leaf_size && leaf_size_check) { - #ifdef DEBUG +#ifdef DEBUG printf(">>> %s leaf size: %d\n\n", node->filename, node->leaf_size); - #endif +#endif split_node(index, node); add_record_to_node(index, node, record, leaf_size_check); - } - else - { + } else { if (node->filename == NULL) { - create_node_filename(index,node,record); + create_node_filename(index, node, record); } - add_to_node_buffer(node->buffer, record, index->settings->paa_segments, - index->settings->timeseries_size); - node->leaf_size++; + add_to_node_buffer(node->buffer, record, index->settings->paa_segments, index->settings->timeseries_size); + node->leaf_size++; } + return node; } /** Flushes all leaf buffers of a tree to disk. */ -enum response flush_all_leaf_buffers(isax_index *index, enum buffer_cleaning_mode buffer_clean_mode) -{ +enum response flush_all_leaf_buffers(isax_index *index, enum buffer_cleaning_mode buffer_clean_mode) { #ifndef DEBUG - //printf("\n"); fflush(stdout); #else printf("*** FLUSHING ***\n\n"); #endif - // TODO: OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! + // TODO(someone): OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! isax_node *subtree_root = index->first_node; - + #ifndef DEBUG #if VERBOSE_LEVEL == 2 - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); #endif #if VERBOSE_LEVEL == 1 fprintf(stdout, "Flushing...\n"); #endif #endif - - while (subtree_root != NULL) - { + + while (subtree_root != NULL) { #ifndef DEBUG #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)i/(float)index->root_nodes)*100); + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)i/(float)index->root_nodes) * 100); i++; fflush(stdout); #endif #endif - if(flush_subtree_leaf_buffers(index, subtree_root) == FAILURE) - return FAILURE; + if (flush_subtree_leaf_buffers(index, subtree_root) == FAILURE) { + return FAILURE; + } + subtree_root = subtree_root->next; } #ifndef DEBUG @@ -745,463 +695,408 @@ enum response flush_all_leaf_buffers(isax_index *index, enum buffer_cleaning_mod printf("\n"); #endif #endif - + // *** FREE MEMORY OF NODES BUFFERS *** // Now that we have flushed its contents // there is no need to keep memory allocated. - isax_index_clear_node_buffers(index, NULL, 1, buffer_clean_mode); - +// isax_index_clear_node_buffers(index, NULL, 1, buffer_clean_mode); + isax_index_clear_node_buffers(index, NULL, INCLUDE_CHILDREN, buffer_clean_mode); + return SUCCESS; } - /** Flushes the leaf buffers of a sub-tree to disk. */ -enum response flush_subtree_leaf_buffers (isax_index *index, isax_node *node) -{ - +enum response flush_subtree_leaf_buffers(isax_index *index, isax_node *node) { if (node->is_leaf && node->filename != NULL) { // Set that unloaded data exist in disk - if (node->buffer->partial_buffer_size > 0 - || node->buffer->tmp_partial_buffer_size > 0) { + if (node->buffer->partial_buffer_size > 0 || node->buffer->tmp_partial_buffer_size > 0) { node->has_partial_data_file = 1; } + // Set that the node has flushed full data in the disk - if (node->buffer->full_buffer_size > 0 - || node->buffer->tmp_full_buffer_size > 0) { + if (node->buffer->full_buffer_size > 0 || node->buffer->tmp_full_buffer_size > 0) { node->has_full_data_file = 1; } - if(node->has_full_data_file) { + if (node->has_full_data_file) { int prev_rec_count = node->leaf_size - (node->buffer->full_buffer_size + node->buffer->tmp_full_buffer_size); - - int previous_page_size = ceil((float) (prev_rec_count * index->settings->full_record_size) / (float) PAGE_SIZE); + int previous_page_size = ceil((float) (prev_rec_count * index->settings->full_record_size) / (float) PAGE_SIZE); int current_page_size = ceil((float) (node->leaf_size * index->settings->full_record_size) / (float) PAGE_SIZE); - index->memory_info.disk_data_full += (current_page_size - previous_page_size); } - if(node->has_partial_data_file) { + + if (node->has_partial_data_file) { int prev_rec_count = node->leaf_size - (node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size); - - int previous_page_size = ceil((float) (prev_rec_count * index->settings->partial_record_size) / (float) PAGE_SIZE); + int previous_page_size = ceil((float) (prev_rec_count * index->settings->partial_record_size) / (float) PAGE_SIZE); int current_page_size = ceil((float) (node->leaf_size * index->settings->partial_record_size) / (float) PAGE_SIZE); - index->memory_info.disk_data_partial += (current_page_size - previous_page_size); } - if(node->has_full_data_file && node->has_partial_data_file) { - printf("WARNING: (Mem size counting) this leaf has both partial and full data.\n"); + + if (node->has_full_data_file && node->has_partial_data_file) { + printf("WARNING: (Mem size counting) this leaf has both partial and full data.\n"); } - index->memory_info.disk_data_full += (node->buffer->full_buffer_size + - node->buffer->tmp_full_buffer_size); - index->memory_info.disk_data_partial += (node->buffer->partial_buffer_size + - node->buffer->tmp_partial_buffer_size); + index->memory_info.disk_data_full += (node->buffer->full_buffer_size + node->buffer->tmp_full_buffer_size); + index->memory_info.disk_data_partial += (node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size); - flush_node_buffer(node->buffer, index->settings->paa_segments, - index->settings->timeseries_size, - node->filename); - } - else if (!node->is_leaf) - { + flush_node_buffer(node->buffer, index->settings->paa_segments, index->settings->timeseries_size, node->filename); + } else if (!node->is_leaf) { flush_subtree_leaf_buffers(index, node->left_child); flush_subtree_leaf_buffers(index, node->right_child); } - + return SUCCESS; } -enum response flush_subtree_leaf_buffers_m1(isax_index *index, isax_node *node,pthread_mutex_t *lock_index,pthread_mutex_t *lock_write) -{ - + +enum response flush_subtree_leaf_buffers_m1(isax_index *index, isax_node *node, + pthread_mutex_t *lock_index, pthread_mutex_t *lock_write) { if (node->is_leaf && node->filename != NULL) { // Set that unloaded data exist in disk - if (node->buffer->partial_buffer_size > 0 - || node->buffer->tmp_partial_buffer_size > 0) { + if (node->buffer->partial_buffer_size > 0 || node->buffer->tmp_partial_buffer_size > 0) { node->has_partial_data_file = 1; } + // Set that the node has flushed full data in the disk - if (node->buffer->full_buffer_size > 0 - || node->buffer->tmp_full_buffer_size > 0) { + if (node->buffer->full_buffer_size > 0 || node->buffer->tmp_full_buffer_size > 0) { node->has_full_data_file = 1; } - if(node->has_full_data_file) { + if (node->has_full_data_file) { int prev_rec_count = node->leaf_size - (node->buffer->full_buffer_size + node->buffer->tmp_full_buffer_size); - - int previous_page_size = ceil((float) (prev_rec_count * index->settings->full_record_size) / (float) PAGE_SIZE); - int current_page_size = ceil((float) (node->leaf_size * index->settings->full_record_size) / (float) PAGE_SIZE); + int previous_page_size = ceil((float) (prev_rec_count * index->settings->full_record_size) / (float) PAGE_SIZE); + int current_page_size = ceil((float) (node->leaf_size * index->settings->full_record_size) / (float) PAGE_SIZE); pthread_mutex_lock(lock_index); - //COUNT_CAL_TIME_START index->memory_info.disk_data_full += (current_page_size - previous_page_size); - //COUNT_CAL_TIME_END pthread_mutex_unlock(lock_index); } - if(node->has_partial_data_file) { + + if (node->has_partial_data_file) { int prev_rec_count = node->leaf_size - (node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size); - - int previous_page_size = ceil((float) (prev_rec_count * index->settings->partial_record_size) / (float) PAGE_SIZE); + int previous_page_size = ceil((float) (prev_rec_count * index->settings->partial_record_size) / (float) PAGE_SIZE); int current_page_size = ceil((float) (node->leaf_size * index->settings->partial_record_size) / (float) PAGE_SIZE); pthread_mutex_lock(lock_index); - //COUNT_CAL_TIME_START + index->memory_info.disk_data_partial += (current_page_size - previous_page_size); - //COUNT_CAL_TIME_END + pthread_mutex_unlock(lock_index); } - if(node->has_full_data_file && node->has_partial_data_file) { - printf("WARNING: (Mem size counting) this leaf has both partial and full data.\n"); + + if (node->has_full_data_file && node->has_partial_data_file) { + printf("WARNING: (Mem size counting) this leaf has both partial and full data.\n"); } + pthread_mutex_lock(lock_index); - //COUNT_CAL_TIME_START - index->memory_info.disk_data_full += (node->buffer->full_buffer_size + - node->buffer->tmp_full_buffer_size); - index->memory_info.disk_data_partial += (node->buffer->partial_buffer_size + - node->buffer->tmp_partial_buffer_size); - //COUNT_CAL_TIME_END + index->memory_info.disk_data_full += (node->buffer->full_buffer_size + node->buffer->tmp_full_buffer_size); + index->memory_info.disk_data_partial += (node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size); + pthread_mutex_unlock(lock_index); - //flush_node_buffer(node->buffer, index->settings->paa_segments, - // index->settings->timeseries_size, - // node->filename); flush_node_buffer_m(node->buffer, index->settings->paa_segments, - index->settings->timeseries_size, - node->filename,lock_write); - } - else if (!node->is_leaf) - { + index->settings->timeseries_size, node->filename, lock_write); + } else if (!node->is_leaf) { pid_t fpid; - fpid=fork(); - if(fpid<0) - { + fpid = fork(); + if (fpid < 0) { printf("error in fork! \n"); - } - else if(fpid==0) - { - flush_subtree_leaf_buffers_m(index, node->left_child,lock_index,lock_write); - - } - else - { - flush_subtree_leaf_buffers_m(index, node->right_child,lock_index,lock_write); - + } else if (fpid == 0) { + flush_subtree_leaf_buffers_m(index, node->left_child, lock_index, lock_write); + } else { + flush_subtree_leaf_buffers_m(index, node->right_child, lock_index, lock_write); } } - + return SUCCESS; } -enum response flush_subtree_leaf_buffers_m(isax_index *index, isax_node *node,pthread_mutex_t *lock_index,pthread_mutex_t *lock_write) -{ - +enum response flush_subtree_leaf_buffers_m(isax_index *index, isax_node *node, + pthread_mutex_t *lock_index, pthread_mutex_t *lock_write) { if (node->is_leaf && node->filename != NULL) { // Set that unloaded data exist in disk - if (node->buffer->partial_buffer_size > 0 - || node->buffer->tmp_partial_buffer_size > 0) { + if (node->buffer->partial_buffer_size > 0 || node->buffer->tmp_partial_buffer_size > 0) { node->has_partial_data_file = 1; } + // Set that the node has flushed full data in the disk - if (node->buffer->full_buffer_size > 0 - || node->buffer->tmp_full_buffer_size > 0) { + if (node->buffer->full_buffer_size > 0 || node->buffer->tmp_full_buffer_size > 0) { node->has_full_data_file = 1; } - if(node->has_full_data_file) { + if (node->has_full_data_file) { int prev_rec_count = node->leaf_size - (node->buffer->full_buffer_size + node->buffer->tmp_full_buffer_size); - - int previous_page_size = ceil((float) (prev_rec_count * index->settings->full_record_size) / (float) PAGE_SIZE); + + int previous_page_size = ceil((float) (prev_rec_count * index->settings->full_record_size) / (float) PAGE_SIZE); int current_page_size = ceil((float) (node->leaf_size * index->settings->full_record_size) / (float) PAGE_SIZE); pthread_mutex_lock(lock_index); - //COUNT_CAL_TIME_START index->memory_info.disk_data_full += (current_page_size - previous_page_size); - //COUNT_CAL_TIME_END pthread_mutex_unlock(lock_index); } - if(node->has_partial_data_file) { + + if (node->has_partial_data_file) { int prev_rec_count = node->leaf_size - (node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size); - - int previous_page_size = ceil((float) (prev_rec_count * index->settings->partial_record_size) / (float) PAGE_SIZE); + + int previous_page_size = ceil((float) (prev_rec_count * index->settings->partial_record_size) / (float) PAGE_SIZE); int current_page_size = ceil((float) (node->leaf_size * index->settings->partial_record_size) / (float) PAGE_SIZE); pthread_mutex_lock(lock_index); - //COUNT_CAL_TIME_START + index->memory_info.disk_data_partial += (current_page_size - previous_page_size); - //COUNT_CAL_TIME_END pthread_mutex_unlock(lock_index); } - if(node->has_full_data_file && node->has_partial_data_file) { - printf("WARNING: (Mem size counting) this leaf has both partial and full data.\n"); + + if (node->has_full_data_file && node->has_partial_data_file) { + printf("WARNING: (Mem size counting) this leaf has both partial and full data.\n"); } + pthread_mutex_lock(lock_index); - //COUNT_CAL_TIME_START - index->memory_info.disk_data_full += (node->buffer->full_buffer_size + - node->buffer->tmp_full_buffer_size); - index->memory_info.disk_data_partial += (node->buffer->partial_buffer_size + - node->buffer->tmp_partial_buffer_size); - //COUNT_CAL_TIME_END + index->memory_info.disk_data_full += (node->buffer->full_buffer_size + node->buffer->tmp_full_buffer_size); + + index->memory_info.disk_data_partial += (node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size); + pthread_mutex_unlock(lock_index); - //flush_node_buffer(node->buffer, index->settings->paa_segments, - // index->settings->timeseries_size, - // node->filename); flush_node_buffer_m(node->buffer, index->settings->paa_segments, - index->settings->timeseries_size, - node->filename,lock_write); + index->settings->timeseries_size, node->filename, lock_write); + } else if (!node->is_leaf) { + flush_subtree_leaf_buffers_m(index, node->left_child, lock_index, lock_write); + flush_subtree_leaf_buffers_m(index, node->right_child, lock_index, lock_write); } - else if (!node->is_leaf) - { - flush_subtree_leaf_buffers_m(index, node->left_child,lock_index,lock_write); - flush_subtree_leaf_buffers_m(index, node->right_child,lock_index,lock_write); - } - return SUCCESS; } -void isax_index_clear_node_buffers(isax_index *index, isax_node *node, - enum node_cleaning_mode node_cleaning_mode, - enum buffer_cleaning_mode buffer_clean_mode) -{ + +void isax_index_clear_node_buffers(isax_index *index, isax_node *node, + enum node_cleaning_mode node_cleaning_mode, + enum buffer_cleaning_mode buffer_clean_mode) { if (node == NULL) { - // TODO: OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! + // TODO(someone): OPTIMIZE TO FLUSH WITHOUT TRAVERSAL! isax_node *subtree_root = index->first_node; - - while (subtree_root != NULL) - { - + + while (subtree_root != NULL) { isax_index_clear_node_buffers(index, subtree_root, node_cleaning_mode, buffer_clean_mode); subtree_root = subtree_root->next; } - } - else { + } else { // Traverse tree - //printf("this is the time 2\n"); - - if(!node->is_leaf && node_cleaning_mode == INCLUDE_CHILDREN) { + if (!node->is_leaf && node_cleaning_mode == INCLUDE_CHILDREN) { isax_index_clear_node_buffers(index, node->right_child, node_cleaning_mode, buffer_clean_mode); isax_index_clear_node_buffers(index, node->left_child, node_cleaning_mode, buffer_clean_mode); - } - else if(node->is_leaf && node->buffer != NULL) - { + } else if (node->is_leaf && node->buffer != NULL) { clear_node_buffer(node->buffer, buffer_clean_mode); } } } - -int comp(const void * a, const void * b) -{ +int comp(const void * a, const void * b) { isax_node_record *ra = (isax_node_record*) a; isax_node_record *rb = (isax_node_record*) b; - - if (*ra->position==*rb->position) + + if (*ra->position == *rb->position) { return 0; - else - if (*ra->position < *rb->position) + } else if (*ra->position < *rb->position) { return -1; - else + } else { return 1; + } } -void find_empty_children(isax_node *start_node, isax_node **nodes_to_load, - int * number, int * offset) { - - +void find_empty_children(isax_node *start_node, isax_node **nodes_to_load, int * number, int * offset) { if (*number == 0 || start_node == NULL) { return; } - //printf("*** Loading all children of node: %p\n", start_node); - - - if (start_node->is_leaf && (start_node->has_partial_data_file || - start_node->buffer->partial_buffer_size > 0 || - start_node->buffer->tmp_partial_buffer_size > 0 - )) { + + if (start_node->is_leaf && (start_node->has_partial_data_file || + start_node->buffer->partial_buffer_size > 0 || + start_node->buffer->tmp_partial_buffer_size > 0)) { nodes_to_load[*offset] = start_node; (*offset)++; (*number)--; #ifdef DEBUG - printf("*** %pis a leaf, loaded.\n", start_node); +printf("*** %pis a leaf, loaded.\n", start_node); #endif - } - else { + } else { if (start_node->left_child != NULL) { - find_empty_children(start_node->left_child, nodes_to_load, - number, offset); + find_empty_children(start_node->left_child, nodes_to_load, number, offset); } - if(start_node->right_child != NULL) { - find_empty_children(start_node->right_child, nodes_to_load, - number, offset); + + if (start_node->right_child != NULL) { + find_empty_children(start_node->right_child, nodes_to_load, number, offset); } } } - - -int find_siblings(isax_node *c_node, isax_node **nodes_to_load, - int *number_of_leaves, int *offset) { - +int find_siblings(isax_node *c_node, isax_node **nodes_to_load, int *number_of_leaves, int *offset) { find_empty_children(c_node, nodes_to_load, number_of_leaves, offset); - + // Current node is already loaded. if (offset == 0) { return 0; } - + // In-subtree siblings... while (c_node->parent != NULL && *number_of_leaves > 0) { isax_node *parent = NULL; isax_node *sibling = NULL; - + parent = c_node->parent; - if (parent->left_child == c_node) + + if (parent->left_child == c_node) { sibling = parent->right_child; - if (parent->right_child == c_node) + } + + if (parent->right_child == c_node) { sibling = parent->left_child; + } #ifdef DEBUG printf("Found sibling: %p\n", sibling); #endif find_empty_children(sibling, nodes_to_load, number_of_leaves, offset); - + c_node = c_node->parent; } - + #ifndef CLUSTERED // In different sub-tree siblings... only if it is not clustered. isax_node *ptr_left = c_node->previous; isax_node *ptr_right = c_node->next; - while (*number_of_leaves > 0 && - !(ptr_left == NULL && ptr_right == NULL)) { - if(ptr_left != NULL) - { - find_empty_children(ptr_left, nodes_to_load, - number_of_leaves, offset); + + while (*number_of_leaves > 0 && !(ptr_left == NULL && ptr_right == NULL)) { + if (ptr_left != NULL) { + find_empty_children(ptr_left, nodes_to_load, number_of_leaves, offset); ptr_left = ptr_left->previous; - } - if(ptr_right != NULL) - { - find_empty_children(ptr_right, nodes_to_load, - number_of_leaves, offset); + + if (ptr_right != NULL) { + find_empty_children(ptr_right, nodes_to_load, number_of_leaves, offset); ptr_right = ptr_right->next; } } #endif + return SUCCESS; } float isax_index_load_node(isax_index *index, isax_node *c_node, ts_type * query, float bsf) { - isax_node *fbl_node = c_node; - #ifdef CLUSTERED - while (fbl_node->parent != NULL){ + isax_node *fbl_node = c_node; +#ifdef CLUSTERED + while (fbl_node->parent != NULL) { fbl_node = fbl_node->parent; } - char* pfilename = malloc(255); - snprintf(pfilename, 255, "%s.%llu",index->settings->raw_filename, fbl_node->mask); + + char* pfilename = (char*)malloc(255); + snprintf(pfilename, sizeof(pfilename), "%s.%llu", index->settings->raw_filename, fbl_node->mask); FILE * raw_file = fopen(pfilename, "r"); - #else +#else FILE * raw_file = fopen(index->settings->raw_filename, "r"); - #endif - +#endif + int total_loaded_leaves = index->settings->total_loaded_leaves; + // *** Step 1 *** Decide nodes to load - int leaves_to_load = total_loaded_leaves; + int leaves_to_load = total_loaded_leaves; int offset = 0; - isax_node **nodes_to_load = malloc(sizeof(isax_node *) * leaves_to_load); + isax_node **nodes_to_load = (isax_node**)malloc(sizeof(isax_node *) * leaves_to_load); find_siblings(c_node, nodes_to_load, &leaves_to_load, &offset); - + // Current node is already loaded. if (offset == 0) { return FLT_MAX; } - + // *** Step 2 *** Prepare load buffers for all nodes isax_node_record *load_buffer = NULL; int total_records = 0; - int node_id=0; + int node_id = 0; int load_buffer_index = 0; - + for (node_id = 0; node_id < offset; node_id++) { isax_node * node = nodes_to_load[node_id]; - + FILE * partial_file; int file_records = 0; int buffer_records = 0; - - if (node->buffer) - { - buffer_records = node->buffer->partial_buffer_size - + node->buffer->tmp_partial_buffer_size; + + if (node->buffer) { + buffer_records = node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size; total_records += buffer_records; } - - if(node->has_partial_data_file) { - char * partial_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + + if (node->has_partial_data_file) { + char * partial_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(partial_fname, node->filename); strcat(partial_fname, ".part"); COUNT_INPUT_TIME_START partial_file = fopen(partial_fname, "r"); - if(partial_file != NULL) { + + if (partial_file != NULL) { fseek(partial_file, 0L, SEEK_END); size_t file_size = ftell(partial_file); fseek(partial_file, 0L, SEEK_SET); file_records = (int) file_size / (int)index->settings->partial_record_size; total_records += file_records; + } else { + fprintf(stderr, "[ERROR] LEAF FILE \"%s\" DOES NOT EXIST.\n", partial_fname); + system("ls "); } - else { - fprintf(stderr, "[ERROR] LEAF FILE \"%s\" DOES NOT EXIST.\n", partial_fname); - system("ls "); - } + COUNT_INPUT_TIME_END free(partial_fname); } - - if (load_buffer == NULL) - load_buffer = malloc(sizeof(isax_node_record) * (total_records)); - else - load_buffer = realloc(load_buffer, sizeof(isax_node_record) * - (total_records)); - + + if (load_buffer == NULL) { + load_buffer = (isax_node_record*)malloc(sizeof(isax_node_record) * (total_records)); + } else { + load_buffer = (isax_node_record*)realloc(load_buffer, sizeof(isax_node_record) * (total_records)); + } + // PARTIAL DATA THAT ARE LOCATED IN BUFFERS if (node->buffer != NULL) { int i; - for (i=0; ibuffer->partial_buffer_size; i++) { + + for (i = 0; i < node->buffer->partial_buffer_size; i++) { // CREATE RECORD AND SET AS NO_TMP // NO MALLOC JUST REFERENCE load_buffer[load_buffer_index].position = node->buffer->partial_position_buffer[i]; load_buffer[load_buffer_index].sax = node->buffer->partial_sax_buffer[i]; - load_buffer[load_buffer_index].ts = malloc(index->settings->ts_byte_size); - load_buffer[load_buffer_index].insertion_mode = FULL | NO_TMP; + load_buffer[load_buffer_index].ts = (ts_type*)malloc(index->settings->ts_byte_size); + load_buffer[load_buffer_index].insertion_mode = FULL_OR_NO_TMP; load_buffer[load_buffer_index].destination = node; load_buffer_index++; } + node->buffer->partial_buffer_size = 0; - - for (i=0; ibuffer->tmp_partial_buffer_size; i++) { + + for (i = 0; i < node->buffer->tmp_partial_buffer_size; i++) { // CREATE RECORD AND SET AS TMP // NO MALLOC JUST REFERENCE load_buffer[load_buffer_index].position = node->buffer->tmp_partial_position_buffer[i]; load_buffer[load_buffer_index].sax = node->buffer->tmp_partial_sax_buffer[i]; - load_buffer[load_buffer_index].ts = malloc(index->settings->ts_byte_size); - load_buffer[load_buffer_index].insertion_mode = FULL | TMP; + load_buffer[load_buffer_index].ts = (ts_type*)malloc(index->settings->ts_byte_size); + load_buffer[load_buffer_index].insertion_mode = TMP_OR_FULL; load_buffer[load_buffer_index].destination = node; load_buffer_index++; } + node->buffer->tmp_partial_buffer_size = 0; // Count memory that was allocated here - index->allocated_memory += index->settings->ts_byte_size * (node->buffer->tmp_partial_buffer_size + - node->buffer->partial_buffer_size); + index->allocated_memory += index->settings->ts_byte_size * + (node->buffer->tmp_partial_buffer_size + node->buffer->partial_buffer_size); } - + // PARTIAL DATA THAT ARE IN FILE ON DISK if (file_records > 0) { int i; - for (i=0; isettings->position_byte_size); - load_buffer[load_buffer_index].sax = malloc(index->settings->sax_byte_size); - load_buffer[load_buffer_index].ts = malloc(index->settings->ts_byte_size); - load_buffer[load_buffer_index].insertion_mode = FULL | TMP; + load_buffer[load_buffer_index].position = (file_position_type*)malloc(index->settings->position_byte_size); + load_buffer[load_buffer_index].sax = (sax_type*)malloc(index->settings->sax_byte_size); + load_buffer[load_buffer_index].ts = (ts_type*)malloc(index->settings->ts_byte_size); + load_buffer[load_buffer_index].insertion_mode = TMP_OR_FULL; load_buffer[load_buffer_index].destination = node; COUNT_INPUT_TIME_START fread(load_buffer[load_buffer_index].position, sizeof(file_position_type), 1, partial_file); @@ -1210,198 +1105,191 @@ float isax_index_load_node(isax_index *index, isax_node *c_node, ts_type * query load_buffer_index++; } - // Count memory that was allocated here index->allocated_memory += (file_records * index->settings->full_record_size); - + // Remove memory that is deallocated from disk index->memory_info.disk_data_partial -= ceil((float)(file_records * index->settings->partial_record_size) / (float) PAGE_SIZE); - + COUNT_INPUT_TIME_START fclose(partial_file); COUNT_INPUT_TIME_END } - #ifdef BENCHMARK +#ifdef BENCHMARK if (total_records > 0) { COUNT_LOADED_NODE() } - #endif - +#endif + load_buffer_index = total_records; } - - + // *** Step 3 *** Sort array of data to load - qsort(load_buffer,total_records,sizeof(isax_node_record), comp); - - + qsort(load_buffer, total_records, sizeof(isax_node_record), comp); + + // *** Step 4 *** Read node data from raw file and store in tree - //float bsf = FLT_MAX; - int i; - for (i=0; iloaded_records++; - - //printf("LOADING POSITION: %d\n", *load_buffer[i].position); + COUNT_INPUT_TIME_START fseek(raw_file, *load_buffer[i].position, SEEK_SET); fread(load_buffer[i].ts, sizeof(ts_type), index->settings->timeseries_size, raw_file); COUNT_INPUT_TIME_END - - if(query != NULL) - { + if (query != NULL) { // Also calculate distance - float dist = ts_euclidean_distance(query, load_buffer[i].ts, - index->settings->timeseries_size, bsf); + float dist = ts_euclidean_distance(query, load_buffer[i].ts, index->settings->timeseries_size, bsf); if (dist < bsf) { bsf = dist; - #ifdef STORE_ANSWER +#ifdef STORE_ANSWER ts_type *ts = load_buffer[i].ts; memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); - #endif +#endif } } - - //printf("Distance: %lf\n", dist); - - add_to_node_buffer(((isax_node *)load_buffer[i].destination)->buffer, - &load_buffer[i], - index->settings->paa_segments, - index->settings->timeseries_size); + + add_to_node_buffer(((isax_node *)load_buffer[i].destination)->buffer, + &load_buffer[i], index->settings->paa_segments, index->settings->timeseries_size); } + free(load_buffer); COUNT_INPUT_TIME_START fclose(raw_file); COUNT_INPUT_TIME_END - + // Set nodes as loaded. for (node_id = 0; node_id < offset; node_id++) { nodes_to_load[node_id]->has_partial_data_file = 0; } - - if (index->allocated_memory > index->settings->max_total_full_buffer_size) - { + + if (index->allocated_memory > index->settings->max_total_full_buffer_size) { FLUSHES++; flush_all_leaf_buffers(index, TMP_ONLY_CLEAN); index->allocated_memory = 0; } + free(nodes_to_load); + return bsf; } void isax_index_load_node_topk(isax_index *index, isax_node *c_node, ts_type * query, pqueue_bsf *pq_bsf) { isax_node *fbl_node = c_node; - #ifdef CLUSTERED - while (fbl_node->parent != NULL){ +#ifdef CLUSTERED + while (fbl_node->parent != NULL) { fbl_node = fbl_node->parent; } + char* pfilename = malloc(255); - snprintf(pfilename, 255, "%s.%llu",index->settings->raw_filename, fbl_node->mask); + snprintf(pfilename, sizeof(pfilename), "%s.%llu", index->settings->raw_filename, fbl_node->mask); FILE * raw_file = fopen(pfilename, "r"); - #else +#else FILE * raw_file = fopen(index->settings->raw_filename, "r"); - #endif - +#endif + int total_loaded_leaves = index->settings->total_loaded_leaves; // *** Step 1 *** Decide nodes to load - int leaves_to_load = total_loaded_leaves; + int leaves_to_load = total_loaded_leaves; int offset = 0; - isax_node **nodes_to_load = malloc(sizeof(isax_node *) * leaves_to_load); + isax_node **nodes_to_load = (isax_node**)malloc(sizeof(isax_node *) * leaves_to_load); find_siblings(c_node, nodes_to_load, &leaves_to_load, &offset); - + // Current node is already loaded. if (offset == 0) { + fclose(raw_file); return; } - + // *** Step 2 *** Prepare load buffers for all nodes isax_node_record *load_buffer = NULL; int total_records = 0; - int node_id=0; + int node_id = 0; int load_buffer_index = 0; - + for (node_id = 0; node_id < offset; node_id++) { isax_node * node = nodes_to_load[node_id]; - + FILE * partial_file; int file_records = 0; int buffer_records = 0; - - if (node->buffer) - { - buffer_records = node->buffer->partial_buffer_size - + node->buffer->tmp_partial_buffer_size; + + if (node->buffer) { + buffer_records = node->buffer->partial_buffer_size + node->buffer->tmp_partial_buffer_size; total_records += buffer_records; } - - if(node->has_partial_data_file) { - char * partial_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + + if (node->has_partial_data_file) { + char * partial_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(partial_fname, node->filename); strcat(partial_fname, ".part"); COUNT_INPUT_TIME_START partial_file = fopen(partial_fname, "r"); - if(partial_file != NULL) { + + if (partial_file != NULL) { fseek(partial_file, 0L, SEEK_END); size_t file_size = ftell(partial_file); fseek(partial_file, 0L, SEEK_SET); file_records = (int) file_size / (int)index->settings->partial_record_size; total_records += file_records; - } - else { + } else { fprintf(stderr, "[ERROR] LEAF FILE \"%s\" DOES NOT EXIST.\n", partial_fname); system("ls "); } + COUNT_INPUT_TIME_END free(partial_fname); } - - if (load_buffer == NULL) - load_buffer = malloc(sizeof(isax_node_record) * (total_records)); - else - load_buffer = realloc(load_buffer, sizeof(isax_node_record) * - (total_records)); - + + if (load_buffer == NULL) { + load_buffer = (isax_node_record*)malloc(sizeof(isax_node_record) * (total_records)); + } else { + load_buffer = (isax_node_record*)realloc(load_buffer, sizeof(isax_node_record) * (total_records)); + } + // PARTIAL DATA THAT ARE LOCATED IN BUFFERS if (node->buffer != NULL) { int i; - for (i=0; ibuffer->partial_buffer_size; i++) { + + for (i = 0; i < node->buffer->partial_buffer_size; i++) { // CREATE RECORD AND SET AS NO_TMP // NO MALLOC JUST REFERENCE load_buffer[load_buffer_index].position = node->buffer->partial_position_buffer[i]; load_buffer[load_buffer_index].sax = node->buffer->partial_sax_buffer[i]; - load_buffer[load_buffer_index].ts = malloc(index->settings->ts_byte_size); - load_buffer[load_buffer_index].insertion_mode = FULL | NO_TMP; + load_buffer[load_buffer_index].ts = (ts_type*)malloc(index->settings->ts_byte_size); + load_buffer[load_buffer_index].insertion_mode = FULL_OR_NO_TMP; load_buffer[load_buffer_index].destination = node; load_buffer_index++; } + node->buffer->partial_buffer_size = 0; - - for (i=0; ibuffer->tmp_partial_buffer_size; i++) { + + for (i = 0; i < node->buffer->tmp_partial_buffer_size; i++) { // CREATE RECORD AND SET AS TMP // NO MALLOC JUST REFERENCE load_buffer[load_buffer_index].position = node->buffer->tmp_partial_position_buffer[i]; load_buffer[load_buffer_index].sax = node->buffer->tmp_partial_sax_buffer[i]; - load_buffer[load_buffer_index].ts = malloc(index->settings->ts_byte_size); - load_buffer[load_buffer_index].insertion_mode = FULL | TMP; + load_buffer[load_buffer_index].ts = (ts_type*)malloc(index->settings->ts_byte_size); + load_buffer[load_buffer_index].insertion_mode = TMP_OR_FULL; load_buffer[load_buffer_index].destination = node; load_buffer_index++; } + node->buffer->tmp_partial_buffer_size = 0; // Count memory that was allocated here - index->allocated_memory += index->settings->ts_byte_size * (node->buffer->tmp_partial_buffer_size + - node->buffer->partial_buffer_size); + index->allocated_memory += index->settings->ts_byte_size * + (node->buffer->tmp_partial_buffer_size + node->buffer->partial_buffer_size); } - + // PARTIAL DATA THAT ARE IN FILE ON DISK if (file_records > 0) { - int i; - for (i=0; isettings->position_byte_size); - load_buffer[load_buffer_index].sax = malloc(index->settings->sax_byte_size); - load_buffer[load_buffer_index].ts = malloc(index->settings->ts_byte_size); - load_buffer[load_buffer_index].insertion_mode = FULL | TMP; + load_buffer[load_buffer_index].position = (file_position_type*)malloc(index->settings->position_byte_size); + load_buffer[load_buffer_index].sax = (sax_type*)malloc(index->settings->sax_byte_size); + load_buffer[load_buffer_index].ts = (ts_type*)malloc(index->settings->ts_byte_size); + load_buffer[load_buffer_index].insertion_mode = TMP_OR_FULL; load_buffer[load_buffer_index].destination = node; COUNT_INPUT_TIME_START fread(load_buffer[load_buffer_index].position, sizeof(file_position_type), 1, partial_file); @@ -1410,229 +1298,113 @@ void isax_index_load_node_topk(isax_index *index, isax_node *c_node, ts_type * q load_buffer_index++; } - // Count memory that was allocated here index->allocated_memory += (file_records * index->settings->full_record_size); - + // Remove memory that is deallocated from disk index->memory_info.disk_data_partial -= ceil((float)(file_records * index->settings->partial_record_size) / (float) PAGE_SIZE); - + COUNT_INPUT_TIME_START fclose(partial_file); COUNT_INPUT_TIME_END } - #ifdef BENCHMARK +#ifdef BENCHMARK if (total_records > 0) { COUNT_LOADED_NODE() } - #endif - +#endif + load_buffer_index = total_records; } - - + // *** Step 3 *** Sort array of data to load - qsort(load_buffer,total_records,sizeof(isax_node_record), comp); - - + qsort(load_buffer, total_records, sizeof(isax_node_record), comp); + // *** Step 4 *** Read node data from raw file and store in tree - //float bsf = FLT_MAX; - int i; - for (i=0; iloaded_records++; - - //printf("LOADING POSITION: %d\n", *load_buffer[i].position); + COUNT_INPUT_TIME_START fseek(raw_file, *load_buffer[i].position, SEEK_SET); fread(load_buffer[i].ts, sizeof(ts_type), index->settings->timeseries_size, raw_file); COUNT_INPUT_TIME_END - - if(query != NULL) - { + if (query != NULL) { // Also calculate distance - float dist = ts_euclidean_distance(query, load_buffer[i].ts, - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1]); + float dist = ts_euclidean_distance(query, load_buffer[i].ts, + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1]); + if (dist <= pq_bsf->knn[pq_bsf->k-1]) { - pqueue_bsf_insert(pq_bsf,dist,0,NULL); - #ifdef STORE_ANSWER + pqueue_bsf_insert(pq_bsf, dist, 0, NULL); +#ifdef STORE_ANSWER ts_type *ts = load_buffer[i].ts; memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); - #endif +#endif } - } - - //printf("Distance: %lf\n", dist); - - add_to_node_buffer(((isax_node *)load_buffer[i].destination)->buffer, - &load_buffer[i], - index->settings->paa_segments, - index->settings->timeseries_size); + + add_to_node_buffer(((isax_node *)load_buffer[i].destination)->buffer, + &load_buffer[i], index->settings->paa_segments, index->settings->timeseries_size); } + free(load_buffer); COUNT_INPUT_TIME_START fclose(raw_file); COUNT_INPUT_TIME_END - + // Set nodes as loaded. for (node_id = 0; node_id < offset; node_id++) { nodes_to_load[node_id]->has_partial_data_file = 0; } - - if (index->allocated_memory > index->settings->max_total_full_buffer_size) - { + + if (index->allocated_memory > index->settings->max_total_full_buffer_size) { FLUSHES++; flush_all_leaf_buffers(index, TMP_ONLY_CLEAN); index->allocated_memory = 0; } + free(nodes_to_load); } -float calculate_minimum_distance (isax_index *index, isax_node *node, ts_type *raw_query, ts_type *query) -{ - //printf("Calculating minimum distance...\n"); - float bsfLeaf = minidist_paa_to_isax(query, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - float bsfRecord = FLT_MAX; - //printf("---> Distance: %lf\n", bsfLeaf); - //sax_print(node->isax_values, 1, index->settings->sax_bit_cardinality); - - if(!index->has_wedges) { - // printf("--------------\n"); - int i = 0; - if(node->has_partial_data_file) { - char * partial_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); - strcpy(partial_fname, node->filename); - strcat(partial_fname, ".part"); - COUNT_INPUT_TIME_START - FILE * partial_file = fopen(partial_fname, "r"); - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - file_position_type *pos = malloc(sizeof(file_position_type)); - while(!feof(partial_file)) { - if(fread(pos, sizeof(file_position_type), 1, partial_file)) { - if(fread(sax, sizeof(sax_type), index->settings->paa_segments, partial_file)) { - float mindist = minidist_paa_to_isax_raw(query, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - // printf("+[FILE] %lf\n", mindist); - - if(mindist < bsfRecord) { - bsfRecord = mindist; - } - } - } - } - fclose(partial_file); - COUNT_INPUT_TIME_END - free(sax); - free(pos); - free(partial_fname); - } - - if (node->buffer != NULL) { - for (i=0; ibuffer->partial_buffer_size; i++) { - float mindist = minidist_paa_to_isax_raw(query, node->buffer->partial_sax_buffer[i], index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - // printf("+[PARTIAL] %lf\n", mindist); - if(mindist < bsfRecord) { - bsfRecord = mindist; - } - } - - for (i=0; ibuffer->tmp_partial_buffer_size; i++) { - float mindist = minidist_paa_to_isax_raw(query, node->buffer->tmp_partial_sax_buffer[i], index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - // printf("+[TMP_PARTIAL] %lf\n", mindist); - if(mindist < bsfRecord) { - bsfRecord = mindist; - } - } - } - } - else { - int i=0; - if(node->wedges[0] == FLT_MIN) { - bsfRecord = FLT_MAX; - } - else { - bsfRecord = 0; - ts_type *min_wedge = &node->wedges[0]; - ts_type *max_wedge = &node->wedges[index->settings->timeseries_size]; - if(raw_query[i] > max_wedge[i]) { - bsfRecord += (raw_query[i] - max_wedge[i]) * (raw_query[i] - max_wedge[i]); - } - else if(raw_query[i] < max_wedge[i] && raw_query[i] > min_wedge[i]) { - //bound += 0; - } - else { - bsfRecord += (min_wedge[i] - raw_query[i]) * (min_wedge[i] - raw_query[i]); - } - //bsfRecord = sqrtf(bsfRecord); - } - - } - float bsf = (bsfRecord == FLT_MAX) ? bsfLeaf : bsfRecord; - // printf("\t%.2lf - %d [%d] : %s.%s\n",bsfRecord, node->leaf_size, node->is_leaf, node->filename, node->has_full_data_file ? ".full" : ".part"); - - - //printf("---> Final: %lf\n", bsf); - return bsf; -} -float calculate_minimum_distance_SIMD (isax_index *index, isax_node *node, ts_type *raw_query, ts_type *query) -{ - //printf("Calculating minimum distance...\n"); - float bsfLeaf = minidist_paa_to_isax(query, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - float bsfRecord = FLT_MAX; - //printf("---> Distance: %lf\n", bsfLeaf); - //sax_print(node->isax_values, 1, index->settings->sax_bit_cardinality); - - if(!index->has_wedges) { - // printf("--------------\n"); + +float calculate_minimum_distance(isax_index *index, isax_node *node, ts_type *raw_query, ts_type *query) { + float bsfLeaf = minidist_paa_to_isax(query, node->isax_values, + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + float bsfRecord = FLT_MAX; + + if (!index->has_wedges) { int i = 0; - if(node->has_partial_data_file) { - char * partial_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + + if (node->has_partial_data_file) { + char * partial_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(partial_fname, node->filename); strcat(partial_fname, ".part"); COUNT_INPUT_TIME_START FILE * partial_file = fopen(partial_fname, "r"); - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - file_position_type *pos = malloc(sizeof(file_position_type)); - while(!feof(partial_file)) { - if(fread(pos, sizeof(file_position_type), 1, partial_file)) { - if(fread(sax, sizeof(sax_type), index->settings->paa_segments, partial_file)) { - float mindist = minidist_paa_to_isax_raw_SIMD(query, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - // printf("+[FILE] %lf\n", mindist); - - if(mindist < bsfRecord) { + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + + while (!feof(partial_file)) { + if (fread(pos, sizeof(file_position_type), 1, partial_file)) { + if (fread(sax, sizeof(sax_type), index->settings->paa_segments, partial_file)) { + float mindist = minidist_paa_to_isax_raw(query, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); + + if (mindist < bsfRecord) { bsfRecord = mindist; } } } } + fclose(partial_file); COUNT_INPUT_TIME_END free(sax); @@ -1641,134 +1413,247 @@ float calculate_minimum_distance_SIMD (isax_index *index, isax_node *node, ts_ty } if (node->buffer != NULL) { - for (i=0; ibuffer->partial_buffer_size; i++) { - float mindist = minidist_paa_to_isax_raw_SIMD(query, node->buffer->partial_sax_buffer[i], index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - // printf("+[PARTIAL] %lf\n", mindist); - if(mindist < bsfRecord) { + for (i = 0; i < node->buffer->partial_buffer_size; i++) { + float mindist = minidist_paa_to_isax_raw(query, node->buffer->partial_sax_buffer[i], index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); + + if (mindist < bsfRecord) { bsfRecord = mindist; } } - for (i=0; ibuffer->tmp_partial_buffer_size; i++) { - float mindist = minidist_paa_to_isax_raw_SIMD(query, node->buffer->tmp_partial_sax_buffer[i], index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - // printf("+[TMP_PARTIAL] %lf\n", mindist); - if(mindist < bsfRecord) { + for (i = 0; i < node->buffer->tmp_partial_buffer_size; i++) { + float mindist = minidist_paa_to_isax_raw(query, node->buffer->tmp_partial_sax_buffer[i], index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); + + if (mindist < bsfRecord) { bsfRecord = mindist; } } } - } - else { - int i=0; - if(node->wedges[0] == FLT_MIN) { + } else { + int i = 0; + + if (node->wedges[0] == FLT_MIN) { bsfRecord = FLT_MAX; - } - else { + } else { bsfRecord = 0; ts_type *min_wedge = &node->wedges[0]; ts_type *max_wedge = &node->wedges[index->settings->timeseries_size]; - if(raw_query[i] > max_wedge[i]) { + + if (raw_query[i] > max_wedge[i]) { bsfRecord += (raw_query[i] - max_wedge[i]) * (raw_query[i] - max_wedge[i]); - } - else if(raw_query[i] < max_wedge[i] && raw_query[i] > min_wedge[i]) { - //bound += 0; - } - else { + } else if (raw_query[i] < max_wedge[i] && raw_query[i] > min_wedge[i]) { + // bound += 0; + } else { bsfRecord += (min_wedge[i] - raw_query[i]) * (min_wedge[i] - raw_query[i]); } - //bsfRecord = sqrtf(bsfRecord); } - } + float bsf = (bsfRecord == FLT_MAX) ? bsfLeaf : bsfRecord; - // printf("\t%.2lf - %d [%d] : %s.%s\n",bsfRecord, node->leaf_size, node->is_leaf, node->filename, node->has_full_data_file ? ".full" : ".part"); - - //printf("---> Final: %lf\n", bsf); return bsf; } -float calculate_node_distance (isax_index *index, isax_node *node, ts_type *query, float bsf) -{ - COUNT_CHECKED_NODE() - // If node has buffered data - if (node->buffer != NULL) - { - int i; +float calculate_minimum_distance_SIMD(isax_index *index, isax_node *node, ts_type *raw_query, ts_type *query) { + float bsfLeaf = minidist_paa_to_isax(query, node->isax_values, + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + float bsfRecord = FLT_MAX; + + if (!index->has_wedges) { + int i = 0; - for (i=0; ibuffer->full_buffer_size; i++) { - float dist = ts_euclidean_distance(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, bsf); - if (dist < bsf) { - bsf = dist; - #ifdef STORE_ANSWER - ts_type *ts = node->buffer->full_ts_buffer[i]; - memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); - #endif + if (node->has_partial_data_file) { + char * partial_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); + strcpy(partial_fname, node->filename); + strcat(partial_fname, ".part"); + COUNT_INPUT_TIME_START + FILE * partial_file = fopen(partial_fname, "r"); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + + while (!feof(partial_file)) { + if (fread(pos, sizeof(file_position_type), 1, partial_file)) { + if (fread(sax, sizeof(sax_type), index->settings->paa_segments, partial_file)) { + float mindist = +#if defined(__x86_64__) + minidist_paa_to_isax_raw_SIMD(query, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + minidist_paa_to_isax_raw(query, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + + if (mindist < bsfRecord) { + bsfRecord = mindist; + } + } + } } + + fclose(partial_file); + COUNT_INPUT_TIME_END + free(sax); + free(pos); + free(partial_fname); } - for (i=0; ibuffer->tmp_full_buffer_size; i++) { - float dist = ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, bsf); - if (dist < bsf) { - bsf = dist; - #ifdef STORE_ANSWER - ts_type *ts = node->buffer->tmp_full_ts_buffer[i]; - memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); - #endif + + if (node->buffer != NULL) { + for (i = 0; i < node->buffer->partial_buffer_size; i++) { + float mindist = +#if defined(__x86_64) + minidist_paa_to_isax_raw_SIMD(query, node->buffer->partial_sax_buffer[i], index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + minidist_paa_to_isax_raw(query, node->buffer->partial_sax_buffer[i], index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + + if (mindist < bsfRecord) { + bsfRecord = mindist; + } + } + + for (i = 0; i < node->buffer->tmp_partial_buffer_size; i++) { + float mindist = +#if defined(__x86_64__) + minidist_paa_to_isax_raw_SIMD(query, node->buffer->tmp_partial_sax_buffer[i], index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + minidist_paa_to_isax_raw(query, node->buffer->tmp_partial_sax_buffer[i], index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + + if (mindist < bsfRecord) { + bsfRecord = mindist; + } } } + } else { + int i = 0; + + if (node->wedges[0] == FLT_MIN) { + bsfRecord = FLT_MAX; + } else { + bsfRecord = 0; + ts_type *min_wedge = &node->wedges[0]; + ts_type *max_wedge = &node->wedges[index->settings->timeseries_size]; + if (raw_query[i] > max_wedge[i]) { + bsfRecord += (raw_query[i] - max_wedge[i]) * (raw_query[i] - max_wedge[i]); + } else if (raw_query[i] < max_wedge[i] && raw_query[i] > min_wedge[i]) { + // bound += 0; + } else { + bsfRecord += (min_wedge[i] - raw_query[i]) * (min_wedge[i] - raw_query[i]); + } + } } - - if (node->has_full_data_file) - { - char * full_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + + float bsf = (bsfRecord == FLT_MAX) ? bsfLeaf : bsfRecord; + + return bsf; +} + +float calculate_node_distance(isax_index *index, isax_node *node, ts_type *query, float bsf) { + COUNT_CHECKED_NODE() + + // If node has buffered data + if (node->buffer != NULL) { + int i; + + for (i = 0; i < node->buffer->full_buffer_size; i++) { + float dist = ts_euclidean_distance(query, node->buffer->full_ts_buffer[i], + index->settings->timeseries_size, bsf); + + if (dist < bsf) { + bsf = dist; +#ifdef STORE_ANSWER + ts_type *ts = node->buffer->full_ts_buffer[i]; + memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); +#endif + } + } + + for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { + float dist = ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], + index->settings->timeseries_size, bsf); + + if (dist < bsf) { + bsf = dist; +#ifdef STORE_ANSWER + ts_type *ts = node->buffer->tmp_full_ts_buffer[i]; + memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); +#endif + } + } + } + + if (node->has_full_data_file) { + char * full_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(full_fname, node->filename); strcat(full_fname, ".full"); COUNT_INPUT_TIME_START FILE * full_file = fopen(full_fname, "r"); COUNT_INPUT_TIME_END - - if(full_file != NULL) { + + if (full_file != NULL) { COUNT_INPUT_TIME_START fseek(full_file, 0L, SEEK_END); size_t file_size = ftell(full_file); fseek(full_file, 0L, SEEK_SET); COUNT_INPUT_TIME_END int file_records = (int) file_size / (int)index->settings->full_record_size; - ts_type *ts = malloc(index->settings->ts_byte_size); - while (file_records > 0) { + ts_type *ts = (ts_type*)malloc(index->settings->ts_byte_size); + while (file_records > 0) { COUNT_INPUT_TIME_START fseek(full_file, sizeof(file_position_type), SEEK_CUR); fseek(full_file, index->settings->sax_byte_size, SEEK_CUR); fread(ts, sizeof(ts_type), index->settings->timeseries_size, full_file); COUNT_INPUT_TIME_END - float dist = ts_euclidean_distance(query, ts, - index->settings->timeseries_size, bsf); - //if(conter_ts<30) - //{printf(" %f \n", dist); - //conter_ts++; - //} + float dist = ts_euclidean_distance(query, ts, index->settings->timeseries_size, bsf); + if (dist < bsf) { bsf = dist; - #ifdef STORE_ANSWER +#ifdef STORE_ANSWER memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); - #endif +#endif } + file_records--; - } - + } + free(ts); } @@ -1777,70 +1662,68 @@ float calculate_node_distance (isax_index *index, isax_node *node, ts_type *quer COUNT_INPUT_TIME_END free(full_fname); } - //////// ADAPTIVE //////////////////// - - if (node->is_leaf && (node->has_partial_data_file || - node->buffer->partial_buffer_size > 0 || - node->buffer->tmp_partial_buffer_size > 0 - )) { - - float partial_bsf = isax_index_load_node(index, node, query, bsf); - - if (partial_bsf < bsf) + + if (node->is_leaf && (node->has_partial_data_file || + node->buffer->partial_buffer_size > 0 || + node->buffer->tmp_partial_buffer_size > 0)) { + float partial_bsf = isax_index_load_node(index, node, query, bsf); + + if (partial_bsf < bsf) { bsf = partial_bsf; + } } - + ////////////////////////////////////// - + return bsf; } -void calculate_node_topk (isax_index *index, isax_node *node, ts_type *query, pqueue_bsf *pq_bsf) -{ + +void calculate_node_topk(isax_index *index, isax_node *node, ts_type *query, pqueue_bsf *pq_bsf) { COUNT_CHECKED_NODE() // If node has buffered data - if (node->buffer != NULL) - { + if (node->buffer != NULL) { int i; - for (i=0; ibuffer->full_buffer_size; i++) { - float dist = ts_euclidean_distance(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1]); + for (i = 0; i < node->buffer->full_buffer_size; i++) { + float dist = ts_euclidean_distance(query, node->buffer->full_ts_buffer[i], + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1]); + if (dist <= pq_bsf->knn[pq_bsf->k-1]) { - pqueue_bsf_insert(pq_bsf,dist,0,node); + pqueue_bsf_insert(pq_bsf, dist, 0, node); } } - for (i=0; ibuffer->tmp_full_buffer_size; i++) { - float dist = ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1]); + + for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { + float dist = ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1]); + if (dist <= pq_bsf->knn[pq_bsf->k-1]) { - pqueue_bsf_insert(pq_bsf,dist,0,node); + pqueue_bsf_insert(pq_bsf, dist, 0, node); } } - } - - if (node->has_full_data_file) - { - char * full_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + + if (node->has_full_data_file) { + char * full_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(full_fname, node->filename); strcat(full_fname, ".full"); COUNT_INPUT_TIME_START FILE * full_file = fopen(full_fname, "r"); COUNT_INPUT_TIME_END - - if(full_file != NULL) { + + if (full_file != NULL) { COUNT_INPUT_TIME_START fseek(full_file, 0L, SEEK_END); size_t file_size = ftell(full_file); fseek(full_file, 0L, SEEK_SET); COUNT_INPUT_TIME_END int file_records = (int) file_size / (int)index->settings->full_record_size; - ts_type *ts = malloc(index->settings->ts_byte_size); - while (file_records > 0) { + ts_type *ts = (ts_type*)malloc(index->settings->ts_byte_size); + while (file_records > 0) { COUNT_INPUT_TIME_START fseek(full_file, sizeof(file_position_type), SEEK_CUR); fseek(full_file, index->settings->sax_byte_size, SEEK_CUR); @@ -1848,17 +1731,15 @@ void calculate_node_topk (isax_index *index, isax_node *node, ts_type *query, pq COUNT_INPUT_TIME_END float dist = ts_euclidean_distance(query, ts, - index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1]); - //if(conter_ts<30) - //{printf(" %f \n", dist); - //conter_ts++; - //} - if (dist < pq_bsf->knn[pq_bsf->k-1]) { - pqueue_bsf_insert(pq_bsf,dist,0,NULL); - } + index->settings->timeseries_size, pq_bsf->knn[pq_bsf->k-1]); + + if (dist < pq_bsf->knn[pq_bsf->k-1]) { + pqueue_bsf_insert(pq_bsf, dist, 0, NULL); + } + file_records--; - } - + } + free(ts); } @@ -1867,106 +1748,107 @@ void calculate_node_topk (isax_index *index, isax_node *node, ts_type *query, pq COUNT_INPUT_TIME_END free(full_fname); } - //////// ADAPTIVE //////////////////// - - if (node->is_leaf && (node->has_partial_data_file || - node->buffer->partial_buffer_size > 0 || - node->buffer->tmp_partial_buffer_size > 0 - )) { + + if (node->is_leaf && (node->has_partial_data_file || + node->buffer->partial_buffer_size > 0 || + node->buffer->tmp_partial_buffer_size > 0)) { isax_index_load_node_topk(index, node, query, pq_bsf); - } - ////////////////////////////////////// } -float calculate_node_distance_SIMD (isax_index *index, isax_node *node, ts_type *query, float bsf) -{ + +float calculate_node_distance_SIMD(isax_index *index, isax_node *node, ts_type *query, float bsf) { COUNT_CHECKED_NODE() - - // If node has buffered data - if (node->buffer != NULL) - { + // If node has buffered data + if (node->buffer != NULL) { int i; - for (i=0; ibuffer->full_buffer_size; i++) { - float dist = ts_euclidean_distance_SIMD(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, bsf); + for (i = 0; i < node->buffer->full_buffer_size; i++) { + float dist = +#if defined(__x86_64) + ts_euclidean_distance_SIMD(query, node->buffer->full_ts_buffer[i], + index->settings->timeseries_size, bsf); +#else + ts_euclidean_distance(query, node->buffer->full_ts_buffer[i], + index->settings->timeseries_size, bsf); +#endif + if (dist < bsf) { bsf = dist; - #ifdef STORE_ANSWER +#ifdef STORE_ANSWER ts_type *ts = node->buffer->full_ts_buffer[i]; memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); - #endif +#endif } } - for (i=0; ibuffer->tmp_full_buffer_size; i++) { - float dist = ts_euclidean_distance_SIMD(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, bsf); + + for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { + float dist = +#if defined(__x86_64__) + ts_euclidean_distance_SIMD(query, node->buffer->tmp_full_ts_buffer[i], + index->settings->timeseries_size, bsf); +#else + ts_euclidean_distance(query, node->buffer->tmp_full_ts_buffer[i], + index->settings->timeseries_size, bsf); +#endif + if (dist < bsf) { bsf = dist; - #ifdef STORE_ANSWER +#ifdef STORE_ANSWER ts_type *ts = node->buffer->tmp_full_ts_buffer[i]; memcpy(index->answer, ts, index->settings->timeseries_size * sizeof(ts_type)); - #endif +#endif } } } - - if (node->has_full_data_file) - { - char * full_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + + if (node->has_full_data_file) { + char * full_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(full_fname, node->filename); strcat(full_fname, ".full"); COUNT_INPUT_TIME_START FILE * full_file = fopen(full_fname, "r"); COUNT_INPUT_TIME_END - - if(full_file != NULL) { + + if (full_file != NULL) { COUNT_INPUT_TIME_START fseek(full_file, 0L, SEEK_END); size_t file_size = ftell(full_file); fseek(full_file, 0L, SEEK_SET); COUNT_INPUT_TIME_END int file_records = (int) file_size / (int)index->settings->full_record_size; - int i=0; + int i = 0; ts_type *tsp; - void *ts_buffer = malloc(file_size); - //fseek(full_file, sizeof(file_position_type), SEEK_CUR); - //fseek(full_file, index->settings->sax_byte_size, SEEK_CUR); - COUNT_INPUT_TIME_START + size_t *ts_buffer = (size_t*)malloc(file_size); + COUNT_INPUT_TIME_START - fread(ts_buffer, file_size,1, full_file); - COUNT_INPUT_TIME_END + fread(ts_buffer, file_size, 1 , full_file); + COUNT_INPUT_TIME_END - //printf("wefwaeweaaef is%ld\n",index->settings->full_record_size ); while (file_records > 0) { - COUNT_INPUT_TIME_START - //fseek(full_file, sizeof(file_position_type), SEEK_CUR); - //fseek(full_file, index->settings->sax_byte_size, SEEK_CUR); - //fread(ts, sizeof(ts_type), index->settings->timeseries_size, full_file); COUNT_INPUT_TIME_END - tsp=ts_buffer+i*index->settings->full_record_size+sizeof(file_position_type)+index->settings->sax_byte_size; - float dist = ts_euclidean_distance_SIMD(query, tsp, - index->settings->timeseries_size, bsf); - //if(conter_ts<30) - //{printf(" %f \n", dist); - //conter_ts++; - //} + tsp = (ts_type*)(ts_buffer + i * index->settings->full_record_size + sizeof(file_position_type) + index->settings->sax_byte_size); +#if defined(__x86_64__) + float dist = ts_euclidean_distance_SIMD(query, tsp, index->settings->timeseries_size, bsf); +#else + float dist = ts_euclidean_distance(query, tsp, index->settings->timeseries_size, bsf); +#endif + if (dist < bsf) { bsf = dist; - #ifdef STORE_ANSWER - //memcpy(index->answer, &(ts_buffer[i]), index->settings->timeseries_size * sizeof(ts_type)); - #endif +#ifdef STORE_ANSWER + // memcpy(index->answer, &(ts_buffer[i]), index->settings->timeseries_size * sizeof(ts_type)); +#endif } + file_records--; i++; - } - - //free(ts); + } + free(ts_buffer); } @@ -1975,400 +1857,439 @@ float calculate_node_distance_SIMD (isax_index *index, isax_node *node, ts_type COUNT_INPUT_TIME_END free(full_fname); } - //////// ADAPTIVE //////////////////// - - if (node->is_leaf && (node->has_partial_data_file || - node->buffer->partial_buffer_size > 0 || - node->buffer->tmp_partial_buffer_size > 0 - )) { - //printf("check point 1!!!!!\n"); + + if (node->is_leaf && (node->has_partial_data_file || + node->buffer->partial_buffer_size > 0 || + node->buffer->tmp_partial_buffer_size > 0)) { float partial_bsf = isax_index_load_node(index, node, query, bsf); - - if (partial_bsf < bsf) + + if (partial_bsf < bsf) { bsf = partial_bsf; + } } - + ////////////////////////////////////// - + return bsf; } + void load_random_leaf(isax_index *index) { isax_node *rnode = index->first_node; - + while (rnode->next != NULL) { rnode = rnode->next; isax_node *curr = rnode; + while (!curr->is_leaf) { curr = curr->left_child; } + isax_index_load_node(index, curr, NULL, FLT_MAX); } } -void complete_index_leafs(isax_index *index) -{ +void complete_index_leafs(isax_index *index) { isax_node *subtree_root = index->first_node; + while (subtree_root != NULL) { complete_subtree_leafs(index, subtree_root); subtree_root = subtree_root->next; } - // TODO: CHECK THAT THIS IS NEEDED! + + // TODO(someone): CHECK THAT THIS IS NEEDED! FLUSHES++; flush_all_leaf_buffers(index, TMP_ONLY_CLEAN); index->allocated_memory = 0; } -void complete_subtree_leafs(isax_index *index, isax_node *node) -{ - if(node->is_leaf) - { +void complete_subtree_leafs(isax_index *index, isax_node *node) { + if (node->is_leaf) { isax_index_load_node(index, node, NULL, FLT_MAX); - } - else - { + } else { complete_subtree_leafs(index, node->left_child); complete_subtree_leafs(index, node->right_child); } } -void complete_index(isax_index *index, int ts_num) -{ - +void complete_index(isax_index *index, int ts_num) { FILE * ifile; - + COUNT_INPUT_TIME_START - ifile = fopen (index->settings->raw_filename,"rb"); + ifile = fopen(index->settings->raw_filename, "rb"); COUNT_INPUT_TIME_END - + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", index->settings->raw_filename); + exit(-1); } - + fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); - file_position_type total_records = sz/index->settings->ts_byte_size; + file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < ts_num) { - fprintf(stderr, "File %s has only %llu records!\n", - index->settings->raw_filename, total_records); + fprintf(stderr, "File %s has only %llu records!\n", index->settings->raw_filename, total_records); + exit(-1); } - - - int ts_loaded = 0; - isax_node_record *record = malloc(sizeof(isax_node_record)); - - while (ts_loadedsettings->timeseries_size); - sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); - -#ifndef DEBUG + + int ts_loaded = 0; + isax_node_record *record = (isax_node_record*)malloc(sizeof(isax_node_record)); + + while (ts_loaded < ts_num) { + ts_type * ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + sax_type * sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); +#ifndef DEBUG #if VERBOSE_LEVEL == 2 - printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m",(ts_loaded + 1)); + printf("\r\x1b[32mLoading: \x1b[36m%d\x1b[0m", (ts_loaded + 1)); #endif #endif COUNT_INPUT_TIME_START fread(ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END - - if(sax_from_ts(ts, sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) - { + if (sax_from_ts(ts, sax, index->settings->ts_values_per_paa_segment, + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { root_mask_type first_bit_mask = 0x00; - + CREATE_MASK(first_bit_mask, index, sax); record->sax = sax; - record->position = malloc(sizeof(file_position_type)); + record->position = (file_position_type*)malloc(sizeof(file_position_type)); record->ts = ts; *(record->position) = ts_loaded * index->settings->ts_byte_size; - record->insertion_mode = FULL | TMP; + record->insertion_mode = TMP_OR_FULL; + if (index->fbl->soft_buffers[first_bit_mask].initialized == 0) { index->fbl->soft_buffers[first_bit_mask].initialized = 1; - index->fbl->soft_buffers[first_bit_mask].node = isax_root_node_init(first_bit_mask, - index->settings->initial_leaf_buffer_size); + index->fbl->soft_buffers[first_bit_mask].node = isax_root_node_init(first_bit_mask, + index->settings->initial_leaf_buffer_size); index->root_nodes++; index->fbl->soft_buffers[first_bit_mask].node->is_leaf = 1; - - if(index->first_node == NULL) - { + + if (index->first_node == NULL) { index->first_node = index->fbl->soft_buffers[first_bit_mask].node; index->fbl->soft_buffers[first_bit_mask].node->next = NULL; index->fbl->soft_buffers[first_bit_mask].node->previous = NULL; - } - else - { + } else { isax_node * prev_first = index->first_node; index->first_node = index->fbl->soft_buffers[first_bit_mask].node; index->first_node->next = prev_first; prev_first->previous = index->fbl->soft_buffers[first_bit_mask].node; } - } + isax_node * dest = add_record_to_node(index, index->fbl->soft_buffers[first_bit_mask].node, record, 0); - + // Define leaf as loaded. - if(!dest->has_full_data_file) - { + if (!dest->has_full_data_file) { dest->has_full_data_file = 1; dest->has_partial_data_file = 0; } + ts_loaded++; - } - else - { + } else { fprintf(stderr, "error: SAX representation failed to be created."); } + COUNT_INPUT_TIME_START - - if (ts_loaded % index->settings->max_total_full_buffer_size == 0) - { + if (ts_loaded % index->settings->max_total_full_buffer_size == 0) { FLUSHES++; flush_all_leaf_buffers(index, TMP_ONLY_CLEAN); } - } + free(record); FLUSHES++; - - // TODO: CHECK THAT THIS IS NEEDED! + + // TODO(someone): CHECK THAT THIS IS NEEDED! flush_all_leaf_buffers(index, TMP_ONLY_CLEAN); COUNT_INPUT_TIME_START fclose(ifile); COUNT_INPUT_TIME_END - } void cache_sax_file(isax_index *index) { COUNT_OUTPUT_TIME_START - fflush(index->sax_file); - COUNT_OUTPUT_TIME_END - fseek(index->sax_file, 0L, SEEK_END); - unsigned long size = ftell(index->sax_file); - fseek(index->sax_file, 0L, SEEK_SET); - index->sax_cache = malloc(size); - index->sax_cache_size = size / index->settings->sax_byte_size; - COUNT_INPUT_TIME_START - fread(index->sax_cache, index->settings->sax_byte_size, index->sax_cache_size, index->sax_file); - COUNT_INPUT_TIME_END + fflush(index->sax_file); + COUNT_OUTPUT_TIME_END + fseek(index->sax_file, 0L, SEEK_END); + uint32_t size = ftell(index->sax_file); + fseek(index->sax_file, 0L, SEEK_SET); + index->sax_cache = (sax_type*)malloc(size); + index->sax_cache_size = size / index->settings->sax_byte_size; + COUNT_INPUT_TIME_START + fread(index->sax_cache, index->settings->sax_byte_size, index->sax_cache_size, index->sax_file); + COUNT_INPUT_TIME_END index->memory_info.mem_summaries = index->sax_cache_size; } void node_write(isax_index *index, isax_node *node, FILE *file) { - fwrite(&(node->is_leaf), sizeof(unsigned char), 1, file); - fwrite(&(node->mask), sizeof(root_mask_type), 1, file); - - if(node->is_leaf) { - if(node->filename != NULL) { - int filename_size = strlen(node->filename); - fwrite(&filename_size, sizeof(int), 1, file); - fwrite(node->filename, sizeof(char), filename_size, file); - fwrite(&(node->leaf_size), sizeof(int), 1, file); - fwrite(&(node->has_full_data_file), sizeof(char), 1, file); - fwrite(&(node->has_partial_data_file), sizeof(char), 1, file); - } - else { - int filename_size = 0; - fwrite(&filename_size, sizeof(int), 1, file); - } - } - else { - fwrite(&(node->split_data->splitpoint), sizeof(int), 1, file); - fwrite(node->split_data->split_mask, sizeof(sax_type), index->settings->paa_segments, file); - } - - if(node->isax_cardinalities != NULL) { - char has_isax_data = 1; - fwrite(&has_isax_data, sizeof(char), 1, file); - fwrite(node->isax_cardinalities, sizeof(sax_type), index->settings->paa_segments, file); - fwrite(node->isax_values, sizeof(sax_type), index->settings->paa_segments, file); - } - else { - char has_isax_data = 0; - fwrite(&has_isax_data, sizeof(char), 1, file); - } - - if(!node->is_leaf) { - node_write(index, node->left_child, file); - node_write(index, node->right_child, file); - } + fwrite(&(node->is_leaf), sizeof(unsigned char), 1, file); + fwrite(&(node->mask), sizeof(root_mask_type), 1, file); + + if (node->is_leaf) { + if (node->filename != NULL) { + int filename_size = strlen(node->filename); + fwrite(&filename_size, sizeof(int), 1, file); + fwrite(node->filename, sizeof(char), filename_size, file); + fwrite(&(node->leaf_size), sizeof(int), 1, file); + fwrite(&(node->has_full_data_file), sizeof(char), 1, file); + fwrite(&(node->has_partial_data_file), sizeof(char), 1, file); + } else { + int filename_size = 0; + fwrite(&filename_size, sizeof(int), 1, file); + } + } else { + fwrite(&(node->split_data->splitpoint), sizeof(int), 1, file); + fwrite(node->split_data->split_mask, sizeof(sax_type), index->settings->paa_segments, file); + } + + if (node->isax_cardinalities != NULL) { + char has_isax_data = 1; + fwrite(&has_isax_data, sizeof(char), 1, file); + fwrite(node->isax_cardinalities, sizeof(sax_type), index->settings->paa_segments, file); + fwrite(node->isax_values, sizeof(sax_type), index->settings->paa_segments, file); + } else { + char has_isax_data = 0; + fwrite(&has_isax_data, sizeof(char), 1, file); + } + + if (!node->is_leaf) { + node_write(index, node->left_child, file); + node_write(index, node->right_child, file); + } } isax_node *node_read(isax_index *index, FILE *file) { - isax_node *node; + isax_node *node; - char is_leaf = 0; - fread(&is_leaf, sizeof(unsigned char), 1, file); + char is_leaf = 0; + fread(&is_leaf, sizeof(unsigned char), 1, file); - root_mask_type mask = 0; - fread(&(mask), sizeof(root_mask_type), 1, file); + root_mask_type mask = 0; + fread(&(mask), sizeof(root_mask_type), 1, file); index->memory_info.mem_tree_structure++; - if(is_leaf) { - node = malloc(sizeof(isax_node)); - node->is_leaf = 1; - node->has_partial_data_file = 0; - node->has_full_data_file = 0; - node->right_child = NULL; - node->left_child = NULL; - node->parent = NULL; - node->next = NULL; - node->leaf_size = 0; - node->filename = NULL; - node->isax_values = NULL; - node->isax_cardinalities = NULL; - node->previous = NULL; - node->split_data = NULL; - node->buffer = init_node_buffer(index->settings->initial_leaf_buffer_size); - node->mask = 0; - - int filename_size = 0; - fread(&filename_size, sizeof(int), 1, file); - if(filename_size > 0) { - node->filename = malloc(sizeof(char) * (filename_size + 1)); - fread(node->filename, sizeof(char), filename_size, file); - node->filename[filename_size] = '\0'; - fread(&(node->leaf_size), sizeof(int), 1, file); - fread(&(node->has_full_data_file), sizeof(char), 1, file); - fread(&(node->has_partial_data_file), sizeof(char), 1, file); - COUNT_NEW_NODE(); - - if(node->has_full_data_file) { + if (is_leaf) { + node = (isax_node*)malloc(sizeof(isax_node)); + node->is_leaf = 1; + node->has_partial_data_file = 0; + node->has_full_data_file = 0; + node->right_child = NULL; + node->left_child = NULL; + node->parent = NULL; + node->next = NULL; + node->leaf_size = 0; + node->filename = NULL; + node->isax_values = NULL; + node->isax_cardinalities = NULL; + node->previous = NULL; + node->split_data = NULL; + node->buffer = init_node_buffer(index->settings->initial_leaf_buffer_size); + node->mask = 0; + + int filename_size = 0; + fread(&filename_size, sizeof(int), 1, file); + + if (filename_size > 0) { + node->filename = (char*)malloc(sizeof(char) * (filename_size + 1)); + fread(node->filename, sizeof(char), filename_size, file); + node->filename[filename_size] = '\0'; + fread(&(node->leaf_size), sizeof(int), 1, file); + fread(&(node->has_full_data_file), sizeof(char), 1, file); + fread(&(node->has_partial_data_file), sizeof(char), 1, file); + COUNT_NEW_NODE(); + + if (node->has_full_data_file) { float number_of_bytes = (float) (node->leaf_size * index->settings->full_record_size); int number_of_pages = ceil(number_of_bytes / (float) PAGE_SIZE); index->memory_info.disk_data_full += number_of_pages; - } - else if(node->has_partial_data_file) { + } else if (node->has_partial_data_file) { float number_of_bytes = (float) (node->leaf_size * index->settings->partial_record_size); int number_of_pages = ceil(number_of_bytes / (float) PAGE_SIZE); index->memory_info.disk_data_partial += number_of_pages; } - if(node->has_full_data_file && node->has_partial_data_file) { + + if (node->has_full_data_file && node->has_partial_data_file) { printf("WARNING: (Mem size counting) this leaf has both partial and full data.\n"); } - } - else { - node->filename = NULL; - node->leaf_size = 0; - node->has_full_data_file = 0; - node->has_partial_data_file = 0; - } - } - else { - node = malloc(sizeof(isax_node)); - node->buffer = NULL; - node->is_leaf = 0; - node->filename = NULL; - node->has_full_data_file = 0; - node->has_partial_data_file = 0; - node->leaf_size = 0; - node->split_data = malloc(sizeof(isax_node_split_data)); - node->split_data->split_mask = malloc(sizeof(sax_type) * index->settings->paa_segments); - - fread(&(node->split_data->splitpoint), sizeof(int), 1, file); - fread(node->split_data->split_mask, sizeof(sax_type), index->settings->paa_segments, file); - } - node->mask = mask; - - char has_isax_data = 0; - fread(&has_isax_data, sizeof(char), 1, file); - - if(has_isax_data) { - node->isax_cardinalities = malloc(sizeof(sax_type) * index->settings->paa_segments); - node->isax_values = malloc(sizeof(sax_type) * index->settings->paa_segments); - fread(node->isax_cardinalities, sizeof(sax_type), index->settings->paa_segments, file); - fread(node->isax_values, sizeof(sax_type), index->settings->paa_segments, file); - } - else { - node->isax_cardinalities = NULL; - node->isax_values = NULL; - } - - if(!is_leaf) { - node->left_child = node_read(index, file); - node->right_child = node_read(index, file); - } - - return node; + } else { + node->filename = NULL; + node->leaf_size = 0; + node->has_full_data_file = 0; + node->has_partial_data_file = 0; + } + } else { + node = (isax_node*)malloc(sizeof(isax_node)); + node->buffer = NULL; + node->is_leaf = 0; + node->filename = NULL; + node->has_full_data_file = 0; + node->has_partial_data_file = 0; + node->leaf_size = 0; + node->split_data = (isax_node_split_data*)malloc(sizeof(isax_node_split_data)); + node->split_data->split_mask = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + + fread(&(node->split_data->splitpoint), sizeof(int), 1, file); + fread(node->split_data->split_mask, sizeof(sax_type), index->settings->paa_segments, file); + } + + node->mask = mask; + + char has_isax_data = 0; + fread(&has_isax_data, sizeof(char), 1, file); + + if (has_isax_data) { + node->isax_cardinalities = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + node->isax_values = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + fread(node->isax_cardinalities, sizeof(sax_type), index->settings->paa_segments, file); + fread(node->isax_values, sizeof(sax_type), index->settings->paa_segments, file); + } else { + node->isax_cardinalities = NULL; + node->isax_values = NULL; + } + + if (!is_leaf) { + node->left_child = node_read(index, file); + node->right_child = node_read(index, file); + } + + return node; +} + +void create_dirs(char *filename, isax_index *index) { + struct stat st = { 0 }; + if (stat(filename, &st) == -1) { + char *buffer; + char *fileSep = "/"; + char *consumed = (char*) malloc(sizeof(char) * (strlen(filename) + 1)); + strcpy(consumed, filename); + char *dir_exists = (char*) malloc( + sizeof(char) * (strlen(index->settings->root_directory))); + int stopPos = strrchr(index->settings->root_directory, '/') - index->settings->root_directory; + // first round, precheck + buffer = strtok(consumed, fileSep); + strcpy(dir_exists, fileSep); + strcat(dir_exists, buffer); + // if directory does not exist, create ist + if (stat(dir_exists, &st) == -1) { + mkdir(dir_exists, 0777); + } + // now treat the entire path + while (buffer != NULL) { + buffer = strtok(NULL, "/"); + if (buffer != NULL) { + strcat(dir_exists, fileSep); + strcat(dir_exists, buffer); + // if directory does not exist, create it + if (stat(dir_exists, &st) == -1) { + mkdir(dir_exists, 0777); + } + // if last directory in path reached, exit loop + if (strlen(dir_exists) >= stopPos) { + break; + } + } + } + } } -void index_write(isax_index *index) -{ - fprintf(stderr, ">>> Storing index: %s\n", index->settings->root_directory); - char *filename = malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); - filename = strcpy(filename, index->settings->root_directory); - filename = strcat(filename, "/index.idx"); - FILE *file = fopen(filename, "wb"); - free(filename); - - int raw_filename_size = strlen(index->settings->raw_filename); - int timeseries_size = index->settings->timeseries_size; - int paa_segments = index->settings->paa_segments; - int sax_bit_cardinality = index->settings->sax_bit_cardinality; - int max_leaf_size = index->settings->max_leaf_size; - int min_leaf_size = index->settings->min_leaf_size; - int initial_leaf_buffer_size = index->settings->initial_leaf_buffer_size; - int max_total_buffer_size = index->settings->max_total_buffer_size; - int initial_fbl_buffer_size = index->settings->initial_fbl_buffer_size; - int total_loaded_leaves = index->settings->total_loaded_leaves; - int tight_bound = index->settings->tight_bound; - int aggressive_check = index->settings->aggressive_check; - int new_index = 0; - // SETTINGS DATA - fwrite(&raw_filename_size, sizeof(int), 1, file); - fwrite(index->settings->raw_filename, sizeof(char), raw_filename_size, file); - fwrite(×eries_size, sizeof(int), 1, file); - fwrite(&paa_segments, sizeof(int), 1, file); - fwrite(&sax_bit_cardinality, sizeof(int), 1, file); - fwrite(&max_leaf_size, sizeof(int), 1, file); - fwrite(&min_leaf_size, sizeof(int), 1, file); - fwrite(&initial_leaf_buffer_size, sizeof(int), 1, file); - fwrite(&max_total_buffer_size, sizeof(int), 1, file); - fwrite(&initial_fbl_buffer_size, sizeof(int), 1, file); - fwrite(&total_loaded_leaves, sizeof(int), 1, file); - fwrite(&tight_bound, sizeof(int), 1, file); - fwrite(&aggressive_check, sizeof(int), 1, file); - // FBL DATA AND NODES - int j; - for (j=0; jfbl->number_of_buffers; j++) { - fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; - if (current_fbl_node->initialized && current_fbl_node->node != NULL) { - fwrite(&j, sizeof(int), 1, file); - node_write(index, current_fbl_node->node, file); - } - } - fclose(file); - - char *filename_adpt = malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); +void index_write(isax_index *index) { + fprintf(stderr, ">>> Storing index: %s\n", index->settings->root_directory); + char *filename = (char*)malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); + filename = strcpy(filename, index->settings->root_directory); + filename = strcat(filename, "/index.idx"); + + create_dirs(filename, index); + + FILE *file = fopen(filename, "wb"); + + if (file == NULL) { + printf("error on opening file %s for writing\n", filename); + + exit(-1); + } + + free(filename); + + int raw_filename_size = strlen(index->settings->raw_filename); + int timeseries_size = index->settings->timeseries_size; + int paa_segments = index->settings->paa_segments; + int sax_bit_cardinality = index->settings->sax_bit_cardinality; + int max_leaf_size = index->settings->max_leaf_size; + int min_leaf_size = index->settings->min_leaf_size; + int initial_leaf_buffer_size = index->settings->initial_leaf_buffer_size; + int max_total_buffer_size = index->settings->max_total_buffer_size; + int initial_fbl_buffer_size = index->settings->initial_fbl_buffer_size; + int total_loaded_leaves = index->settings->total_loaded_leaves; + int tight_bound = index->settings->tight_bound; + int aggressive_check = index->settings->aggressive_check; + int new_index = 0; + + // SETTINGS DATA + fwrite(&raw_filename_size, sizeof(int), 1, file); + fwrite(index->settings->raw_filename, sizeof(char), raw_filename_size, file); + fwrite(×eries_size, sizeof(int), 1, file); + fwrite(&paa_segments, sizeof(int), 1, file); + fwrite(&sax_bit_cardinality, sizeof(int), 1, file); + fwrite(&max_leaf_size, sizeof(int), 1, file); + fwrite(&min_leaf_size, sizeof(int), 1, file); + fwrite(&initial_leaf_buffer_size, sizeof(int), 1, file); + fwrite(&max_total_buffer_size, sizeof(int), 1, file); + fwrite(&initial_fbl_buffer_size, sizeof(int), 1, file); + fwrite(&total_loaded_leaves, sizeof(int), 1, file); + fwrite(&tight_bound, sizeof(int), 1, file); + fwrite(&aggressive_check, sizeof(int), 1, file); + + // FBL DATA AND NODES + for (int j = 0; j < index->fbl->number_of_buffers; j++) { + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + + if (current_fbl_node->initialized && current_fbl_node->node != NULL) { + fwrite(&j, sizeof(int), 1, file); + node_write(index, current_fbl_node->node, file); + } + } + + fclose(file); + + char *filename_adpt = (char*)malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); filename_adpt = strcpy(filename_adpt, index->settings->root_directory); filename_adpt = strcat(filename_adpt, "/adaptive"); FILE *file_adpt = fopen(filename_adpt, "wb"); free(filename_adpt); - fwrite(&(index->total_records), sizeof(unsigned long long), 1, file_adpt); - fwrite(&(index->loaded_records), sizeof(unsigned long long), 1, file_adpt); - fclose(file_adpt); - + fwrite(&(index->total_records), sizeof(uint64_t), 1, file_adpt); + fwrite(&(index->loaded_records), sizeof(uint64_t), 1, file_adpt); + fclose(file_adpt); } -void index_mRecBuf_write(isax_index *index) -{ + +void index_mRecBuf_write(isax_index *index) { fprintf(stderr, ">>> Storing index: %s\n", index->settings->root_directory); - char *filename = malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); - + char *filename = (char*)malloc(sizeof(char) * (strlen(index->settings->root_directory) + 11)); + filename = strcpy(filename, index->settings->root_directory); - //filename = strcat(filename, "/index.idx"); filename = strcat(filename, "_index.idx"); - fprintf(stderr, "FILENAME %s", filename); + + create_dirs(filename, index); + fprintf(stderr, "FILENAME %s\n", filename); FILE *file = fopen(filename, "wb"); + + if (file == NULL) { + printf("error on opening file %s for writing\n", filename); + + exit(-1); + } + free(filename); int function_type = index->settings->function_type; @@ -2402,9 +2323,8 @@ void index_mRecBuf_write(isax_index *index) fwrite(&tight_bound, sizeof(int), 1, file); fwrite(&aggressive_check, sizeof(int), 1, file); - //SFA: write additional sampling settings and bins - if(index->settings->function_type==4) - { + // SFA: write additional sampling settings and bins + if (index->settings->function_type == 4) { char is_norm = index->settings->is_norm; int sample_size = index->settings->sample_size; int sample_type = index->settings->sample_type; @@ -2415,408 +2335,378 @@ void index_mRecBuf_write(isax_index *index) fwrite(&sample_type, sizeof(int), 1, file); fwrite(&hist_type, sizeof(int), 1, file); - if(index->settings->coeff_number!=0) - { + if (index->settings->coeff_number != 0) { fwrite(index->coefficients, sizeof(int), index->settings->paa_segments/2, file); } - for(int i=0; isettings->paa_segments; ++i) - { + for (int i = 0; i < index->settings->paa_segments; ++i) { fwrite(index->bins[i], sizeof(float), index->settings->sax_alphabet_cardinality-1, file); - /* - for(int j=0; jsettings->sax_alphabet_cardinality-1; ++j) - { - float binning_value = index->bins[i][j]; - fwrite(&binning_value, sizeof(float), 1, file); - }*/ } } + // FBL DATA AND NODES - int j; - for (j=0; jfbl->number_of_buffers; j++) { + for (int j = 0; j < index->fbl->number_of_buffers; j++) { parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer*)(index->fbl))->soft_buffers[j]; + if (current_fbl_node->initialized && current_fbl_node->node != NULL) { fwrite(&j, sizeof(int), 1, file); node_write(index, current_fbl_node->node, file); } } + fclose(file); - char *filename_adpt = malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); - + char *filename_adpt = (char*)malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); + filename_adpt = strcpy(filename_adpt, index->settings->root_directory); - //filename_adpt = strcat(filename_adpt, "/adaptive"); filename_adpt = strcat(filename_adpt, "_adaptive"); FILE *file_adpt = fopen(filename_adpt, "wb"); - free(filename_adpt); - fwrite(&(index->total_records), sizeof(unsigned long long), 1, file_adpt); - fwrite(&(index->loaded_records), sizeof(unsigned long long), 1, file_adpt); - fclose(file_adpt); + if (file_adpt == NULL) { + printf("error on opening file %s for writing\n", filename); + + exit(-1); + } + + free(filename_adpt); + fwrite(&(index->total_records), sizeof(uint64_t), 1, file_adpt); + fwrite(&(index->loaded_records), sizeof(uint64_t), 1, file_adpt); + fclose(file_adpt); } + isax_index * index_read(const char* root_directory) { - fprintf(stderr, ">>> Loading index: %s\n", root_directory); - char *filename = malloc(sizeof(char) * (strlen(root_directory) + 15)); - filename = strcpy(filename, root_directory); - filename = strcat(filename, "/index.idx"); - FILE *file = fopen(filename, "rb"); - free(filename); - - int raw_filename_size = 0; - char *raw_filename = NULL; - int timeseries_size = 0; - int paa_segments = 0; - int sax_bit_cardinality = 0; - int max_leaf_size = 0; - int min_leaf_size = 0; - int initial_leaf_buffer_size = 0; - int max_total_buffer_size = 0; - int initial_fbl_buffer_size = 0; - int total_loaded_leaves = 0; - int tight_bound = 0; - int aggressive_check = 0; - int new_index = 0; - - fread(&raw_filename_size, sizeof(int), 1, file); - raw_filename = malloc(sizeof(char) * (raw_filename_size+1)); + fprintf(stderr, ">>> Loading index: %s\n", root_directory); + char *filename = (char*)malloc(sizeof(char) * (strlen(root_directory) + 15)); + filename = strcpy(filename, root_directory); + filename = strcat(filename, "/index.idx"); + FILE *file = fopen(filename, "rb"); + free(filename); + + int raw_filename_size = 0; + char *raw_filename = NULL; + int timeseries_size = 0; + int paa_segments = 0; + int sax_bit_cardinality = 0; + int max_leaf_size = 0; + int min_leaf_size = 0; + int initial_leaf_buffer_size = 0; + int max_total_buffer_size = 0; + int initial_fbl_buffer_size = 0; + int total_loaded_leaves = 0; + int tight_bound = 0; + int aggressive_check = 0; + int new_index = 0; + + fread(&raw_filename_size, sizeof(int), 1, file); + raw_filename = (char*)malloc(sizeof(char) * (raw_filename_size+1)); fread(raw_filename, sizeof(char), raw_filename_size, file); - raw_filename[raw_filename_size] = '\0'; - + raw_filename[raw_filename_size] = '\0'; + fread(×eries_size, sizeof(int), 1, file); - fread(&paa_segments, sizeof(int), 1, file); - fread(&sax_bit_cardinality, sizeof(int), 1, file); - fread(&max_leaf_size, sizeof(int), 1, file); - fread(&min_leaf_size, sizeof(int), 1, file); - fread(&initial_leaf_buffer_size, sizeof(int), 1, file); - fread(&max_total_buffer_size, sizeof(int), 1, file); - fread(&initial_fbl_buffer_size, sizeof(int), 1, file); - fread(&total_loaded_leaves, sizeof(int), 1, file); - fread(&tight_bound, sizeof(int), 1, file); - fread(&aggressive_check, sizeof(int), 1, file); - - isax_index_settings *idx_settings = isax_index_settings_init(root_directory, - timeseries_size, - paa_segments, - sax_bit_cardinality, - max_leaf_size, - min_leaf_size, - initial_leaf_buffer_size, - max_total_buffer_size, - initial_fbl_buffer_size, - total_loaded_leaves, - tight_bound, - aggressive_check, - 0,0,false,false,1,false,1,1,0); - idx_settings->raw_filename = malloc(sizeof(char) * 256); - strcpy(idx_settings->raw_filename, raw_filename); - free(raw_filename); - - isax_index *index = isax_index_init(idx_settings); - - while(!feof(file)) { - int j = 0; - if(fread(&j, sizeof(int), 1, file)) { - fbl_soft_buffer *current_buffer = &index->fbl->soft_buffers[j]; - current_buffer->initialized = 1; - current_buffer->node = node_read(index, file); - if(index->first_node == NULL) - { - index->first_node = current_buffer->node; - current_buffer->node->next = NULL; - current_buffer->node->previous = NULL; - } - else - { - isax_node * prev_first = index->first_node; - index->first_node = current_buffer->node; - index->first_node->next = prev_first; - prev_first->previous = current_buffer->node; - } - } - } - - fclose(file); - - char *filename_adpt = malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); + fread(&paa_segments, sizeof(int), 1, file); + fread(&sax_bit_cardinality, sizeof(int), 1, file); + fread(&max_leaf_size, sizeof(int), 1, file); + fread(&min_leaf_size, sizeof(int), 1, file); + fread(&initial_leaf_buffer_size, sizeof(int), 1, file); + fread(&max_total_buffer_size, sizeof(int), 1, file); + fread(&initial_fbl_buffer_size, sizeof(int), 1, file); + fread(&total_loaded_leaves, sizeof(int), 1, file); + fread(&tight_bound, sizeof(int), 1, file); + fread(&aggressive_check, sizeof(int), 1, file); + + isax_index_settings *idx_settings = isax_index_settings_init(root_directory, + timeseries_size, + paa_segments, + sax_bit_cardinality, + max_leaf_size, + min_leaf_size, + initial_leaf_buffer_size, + max_total_buffer_size, + initial_fbl_buffer_size, + total_loaded_leaves, + tight_bound, + aggressive_check, + 0, 0 , false, false, 1, false, 1, 1, 0); + idx_settings->raw_filename = (char*)malloc(sizeof(char) * 256); + strcpy(idx_settings->raw_filename, raw_filename); + free(raw_filename); + + isax_index *index = isax_index_init(idx_settings); + + while (!feof(file)) { + int j = 0; + + if (fread(&j, sizeof(int), 1, file)) { + fbl_soft_buffer *current_buffer = &index->fbl->soft_buffers[j]; + current_buffer->initialized = 1; + current_buffer->node = node_read(index, file); + + if (index->first_node == NULL) { + index->first_node = current_buffer->node; + current_buffer->node->next = NULL; + current_buffer->node->previous = NULL; + } else { + isax_node * prev_first = index->first_node; + index->first_node = current_buffer->node; + index->first_node->next = prev_first; + prev_first->previous = current_buffer->node; + } + } + } + + fclose(file); + + char *filename_adpt = (char*)malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); filename_adpt = strcpy(filename_adpt, index->settings->root_directory); filename_adpt = strcat(filename_adpt, "/adaptive"); FILE *file_adpt = fopen(filename_adpt, "rb"); free(filename_adpt); - if(file_adpt) { - fread(&index->total_records, sizeof(unsigned long long), 1, file_adpt); - fread(&index->loaded_records, sizeof(unsigned long long), 1, file_adpt); - fclose(file_adpt); + if (file_adpt) { + fread(&index->total_records, sizeof(uint64_t), 1, file_adpt); + fread(&index->loaded_records, sizeof(uint64_t), 1, file_adpt); + fclose(file_adpt); } - - return index; + + return index; } -void get_index_size(isax_index *index, struct stat *stat_index, struct stat *stat_adaptive) -{ - char *filename_index = malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); +void get_index_size(isax_index *index, struct stat *stat_index, struct stat *stat_adaptive) { + char *filename_index = (char*)malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); filename_index = strcpy(filename_index, index->settings->root_directory); filename_index = strcat(filename_index, "_index.idx"); - char *filename_adpt = malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); + char *filename_adpt = (char*)malloc(sizeof(char) * (strlen(index->settings->root_directory) + 15)); filename_adpt = strcpy(filename_adpt, index->settings->root_directory); filename_adpt = strcat(filename_adpt, "_adaptive"); - if(stat(filename_index, stat_index)==0 && stat(filename_adpt, stat_adaptive)==0) - { + if (stat(filename_index, stat_index) == 0 && stat(filename_adpt, stat_adaptive) == 0) { return; - } - else - { + } else { fprintf(stderr, "ERROR: unable to find stat for file %s and %s", filename_index, filename_adpt); + return; } } void create_wedges(isax_index *index, isax_node *node) { - if(node == NULL) { - int j; - for (j=0; jfbl->number_of_buffers; j++) { - fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; - if (current_fbl_node->initialized && current_fbl_node->node != NULL) { - isax_node *curr_node = current_fbl_node->node; - create_wedges(index, curr_node); - } - } - index->has_wedges = 1; - } - else { - if(node->is_leaf) { - node->wedges = malloc(sizeof(ts_type) * index->settings->timeseries_size * 2); - int i; - for(i=0; isettings->timeseries_size; i++) { - node->wedges[i] = MINVAL; - node->wedges[index->settings->timeseries_size + i] = MAXVAL; - } - if(node->has_partial_data_file) { - char *filename; - file_position_type *positions; - ts_type *tmp_ts = malloc(sizeof(ts_type) * index->settings->timeseries_size); - - filename = malloc((strlen(node->filename) + 10) * sizeof(char)); - strcpy(filename, node->filename); - strcat(filename, ".part"); - filename[strlen(node->filename)+5] = '\0'; - - FILE *leaf_file = fopen(filename, "rb"); - FILE *raw_file = fopen(index->settings->raw_filename, "rb"); - - fseeko(leaf_file,0L, SEEK_END); - unsigned long size = ftello(leaf_file) / index->settings->partial_record_size; - fseeko(leaf_file, 0L, SEEK_SET); - - positions = malloc(index->settings->position_byte_size * size); - - for(i=0; isettings->position_byte_size, 1, leaf_file); - fseeko(leaf_file, index->settings->sax_byte_size, SEEK_CUR); - } - - qsort(positions, size, index->settings->position_byte_size, compare_file_positions); - - for(i=0; isettings->ts_byte_size, SEEK_SET); - fread(tmp_ts, index->settings->ts_byte_size, 1, raw_file); - - int j; - for(j=0; jsettings->timeseries_size; j++) { - if(tmp_ts[j] < node->wedges[index->settings->timeseries_size + j]) { - node->wedges[index->settings->timeseries_size + j] = tmp_ts[j]; - } - if(tmp_ts[j] > node->wedges[j]) { - node->wedges[j] = tmp_ts[j]; - } - } - } - - fclose(raw_file); - fclose(leaf_file); - free(filename); - free(positions); - free(tmp_ts); - } - if(node->has_full_data_file) { - - char *filename; - - filename = malloc((strlen(node->filename) + 10) * sizeof(char)); - strcpy(filename, node->filename); - strcat(filename, ".full"); - filename[strlen(node->filename)+5] = '\0'; - FILE *leaf_file = fopen(filename, "rb"); - - fseeko(leaf_file,0L, SEEK_END); - unsigned long size = ftello(leaf_file) / index->settings->full_record_size; - fseeko(leaf_file, 0L, SEEK_SET); - - for(i=0; isettings->sax_byte_size + index->settings->position_byte_size, SEEK_CUR); - int j=0; - for(j=0; jsettings->timeseries_size; j++) { - ts_type tmp_val; - fread(&tmp_val, sizeof(ts_type), 1, leaf_file); - if(tmp_val < node->wedges[index->settings->timeseries_size + j]) { - node->wedges[index->settings->timeseries_size + j] = tmp_val; - } - if(tmp_val > node->wedges[j]) { - node->wedges[j] = tmp_val; - } - } - } - - - - ///// PRINT - /*char s[256]; - sprintf(s, "%p.WEDGE.txt", node); - FILE *op = fopen(s, "w"); - - for(i=0; isettings->timeseries_size; i++) { - fprintf(op, "%lf ", node->wedges[i]); - } - fprintf(op, "\n"); - fseeko(leaf_file, 0L, SEEK_SET); - for(i=0; isettings->sax_byte_size + index->settings->position_byte_size, SEEK_CUR); - fread(tmp_ts, index->settings->ts_byte_size, 1, leaf_file); - int j; - for(j=0; jsettings->timeseries_size; j++) { - fprintf(op, "%lf ", tmp_ts[j]); - } - fprintf(op, "\n"); - } - for(i=0; isettings->timeseries_size; i++) { - fprintf(op, "%lf ", node->wedges[index->settings->timeseries_size + i]); - } - - fprintf(op, "\n"); - fclose(op);*/ - ///// END PRINT - - - fclose(leaf_file); - free(filename); - } - } - else { - create_wedges(index, node->left_child); - create_wedges(index, node->right_child); - } - } + if (node == NULL) { + for (int j = 0; j < index->fbl->number_of_buffers; j++) { + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + + if (current_fbl_node->initialized && current_fbl_node->node != NULL) { + isax_node *curr_node = current_fbl_node->node; + create_wedges(index, curr_node); + } + } + + index->has_wedges = 1; + } else { + if (node->is_leaf) { + node->wedges = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size * 2); + int i; + + for (i = 0; i < index->settings->timeseries_size; i++) { + node->wedges[i] = MINVAL; + node->wedges[index->settings->timeseries_size + i] = MAXVAL; + } + + if (node->has_partial_data_file) { + char *filename; + file_position_type *positions; + ts_type *tmp_ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + + filename = (char*)malloc((strlen(node->filename) + 10) * sizeof(char)); + strcpy(filename, node->filename); + strcat(filename, ".part"); + filename[strlen(node->filename)+5] = '\0'; + + FILE *leaf_file = fopen(filename, "rb"); + FILE *raw_file = fopen(index->settings->raw_filename, "rb"); + + fseeko(leaf_file, 0L, SEEK_END); + uint32_t size = ftello(leaf_file) / index->settings->partial_record_size; + fseeko(leaf_file, 0L, SEEK_SET); + + positions = (file_position_type*)malloc(index->settings->position_byte_size * size); + + for (i = 0; i < size; i++) { + fread(&positions[i], index->settings->position_byte_size, 1, leaf_file); + fseeko(leaf_file, index->settings->sax_byte_size, SEEK_CUR); + } + + qsort(positions, size, index->settings->position_byte_size, compare_file_positions); + + for (i = 0; i < size; i++) { + fseek(raw_file, positions[i] * index->settings->ts_byte_size, SEEK_SET); + fread(tmp_ts, index->settings->ts_byte_size, 1, raw_file); + + int j; + for (j = 0; j < index->settings->timeseries_size; j++) { + if (tmp_ts[j] < node->wedges[index->settings->timeseries_size + j]) { + node->wedges[index->settings->timeseries_size + j] = tmp_ts[j]; + } + + if (tmp_ts[j] > node->wedges[j]) { + node->wedges[j] = tmp_ts[j]; + } + } + } + + fclose(raw_file); + fclose(leaf_file); + free(filename); + free(positions); + free(tmp_ts); + } + + if (node->has_full_data_file) { + char *filename; + + filename = (char*)malloc((strlen(node->filename) + 10) * sizeof(char)); + strcpy(filename, node->filename); + strcat(filename, ".full"); + filename[strlen(node->filename)+5] = '\0'; + FILE *leaf_file = fopen(filename, "rb"); + + fseeko(leaf_file, 0L, SEEK_END); + uint32_t size = ftello(leaf_file) / index->settings->full_record_size; + fseeko(leaf_file, 0L, SEEK_SET); + + for (i = 0; i < size; i++) { + fseeko(leaf_file, index->settings->sax_byte_size + index->settings->position_byte_size, SEEK_CUR); + + for (int j = 0; j < index->settings->timeseries_size; j++) { + ts_type tmp_val; + fread(&tmp_val, sizeof(ts_type), 1, leaf_file); + + if (tmp_val < node->wedges[index->settings->timeseries_size + j]) { + node->wedges[index->settings->timeseries_size + j] = tmp_val; + } + + if (tmp_val > node->wedges[j]) { + node->wedges[j] = tmp_val; + } + } + } + + fclose(leaf_file); + free(filename); + } + } else { + create_wedges(index, node->left_child); + create_wedges(index, node->right_child); + } + } } -int compare_file_positions (const void * a, const void * b) -{ - return ( *(file_position_type*)a - *(file_position_type*)b ); +int compare_file_positions(const void * a, const void * b) { + return (*(file_position_type*)a - *(file_position_type*)b); } void clear_wedges(isax_index *index, isax_node *node) { - if(node == NULL) { - int j; - for (j=0; jfbl->number_of_buffers; j++) { - fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; - if (current_fbl_node->initialized && current_fbl_node->node != NULL) { - isax_node *curr_node = current_fbl_node->node; - clear_wedges(index, curr_node); - } - } - index->has_wedges = 0; - } - else { - if(node->is_leaf) { - free(node->wedges); - node->wedges = NULL; - } - else { - clear_wedges(index, node->left_child); - clear_wedges(index, node->right_child); - } - } + if (node == NULL) { + int j; + + for (j = 0; j < index->fbl->number_of_buffers; j++) { + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + + if (current_fbl_node->initialized && current_fbl_node->node != NULL) { + isax_node *curr_node = current_fbl_node->node; + clear_wedges(index, curr_node); + } + } + + index->has_wedges = 0; + } else { + if (node->is_leaf) { + free(node->wedges); + node->wedges = NULL; + } else { + clear_wedges(index, node->left_child); + clear_wedges(index, node->right_child); + } + } } void print_settings(isax_index_settings *settings) { - fprintf(stderr,"############ Index SETTINGS ############\n"); - fprintf(stderr,"## [FILE SETTINGS]\n"); + fprintf(stderr, "############ Index SETTINGS ############\n"); + fprintf(stderr, "## [FILE SETTINGS]\n"); + if (settings->raw_filename) { - fprintf(stderr,"## raw_filename:\t%s\n",settings->raw_filename); - } - fprintf(stderr,"## root_directory:\t%s\n",settings->root_directory); - // fprintf(stderr,"## Dataset is int8:\t%s\n", settings->filetype_int); - - fprintf(stderr,"## \n## [DATA TYPE SETTINGS]\n"); - fprintf(stderr,"## timeseries_size: \t%d\n",settings->timeseries_size); - fprintf(stderr,"## partial_record_size:\t%d\n",settings->partial_record_size); - fprintf(stderr,"## full_record_size: \t%d\n",settings->full_record_size); - fprintf(stderr,"## position_byte_size: \t%d\n",settings->position_byte_size); - fprintf(stderr,"## sax_byte_size: \t%d\n",settings->sax_byte_size); - fprintf(stderr,"## ts_byte_size: \t%d\n",settings->ts_byte_size); - - fprintf(stderr,"## \n## [BUFFER SETTINGS]\n"); - fprintf(stderr, "## initial_fbl_buffer_size: \t%d\n", settings->initial_fbl_buffer_size); - fprintf(stderr, "## initial_leaf_buffer_size: \t%d\n", settings->initial_leaf_buffer_size); - fprintf(stderr,"## max_total_buffer_size: \t%d\n",settings->max_total_buffer_size); - fprintf(stderr,"## max_total_full_buffer_size:\t%d\n",settings->max_total_full_buffer_size); - - fprintf(stderr,"## \n## [LEAF SETTINGS]\n"); - fprintf(stderr, "## max_leaf_size:\t%d\n", settings->max_leaf_size); - fprintf(stderr, "## min_leaf_size:\t%d\n",settings->min_leaf_size); - - fprintf(stderr,"## \n## [Symbolic Transform SETTINGS]\n"); + fprintf(stderr, "## raw_filename:\t%s\n", settings->raw_filename); + } + + fprintf(stderr, "## root_directory:\t%s\n", settings->root_directory); + + fprintf(stderr, "## \n## [DATA TYPE SETTINGS]\n"); + fprintf(stderr, "## timeseries_size: \t%d\n", settings->timeseries_size); + fprintf(stderr, "## partial_record_size:\t%d\n", settings->partial_record_size); + fprintf(stderr, "## full_record_size: \t%d\n", settings->full_record_size); + fprintf(stderr, "## position_byte_size: \t%d\n", settings->position_byte_size); + fprintf(stderr, "## sax_byte_size: \t%d\n", settings->sax_byte_size); + fprintf(stderr, "## ts_byte_size: \t%d\n", settings->ts_byte_size); + + fprintf(stderr, "## \n## [BUFFER SETTINGS]\n"); + fprintf(stderr, "## initial_fbl_buffer_size: \t%d\n", settings->initial_fbl_buffer_size); + fprintf(stderr, "## initial_leaf_buffer_size: \t%d\n", settings->initial_leaf_buffer_size); + fprintf(stderr, "## max_total_buffer_size: \t%d\n", settings->max_total_buffer_size); + fprintf(stderr, "## max_total_full_buffer_size:\t%d\n", settings->max_total_full_buffer_size); + + fprintf(stderr, "## \n## [LEAF SETTINGS]\n"); + fprintf(stderr, "## max_leaf_size:\t%d\n", settings->max_leaf_size); + fprintf(stderr, "## min_leaf_size:\t%d\n", settings->min_leaf_size); + + fprintf(stderr, "## \n## [Symbolic Transform SETTINGS]\n"); if (settings->SIMD_flag) { - fprintf(stderr,"## Using SIMD: \t%c\n", settings->SIMD_flag); + fprintf(stderr, "## Using SIMD: \t%c\n", settings->SIMD_flag); } if (settings->function_type == 3) { - fprintf(stderr,"## Using MESSI + SAX. \n"); - fprintf(stderr,"## \n## [SAX SETTINGS]\n"); - fprintf(stderr,"## paa_segments: \t%d\n",settings->paa_segments); - fprintf(stderr,"## sax_alphabet_card.: \t%d\n",settings->sax_alphabet_cardinality); - fprintf(stderr,"## sax_bit_cardinality:\t%d\n",settings->sax_bit_cardinality); - } - else if (settings->function_type == 4) { + fprintf(stderr, "## Using MESSI + SAX. \n"); + fprintf(stderr, "## \n## [SAX SETTINGS]\n"); + fprintf(stderr, "## paa_segments: \t%d\n", settings->paa_segments); + fprintf(stderr, "## sax_alphabet_card.: \t%d\n", settings->sax_alphabet_cardinality); + fprintf(stderr, "## sax_bit_cardinality:\t%d\n", settings->sax_bit_cardinality); + } else if (settings->function_type == 4) { fprintf(stderr, "## Using MESSI + SFA. \n"); - fprintf(stderr,"## dft_coefficients: \t%d\n",settings->paa_segments); - fprintf(stderr,"## sfa_alphabet_card.: \t%d\n",settings->sax_alphabet_cardinality); - fprintf(stderr,"## sfa_bit_cardinality:\t%d\n",settings->sax_bit_cardinality); - - fprintf(stderr,"## \n## [SFA SETTINGS]\n"); - fprintf(stderr,"## Ignore mean FFT coefficient?: \t%c\n", settings->is_norm); - fprintf(stderr,"## Variance-based coefficient selection?:\t%d\n", settings->coeff_number > 0); - if (settings->histogram_type==3) { + fprintf(stderr, "## dft_coefficients: \t%d\n", settings->paa_segments); + fprintf(stderr, "## sfa_alphabet_card.: \t%d\n", settings->sax_alphabet_cardinality); + fprintf(stderr, "## sfa_bit_cardinality:\t%d\n", settings->sax_bit_cardinality); + + fprintf(stderr, "## \n## [SFA SETTINGS]\n"); + fprintf(stderr, "## Ignore mean FFT coefficient?: \t%c\n", settings->is_norm); + fprintf(stderr, "## Variance-based coefficient selection?:\t%d\n", settings->coeff_number > 0); + + if (settings->histogram_type == 3) { fprintf(stderr, "## \t Equi-Width Binning. \n"); - } else if (settings->histogram_type==4) { + } else if (settings->histogram_type == 4) { fprintf(stderr, "## \t Equi-Depth Binning. \n"); } if (settings->sample_type == 1) { - fprintf(stderr,"## Sampling Type: \tfirst-n-values\n"); + fprintf(stderr, "## Sampling Type: \tfirst-n-values\n"); } else if (settings->sample_type == 2) { fprintf(stderr, "## Sampling Type: \tuniform sampling\n"); } else if (settings->sample_type == 3) { fprintf(stderr, "## Sampling Type: \trandom sampling\n"); } - fprintf(stderr,"## Sampling Size: \t%d\n", settings->sample_size); + fprintf(stderr, "## Sampling Size: \t%d\n", settings->sample_size); } - fprintf(stderr,"## \n## [QUERY ANSWERING SETTINGS]\n"); - fprintf(stderr, "## aggressive_check: \t%d\n", settings->aggressive_check); - fprintf(stderr,"## tight_bound: \t%d\n",settings->tight_bound); - fprintf(stderr,"## total_loaded_leaves:\t%d\n",settings->total_loaded_leaves); - fprintf(stderr,"######################################\n"); + fprintf(stderr, "## \n## [QUERY ANSWERING SETTINGS]\n"); + fprintf(stderr, "## aggressive_check: \t%d\n", settings->aggressive_check); + fprintf(stderr, "## tight_bound: \t%d\n", settings->tight_bound); + fprintf(stderr, "## total_loaded_leaves:\t%d\n", settings->total_loaded_leaves); + fprintf(stderr, "######################################\n"); - fflush(stderr); + fflush(stderr); } meminfo get_memory_utilization_info(isax_index *index) { meminfo bytes_mem_info; - memcpy(&bytes_mem_info, - &(index->memory_info), sizeof(meminfo)); + memcpy(&bytes_mem_info, &(index->memory_info), sizeof(meminfo)); bytes_mem_info.mem_data = index->allocated_memory; bytes_mem_info.mem_tree_structure *= sizeof(isax_node); @@ -2835,9 +2725,5 @@ void print_mem_info(isax_index *index) { printf("# (MEM) RAW DATA: %ld\n", bytes_mem_info.mem_data); printf("# (DISK) MATERIALIZED: %ld\n", bytes_mem_info.disk_data_full); printf("# (DISK) PARTIAL: %ld\n", bytes_mem_info.disk_data_partial); - printf("################################################################\n"); + printf("################################################################\n"); } - - - - diff --git a/src/ads/isax_node.c b/src/ads/isax_node.c index 56e0d2cd..947a829d 100644 --- a/src/ads/isax_node.c +++ b/src/ads/isax_node.c @@ -14,24 +14,26 @@ /** This function initializes an isax root node. */ -isax_node * isax_root_node_init(root_mask_type mask, int initial_buffer_size) -{ +isax_node * isax_root_node_init(root_mask_type mask, int initial_buffer_size) { isax_node *node = isax_leaf_node_init(initial_buffer_size); node->mask = mask; + return node; } /** This function initalizes an isax leaf node. */ -isax_node * isax_leaf_node_init(int initial_buffer_size) -{ +isax_node * isax_leaf_node_init(int initial_buffer_size) { COUNT_NEW_NODE() - isax_node *node = malloc(sizeof(isax_node)); - if(node == NULL) { - fprintf(stderr,"error: could not allocate memory for new node.\n"); + isax_node *node = (isax_node*)malloc(sizeof(isax_node)); + + if (node == NULL) { + fprintf(stderr, "error: could not allocate memory for new node.\n"); + return NULL; } + node->has_partial_data_file = 0; node->has_full_data_file = 0; node->right_child = NULL; @@ -47,8 +49,6 @@ isax_node * isax_leaf_node_init(int initial_buffer_size) node->buffer = init_node_buffer(initial_buffer_size); node->mask = 0; node->wedges = NULL; + return node; } - - - diff --git a/src/ads/isax_node_buffer.c b/src/ads/isax_node_buffer.c index 138e7762..ae7d44ef 100644 --- a/src/ads/isax_node_buffer.c +++ b/src/ads/isax_node_buffer.c @@ -20,51 +20,60 @@ void destroy_node_buffer(isax_node_buffer *node_buffer) { free(node_buffer->full_position_buffer); node_buffer->full_position_buffer = NULL; } + if (node_buffer->full_sax_buffer != NULL) { free(node_buffer->full_sax_buffer); node_buffer->full_sax_buffer = NULL; } + if (node_buffer->full_ts_buffer != NULL) { free(node_buffer->full_ts_buffer); node_buffer->full_ts_buffer = NULL; } + if (node_buffer->partial_position_buffer != NULL) { // !!! DON'T FREE THAT IT REMOVES THE DATA!!!! free(node_buffer->partial_position_buffer); node_buffer->partial_position_buffer = NULL; } + if (node_buffer->partial_sax_buffer != NULL) { free(node_buffer->partial_sax_buffer); node_buffer->partial_sax_buffer = NULL; } + if (node_buffer->tmp_full_position_buffer != NULL) { free(node_buffer->tmp_full_position_buffer); node_buffer->tmp_full_position_buffer = NULL; } + if (node_buffer->tmp_full_sax_buffer != NULL) { free(node_buffer->tmp_full_sax_buffer); node_buffer->tmp_full_sax_buffer = NULL; } + if (node_buffer->tmp_full_ts_buffer != NULL) { free(node_buffer->tmp_full_ts_buffer); node_buffer->tmp_full_ts_buffer = NULL; } + if (node_buffer->tmp_partial_position_buffer != NULL) { free(node_buffer->tmp_partial_position_buffer); node_buffer->tmp_partial_position_buffer = NULL; } + if (node_buffer->tmp_partial_sax_buffer != NULL) { free(node_buffer->tmp_partial_sax_buffer); node_buffer->tmp_partial_sax_buffer = NULL; } + free(node_buffer); } - isax_node_buffer * init_node_buffer(int initial_buffer_size) { - isax_node_buffer * node_buffer = malloc(sizeof(isax_node_buffer)); + isax_node_buffer * node_buffer = (isax_node_buffer*)malloc(sizeof(isax_node_buffer)); node_buffer->initial_buffer_size = initial_buffer_size; - + node_buffer->max_full_buffer_size = 0; node_buffer->max_partial_buffer_size = 0; node_buffer->max_tmp_full_buffer_size = 0; @@ -73,7 +82,7 @@ isax_node_buffer * init_node_buffer(int initial_buffer_size) { node_buffer->partial_buffer_size = 0; node_buffer->tmp_full_buffer_size = 0; node_buffer->tmp_partial_buffer_size = 0; - + (node_buffer->full_position_buffer) = NULL; (node_buffer->full_sax_buffer) = NULL; (node_buffer->full_ts_buffer) = NULL; @@ -83,349 +92,270 @@ isax_node_buffer * init_node_buffer(int initial_buffer_size) { (node_buffer->tmp_full_sax_buffer) = NULL; (node_buffer->tmp_full_ts_buffer) = NULL; (node_buffer->tmp_partial_position_buffer) = NULL; - (node_buffer->tmp_partial_sax_buffer = NULL); - + (node_buffer->tmp_partial_sax_buffer = NULL); + return node_buffer; } -enum response add_to_node_buffer(isax_node_buffer *node_buffer, - isax_node_record *record, - int sax_segments, int ts_segments) -{ - if (record->insertion_mode & TMP) - { +enum response add_to_node_buffer(isax_node_buffer *node_buffer, isax_node_record *record, + int sax_segments, int ts_segments) { + if (record->insertion_mode & TMP) { if (record->insertion_mode & FULL) { if (node_buffer->max_tmp_full_buffer_size == 0) { node_buffer->max_tmp_full_buffer_size = node_buffer->initial_buffer_size; - node_buffer->tmp_full_position_buffer = malloc(sizeof(file_position_type*) * - node_buffer->max_tmp_full_buffer_size); - node_buffer->tmp_full_sax_buffer = malloc(sizeof(sax_type*) * - node_buffer->max_tmp_full_buffer_size); - node_buffer->tmp_full_ts_buffer = malloc(sizeof(ts_type*) * - node_buffer->max_tmp_full_buffer_size); - } - else if (node_buffer->max_tmp_full_buffer_size <= node_buffer->tmp_full_buffer_size) { + node_buffer->tmp_full_position_buffer = (file_position_type**)malloc(sizeof(file_position_type*) * + node_buffer->max_tmp_full_buffer_size); + node_buffer->tmp_full_sax_buffer = (sax_type**)malloc(sizeof(sax_type*) * + node_buffer->max_tmp_full_buffer_size); + node_buffer->tmp_full_ts_buffer = (ts_type**)malloc(sizeof(ts_type*) * + node_buffer->max_tmp_full_buffer_size); + } else if (node_buffer->max_tmp_full_buffer_size <= node_buffer->tmp_full_buffer_size) { node_buffer->max_tmp_full_buffer_size *= BUFFER_REALLOCATION_RATE; - node_buffer->tmp_full_position_buffer = realloc(node_buffer->tmp_full_position_buffer, - sizeof(file_position_type*) * - node_buffer->max_tmp_full_buffer_size); - node_buffer->tmp_full_sax_buffer = realloc(node_buffer->tmp_full_sax_buffer, - sizeof(sax_type*) * - node_buffer->max_tmp_full_buffer_size); - node_buffer->tmp_full_ts_buffer = realloc(node_buffer->tmp_full_ts_buffer, - sizeof(ts_type*) * - node_buffer->max_tmp_full_buffer_size); + node_buffer->tmp_full_position_buffer = (file_position_type**)realloc(node_buffer->tmp_full_position_buffer, + sizeof(file_position_type*) * node_buffer->max_tmp_full_buffer_size); + node_buffer->tmp_full_sax_buffer = (sax_type**)realloc(node_buffer->tmp_full_sax_buffer, + sizeof(sax_type*) * node_buffer->max_tmp_full_buffer_size); + node_buffer->tmp_full_ts_buffer = (ts_type**)realloc(node_buffer->tmp_full_ts_buffer, + sizeof(ts_type*) * node_buffer->max_tmp_full_buffer_size); } + node_buffer->tmp_full_position_buffer[node_buffer->tmp_full_buffer_size] = record->position; node_buffer->tmp_full_sax_buffer[node_buffer->tmp_full_buffer_size] = record->sax; node_buffer->tmp_full_ts_buffer[node_buffer->tmp_full_buffer_size] = record->ts; node_buffer->tmp_full_buffer_size++; } + if (record->insertion_mode & PARTIAL) { if (node_buffer->max_tmp_partial_buffer_size == 0) { node_buffer->max_tmp_partial_buffer_size = node_buffer->initial_buffer_size; - node_buffer->tmp_partial_position_buffer = malloc(sizeof(file_position_type*) * - node_buffer->max_tmp_partial_buffer_size); - node_buffer->tmp_partial_sax_buffer = malloc(sizeof(sax_type*) * - node_buffer->max_tmp_partial_buffer_size); - } - else if (node_buffer->max_tmp_partial_buffer_size <= node_buffer->tmp_partial_buffer_size) { + node_buffer->tmp_partial_position_buffer = (file_position_type**)malloc(sizeof(file_position_type*) * + node_buffer->max_tmp_partial_buffer_size); + node_buffer->tmp_partial_sax_buffer = (sax_type**)malloc(sizeof(sax_type*) * + node_buffer->max_tmp_partial_buffer_size); + } else if (node_buffer->max_tmp_partial_buffer_size <= node_buffer->tmp_partial_buffer_size) { node_buffer->max_tmp_partial_buffer_size *= BUFFER_REALLOCATION_RATE; - node_buffer->tmp_partial_position_buffer = realloc(node_buffer->tmp_full_position_buffer, - sizeof(file_position_type*) * - node_buffer->max_tmp_partial_buffer_size); - node_buffer->tmp_partial_sax_buffer = realloc(node_buffer->tmp_full_sax_buffer, - sizeof(sax_type*) * - node_buffer->max_tmp_partial_buffer_size); + node_buffer->tmp_partial_position_buffer = (file_position_type**)realloc(node_buffer->tmp_full_position_buffer, + sizeof(file_position_type*) * node_buffer->max_tmp_partial_buffer_size); + node_buffer->tmp_partial_sax_buffer = (sax_type**)realloc(node_buffer->tmp_full_sax_buffer, + sizeof(sax_type*) * node_buffer->max_tmp_partial_buffer_size); } + node_buffer->tmp_partial_position_buffer[node_buffer->tmp_partial_buffer_size] = record->position; node_buffer->tmp_partial_sax_buffer[node_buffer->tmp_partial_buffer_size] = record->sax; node_buffer->tmp_partial_buffer_size++; } - } - else if (record->insertion_mode & NO_TMP) - { + } else if (record->insertion_mode & NO_TMP) { if (record->insertion_mode & FULL) { if (node_buffer->max_full_buffer_size == 0) { node_buffer->max_full_buffer_size = node_buffer->initial_buffer_size; - node_buffer->full_position_buffer = malloc(sizeof(file_position_type*) * - node_buffer->max_full_buffer_size); - node_buffer->full_sax_buffer = malloc(sizeof(sax_type*) * - node_buffer->max_full_buffer_size); - node_buffer->full_ts_buffer = malloc(sizeof(ts_type*) * - node_buffer->max_full_buffer_size); - } - else if (node_buffer->max_full_buffer_size <= node_buffer->full_buffer_size) { + node_buffer->full_position_buffer = (file_position_type**)malloc(sizeof(file_position_type*) * + node_buffer->max_full_buffer_size); + node_buffer->full_sax_buffer = (sax_type**)malloc(sizeof(sax_type*) * node_buffer->max_full_buffer_size); + node_buffer->full_ts_buffer = (ts_type**)malloc(sizeof(ts_type*) * node_buffer->max_full_buffer_size); + } else if (node_buffer->max_full_buffer_size <= node_buffer->full_buffer_size) { node_buffer->max_full_buffer_size *= BUFFER_REALLOCATION_RATE; - node_buffer->full_position_buffer = realloc(node_buffer->full_position_buffer, - sizeof(file_position_type*) * - node_buffer->max_full_buffer_size); - node_buffer->full_sax_buffer = realloc(node_buffer->full_sax_buffer, - sizeof(sax_type*) * - node_buffer->max_full_buffer_size); - node_buffer->full_ts_buffer = realloc(node_buffer->full_ts_buffer, - sizeof(ts_type*) * - node_buffer->max_full_buffer_size); + node_buffer->full_position_buffer = (file_position_type**)realloc(node_buffer->full_position_buffer, + sizeof(file_position_type*) * node_buffer->max_full_buffer_size); + node_buffer->full_sax_buffer = (sax_type**)realloc(node_buffer->full_sax_buffer, + sizeof(sax_type*) * node_buffer->max_full_buffer_size); + node_buffer->full_ts_buffer = (ts_type**)realloc(node_buffer->full_ts_buffer, + sizeof(ts_type*) * node_buffer->max_full_buffer_size); } + node_buffer->full_position_buffer[node_buffer->full_buffer_size] = record->position; node_buffer->full_sax_buffer[node_buffer->full_buffer_size] = record->sax; node_buffer->full_ts_buffer[node_buffer->full_buffer_size] = record->ts; node_buffer->full_buffer_size++; } + if (record->insertion_mode & PARTIAL) { if (node_buffer->max_partial_buffer_size == 0) { node_buffer->max_partial_buffer_size = node_buffer->initial_buffer_size; - node_buffer->partial_position_buffer = malloc(sizeof(file_position_type*) * - node_buffer->max_partial_buffer_size); - node_buffer->partial_sax_buffer = malloc(sizeof(sax_type*) * - node_buffer->max_partial_buffer_size); - } - else if (node_buffer->max_partial_buffer_size <= node_buffer->partial_buffer_size) { + node_buffer->partial_position_buffer = (file_position_type**)malloc(sizeof(file_position_type*) * + node_buffer->max_partial_buffer_size); + node_buffer->partial_sax_buffer = (sax_type**)malloc(sizeof(sax_type*) * + node_buffer->max_partial_buffer_size); + } else if (node_buffer->max_partial_buffer_size <= node_buffer->partial_buffer_size) { node_buffer->max_partial_buffer_size *= BUFFER_REALLOCATION_RATE; - node_buffer->partial_position_buffer = realloc(node_buffer->partial_position_buffer, - sizeof(file_position_type*) * - node_buffer->max_partial_buffer_size); - node_buffer->partial_sax_buffer = realloc(node_buffer->partial_sax_buffer, - sizeof(sax_type*) * - node_buffer->max_partial_buffer_size); + node_buffer->partial_position_buffer = (file_position_type**)realloc(node_buffer->partial_position_buffer, + sizeof(file_position_type*) * node_buffer->max_partial_buffer_size); + node_buffer->partial_sax_buffer = (sax_type**)realloc(node_buffer->partial_sax_buffer, + sizeof(sax_type*) * node_buffer->max_partial_buffer_size); } + node_buffer->partial_position_buffer[node_buffer->partial_buffer_size] = record->position; node_buffer->partial_sax_buffer[node_buffer->partial_buffer_size] = record->sax; node_buffer->partial_buffer_size++; - } + } } - + return SUCCESS; } -enum response flush_node_buffer(isax_node_buffer *node_buffer, - int sax_segments, int ts_segments, - const char * filename) -{ +enum response flush_node_buffer(isax_node_buffer *node_buffer, + int sax_segments, int ts_segments, const char * filename) { // WRITE TWO DIFFERENT FILES! // 1. .FULL (full records) // 2. .PART (partial records) int i; - if (node_buffer->full_buffer_size > 0 - || node_buffer->tmp_full_buffer_size > 0) - { + + if (node_buffer->full_buffer_size > 0 || node_buffer->tmp_full_buffer_size > 0) { FILE * full_file; - char * full_filename = malloc(strlen(filename)+6); + char * full_filename = (char*)malloc(strlen(filename) + 6); sprintf(full_filename, "%s.full", filename); COUNT_OUTPUT_TIME_START full_file = fopen(full_filename, "a+"); + // Flushing full records - for (i = 0; i < node_buffer->full_buffer_size; i++) {; - fwrite(node_buffer->full_position_buffer[i], - sizeof(file_position_type), 1, full_file); - fwrite(node_buffer->full_sax_buffer[i], - sizeof(sax_type), sax_segments, full_file); - fwrite(node_buffer->full_ts_buffer[i], - sizeof(ts_type), ts_segments, full_file); + for (i = 0; i < node_buffer->full_buffer_size; i++) { + fwrite(node_buffer->full_position_buffer[i], sizeof(file_position_type), 1, full_file); + fwrite(node_buffer->full_sax_buffer[i], sizeof(sax_type), sax_segments, full_file); + fwrite(node_buffer->full_ts_buffer[i], sizeof(ts_type), ts_segments, full_file); } + for (i = 0; i < node_buffer->tmp_full_buffer_size; i++) { - fwrite(node_buffer->tmp_full_position_buffer[i], - sizeof(file_position_type), 1, full_file); - fwrite(node_buffer->tmp_full_sax_buffer[i], - sizeof(sax_type), sax_segments, full_file); - fwrite(node_buffer->tmp_full_ts_buffer[i], - sizeof(ts_type), ts_segments, full_file); - } + fwrite(node_buffer->tmp_full_position_buffer[i], sizeof(file_position_type), 1, full_file); + fwrite(node_buffer->tmp_full_sax_buffer[i], sizeof(sax_type), sax_segments, full_file); + fwrite(node_buffer->tmp_full_ts_buffer[i], sizeof(ts_type), ts_segments, full_file); + } + fclose(full_file); COUNT_OUTPUT_TIME_END free(full_filename); } - - if (node_buffer->partial_buffer_size > 0 - || node_buffer->tmp_partial_buffer_size > 0) { + + if (node_buffer->partial_buffer_size > 0 || node_buffer->tmp_partial_buffer_size > 0) { FILE * partial_file; - char * partial_filename = malloc(strlen(filename)+6); - //sax_type *midium_ptr=malloc(sizeof(sax_type)*(sax_segments+8)); + char * partial_filename = (char*)malloc(strlen(filename) + 6); sprintf(partial_filename, "%s.part", filename); COUNT_OUTPUT_TIME_START partial_file = fopen(partial_filename, "a+"); // Flushing partial records - //printf("the large is %d\n",node_buffer->partial_buffer_size); - for (i = 0; i < node_buffer->partial_buffer_size; i++) { - //memcpy(midium_ptr, (sax_type*)(node_buffer->partial_position_buffer[i]),8); - //memcpy(&(midium_ptr[8]), (sax_type*)(node_buffer->partial_sax_buffer[i]),sax_segments); - //fwrite(midium_ptr, sizeof(sax_type), sax_segments+8, partial_file); - //memset(midium_ptr,0,sizeof(sax_type)+8); - - fwrite(node_buffer->partial_position_buffer[i], - sizeof(file_position_type), 1, partial_file); - fwrite(node_buffer->partial_sax_buffer[i], - sizeof(sax_type), sax_segments, partial_file); + for (i = 0; i < node_buffer->partial_buffer_size; i++) { + fwrite(node_buffer->partial_position_buffer[i], sizeof(file_position_type), 1, partial_file); + fwrite(node_buffer->partial_sax_buffer[i], sizeof(sax_type), sax_segments, partial_file); } - //printf("hello word\n"); + for (i = 0; i < node_buffer->tmp_partial_buffer_size; i++) { - //memcpy(midium_ptr, (sax_type*)(node_buffer->tmp_partial_position_buffer[i]),8); - //memcpy(&(midium_ptr[8]), (sax_type*)(node_buffer->tmp_partial_sax_buffer[i]),sax_segments); - //fwrite(midium_ptr, sizeof(sax_type), sax_segments+8, partial_file); - //memset(midium_ptr,0,sizeof(sax_type)+8); - - fwrite(node_buffer->tmp_partial_position_buffer[i], - sizeof(file_position_type), 1, partial_file); - fwrite(node_buffer->tmp_partial_sax_buffer[i], - sizeof(sax_type), sax_segments, partial_file); + fwrite(node_buffer->tmp_partial_position_buffer[i], sizeof(file_position_type), 1, partial_file); + fwrite(node_buffer->tmp_partial_sax_buffer[i], sizeof(sax_type), sax_segments, partial_file); } - //free(midium_ptr); fclose(partial_file); COUNT_OUTPUT_TIME_END - + free(partial_filename); } + return SUCCESS; } -enum response flush_node_buffer_m(isax_node_buffer *node_buffer, - int sax_segments, int ts_segments, - const char * filename, pthread_mutex_t *lock_write) -{ + +enum response flush_node_buffer_m(isax_node_buffer *node_buffer, + int sax_segments, int ts_segments, const char * filename, pthread_mutex_t *lock_write) { // WRITE TWO DIFFERENT FILES! // 1. .FULL (full records) // 2. .PART (partial records) int i; - int plotconter=0; + int plotconter = 0; - if (node_buffer->full_buffer_size > 0 - || node_buffer->tmp_full_buffer_size > 0) - { + if (node_buffer->full_buffer_size > 0 || node_buffer->tmp_full_buffer_size > 0) { FILE * full_file; - char * full_filename = malloc(strlen(filename)+6); + char * full_filename = (char*)malloc(strlen(filename) + 6); sprintf(full_filename, "%s.full", filename); - - //pthread_mutex_lock(lock_write); - //COUNT_OUTPUT_TIME_START full_file = fopen(full_filename, "a+"); + // Flushing full records - - for (i = 0; i < node_buffer->full_buffer_size; i++) {; - fwrite(node_buffer->full_position_buffer[i], - sizeof(file_position_type), 1, full_file); - fwrite(node_buffer->full_sax_buffer[i], - sizeof(sax_type), sax_segments, full_file); - fwrite(node_buffer->full_ts_buffer[i], - sizeof(ts_type), ts_segments, full_file); + for (i = 0; i < node_buffer->full_buffer_size; i++) { + fwrite(node_buffer->full_position_buffer[i], sizeof(file_position_type), 1, full_file); + fwrite(node_buffer->full_sax_buffer[i], sizeof(sax_type), sax_segments, full_file); + fwrite(node_buffer->full_ts_buffer[i], sizeof(ts_type), ts_segments, full_file); + } + + for (i = 0; i < node_buffer->tmp_full_buffer_size; i++) { + fwrite(node_buffer->tmp_full_position_buffer[i], sizeof(file_position_type), 1, full_file); + fwrite(node_buffer->tmp_full_sax_buffer[i], sizeof(sax_type), sax_segments, full_file); + fwrite(node_buffer->tmp_full_ts_buffer[i], sizeof(ts_type), ts_segments, full_file); } - //plotconter=plotconter+node_buffer->full_buffer_size*(sizeof(file_position_type)+sizeof(sax_type)*sax_segments+sizeof(ts_type)*ts_segments); - //printf("wfjleklefjwfelwej\n"); - for (i = 0; i < node_buffer->tmp_full_buffer_size; i++) { - fwrite(node_buffer->tmp_full_position_buffer[i], - sizeof(file_position_type), 1, full_file); - fwrite(node_buffer->tmp_full_sax_buffer[i], - sizeof(sax_type), sax_segments, full_file); - fwrite(node_buffer->tmp_full_ts_buffer[i], - sizeof(ts_type), ts_segments, full_file); - - } - //plotconter=plotconter+node_buffer->tmp_full_buffer_size*(sizeof(file_position_type)+sizeof(sax_type)*sax_segments+sizeof(ts_type)*ts_segments); fclose(full_file); - //COUNT_OUTPUT_TIME_END - //pthread_mutex_unlock(lock_write); - + free(full_filename); } - - if (node_buffer->partial_buffer_size > 0 - || node_buffer->tmp_partial_buffer_size > 0) { + + if (node_buffer->partial_buffer_size > 0 || node_buffer->tmp_partial_buffer_size > 0) { FILE * partial_file; - char * partial_filename = malloc(strlen(filename)+6); - //sax_type *midium_ptr=malloc(sizeof(sax_type)*(sax_segments+8)); + char * partial_filename = (char*)malloc(strlen(filename) + 6); sprintf(partial_filename, "%s.part", filename); - - //pthread_mutex_lock(lock_write); - //COUNT_OUTPUT_TIME_START partial_file = fopen(partial_filename, "a+"); + // Flushing partial records - //printf("the large is %d\n",node_buffer->partial_buffer_size); for (i = 0; i < node_buffer->partial_buffer_size; i++) { - //memcpy(midium_ptr, (sax_type*)(node_buffer->partial_position_buffer[i]),8); - //memcpy(&(midium_ptr[8]), (sax_type*)(node_buffer->partial_sax_buffer[i]),sax_segments); - //fwrite(midium_ptr, sizeof(sax_type), sax_segments+8, partial_file); - //memset(midium_ptr,0,sizeof(sax_type)+8); - - fwrite(node_buffer->partial_position_buffer[i], - sizeof(file_position_type), 1, partial_file); - fwrite(node_buffer->partial_sax_buffer[i], - sizeof(sax_type), sax_segments, partial_file); - + fwrite(node_buffer->partial_position_buffer[i], sizeof(file_position_type), 1, partial_file); + fwrite(node_buffer->partial_sax_buffer[i], sizeof(sax_type), sax_segments, partial_file); } - //plotconter=plotconter+node_buffer->partial_buffer_size*(sizeof(file_position_type)+sizeof(sax_type)*sax_segments); - //printf("hello word\n"); for (i = 0; i < node_buffer->tmp_partial_buffer_size; i++) { - //memcpy(midium_ptr, (sax_type*)(node_buffer->tmp_partial_position_buffer[i]),8); - //memcpy(&(midium_ptr[8]), (sax_type*)(node_buffer->tmp_partial_sax_buffer[i]),sax_segments); - //fwrite(midium_ptr, sizeof(sax_type), sax_segments+8, partial_file); - //memset(midium_ptr,0,sizeof(sax_type)+8); - - fwrite(node_buffer->tmp_partial_position_buffer[i], - sizeof(file_position_type), 1, partial_file); - fwrite(node_buffer->tmp_partial_sax_buffer[i], - sizeof(sax_type), sax_segments, partial_file); - } - //free(midium_ptr); - fclose(partial_file); - + fwrite(node_buffer->tmp_partial_position_buffer[i], sizeof(file_position_type), 1, partial_file); + fwrite(node_buffer->tmp_partial_sax_buffer[i], sizeof(sax_type), sax_segments, partial_file); + } + fclose(partial_file); free(partial_filename); } + return SUCCESS; } -enum response clear_node_buffer(isax_node_buffer *node_buffer, - enum buffer_cleaning_mode clean_mode) -{ - - // ONLY SELECTIVELY CLEAR STUFF THAT COME FROM THE INSERT - // TO INDEX FUNCTION BECAUSE THEY MAY COME FROM REUSABLE + +enum response clear_node_buffer(isax_node_buffer *node_buffer, enum buffer_cleaning_mode clean_mode) { + // ONLY SELECTIVELY CLEAR STUFF THAT COME FROM THE INSERT + // TO INDEX FUNCTION BECAUSE THEY MAY COME FROM REUSABLE // MEMORY SEGMENTS SUCH AS THE FBL BUFFERS WHICH ARE USED - // AGAIN FOR THE NEXT EPOC OF DATA LOADING WITHOUT BEING + // AGAIN FOR THE NEXT EPOC OF DATA LOADING WITHOUT BEING // FREED. int i; - if (clean_mode == FULL_CLEAN || clean_mode == TMP_AND_TS_CLEAN) - for (i = 0; i < node_buffer->full_buffer_size; i++) { - if (clean_mode == FULL_CLEAN || clean_mode == TMP_AND_TS_CLEAN) - { - // IMPORTANT: THIS MEANS THAT NOBODY SHOULD INSERT A FULL TS FROM SHARED MEMORY - // THE TS_BUFFER WILL *ALWAYS* BE CLEARED! AND AN INVALID FREE WILL BE RAISED! - free(node_buffer->full_ts_buffer[i]); - } - - if (clean_mode == FULL_CLEAN) { - free(node_buffer->full_sax_buffer[i]); - free(node_buffer->full_position_buffer[i]); + + if (clean_mode == FULL_CLEAN || clean_mode == TMP_AND_TS_CLEAN) { + for (i = 0; i < node_buffer->full_buffer_size; i++) { + if (clean_mode == FULL_CLEAN || clean_mode == TMP_AND_TS_CLEAN) { + // IMPORTANT: THIS MEANS THAT NOBODY SHOULD INSERT A FULL TS FROM SHARED MEMORY + // THE TS_BUFFER WILL *ALWAYS* BE CLEARED! AND AN INVALID FREE WILL BE RAISED! + free(node_buffer->full_ts_buffer[i]); + } + + if (clean_mode == FULL_CLEAN) { + free(node_buffer->full_sax_buffer[i]); + free(node_buffer->full_position_buffer[i]); + } } } - - if (clean_mode == FULL_CLEAN) - for (i = 0; i < node_buffer->partial_buffer_size; i++) { - if (clean_mode == FULL_CLEAN) { - free(node_buffer->partial_sax_buffer[i]); - free(node_buffer->partial_position_buffer[i]); + + if (clean_mode == FULL_CLEAN) { + for (i = 0; i < node_buffer->partial_buffer_size; i++) { + if (clean_mode == FULL_CLEAN) { + free(node_buffer->partial_sax_buffer[i]); + free(node_buffer->partial_position_buffer[i]); + } } } - + // FULL CLEAN TEMPORARY STUFF for (i = 0; i < node_buffer->tmp_full_buffer_size; i++) { free(node_buffer->tmp_full_ts_buffer[i]); free(node_buffer->tmp_full_sax_buffer[i]); free(node_buffer->tmp_full_position_buffer[i]); - } + } + for (i = 0; i < node_buffer->tmp_partial_buffer_size; i++) { free(node_buffer->tmp_partial_sax_buffer[i]); free(node_buffer->tmp_partial_position_buffer[i]); } - + // Set to 0 so that the LBLs will be refilled. - node_buffer->tmp_full_buffer_size = 0; node_buffer->full_buffer_size = 0; node_buffer->tmp_partial_buffer_size = 0; node_buffer->partial_buffer_size = 0; - - + return SUCCESS; } diff --git a/src/ads/isax_node_record.c b/src/ads/isax_node_record.c index 58983530..d495339b 100644 --- a/src/ads/isax_node_record.c +++ b/src/ads/isax_node_record.c @@ -11,33 +11,37 @@ #include "ads/isax_node_record.h" -isax_node_record * isax_node_record_init(int sax_size, int ts_size, - enum insertion_mode mode) -{ - isax_node_record *record = malloc(sizeof(isax_node_record)); - if(record == NULL) { - fprintf(stderr,"error: could not allocate memory for new record.\n"); +isax_node_record * isax_node_record_init(int sax_size, int ts_size, enum insertion_mode mode) { + isax_node_record *record = (isax_node_record*)malloc(sizeof(isax_node_record)); + + if (record == NULL) { + fprintf(stderr, "error: could not allocate memory for new record.\n"); + return NULL; } - record->sax = malloc(sizeof(sax_type) * sax_size); - if(record->sax == NULL) { - fprintf(stderr,"error: could not allocate memory for new record's sax representation.\n"); + + record->sax = (sax_type*)malloc(sizeof(sax_type) * sax_size); + + if (record->sax == NULL) { + fprintf(stderr, "error: could not allocate memory for new record's sax representation.\n"); + return NULL; } - - record->ts = malloc(sizeof(ts_type) * ts_size); - if(record->ts == NULL) { - fprintf(stderr,"error: could not allocate memory for new record's raw time series.\n"); + + record->ts = (ts_type*)malloc(sizeof(ts_type) * ts_size); + + if (record->ts == NULL) { + fprintf(stderr, "error: could not allocate memory for new record's raw time series.\n"); + return NULL; } - + record->insertion_mode = mode; - + return record; } -void isax_node_record_destroy(isax_node_record *node) -{ +void isax_node_record_destroy(isax_node_record *node) { free(node->sax); free(node->ts); free(node); diff --git a/src/ads/isax_node_split.c b/src/ads/isax_node_split.c index 29f5e306..c4de2522 100644 --- a/src/ads/isax_node_split.c +++ b/src/ads/isax_node_split.c @@ -19,86 +19,85 @@ #include "ads/isax_index.h" #include "ads/isax_node_split.h" -int simple_split_decision(isax_node_split_data *split_data, - isax_index_settings *settings) { - if (split_data->split_mask[0] == 0) +int simple_split_decision(isax_node_split_data *split_data, isax_index_settings *settings) { + if (split_data->split_mask[0] == 0) { return 0; + } split_data->splitpoint = 1; + while (split_data->splitpoint < settings->paa_segments) { if (split_data->split_mask[split_data->splitpoint] < - split_data->split_mask[split_data->splitpoint - 1]) { - + split_data->split_mask[split_data->splitpoint - 1]) { return split_data->splitpoint; } + split_data->splitpoint++; } return 0; } -int informed_split_decision(isax_node_split_data *split_data, - isax_index_settings *settings, - isax_node_record *records_buffer, - int records_buffer_size) { - double *segment_mean = malloc(sizeof(double) * settings->paa_segments); - double *segment_stdev = malloc(sizeof(double) * settings->paa_segments); +int informed_split_decision(isax_node_split_data *split_data, isax_index_settings *settings, + isax_node_record *records_buffer, int records_buffer_size) { + double *segment_mean = (double*)malloc(sizeof(double) * settings->paa_segments); + double *segment_stdev = (double*)malloc(sizeof(double) * settings->paa_segments); + int i; + int j; - int i, j; for (i = 0; i < settings->paa_segments; i++) { segment_mean[i] = 0; segment_stdev[i] = 0; } + for (i = 0; i < records_buffer_size; i++) { for (j = 0; j < settings->paa_segments; j++) { segment_mean[j] += (int) records_buffer[i].sax[j]; - } } + for (i = 0; i < settings->paa_segments; i++) { segment_mean[i] /= (records_buffer_size); - //printf("mean: %lf\n", segment_mean[i]); } + for (i = 0; i < records_buffer_size; i++) { for (j = 0; j < settings->paa_segments; j++) { segment_stdev[j] += pow(segment_mean[j] - (int) records_buffer[i].sax[j], 2); } } + for (i = 0; i < settings->paa_segments; i++) { segment_stdev[i] = sqrt(segment_stdev[i] / (records_buffer_size)); - //printf("stdev: %lf\n", segment_stdev[i]); } - - // Decide split point based on the above calculations int segment_to_split = -1; int segment_to_split_b = -1; + for (i = 0; i < settings->paa_segments; i++) { if (split_data->split_mask[i] + 1 > settings->sax_bit_cardinality - 1) { continue; } else { - // TODO: Optimize this. + // TODO(someone): Optimize this. // Calculate break point for new cardinality, a bit complex. int new_bit_cardinality = split_data->split_mask[i] + 1; int break_point_id = records_buffer[0].sax[i]; - break_point_id = (break_point_id >> ((settings->sax_bit_cardinality) - - (new_bit_cardinality))) << 1; + break_point_id = (break_point_id >> ((settings->sax_bit_cardinality) - (new_bit_cardinality))) << 1; int new_cardinality = pow(2, new_bit_cardinality + 1); int right_offset = ((new_cardinality - 1) * (new_cardinality - 2)) / 2 - + new_cardinality - 2; + + new_cardinality - 2; float b = sax_breakpoints[right_offset - break_point_id]; if (segment_to_split == -1) { segment_to_split = i; segment_to_split_b = b; + continue; } float left_range = segment_mean[i] - (3 * segment_stdev[i]); float right_range = segment_mean[i] + (3 * segment_stdev[i]); - //printf("%d, %lf -- %lf \n", i, left_range, right_range); if (left_range <= b && b <= right_range) { if (abs(segment_mean[i] - b) <= abs(segment_mean[i] - segment_to_split_b)) { @@ -111,15 +110,16 @@ int informed_split_decision(isax_node_split_data *split_data, free(segment_mean); free(segment_stdev); + return segment_to_split; } - void split_node(isax_index *index, isax_node *node) { - // ******************************************************* + // ******************************************************* // CREATE TWO NEW NODES AND SET OLD ONE AS AN INTERMEDIATE - // ******************************************************* - int i, sktting; + // ******************************************************* + int i; + int sktting; #ifdef DEBUG printf("*** Splitting. ***\n\n"); @@ -127,8 +127,7 @@ void split_node(isax_index *index, isax_node *node) { #ifdef DEBUG if (!node->is_leaf) { - fprintf(stderr,"sanity error: You are trying to split something weird...\ - ARE YOU TRYING TO KILL ME?\n"); + fprintf(stderr, "sanity error: You are trying to split something weird... ARE YOU TRYING TO KILL ME?\n"); } #endif @@ -136,11 +135,14 @@ void split_node(isax_index *index, isax_node *node) { node->leaf_size = 0; // Create split_data for this node. - isax_node_split_data *split_data = malloc(sizeof(isax_node_split_data)); + isax_node_split_data *split_data = (isax_node_split_data*)malloc(sizeof(isax_node_split_data)); + if (split_data == NULL) { fprintf(stderr, "error: could not allocate memory for node split data.\n"); } - split_data->split_mask = malloc(sizeof(sax_type) * index->settings->paa_segments); + + split_data->split_mask = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + if (split_data->split_mask == NULL) { fprintf(stderr, "error: could not allocate memory for node split mask.\n"); } @@ -149,6 +151,7 @@ void split_node(isax_index *index, isax_node *node) { for (i = 0; i < index->settings->paa_segments; i++) { split_data->split_mask[i] = 0; } + split_data->splitpoint = 0; } else { for (i = 0; i < index->settings->paa_segments; i++) { @@ -168,120 +171,120 @@ void split_node(isax_index *index, isax_node *node) { node->left_child = left_child; node->right_child = right_child; - - // ############ S P L I T D A T A ############# // Allocating 1 more position to cover any off-sized allocations happening due to // trying to load one more record from a fetched file page which does not exist. // e.g. line 284 ( if(!fread... ) - isax_node_record *split_buffer = malloc(sizeof(isax_node_record) * - (index->settings->max_leaf_size + 1)); + isax_node_record *split_buffer = (isax_node_record*)malloc(sizeof(isax_node_record) * + (index->settings->max_leaf_size + 1)); int split_buffer_index = 0; - - // ******************************************************** // SPLIT SAX BUFFERS CONTAINED IN *RAM* AND PUT IN CHILDREN - // ******************************************************** + // ******************************************************** // Split both sax and ts data and move to the new leafs - if (node->buffer->full_buffer_size > 0) + if (node->buffer->full_buffer_size > 0) { for (i = node->buffer->full_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->full_sax_buffer[i]; split_buffer[split_buffer_index].ts = node->buffer->full_ts_buffer[i]; split_buffer[split_buffer_index].position = node->buffer->full_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = NO_TMP | FULL; + split_buffer[split_buffer_index].insertion_mode = FULL_OR_NO_TMP; split_buffer_index++; } + } + node->buffer->full_buffer_size = 0; - if (node->buffer->partial_buffer_size > 0) + if (node->buffer->partial_buffer_size > 0) { for (i = node->buffer->partial_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->partial_sax_buffer[i]; split_buffer[split_buffer_index].ts = NULL; split_buffer[split_buffer_index].position = node->buffer->partial_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = NO_TMP | PARTIAL; + split_buffer[split_buffer_index].insertion_mode = PARTIAL_OR_NO_TMP; split_buffer_index++; } + } + node->buffer->partial_buffer_size = 0; - if (node->buffer->tmp_full_buffer_size > 0) + if (node->buffer->tmp_full_buffer_size > 0) { for (i = node->buffer->tmp_full_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->tmp_full_sax_buffer[i]; split_buffer[split_buffer_index].ts = node->buffer->tmp_full_ts_buffer[i]; split_buffer[split_buffer_index].position = node->buffer->tmp_full_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = TMP | FULL; + split_buffer[split_buffer_index].insertion_mode = TMP_OR_FULL; split_buffer_index++; } + } + node->buffer->tmp_full_buffer_size = 0; - if (node->buffer->tmp_partial_buffer_size > 0) + if (node->buffer->tmp_partial_buffer_size > 0) { for (i = node->buffer->tmp_partial_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->tmp_partial_sax_buffer[i]; split_buffer[split_buffer_index].ts = NULL; split_buffer[split_buffer_index].position = node->buffer->tmp_partial_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = TMP | PARTIAL; + split_buffer[split_buffer_index].insertion_mode = PARTIAL_OR_TMP; split_buffer_index++; - } - node->buffer->tmp_partial_buffer_size = 0; + } + node->buffer->tmp_partial_buffer_size = 0; destroy_node_buffer(node->buffer); node->buffer = NULL; - // ***************************************************** // SPLIT BUFFERS CONTAINED ON *DISK* AND PUT IN CHILDREN - // ***************************************************** + // ***************************************************** // File is split in two files but it is not // removed from disk. It is going to be used in the end. if (node->filename != NULL) { - char *full_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + char *full_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(full_fname, node->filename); strcat(full_fname, ".full"); - //COUNT_INPUT_TIME_START FILE *full_file = fopen(full_fname, "r"); - //COUNT_INPUT_TIME_END // If it can't open exit; if (full_file != NULL) { - #ifdef DEBUG printf("*** Splitting: %s\n\n", full_fname); #endif - //COUNT_INPUT_TIME_START + while (!feof(full_file)) { - split_buffer[split_buffer_index].position = malloc(index->settings->position_byte_size); - split_buffer[split_buffer_index].sax = malloc(index->settings->sax_byte_size); - split_buffer[split_buffer_index].ts = malloc(index->settings->ts_byte_size); - split_buffer[split_buffer_index].insertion_mode = FULL | TMP; + split_buffer[split_buffer_index].position = (file_position_type*)malloc(index->settings->position_byte_size); + split_buffer[split_buffer_index].sax = (sax_type*)malloc(index->settings->sax_byte_size); + split_buffer[split_buffer_index].ts = (ts_type*)malloc(index->settings->ts_byte_size); + split_buffer[split_buffer_index].insertion_mode = TMP_OR_FULL; // If it can't read continue. - if (!fread(split_buffer[split_buffer_index].position, sizeof(file_position_type), - 1, full_file)) { + if (!fread(split_buffer[split_buffer_index].position, sizeof(file_position_type), 1, full_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); + continue; } else { if (!fread(split_buffer[split_buffer_index].sax, sizeof(sax_type), - index->settings->paa_segments, full_file)) { + index->settings->paa_segments, full_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); free(split_buffer[split_buffer_index].sax); free(split_buffer[split_buffer_index].ts); + continue; } else { if (!fread(split_buffer[split_buffer_index].sax, sizeof(ts_type), - index->settings->timeseries_size, full_file)) { + index->settings->timeseries_size, full_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); free(split_buffer[split_buffer_index].sax); free(split_buffer[split_buffer_index].ts); + continue; } else { - // Increase leaf size (from 0) so that we keep track how many raw time series we + // Increase leaf size (from 0) so that we keep track how many raw time series we // have to move in the finalization step. node->leaf_size++; split_buffer_index++; @@ -290,7 +293,6 @@ void split_node(isax_index *index, isax_node *node) { } } } - //COUNT_INPUT_TIME_END #ifdef DEBUG printf("*** END OF: %s\n\n", full_fname); @@ -298,34 +300,30 @@ void split_node(isax_index *index, isax_node *node) { COUNT_OUTPUT_TIME_START remove(full_fname); COUNT_OUTPUT_TIME_END - //COUNT_INPUT_TIME_START fclose(full_file); - //COUNT_INPUT_TIME_END } + free(full_fname); - char *partial_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + char *partial_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(partial_fname, node->filename); strcat(partial_fname, ".part"); - //COUNT_INPUT_TIME_START FILE *partial_file = fopen(partial_fname, "r"); - //COUNT_INPUT_TIME_END // If it can't open exit; if (partial_file != NULL) { - #ifdef DEBUG printf("*** Splitting: %s\n\n", partial_fname); #endif - //COUNT_INPUT_TIME_START while (!feof(partial_file)) { - split_buffer[split_buffer_index].position = malloc(index->settings->position_byte_size); - split_buffer[split_buffer_index].sax = malloc(index->settings->sax_byte_size); - split_buffer[split_buffer_index].insertion_mode = PARTIAL | TMP; + split_buffer[split_buffer_index].position = (file_position_type*)malloc(index->settings->position_byte_size); + split_buffer[split_buffer_index].sax = (sax_type*)malloc(index->settings->sax_byte_size); + split_buffer[split_buffer_index].insertion_mode = PARTIAL_OR_TMP; + // If it can't read continue. if (!fread(split_buffer[split_buffer_index].position, sizeof(file_position_type), - 1, partial_file)) { + 1, partial_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); free(split_buffer[split_buffer_index].sax); @@ -333,10 +331,11 @@ void split_node(isax_index *index, isax_node *node) { continue; } else { if (!fread(split_buffer[split_buffer_index].sax, sizeof(sax_type), - index->settings->paa_segments, partial_file)) { + index->settings->paa_segments, partial_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); free(split_buffer[split_buffer_index].sax); + continue; } else { node->leaf_size++; @@ -345,54 +344,41 @@ void split_node(isax_index *index, isax_node *node) { } } } - //COUNT_INPUT_TIME_END + COUNT_OUTPUT_TIME_START remove(partial_fname); COUNT_OUTPUT_TIME_END - //COUNT_INPUT_TIME_START - //printf("this is before sktting\n"); sktting = fclose(partial_file); - //printf("this is skating%d\n",sktting); - //COUNT_INPUT_TIME_END } free(partial_fname); } - //printf("sizeof split buffer: %d\n", split_buffer_index); // Insert buffered data in children - - // Decide split point... - //printf("informed decision: %d\n", - // informed_split_decision(split_data, index->settings, split_buffer, (split_buffer_index))); split_data->splitpoint = informed_split_decision(split_data, index->settings, split_buffer, (split_buffer_index)); // Decide split point... - //split_data->splitpoint = simple_split_decision(split_data, index->settings); - //printf("not informed decision: %d\n", split_data->splitpoint); if (split_data->splitpoint < 0) { - //fprintf(stderr, "error 1: cannot split in depth more than %d.\n", - // index->settings->sax_bit_cardinality); - // exit(-1); return; } if (++split_data->split_mask[split_data->splitpoint] > index->settings->sax_bit_cardinality - 1) { fprintf(stderr, "error 2: cannot split in depth more than %d.\n", index->settings->sax_bit_cardinality); + exit(-1); } root_mask_type mask = index->settings->bit_masks[index->settings->sax_bit_cardinality - split_data->split_mask[split_data->splitpoint] - 1]; - while (split_buffer_index > 0) { split_buffer_index--; + if (mask & split_buffer[split_buffer_index].sax[split_data->splitpoint]) { add_record_to_node(index, right_child, &split_buffer[split_buffer_index], 1); } else { @@ -401,14 +387,14 @@ void split_node(isax_index *index, isax_node *node) { } free(split_buffer); - //printf("Splitted\n"); } void split_node_inmemory(isax_index *index, isax_node *node) { - // ******************************************************* + // ******************************************************* // CREATE TWO NEW NODES AND SET OLD ONE AS AN INTERMEDIATE - // ******************************************************* - int i, sktting; + // ******************************************************* + int i; + int sktting; #ifdef DEBUG printf("*** Splitting. ***\n\n"); @@ -416,8 +402,7 @@ void split_node_inmemory(isax_index *index, isax_node *node) { #ifdef DEBUG if (!node->is_leaf) { - fprintf(stderr,"sanity error: You are trying to split something weird...\ - ARE YOU TRYING TO KILL ME?\n"); + fprintf(stderr, "sanity error: You are trying to split something weird... ARE YOU TRYING TO KILL ME?\n"); } #endif @@ -425,11 +410,14 @@ void split_node_inmemory(isax_index *index, isax_node *node) { node->leaf_size = 0; // Create split_data for this node. - isax_node_split_data *split_data = malloc(sizeof(isax_node_split_data)); + isax_node_split_data *split_data = (isax_node_split_data*)malloc(sizeof(isax_node_split_data)); + if (split_data == NULL) { fprintf(stderr, "error: could not allocate memory for node split data.\n"); } - split_data->split_mask = malloc(sizeof(sax_type) * index->settings->paa_segments); + + split_data->split_mask = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + if (split_data->split_mask == NULL) { fprintf(stderr, "error: could not allocate memory for node split mask.\n"); } @@ -438,6 +426,7 @@ void split_node_inmemory(isax_index *index, isax_node *node) { for (i = 0; i < index->settings->paa_segments; i++) { split_data->split_mask[i] = 0; } + split_data->splitpoint = 0; } else { for (i = 0; i < index->settings->paa_segments; i++) { @@ -457,109 +446,103 @@ void split_node_inmemory(isax_index *index, isax_node *node) { node->left_child = left_child; node->right_child = right_child; - - // ############ S P L I T D A T A ############# // Allocating 1 more position to cover any off-sized allocations happening due to // trying to load one more record from a fetched file page which does not exist. // e.g. line 284 ( if(!fread... ) - isax_node_record *split_buffer = malloc(sizeof(isax_node_record) * - (index->settings->max_leaf_size + 1)); + isax_node_record *split_buffer = (isax_node_record*)malloc(sizeof(isax_node_record) * + (index->settings->max_leaf_size + 1)); int split_buffer_index = 0; - - // ******************************************************** // SPLIT SAX BUFFERS CONTAINED IN *RAM* AND PUT IN CHILDREN - // ******************************************************** + // ******************************************************** // Split both sax and ts data and move to the new leafs - if (node->buffer->full_buffer_size > 0) + if (node->buffer->full_buffer_size > 0) { for (i = node->buffer->full_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->full_sax_buffer[i]; split_buffer[split_buffer_index].ts = node->buffer->full_ts_buffer[i]; split_buffer[split_buffer_index].position = node->buffer->full_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = NO_TMP | FULL; + split_buffer[split_buffer_index].insertion_mode = FULL_OR_NO_TMP; split_buffer_index++; } + } + node->buffer->full_buffer_size = 0; - if (node->buffer->partial_buffer_size > 0) + if (node->buffer->partial_buffer_size > 0) { for (i = node->buffer->partial_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->partial_sax_buffer[i]; split_buffer[split_buffer_index].ts = NULL; split_buffer[split_buffer_index].position = node->buffer->partial_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = NO_TMP | PARTIAL; + split_buffer[split_buffer_index].insertion_mode = PARTIAL_OR_NO_TMP; split_buffer_index++; } + } + node->buffer->partial_buffer_size = 0; - if (node->buffer->tmp_full_buffer_size > 0) + if (node->buffer->tmp_full_buffer_size > 0) { for (i = node->buffer->tmp_full_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->tmp_full_sax_buffer[i]; split_buffer[split_buffer_index].ts = node->buffer->tmp_full_ts_buffer[i]; split_buffer[split_buffer_index].position = node->buffer->tmp_full_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = TMP | FULL; + split_buffer[split_buffer_index].insertion_mode = TMP_OR_FULL; split_buffer_index++; } + } + node->buffer->tmp_full_buffer_size = 0; - if (node->buffer->tmp_partial_buffer_size > 0) + if (node->buffer->tmp_partial_buffer_size > 0) { for (i = node->buffer->tmp_partial_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->tmp_partial_sax_buffer[i]; split_buffer[split_buffer_index].ts = NULL; split_buffer[split_buffer_index].position = node->buffer->tmp_partial_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = TMP | PARTIAL; + split_buffer[split_buffer_index].insertion_mode = PARTIAL_OR_TMP; split_buffer_index++; - } - node->buffer->tmp_partial_buffer_size = 0; + } + node->buffer->tmp_partial_buffer_size = 0; destroy_node_buffer(node->buffer); node->buffer = NULL; - // ***************************************************** // SPLIT BUFFERS CONTAINED ON *DISK* AND PUT IN CHILDREN - // ***************************************************** + // ***************************************************** // File is split in two files but it is not // removed from disk. It is going to be used in the end. - - //printf("sizeof split buffer: %d\n", split_buffer_index); // Insert buffered data in children - // Decide split point... - //printf("informed decision: %d\n", - // informed_split_decision(split_data, index->settings, split_buffer, (split_buffer_index))); - split_data->splitpoint = informed_split_decision(split_data, index->settings, split_buffer, (split_buffer_index)); // Decide split point... - //split_data->splitpoint = simple_split_decision(split_data, index->settings); - - //printf("not informed decision: %d\n", split_data->splitpoint); if (split_data->splitpoint < 0) { fprintf(stderr, "error: cannot split in depth more than %d.\n", index->settings->sax_bit_cardinality); + exit(-1); } if (++split_data->split_mask[split_data->splitpoint] > index->settings->sax_bit_cardinality - 1) { fprintf(stderr, "error: cannot split in depth more than %d.\n", index->settings->sax_bit_cardinality); + exit(-1); } root_mask_type mask = index->settings->bit_masks[index->settings->sax_bit_cardinality - split_data->split_mask[split_data->splitpoint] - 1]; - while (split_buffer_index > 0) { split_buffer_index--; + if (mask & split_buffer[split_buffer_index].sax[split_data->splitpoint]) { add_record_to_node(index, right_child, &split_buffer[split_buffer_index], 1); } else { @@ -568,16 +551,14 @@ void split_node_inmemory(isax_index *index, isax_node *node) { } free(split_buffer); - //printf("Splitted\n"); - } - void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_index) { - // ******************************************************* + // ******************************************************* // CREATE TWO NEW NODES AND SET OLD ONE AS AN INTERMEDIATE - // ******************************************************* - int i, sktting; + // ******************************************************* + int i; + int sktting; #ifdef DEBUG printf("*** Splitting. ***\n\n"); @@ -585,8 +566,7 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde #ifdef DEBUG if (!node->is_leaf) { - fprintf(stderr,"sanity error: You are trying to split something weird...\ - ARE YOU TRYING TO KILL ME?\n"); + fprintf(stderr, "sanity error: You are trying to split something weird... ARE YOU TRYING TO KILL ME?\n"); } #endif @@ -594,11 +574,14 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde node->leaf_size = 0; // Create split_data for this node. - isax_node_split_data *split_data = malloc(sizeof(isax_node_split_data)); + isax_node_split_data *split_data = (isax_node_split_data*)malloc(sizeof(isax_node_split_data)); + if (split_data == NULL) { fprintf(stderr, "error: could not allocate memory for node split data.\n"); } - split_data->split_mask = malloc(sizeof(sax_type) * index->settings->paa_segments); + + split_data->split_mask = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); + if (split_data->split_mask == NULL) { fprintf(stderr, "error: could not allocate memory for node split mask.\n"); } @@ -607,12 +590,14 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde for (i = 0; i < index->settings->paa_segments; i++) { split_data->split_mask[i] = 0; } + split_data->splitpoint = 0; } else { for (i = 0; i < index->settings->paa_segments; i++) { split_data->split_mask[i] = node->parent->split_data->split_mask[i]; } } + pthread_mutex_lock(lock_index); index->memory_info.mem_tree_structure += 2; pthread_mutex_unlock(lock_index); @@ -627,120 +612,121 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde node->left_child = left_child; node->right_child = right_child; - - // ############ S P L I T D A T A ############# // Allocating 1 more position to cover any off-sized allocations happening due to // trying to load one more record from a fetched file page which does not exist. // e.g. line 284 ( if(!fread... ) - isax_node_record *split_buffer = malloc(sizeof(isax_node_record) * - (index->settings->max_leaf_size + 1)); + isax_node_record *split_buffer = (isax_node_record*)malloc(sizeof(isax_node_record) * + (index->settings->max_leaf_size + 1)); int split_buffer_index = 0; - - // ******************************************************** // SPLIT SAX BUFFERS CONTAINED IN *RAM* AND PUT IN CHILDREN - // ******************************************************** + // ******************************************************** // Split both sax and ts data and move to the new leafs - if (node->buffer->full_buffer_size > 0) + if (node->buffer->full_buffer_size > 0) { for (i = node->buffer->full_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->full_sax_buffer[i]; split_buffer[split_buffer_index].ts = node->buffer->full_ts_buffer[i]; split_buffer[split_buffer_index].position = node->buffer->full_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = NO_TMP | FULL; + split_buffer[split_buffer_index].insertion_mode = FULL_OR_NO_TMP; split_buffer_index++; } + } + node->buffer->full_buffer_size = 0; - if (node->buffer->partial_buffer_size > 0) + if (node->buffer->partial_buffer_size > 0) { for (i = node->buffer->partial_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->partial_sax_buffer[i]; split_buffer[split_buffer_index].ts = NULL; split_buffer[split_buffer_index].position = node->buffer->partial_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = NO_TMP | PARTIAL; + split_buffer[split_buffer_index].insertion_mode = PARTIAL_OR_NO_TMP; split_buffer_index++; } + } + node->buffer->partial_buffer_size = 0; - if (node->buffer->tmp_full_buffer_size > 0) + if (node->buffer->tmp_full_buffer_size > 0) { for (i = node->buffer->tmp_full_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->tmp_full_sax_buffer[i]; split_buffer[split_buffer_index].ts = node->buffer->tmp_full_ts_buffer[i]; split_buffer[split_buffer_index].position = node->buffer->tmp_full_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = TMP | FULL; + split_buffer[split_buffer_index].insertion_mode = TMP_OR_FULL; split_buffer_index++; } + } + node->buffer->tmp_full_buffer_size = 0; - if (node->buffer->tmp_partial_buffer_size > 0) + if (node->buffer->tmp_partial_buffer_size > 0) { for (i = node->buffer->tmp_partial_buffer_size - 1; i >= 0; i--) { split_buffer[split_buffer_index].sax = node->buffer->tmp_partial_sax_buffer[i]; split_buffer[split_buffer_index].ts = NULL; split_buffer[split_buffer_index].position = node->buffer->tmp_partial_position_buffer[i]; - split_buffer[split_buffer_index].insertion_mode = TMP | PARTIAL; + split_buffer[split_buffer_index].insertion_mode = PARTIAL_OR_TMP; split_buffer_index++; - } - node->buffer->tmp_partial_buffer_size = 0; + } + node->buffer->tmp_partial_buffer_size = 0; destroy_node_buffer(node->buffer); node->buffer = NULL; - // ***************************************************** // SPLIT BUFFERS CONTAINED ON *DISK* AND PUT IN CHILDREN - // ***************************************************** + // ***************************************************** // File is split in two files but it is not // removed from disk. It is going to be used in the end. if (node->filename != NULL) { - char *full_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + char *full_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(full_fname, node->filename); strcat(full_fname, ".full"); - //COUNT_INPUT_TIME_START FILE *full_file = fopen(full_fname, "r"); - //COUNT_INPUT_TIME_END // If it can't open exit; if (full_file != NULL) { - #ifdef DEBUG printf("*** Splitting: %s\n\n", full_fname); #endif - //COUNT_INPUT_TIME_START + while (!feof(full_file)) { - split_buffer[split_buffer_index].position = malloc(index->settings->position_byte_size); - split_buffer[split_buffer_index].sax = malloc(index->settings->sax_byte_size); - split_buffer[split_buffer_index].ts = malloc(index->settings->ts_byte_size); - split_buffer[split_buffer_index].insertion_mode = FULL | TMP; + split_buffer[split_buffer_index].position = (file_position_type*)malloc(index->settings->position_byte_size); + split_buffer[split_buffer_index].sax = (sax_type*)malloc(index->settings->sax_byte_size); + split_buffer[split_buffer_index].ts = (ts_type*)malloc(index->settings->ts_byte_size); + split_buffer[split_buffer_index].insertion_mode = TMP_OR_FULL; // If it can't read continue. - if (!fread(split_buffer[split_buffer_index].position, sizeof(file_position_type), - 1, full_file)) { + if (!fread(split_buffer[split_buffer_index].position, + sizeof(file_position_type), 1, full_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); + continue; } else { if (!fread(split_buffer[split_buffer_index].sax, sizeof(sax_type), - index->settings->paa_segments, full_file)) { + index->settings->paa_segments, full_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); free(split_buffer[split_buffer_index].sax); free(split_buffer[split_buffer_index].ts); + continue; } else { if (!fread(split_buffer[split_buffer_index].sax, sizeof(ts_type), - index->settings->timeseries_size, full_file)) { + index->settings->timeseries_size, full_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); free(split_buffer[split_buffer_index].sax); free(split_buffer[split_buffer_index].ts); + continue; } else { - // Increase leaf size (from 0) so that we keep track how many raw time series we + // Increase leaf size (from 0) so that we keep track how many raw time series we // have to move in the finalization step. node->leaf_size++; split_buffer_index++; @@ -751,7 +737,6 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde } } } - //COUNT_INPUT_TIME_END #ifdef DEBUG printf("*** END OF: %s\n\n", full_fname); @@ -759,34 +744,30 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde COUNT_OUTPUT_TIME_START remove(full_fname); COUNT_OUTPUT_TIME_END - //COUNT_INPUT_TIME_START fclose(full_file); - //COUNT_INPUT_TIME_END } + free(full_fname); - char *partial_fname = malloc(sizeof(char) * (strlen(node->filename) + 6)); + char *partial_fname = (char*)malloc(sizeof(char) * (strlen(node->filename) + 6)); strcpy(partial_fname, node->filename); strcat(partial_fname, ".part"); - //COUNT_INPUT_TIME_START FILE *partial_file = fopen(partial_fname, "r"); - //COUNT_INPUT_TIME_END // If it can't open exit; if (partial_file != NULL) { - #ifdef DEBUG printf("*** Splitting: %s\n\n", partial_fname); #endif - //COUNT_INPUT_TIME_START while (!feof(partial_file)) { - split_buffer[split_buffer_index].position = malloc(index->settings->position_byte_size); - split_buffer[split_buffer_index].sax = malloc(index->settings->sax_byte_size); - split_buffer[split_buffer_index].insertion_mode = PARTIAL | TMP; + split_buffer[split_buffer_index].position = (file_position_type*)malloc(index->settings->position_byte_size); + split_buffer[split_buffer_index].sax = (sax_type*)malloc(index->settings->sax_byte_size); + split_buffer[split_buffer_index].insertion_mode = PARTIAL_OR_TMP; // If it can't read continue. - if (!fread(split_buffer[split_buffer_index].position, sizeof(file_position_type), - 1, partial_file)) { + + if (!fread(split_buffer[split_buffer_index].position, + sizeof(file_position_type), 1, partial_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); free(split_buffer[split_buffer_index].sax); @@ -794,10 +775,11 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde continue; } else { if (!fread(split_buffer[split_buffer_index].sax, sizeof(sax_type), - index->settings->paa_segments, partial_file)) { + index->settings->paa_segments, partial_file)) { // Free because it is not inserted in the tree free(split_buffer[split_buffer_index].position); free(split_buffer[split_buffer_index].sax); + continue; } else { node->leaf_size++; @@ -806,53 +788,42 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde } } } - //COUNT_INPUT_TIME_END + COUNT_OUTPUT_TIME_START remove(partial_fname); COUNT_OUTPUT_TIME_END - //COUNT_INPUT_TIME_START - //printf("this is before sktting\n"); - sktting = fclose(partial_file); - //printf("this is skating%d\n",sktting); - //COUNT_INPUT_TIME_END } free(partial_fname); } - //printf("sizeof split buffer: %d\n", split_buffer_index); // Insert buffered data in children - // Decide split point... - //printf("informed decision: %d\n", - // informed_split_decision(split_data, index->settings, split_buffer, (split_buffer_index))); - split_data->splitpoint = informed_split_decision(split_data, index->settings, split_buffer, (split_buffer_index)); // Decide split point... - //split_data->splitpoint = simple_split_decision(split_data, index->settings); - - //printf("not informed decision: %d\n", split_data->splitpoint); if (split_data->splitpoint < 0) { fprintf(stderr, "error: cannot split in depth more than %d.\n", index->settings->sax_bit_cardinality); + exit(-1); } if (++split_data->split_mask[split_data->splitpoint] > index->settings->sax_bit_cardinality - 1) { fprintf(stderr, "error: cannot split in depth more than %d.\n", index->settings->sax_bit_cardinality); + exit(-1); } root_mask_type mask = index->settings->bit_masks[index->settings->sax_bit_cardinality - split_data->split_mask[split_data->splitpoint] - 1]; - while (split_buffer_index > 0) { split_buffer_index--; + if (mask & split_buffer[split_buffer_index].sax[split_data->splitpoint]) { add_record_to_node(index, right_child, &split_buffer[split_buffer_index], 1); } else { @@ -861,6 +832,4 @@ void split_node_m(isax_index *index, isax_node *node, pthread_mutex_t *lock_inde } free(split_buffer); - //printf("Splitted\n"); - -} \ No newline at end of file +} diff --git a/src/ads/isax_query_engine.c b/src/ads/isax_query_engine.c index 604c900f..df0f8a76 100644 --- a/src/ads/isax_query_engine.c +++ b/src/ads/isax_query_engine.c @@ -15,6 +15,7 @@ #include "../../config.h" #include "../../globals.h" #include +#include #include #include #include @@ -31,8 +32,8 @@ float *MINDISTS; struct args { unsigned int i; - unsigned long from; - unsigned long to; + uint32_t from; + uint32_t to; ts_type *paa; isax_index *index; }; @@ -40,287 +41,249 @@ struct args { void *compute_mindists(void *ptr) { struct args *arguments = (struct args*) ptr; - //printf("[%u] Computing mindists from: %lu to: %lu\n", arguments->i, arguments->from, arguments->to); - unsigned long i; - for(i=arguments->from; ito; i++) { + for (uint32_t i = arguments->from; i < arguments->to; i++) { sax_type *sax = &(arguments->index->sax_cache[i * arguments->index->settings->paa_segments]); MINDISTS[i] = minidist_paa_to_isax_raw(arguments->paa, sax, - arguments->index->settings->max_sax_cardinalities, - arguments->index->settings->sax_bit_cardinality, - arguments->index->settings->sax_alphabet_cardinality, - arguments->index->settings->paa_segments, MINVAL, MAXVAL, - arguments->index->settings->mindist_sqrt); + arguments->index->settings->max_sax_cardinalities, + arguments->index->settings->sax_bit_cardinality, + arguments->index->settings->sax_alphabet_cardinality, + arguments->index->settings->paa_segments, MINVAL, MAXVAL, + arguments->index->settings->mindist_sqrt); } + return NULL; } - - -query_result exact_search_serial(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves) -{ - +query_result exact_search_serial(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED // FOR THREAD USE - MINDISTS=malloc(sizeof(float) * index->sax_cache_size); - unsigned long j; - for (j = 0; j < index->sax_cache_size; j++) + MINDISTS = (float*)malloc(sizeof(float) * index->sax_cache_size); + uint32_t j; + + for (j = 0; j < index->sax_cache_size; j++) { MINDISTS[j] = FLT_MAX; + } // END - - + query_result approximate_result = approximate_search(ts, paa, index); query_result bsf_result = approximate_result; - - + int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; - + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { + + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); } - - - - unsigned long i; + + uint32_t i; COUNT_INPUT_TIME_START FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); COUNT_INPUT_TIME_END - + SET_APPROXIMATE(approximate_result.distance); // THREADED pthread_t thread[NTHREADS]; struct args arguments[NTHREADS]; - //for ( i = 0; i < 100; i++) - //{ - // printf("the sax [%d ]%d\n",i,(int)(index->sax_cache[i * index->settings->paa_segments] )); - //} - - for(i=0; isax_cache_size / NTHREADS); - if(i < (NTHREADS-1)) { - arguments[i].to = (i+1)*(index->sax_cache_size / NTHREADS); - } - else { + arguments[i].from = i * (index->sax_cache_size / NTHREADS); + + if (i < (NTHREADS - 1)) { + arguments[i].to = (i + 1) * (index->sax_cache_size / NTHREADS); + } else { arguments[i].to = index->sax_cache_size; } + arguments[i].paa = paa; arguments[i].index = index; int ret = pthread_create(&thread[i], NULL, compute_mindists, &arguments[i]); } - - for(i=0; isax_cache_size; i++) { + for (i = 0; i < index->sax_cache_size; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - if(MINDISTS[i] <= approximate_result.distance) { + if (MINDISTS[i] <= approximate_result.distance) { COUNT_INPUT_TIME_START fseek(raw_file, i * index->settings->ts_byte_size, SEEK_SET); fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); COUNT_INPUT_TIME_END - //printf(" the %d sax is : %d !!!\n",i,index->sax_cache[i* index->settings->paa_segments] ); float dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, approximate_result.distance); - if(dist < approximate_result.distance) { - + if (dist < approximate_result.distance) { approximate_result.distance = dist; - #ifdef STORE_ANSWER +#ifdef STORE_ANSWER memcpy(index->answer, ts_buffer, index->settings->timeseries_size * sizeof(ts_type)); - #endif +#endif } + INCREASE_BYTES_ACCESSED(index->settings->ts_byte_size) } } + free(ts_buffer); fclose(raw_file); free(MINDISTS); - + return approximate_result; } -pqueue_bsf exact_topk_serial(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, int k) -{ - + +pqueue_bsf exact_topk_serial(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves, int k) { RESET_BYTES_ACCESSED - pqueue_bsf *pq_bsf= pqueue_bsf_init(k); + pqueue_bsf *pq_bsf = pqueue_bsf_init(k); // FOR THREAD USE - MINDISTS=malloc(sizeof(float) * index->sax_cache_size); - unsigned long j; - for (j = 0; j < index->sax_cache_size; j++) + MINDISTS = (float*)malloc(sizeof(float) * index->sax_cache_size); + uint32_t j; + + for (j = 0; j < index->sax_cache_size; j++) { MINDISTS[j] = FLT_MAX; + } // END - - - approximate_topk(ts, paa, index,pq_bsf); - - + + approximate_topk(ts, paa, index, pq_bsf); + int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; - + // Early termination... - if (pq_bsf->knn[k-1] == 0) { + if (pq_bsf->knn[k - 1] == 0) { return *pq_bsf; } - // - if(pq_bsf->knn[k-1] == FLT_MAX || min_checked_leaves > 1) { + + if (pq_bsf->knn[k - 1] == FLT_MAX || min_checked_leaves > 1) { refine_topk_answer(ts, paa, index, pq_bsf, minimum_distance, min_checked_leaves); } - //printf("the bsf is %f\n",pq_bsf->knn[k-1] ); - - unsigned long i; + + uint32_t i; COUNT_INPUT_TIME_START FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); COUNT_INPUT_TIME_END - - SET_APPROXIMATE(pq_bsf->knn[k-1]); + + SET_APPROXIMATE(pq_bsf->knn[k - 1]); // THREADED pthread_t thread[NTHREADS]; struct args arguments[NTHREADS]; - //for ( i = 0; i < 100; i++) - //{ - // printf("the sax [%d ]%d\n",i,(int)(index->sax_cache[i * index->settings->paa_segments] )); - //} - - for(i=0; isax_cache_size / NTHREADS); - if(i < (NTHREADS-1)) { - arguments[i].to = (i+1)*(index->sax_cache_size / NTHREADS); - } - else { + arguments[i].from = i * (index->sax_cache_size / NTHREADS); + + if (i < (NTHREADS - 1)) { + arguments[i].to = (i + 1) * (index->sax_cache_size / NTHREADS); + } else { arguments[i].to = index->sax_cache_size; } + arguments[i].paa = paa; arguments[i].index = index; int ret = pthread_create(&thread[i], NULL, compute_mindists, &arguments[i]); } - - for(i=0; isax_cache_size; i++) { + for (i = 0; i < index->sax_cache_size; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - if(MINDISTS[i] <= pq_bsf->knn[k-1]) { + if (MINDISTS[i] <= pq_bsf->knn[k - 1]) { COUNT_INPUT_TIME_START fseek(raw_file, i * index->settings->ts_byte_size, SEEK_SET); fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); COUNT_INPUT_TIME_END - //printf(" the %d sax is : %d !!!\n",i,index->sax_cache[i* index->settings->paa_segments] ); - float dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, pq_bsf->knn[k-1]); - //approximate_result.distance = dist; - if (dist <= pq_bsf->knn[pq_bsf->k-1]) { - #ifdef STORE_ANSWER + float dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, pq_bsf->knn[k - 1]); + + if (dist <= pq_bsf->knn[pq_bsf->k - 1]) { +#ifdef STORE_ANSWER memcpy(index->answer, ts_buffer, index->settings->timeseries_size * sizeof(ts_type)); - #endif - - pqueue_bsf_insert(pq_bsf,dist,i,NULL); +#endif + pqueue_bsf_insert(pq_bsf, dist, i, NULL); } + INCREASE_BYTES_ACCESSED(index->settings->ts_byte_size) } } + free(ts_buffer); fclose(raw_file); free(MINDISTS); + return *pq_bsf; } ts_type * get_ads_record(unsigned long tid, isax_index *index) { - FILE *raw_file = fopen(index->settings->raw_filename, "rb"); - fseek(raw_file, 0, SEEK_SET); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + FILE *raw_file = fopen(index->settings->raw_filename, "rb"); + fseek(raw_file, 0, SEEK_SET); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); fseek(raw_file, tid * index->settings->ts_byte_size, SEEK_SET); fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); fclose(raw_file); + return ts_buffer; } - -query_result approximate_search (ts_type *ts, ts_type *paa, isax_index *index) -{ +query_result approximate_search(ts_type *ts, ts_type *paa, isax_index *index) { query_result result; - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality); root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); if (index->fbl->soft_buffers[(int) root_mask].initialized) { isax_node *node = index->fbl->soft_buffers[(int) root_mask].node; - //printf("Root: [%0#6X]\n", (unsigned long int) node); - // Traverse tree + // Traverse tree // Adaptive splitting if (node->is_leaf && !node->has_full_data_file && - (node->leaf_size > index->settings->min_leaf_size)) - { + (node->leaf_size > index->settings->min_leaf_size)) { split_node(index, node); } while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; - if(sax[node->split_data->splitpoint] & mask) - { + if (sax[node->split_data->splitpoint] & mask) { node = node->right_child; - } - else - { + } else { node = node->left_child; } // Adaptive splitting if (node->is_leaf && !node->has_full_data_file && - (node->leaf_size > index->settings->min_leaf_size)) - { + (node->leaf_size > index->settings->min_leaf_size)) { split_node(index, node); } } result.distance = calculate_node_distance(index, node, ts, FLT_MAX); - - result.node = node; - } - else { + } else { result.node = NULL; result.distance = FLT_MAX; } @@ -330,66 +293,57 @@ query_result approximate_search (ts_type *ts, ts_type *paa, isax_index *index) return result; } -query_result approximate_search_manynode (ts_type *ts, ts_type *paa, isax_index *index) -{ +query_result approximate_search_manynode(ts_type *ts, ts_type *paa, isax_index *index) { query_result result; - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); if (index->fbl->soft_buffers[(int) root_mask].initialized) { isax_node *node = index->fbl->soft_buffers[(int) root_mask].node; - //printf("Root: [%0#6X]\n", (unsigned long int) node); + // Traverse tree isax_node *node2; + // Adaptive splitting if (node->is_leaf && !node->has_full_data_file && - (node->leaf_size > index->settings->min_leaf_size)) - { + (node->leaf_size > index->settings->min_leaf_size)) { split_node(index, node); } while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; - if(sax[node->split_data->splitpoint] & mask) - { + if (sax[node->split_data->splitpoint] & mask) { node = node->right_child; - node2=node->left_child; - } - else - { + node2 = node->left_child; + } else { node = node->left_child; - node2=node->right_child; + node2 = node->right_child; } // Adaptive splitting if (node->is_leaf && !node->has_full_data_file && - (node->leaf_size > index->settings->min_leaf_size)) - { + (node->leaf_size > index->settings->min_leaf_size)) { split_node(index, node); } } result.distance = calculate_node_distance(index, node, ts, FLT_MAX); result.node = node; - float distance2=calculate_node_distance(index, node2, ts, FLT_MAX); - if(result.distance>distance2) - { - result.distance=distance2; + float distance2 = calculate_node_distance(index, node2, ts, FLT_MAX); + + if (result.distance > distance2) { + result.distance = distance2; result.node = node2; } - - - } - else { + } else { result.node = NULL; result.distance = FLT_MAX; } @@ -399,374 +353,367 @@ query_result approximate_search_manynode (ts_type *ts, ts_type *paa, isax_index return result; } - -void approximate_topk (ts_type *ts, ts_type *paa, isax_index *index, pqueue_bsf *pq_bsf) -{ - - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); +void approximate_topk(ts_type *ts, ts_type *paa, isax_index *index, pqueue_bsf *pq_bsf) { + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); if (index->fbl->soft_buffers[(int) root_mask].initialized) { isax_node *node = index->fbl->soft_buffers[(int) root_mask].node; - //printf("Root: [%0#6X]\n", (unsigned long int) node); - // Traverse tree + // Traverse tree // Adaptive splitting if (node->is_leaf && !node->has_full_data_file && - (node->leaf_size > index->settings->min_leaf_size)) - { + (node->leaf_size > index->settings->min_leaf_size)) { split_node(index, node); } while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; - if(sax[node->split_data->splitpoint] & mask) - { + if (sax[node->split_data->splitpoint] & mask) { node = node->right_child; - } - else - { + } else { node = node->left_child; } // Adaptive splitting if (node->is_leaf && !node->has_full_data_file && - (node->leaf_size > index->settings->min_leaf_size)) - { + (node->leaf_size > index->settings->min_leaf_size)) { split_node(index, node); } } calculate_node_topk(index, node, ts, pq_bsf); } - else { + for (int i = 0; i < pq_bsf->k-1; ++i) { + pq_bsf->knn[i] = pq_bsf->knn[pq_bsf->k - 1]; } - for (int i = 0; i < pq_bsf->k-1; ++i) - { - pq_bsf->knn[i]=pq_bsf->knn[pq_bsf->k-1]; - } + free(sax); } -query_result refine_answer (ts_type *ts, ts_type *paa, isax_index *index, - query_result approximate_bsf_result, - float minimum_distance, int limit) -{ - query_result bsf_result = approximate_bsf_result; - - int tight_bound = index->settings->tight_bound; - int aggressive_check = index->settings->aggressive_check; - - pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); - - // Insert all root nodes in heap. - isax_node *current_root_node = index->first_node; - while (current_root_node != NULL) { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = current_root_node; - pqueue_insert(pq, mindist_result); - current_root_node = current_root_node->next; - } - query_result * n; - int checks = 0; - while ((n = pqueue_pop(pq))) - { - // The best node has a worse mindist, so search is finished! - if (n->distance >= bsf_result.distance || n->distance > minimum_distance) { - pqueue_insert(pq, n); - break; - } - else { - // If it is a leaf, check its real distance. - if (n->node->is_leaf) { - // *** ADAPTIVE SPLITTING *** - if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) - { - // Split and push again in the queue - split_node(index, n->node); - pqueue_insert(pq, n); - continue; - } - // *** EXTRA BOUNDING *** - if(tight_bound) { - float mindistance = calculate_minimum_distance(index, n->node, ts, paa); - if(mindistance >= bsf_result.distance) - { - free(n); - continue; - } - } - // *** REAL DISTANCE *** - checks++; - float distance = calculate_node_distance(index, n->node, ts, bsf_result.distance); - if (distance < bsf_result.distance) - { - bsf_result.distance = distance; - bsf_result.node = n->node; - } - if(checks > limit) { - pqueue_insert(pq, n); - break; - } - } - else { - // If it is an intermediate node calculate mindist for children - // and push them in the queue - if (n->node->left_child->isax_cardinalities != NULL) { - if(n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ - float distance = calculate_node_distance(index, n->node->left_child, ts, bsf_result.distance); - if (distance < bsf_result.distance) - { - bsf_result.distance = distance; - bsf_result.node = n->node->left_child; - } - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->left_child; - pqueue_insert(pq, mindist_result); - } - } - if (n->node->right_child->isax_cardinalities != NULL) { - if(n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ - float distance = calculate_node_distance(index, n->node->right_child, ts, bsf_result.distance); - if (distance < bsf_result.distance) - { - bsf_result.distance = distance; - bsf_result.node = n->node->right_child; - } - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->right_child; - pqueue_insert(pq, mindist_result); - } - } - } - - // Free the node currently popped. - free(n); - } - } - // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) - { - free(n); - } - // Free the priority queue. - pqueue_free(pq); - return bsf_result; -} -void refine_topk_answer (ts_type *ts, ts_type *paa, isax_index *index, - pqueue_bsf *pq_bsf, - float minimum_distance, int limit) -{ - int tight_bound = index->settings->tight_bound; - int aggressive_check = index->settings->aggressive_check; - - pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); - - // Insert all root nodes in heap. - isax_node *current_root_node = index->first_node; - while (current_root_node != NULL) { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = current_root_node; - if (mindist_result->distance < pq_bsf->knn[pq_bsf->k-1]) - { +query_result refine_answer(ts_type *ts, ts_type *paa, isax_index *index, + query_result approximate_bsf_result, float minimum_distance, int limit) { + query_result bsf_result = approximate_bsf_result; + + int tight_bound = index->settings->tight_bound; + int aggressive_check = index->settings->aggressive_check; + + pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, + cmp_pri, get_pri, set_pri, get_pos, set_pos); + + // Insert all root nodes in heap. + isax_node *current_root_node = index->first_node; + + while (current_root_node != NULL) { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = current_root_node; + pqueue_insert(pq, mindist_result); + current_root_node = current_root_node->next; + } + + query_result * n; + int checks = 0; + + while ((n = (query_result*)pqueue_pop(pq))) { + // The best node has a worse mindist, so search is finished! + if (n->distance >= bsf_result.distance || n->distance > minimum_distance) { + pqueue_insert(pq, n); + + break; + } else { + // If it is a leaf, check its real distance. + if (n->node->is_leaf) { + // *** ADAPTIVE SPLITTING *** + if (!n->node->has_full_data_file && + (n->node->leaf_size > index->settings->min_leaf_size)) { + // Split and push again in the queue + split_node(index, n->node); + pqueue_insert(pq, n); + + continue; + } + + // *** EXTRA BOUNDING *** + if (tight_bound) { + float mindistance = calculate_minimum_distance(index, n->node, ts, paa); + + if (mindistance >= bsf_result.distance) { + free(n); + + continue; + } + } + + // *** REAL DISTANCE *** + checks++; + float distance = calculate_node_distance(index, n->node, ts, bsf_result.distance); + + if (distance < bsf_result.distance) { + bsf_result.distance = distance; + bsf_result.node = n->node; + } + + if (checks > limit) { + pqueue_insert(pq, n); + + break; + } + } else { + // If it is an intermediate node calculate mindist for children + // and push them in the queue + if (n->node->left_child->isax_cardinalities != NULL) { + if (n->node->left_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { + float distance = calculate_node_distance(index, n->node->left_child, ts, bsf_result.distance); + + if (distance < bsf_result.distance) { + bsf_result.distance = distance; + bsf_result.node = n->node->left_child; + } + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->left_child; + pqueue_insert(pq, mindist_result); + } + } + + if (n->node->right_child->isax_cardinalities != NULL) { + if (n->node->right_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { + float distance = calculate_node_distance(index, n->node->right_child, ts, bsf_result.distance); + + if (distance < bsf_result.distance) { + bsf_result.distance = distance; + bsf_result.node = n->node->right_child; + } + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->right_child; + pqueue_insert(pq, mindist_result); + } + } + } + + // Free the node currently popped. + free(n); + } + } + + // Free the nodes that where not popped. + while ((n = (query_result*)pqueue_pop(pq))) { + free(n); + } + + // Free the priority queue. + pqueue_free(pq); + + return bsf_result; +} + +void refine_topk_answer(ts_type *ts, ts_type *paa, isax_index *index, + pqueue_bsf *pq_bsf, float minimum_distance, int limit) { + int tight_bound = index->settings->tight_bound; + int aggressive_check = index->settings->aggressive_check; + + pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, + cmp_pri, get_pri, set_pri, get_pos, set_pos); + + // Insert all root nodes in heap. + isax_node *current_root_node = index->first_node; + + while (current_root_node != NULL) { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = current_root_node; + + if (mindist_result->distance < pq_bsf->knn[pq_bsf->k - 1]) { pqueue_insert(pq, mindist_result); } - current_root_node = current_root_node->next; - } - query_result * n; - int checks = 0; - while ((n = pqueue_pop(pq))) - { - // The best node has a worse mindist, so search is finished! - if (n->distance >= pq_bsf->knn[pq_bsf->k-1] || n->distance > minimum_distance) { + + current_root_node = current_root_node->next; + } + + query_result * n; + int checks = 0; + + while ((n = (query_result*)pqueue_pop(pq))) { + // The best node has a worse mindist, so search is finished! + if (n->distance >= pq_bsf->knn[pq_bsf->k - 1] || n->distance > minimum_distance) { pqueue_insert(pq, n); + break; - } - else { - // If it is a leaf, check its real distance. - if (n->node->is_leaf) { - // *** ADAPTIVE SPLITTING *** - if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) - { - // Split and push again in the queue - split_node(index, n->node); - pqueue_insert(pq, n); - continue; - } - // *** EXTRA BOUNDING *** - if(tight_bound) { - float mindistance = calculate_minimum_distance(index, n->node, ts, paa); - if(mindistance >= pq_bsf->knn[pq_bsf->k-1]) - { + } else { + // If it is a leaf, check its real distance. + if (n->node->is_leaf) { + // *** ADAPTIVE SPLITTING *** + if (!n->node->has_full_data_file && + (n->node->leaf_size > index->settings->min_leaf_size)) { + // Split and push again in the queue + split_node(index, n->node); + pqueue_insert(pq, n); + + continue; + } + + // *** EXTRA BOUNDING *** + if (tight_bound) { + float mindistance = calculate_minimum_distance(index, n->node, ts, paa); + + if (mindistance >= pq_bsf->knn[pq_bsf->k - 1]) { free(n); + continue; } - } - // *** REAL DISTANCE *** - checks++; - calculate_node_topk(index, n->node, ts, pq_bsf); - - if(pq_bsf->knn[pq_bsf->k-1] < FLT_MAX) { + } + + // *** REAL DISTANCE *** + checks++; + calculate_node_topk(index, n->node, ts, pq_bsf); + + if (pq_bsf->knn[pq_bsf->k - 1] < FLT_MAX) { pqueue_insert(pq, n); + break; } - } - else { - // If it is an intermediate node calculate mindist for children - // and push them in the queue - if (n->node->left_child->isax_cardinalities != NULL) { - if(n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ - calculate_node_topk(index, n->node->left_child, ts, pq_bsf); - - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->left_child; - if (mindist_result->distance < pq_bsf->knn[pq_bsf->k-1]) - { - pqueue_insert(pq, mindist_result); + } else { + // If it is an intermediate node calculate mindist for children + // and push them in the queue + if (n->node->left_child->isax_cardinalities != NULL) { + if (n->node->left_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { + calculate_node_topk(index, n->node->left_child, ts, pq_bsf); + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->left_child; + + if (mindist_result->distance < pq_bsf->knn[pq_bsf->k - 1]) { + pqueue_insert(pq, mindist_result); + } + } + } + + if (n->node->right_child->isax_cardinalities != NULL) { + if (n->node->right_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { + calculate_node_topk(index, n->node->right_child, ts, pq_bsf); + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->right_child; + + if (mindist_result->distance < pq_bsf->knn[pq_bsf->k - 1]) { + pqueue_insert(pq, mindist_result); + } + } + } } - } - } - if (n->node->right_child->isax_cardinalities != NULL) { - if(n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ - calculate_node_topk(index, n->node->right_child, ts, pq_bsf); - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->right_child; - if (mindist_result->distance < pq_bsf->knn[pq_bsf->k-1]) - { - pqueue_insert(pq, mindist_result); - } - } - } - } - - // Free the node currently popped. - free(n); - } - } - // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) - { - free(n); - } - // Free the priority queue. - for (int i = 0; i < pq_bsf->k-1; ++i) - { - pq_bsf->knn[i]=pq_bsf->knn[pq_bsf->k-1]; + + // Free the node currently popped. + free(n); + } } - pqueue_free(pq); -} -query_result approximate_search_SIMD (ts_type *ts, ts_type *paa, isax_index *index) -{ - query_result result; - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + // Free the nodes that where not popped. + while ((n = (query_result*)pqueue_pop(pq))) { + free(n); + } + + // Free the priority queue. + for (int i = 0; i < pq_bsf->k - 1; ++i) { + pq_bsf->knn[i] = pq_bsf->knn[pq_bsf->k - 1]; + } + + pqueue_free(pq); +} + +query_result approximate_search_SIMD(ts_type *ts, ts_type *paa, isax_index *index) { + query_result result; + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality); root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); if (index->fbl->soft_buffers[(int) root_mask].initialized) { isax_node *node = index->fbl->soft_buffers[(int) root_mask].node; - //printf("Root: [%0#6X]\n", (unsigned long int) node); - // Traverse tree + // Traverse tree // Adaptive splitting if (node->is_leaf && !node->has_full_data_file && - (node->leaf_size > index->settings->min_leaf_size)) - { + (node->leaf_size > index->settings->min_leaf_size)) { split_node(index, node); } while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; - if(sax[node->split_data->splitpoint] & mask) - { + if (sax[node->split_data->splitpoint] & mask) { node = node->right_child; - } - else - { + } else { node = node->left_child; } // Adaptive splitting if (node->is_leaf && !node->has_full_data_file && - (node->leaf_size > index->settings->min_leaf_size)) - { + (node->leaf_size > index->settings->min_leaf_size)) { split_node(index, node); } } result.distance = calculate_node_distance(index, node, ts, FLT_MAX); result.node = node; - } - else { + } else { result.node = NULL; result.distance = FLT_MAX; } @@ -774,95 +721,8 @@ query_result approximate_search_SIMD (ts_type *ts, ts_type *paa, isax_index *in free(sax); } - -/* -query_result exact_search_serial(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves) -{ - - RESET_BYTES_ACCESSED - - query_result approximate_result = approximate_search(ts, paa, index); - - query_result bsf_result = approximate_result; - query_result *approximate_result2=malloc(sizeof(query_result)); - approximate_result2->distance=approximate_result.distance; - approximate_result2->node=approximate_result.node; - approximate_result2->pqueue_position=approximate_result.pqueue_position; - - int tight_bound = index->settings->tight_bound; - int aggressive_check = index->settings->aggressive_check; - - // Early termination... - if (approximate_result.distance == 0) { - return approximate_result; - } - - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); - } - - - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size); - - unsigned long i; - COUNT_INPUT_TIME_START - FILE *raw_file = fopen(index->settings->raw_filename, "rb"); - fseek(raw_file, 0, SEEK_SET); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); - COUNT_INPUT_TIME_END - #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); - #endif - - SET_APPROXIMATE(approximate_result.distance); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - //printf("the old distance is: %f \n",approximate_result.distance); - - for(i=0; isax_cache_size; i++) { - - sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - - float mindist = minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - - if(mindist <= approximate_result.distance) { - /*bit_array_set_bit(bitarray, i); - COUNT_INPUT_TIME_START - fseek(raw_file, i * index->settings->ts_byte_size, SEEK_SET); - fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); - COUNT_INPUT_TIME_END - - float dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, approximate_result.distance); - //printf("the distance is : %f !!!!!!!!!\n", dist); - if(dist < approximate_result.distance) { - approximate_result.distance = dist; - - #ifdef STORE_ANSWER - memcpy(index->answer, ts_buffer, index->settings->timeseries_size * sizeof(ts_type)); - #endif - } - INCREASE_BYTES_ACCESSED(index->settings->ts_byte_size) - } - - } - //printf("the new distance is: %f \n",approximate_result.distance); - - free(ts_buffer); - fclose(raw_file); - //printf("I need to check: %2.2lf%% of the data.\n", (double)tocheck*100/(double)index->sax_cache_size); - /*bit_array_free(bitarray); - return approximate_result; -} -*/ - - -query_result exact_search (ts_type *ts, ts_type *paa, isax_index *index, - float minimum_distance, int min_checked_leaves) -{ +query_result exact_search(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; @@ -872,188 +732,197 @@ query_result exact_search (ts_type *ts, ts_type *paa, isax_index *index, if (approximate_result.distance == 0) { return approximate_result; } - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { + + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); } + COUNT_QUEUE_TIME_START pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); COUNT_QUEUE_TIME_END - query_result *do_not_remove = &approximate_result; SET_APPROXIMATE(approximate_result.distance); RESET_BYTES_ACCESSED - if(approximate_result.node != NULL) { + if (approximate_result.node != NULL) { // Insert approximate result in heap. COUNT_QUEUE_TIME_START pqueue_insert(pq, &approximate_result); COUNT_QUEUE_TIME_END - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; + while (current_root_node != NULL) { - query_result * mindist_result = malloc(sizeof(query_result)); + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = current_root_node; COUNT_QUEUE_TIME_START pqueue_insert(pq, mindist_result); COUNT_QUEUE_TIME_END current_root_node = current_root_node->next; } + query_result * n; int checks = 0; - while ((n = pqueue_pop(pq))) - { + + while ((n = (query_result*)pqueue_pop(pq))) { // The best node has a worse mindist, so search is finished! - //printf("this is the check point of e s !!!\n"); if (n->distance >= bsf_result.distance || n->distance > minimum_distance) { COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + break; - } - else { + } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) - { + (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue - split_node(index, n->node); COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + continue; } + // *** EXTRA BOUNDING *** - if(tight_bound) { + if (tight_bound) { COUNT_CAL_TIME_START float mindistance = calculate_minimum_distance(index, n->node, ts, paa); COUNT_CAL_TIME_END - if(mindistance >= bsf_result.distance) - { - if(n != do_not_remove)//add + + if (mindistance >= bsf_result.distance) { + if (n != do_not_remove) { // add free(n); + } + continue; } } + // *** REAL DISTANCE *** checks++; COUNT_CAL_TIME_START float distance = calculate_node_distance(index, n->node, ts, bsf_result.distance); COUNT_CAL_TIME_END - if (distance < bsf_result.distance) - { + + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node; } - //no check limit juge - } - else { + // no check limit juge + } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { - if(n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ + if (n->node->left_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { COUNT_CAL_TIME_START float distance = calculate_node_distance(index, n->node->left_child, ts, bsf_result.distance); COUNT_CAL_TIME_END - if (distance < bsf_result.distance) - { + + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->left_child; } - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->left_child; - COUNT_QUEUE_TIME_START - pqueue_insert(pq, mindist_result); - COUNT_QUEUE_TIME_END + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->left_child; + COUNT_QUEUE_TIME_START + pqueue_insert(pq, mindist_result); + COUNT_QUEUE_TIME_END } } + if (n->node->right_child->isax_cardinalities != NULL) { - if(n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ + if (n->node->right_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { COUNT_CAL_TIME_START float distance = calculate_node_distance(index, n->node->right_child, ts, bsf_result.distance); COUNT_CAL_TIME_END - if (distance < bsf_result.distance) - { + + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->right_child; } - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->right_child; - COUNT_QUEUE_TIME_START - pqueue_insert(pq, mindist_result); - COUNT_QUEUE_TIME_END + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->right_child; + COUNT_QUEUE_TIME_START + pqueue_insert(pq, mindist_result); + COUNT_QUEUE_TIME_END } } } // Free the node currently popped. - if(n != do_not_remove)//add + if (n != do_not_remove) { // add free(n); + } } } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) - { - if(n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. COUNT_QUEUE_TIME_START pqueue_free(pq); COUNT_QUEUE_TIME_END - //PRINT_BYTES_ACCESSED - return bsf_result; + // PRINT_BYTES_ACCESSED + + return bsf_result; } -pqueue_bsf exact_topk (ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, int k) -{ +pqueue_bsf exact_topk(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves, int k) { pqueue_bsf *pq_bsf = pqueue_bsf_init(k); approximate_topk(ts, paa, index, pq_bsf); int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; // Early termination... - if (pq_bsf->knn[k-1] == 0) { + if (pq_bsf->knn[k - 1] == 0) { return *pq_bsf; } - if(pq_bsf->knn[k-1] == FLT_MAX || min_checked_leaves > 1) { + + if (pq_bsf->knn[k - 1] == FLT_MAX || min_checked_leaves > 1) { refine_topk_answer(ts, paa, index, pq_bsf, minimum_distance, min_checked_leaves); } @@ -1061,123 +930,124 @@ pqueue_bsf exact_topk (ts_type *ts, ts_type *paa, isax_index *index, float minim pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, cmp_pri, get_pri, set_pri, get_pos, set_pos); COUNT_QUEUE_TIME_END - //pqueue_bsf *do_not_remove = &pq_bsf; - SET_APPROXIMATE(pq_bsf->knn[k-1]); RESET_BYTES_ACCESSED - if(pq_bsf->node[k-1] != NULL) { + if (pq_bsf->node[k - 1] != NULL) { // Insert approximate result in heap. COUNT_QUEUE_TIME_START - //pqueue_insert(pq, &pq_bsf); + // pqueue_insert(pq, &pq_bsf); COUNT_QUEUE_TIME_END - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; + while (current_root_node != NULL) { - query_result * mindist_result = malloc(sizeof(query_result)); + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = current_root_node; - if (mindist_result->distance < pq_bsf->knn[k-1]) { + + if (mindist_result->distance < pq_bsf->knn[k - 1]) { COUNT_QUEUE_TIME_START pqueue_insert(pq, mindist_result); COUNT_QUEUE_TIME_END } + current_root_node = current_root_node->next; } + query_result * n; int checks = 0; - while ((n = pqueue_pop(pq))) - { + + while ((n = (query_result*)pqueue_pop(pq))) { // The best node has a worse mindist, so search is finished! - //printf("this is the check point of e s !!!\n"); - if (n->distance >= pq_bsf->knn[pq_bsf->k-1] || n->distance > minimum_distance) { + if (n->distance >= pq_bsf->knn[pq_bsf->k - 1] || n->distance > minimum_distance) { COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + break; - } - else { + } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) - { + (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue - split_node(index, n->node); COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + continue; } + // *** EXTRA BOUNDING *** - if(tight_bound) { + if (tight_bound) { COUNT_CAL_TIME_START float mindistance = calculate_minimum_distance(index, n->node, ts, paa); COUNT_CAL_TIME_END - if(mindistance >= pq_bsf->knn[pq_bsf->k-1]) - { + if (mindistance >= pq_bsf->knn[pq_bsf->k - 1]) { free(n); + continue; } } + // *** REAL DISTANCE *** checks++; calculate_node_topk(index, n->node, ts, pq_bsf); - - //no check limit juge - } - else { + // no check limit juge + } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { - if(n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ + if (n->node->left_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { calculate_node_topk(index, n->node->left_child, ts, pq_bsf); - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->left_child; - COUNT_QUEUE_TIME_START - pqueue_insert(pq, mindist_result); - COUNT_QUEUE_TIME_END + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->left_child; + COUNT_QUEUE_TIME_START + pqueue_insert(pq, mindist_result); + COUNT_QUEUE_TIME_END } } + if (n->node->right_child->isax_cardinalities != NULL) { - if(n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ + if (n->node->right_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { calculate_node_topk(index, n->node->right_child, ts, pq_bsf); - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->right_child; - COUNT_QUEUE_TIME_START - pqueue_insert(pq, mindist_result); - COUNT_QUEUE_TIME_END + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->right_child; + COUNT_QUEUE_TIME_START + pqueue_insert(pq, mindist_result); + COUNT_QUEUE_TIME_END } } } @@ -1185,212 +1055,222 @@ pqueue_bsf exact_topk (ts_type *ts, ts_type *paa, isax_index *index, float minim } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) - { - //if(n != do_not_remove) - //free(n); + while ((n = (query_result*)pqueue_pop(pq))) { + // free(n); } + // Free the priority queue. COUNT_QUEUE_TIME_START pqueue_free(pq); COUNT_QUEUE_TIME_END - //PRINT_BYTES_ACCESSED - /*for (int i=0; i < k-1; i++) - { - pq_bsf->knn[i] = pq_bsf->knn[k-1]; - }*/ + return *pq_bsf; } +query_result sanity_check_query(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves) { + float isax_tightness = 0; + float tight_tightness = 0; + int32_t checks = 0; - -query_result sanity_check_query (ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves) { - float isax_tightness = 0; - float tight_tightness = 0; - long checks = 0; - - char failed = 0; - query_result bsf_result; + char failed = 0; + query_result bsf_result; bsf_result.distance = FLT_MAX; pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); RESET_BYTES_ACCESSED // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; + while (current_root_node != NULL) { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = current_root_node; + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = current_root_node; pqueue_insert(pq, mindist_result); current_root_node = current_root_node->next; } + query_result * n; - while ((n = pqueue_pop(pq))) - { - // If it is a leaf, check its real distance. - if (n->node->is_leaf) { - float isax_mindist = minidist_paa_to_isax(paa, n->node->isax_values, - n->node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - float tight_mindist = calculate_minimum_distance(index, n->node, ts, paa); - float distance = calculate_node_distance(index, n->node, ts, FLT_MAX); - - checks++; - tight_tightness += tight_mindist / distance; - isax_tightness += isax_mindist / distance; - - if(distance < isax_mindist) { - printf("ERROR: Real distance (%2.2lf) is less than iSAX distance (%2.2lf)\n", distance, isax_mindist); - failed = 1; - } - if(distance < tight_mindist) { - printf("ERROR: Real distance (%2.2lf) is less than the TIGHT distance (%2.2lf)\n", distance, tight_mindist); - failed = 1; - - printf("DEBUGGING...\n"); - isax_node *node = n->node; - char *filename = malloc((strlen(node->filename) + 10) * sizeof(char)); - strcpy(filename, node->filename); - strcat(filename, ".full"); - filename[strlen(node->filename)+5] = '\0'; - FILE *leaf_file = fopen(filename, "rb"); - if(leaf_file == NULL) { - fprintf(stderr, "Canot open: %s\n", filename); - continue; + + while ((n = (query_result*)pqueue_pop(pq))) { + // If it is a leaf, check its real distance. + if (n->node->is_leaf) { + float isax_mindist = minidist_paa_to_isax(paa, n->node->isax_values, + n->node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + float tight_mindist = calculate_minimum_distance(index, n->node, ts, paa); + float distance = calculate_node_distance(index, n->node, ts, FLT_MAX); + + checks++; + tight_tightness += tight_mindist / distance; + isax_tightness += isax_mindist / distance; + + if (distance < isax_mindist) { + printf("ERROR: Real distance (%2.2lf) is less than iSAX distance (%2.2lf)\n", + distance, isax_mindist); + failed = 1; + } + + if (distance < tight_mindist) { + printf("ERROR: Real distance (%2.2lf) is less than the TIGHT distance (%2.2lf)\n", + distance, tight_mindist); + failed = 1; + + printf("DEBUGGING...\n"); + isax_node *node = n->node; + char *filename = (char*)malloc((strlen(node->filename) + 10) * sizeof(char)); + strcpy(filename, node->filename); + strcat(filename, ".full"); + filename[strlen(node->filename)+5] = '\0'; + FILE *leaf_file = fopen(filename, "rb"); + + if (leaf_file == NULL) { + fprintf(stderr, "Canot open: %s\n", filename); + + continue; + } + + fseeko(leaf_file, 0L, SEEK_END); + uint32_t size = ftello(leaf_file) / index->settings->full_record_size; + fseeko(leaf_file, 0L, SEEK_SET); + + int i; + ts_type *ts_read = (ts_type*)malloc(index->settings->ts_byte_size); + ts_type *min_wedge = (ts_type*)malloc(index->settings->ts_byte_size); + ts_type *max_wedge = (ts_type*)malloc(index->settings->ts_byte_size); + + for (i = 0; i < index->settings->timeseries_size; i++) { + min_wedge[i] = 100000; + max_wedge[i] = -100000; + } + + float mindist = FLT_MAX; + float bound = 0; + + for (i = 0; i < size; i++) { + fseeko(leaf_file, index->settings->sax_byte_size + index->settings->position_byte_size, SEEK_CUR); + fread(ts_read, index->settings->ts_byte_size, 1, leaf_file); + float dist = ts_euclidean_distance(ts, ts_read, index->settings->timeseries_size, mindist); + + if (dist < mindist) { + mindist = dist; + } + + int j = 0; + + for (j = 0; j < index->settings->timeseries_size; j++) { + if (ts_read[j] < min_wedge[j]) { + min_wedge[j] = ts_read[j]; + } + + if (ts_read[j] > max_wedge[j]) { + max_wedge[j] = ts_read[j]; + } + } } - fseeko(leaf_file,0L, SEEK_END); - unsigned long size = ftello(leaf_file) / index->settings->full_record_size; - fseeko(leaf_file, 0L, SEEK_SET); - - int i; - ts_type *ts_read = malloc(index->settings->ts_byte_size); - ts_type *min_wedge = malloc(index->settings->ts_byte_size); - ts_type *max_wedge = malloc(index->settings->ts_byte_size); - - for(i=0; isettings->timeseries_size; i++) { - min_wedge[i] = 100000; - max_wedge[i] = -100000; - } - - float mindist = FLT_MAX; - float bound = 0; - - for(i=0; isettings->sax_byte_size + index->settings->position_byte_size, SEEK_CUR); - fread(ts_read, index->settings->ts_byte_size, 1, leaf_file); - float dist = ts_euclidean_distance(ts, ts_read, index->settings->timeseries_size, mindist); - if(dist < mindist) { - mindist = dist; - } - int j=0; - for(j=0; jsettings->timeseries_size; j++) { - if(ts_read[j] < min_wedge[j]) { - min_wedge[j] = ts_read[j]; - } - if(ts_read[j] > max_wedge[j]) { - max_wedge[j] = ts_read[j]; - } - } - } - - - for(i=0; isettings->timeseries_size; i++) { - if(ts[i] > max_wedge[i]) { - bound += (ts[i] - max_wedge[i]) * (ts[i] - max_wedge[i]); - } - else if(ts[i] < max_wedge[i] && ts[i] > min_wedge[i]) { - //bound += 0; - } - else { - bound += (min_wedge[i] - ts[i]) * (min_wedge[i] - ts[i]); - } - } - bound = sqrtf(bound); - - printf("\t%lf \n", mindist); - printf("\tBound: %lf\n", bound); - free(ts_read); - free(min_wedge); - free(max_wedge); - free(filename); - fclose(leaf_file); - } - - if(distance < bsf_result.distance) { - bsf_result.distance = distance; - } - } - else { - // If it is an intermediate node calculate mindist for children - // and push them in the queue - if (n->node->left_child->isax_cardinalities != NULL) { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->left_child; - pqueue_insert(pq, mindist_result); - } - if (n->node->right_child->isax_cardinalities != NULL) { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->right_child; - pqueue_insert(pq, mindist_result); - } - } - // Free the node currently popped. - free(n); + + + for (i = 0; i < index->settings->timeseries_size; i++) { + if (ts[i] > max_wedge[i]) { + bound += (ts[i] - max_wedge[i]) * (ts[i] - max_wedge[i]); + } else if (ts[i] < max_wedge[i] && ts[i] > min_wedge[i]) { + // bound += 0; + } else { + bound += (min_wedge[i] - ts[i]) * (min_wedge[i] - ts[i]); + } + } + + bound = sqrtf(bound); + + printf("\t%lf \n", mindist); + printf("\tBound: %lf\n", bound); + free(ts_read); + free(min_wedge); + free(max_wedge); + free(filename); + fclose(leaf_file); + } + + if (distance < bsf_result.distance) { + bsf_result.distance = distance; + } + } else { + // If it is an intermediate node calculate mindist for children + // and push them in the queue + if (n->node->left_child->isax_cardinalities != NULL) { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->left_child; + pqueue_insert(pq, mindist_result); + } + + if (n->node->right_child->isax_cardinalities != NULL) { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->right_child; + pqueue_insert(pq, mindist_result); + } + } + + // Free the node currently popped. + free(n); } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) - { + while ((n = (query_result*)pqueue_pop(pq))) { free(n); } + // Free the priority queue. pqueue_free(pq); - query_result answer = exact_search(ts, paa, index, minimum_distance, min_checked_leaves); query_result serial_answer = exact_search_serial(ts, paa, index, minimum_distance, min_checked_leaves); - if(answer.distance != bsf_result.distance) { - fprintf(stderr,"ERROR: answer %2.2lf is not the same as exhaustive search %2.2lf.\n", answer.distance, bsf_result.distance); - failed = 1; - } - if(serial_answer.distance != bsf_result.distance) { - fprintf(stderr,"ERROR: serial answer %2.2lf is not the same as exhaustive search %2.2lf.\n", serial_answer.distance, bsf_result.distance); + if (answer.distance != bsf_result.distance) { + fprintf(stderr, "ERROR: answer %2.2lf is not the same as exhaustive search %2.2lf.\n", + answer.distance, bsf_result.distance); failed = 1; } - if(!failed) { - fprintf(stderr,"[OK] %2.2lf == %2.2lf == %2.2lf\n", answer.distance, serial_answer.distance, bsf_result.distance); - fprintf(stderr,"\t [TIGHTNESSES] iSAX=%lf, TIGHT:%lf\n", isax_tightness/(float)checks, tight_tightness / (float)checks); + if (serial_answer.distance != bsf_result.distance) { + fprintf(stderr, "ERROR: serial answer %2.2lf is not the same as exhaustive search %2.2lf.\n", + serial_answer.distance, bsf_result.distance); + failed = 1; } - else { - fprintf(stderr, "[FAILED]\n"); + + if (!failed) { + fprintf(stderr, "[OK] %2.2lf == %2.2lf == %2.2lf\n", + answer.distance, serial_answer.distance, bsf_result.distance); + fprintf(stderr, "\t [TIGHTNESSES] iSAX=%lf, TIGHT:%lf\n", + isax_tightness / (float)checks, tight_tightness / (float)checks); + } else { + fprintf(stderr, "[FAILED]\n"); } + return bsf_result; } diff --git a/src/ads/isax_visualize_index.c b/src/ads/isax_visualize_index.c index ca18a690..ba73fbef 100644 --- a/src/ads/isax_visualize_index.c +++ b/src/ads/isax_visualize_index.c @@ -7,6 +7,7 @@ #include "../../config.h" #include "../../globals.h" #include +#include #include #include @@ -18,94 +19,86 @@ #define STRING_SIZE 256 #define BUFFER_SIZE 256 -void bst_print_dot_null(void * key, int nullcount, FILE* stream) -{ +void bst_print_dot_null(void * key, int nullcount, FILE* stream) { fprintf(stream, " null%d [shape=point];\n", nullcount); fprintf(stream, " %lu -> null%d;\n", (size_t)key, nullcount); } -void bst_print_dot_aux(isax_node* node, FILE* stream) -{ +void bst_print_dot_aux(isax_node* node, FILE* stream) { static int nullcount = 0; - - if (node->left_child) - { + + if (node->left_child) { fprintf(stream, " %lu -> %lu;\n", (size_t)node, (size_t)node->left_child); bst_print_dot_aux(node->left_child, stream); - } - else + } else { bst_print_dot_null(node, nullcount++, stream); - - if (node->right_child) - { + } + + if (node->right_child) { fprintf(stream, " %lu -> %lu;\n", (size_t)node, (size_t)node->right_child); bst_print_dot_aux(node->right_child, stream); - } - else + } else { bst_print_dot_null(node, nullcount++, stream); + } } -void bst_print_dot(isax_node* tree, FILE* stream) -{ - //fprintf(stream, "digraph BST {\n"); +void bst_print_dot(isax_node* tree, FILE* stream) { fprintf(stream, " node [fontname=\"Arial\"];\n"); - - if (!tree) + + if (!tree) { fprintf(stream, "\n"); - else if (!tree->right_child && !tree->left_child) + } else if (!tree->right_child && !tree->left_child) { fprintf(stream, " %lu;\n", (size_t)tree); - else + } else { bst_print_dot_aux(tree, stream); - - //fprintf(stream, "}\n"); + } } -void isax_print_dot(isax_index* index, FILE *stream) -{ +void isax_print_dot(isax_index* index, FILE *stream) { isax_node *node = index->first_node; fprintf(stream, "digraph BST {\n"); - if(node == NULL){ + + if (node == NULL) { fprintf(stream, "First node is empty"); } + while (node != NULL) { - if(!node->is_leaf) { + if (!node->is_leaf) { fprintf(stream, " %lu -> %lu;\n", (size_t)index, (size_t)node); bst_print_dot(node, stream); fprintf(stream, "\n"); - } + node = node->next; } + fprintf(stream, "\n}"); - } -void calculate_average_depth(FILE *ifile, isax_index *index) -{ +void calculate_average_depth(FILE *ifile, isax_index *index) { isax_node *node = index->first_node; - if(node == NULL){ + + if (node == NULL) { return; - }; + } - char *buffer_number = malloc(BUFFER_SIZE * sizeof(char)); - char *buffer_depth = malloc(BUFFER_SIZE * sizeof(char)); - char *buffer_leaf_size = malloc(BUFFER_SIZE * sizeof(char)); + char *buffer_number = (char*)malloc(BUFFER_SIZE * sizeof(char)); + char *buffer_depth = (char*)malloc(BUFFER_SIZE * sizeof(char)); + char *buffer_leaf_size = (char*)malloc(BUFFER_SIZE * sizeof(char)); char logfile_out_header[STRING_SIZE] = "subtrees,average depth,average leaf size\n"; char logfile_out_values[STRING_SIZE] = ""; double depth = 0.0; - unsigned long leaf_size_total = 0; + uint32_t leaf_size_total = 0; int leaf_counter_total = 0; int tree_counter = 0; while (node != NULL) { - double current_depth; double current_leaf_size; - if(!node->is_leaf) - { + if (!node->is_leaf) { ++tree_counter; unsigned int total_depth = 0; @@ -126,6 +119,7 @@ void calculate_average_depth(FILE *ifile, isax_index *index) node = node->next; } + double total_depth_average = depth / (double)tree_counter; double total_leaf_size_average = (double)leaf_size_total / (double)leaf_counter_total; @@ -137,8 +131,8 @@ void calculate_average_depth(FILE *ifile, isax_index *index) strcat(logfile_out_values, buffer_depth); strcat(logfile_out_values, buffer_leaf_size); - fprintf(ifile,"%s",logfile_out_header); - fprintf(ifile,"%s",logfile_out_values); + fprintf(ifile, "%s", logfile_out_header); + fprintf(ifile, "%s", logfile_out_values); free(buffer_number); free(buffer_depth); @@ -147,29 +141,29 @@ void calculate_average_depth(FILE *ifile, isax_index *index) return; } -void traverse_tree(isax_node *node, unsigned int parent_depth, unsigned int *total_depth, unsigned int *node_count, unsigned int *leaf_count, unsigned long *leaf_size) -{ - if(node->is_leaf) - { - *leaf_count +=1; +void traverse_tree(isax_node *node, unsigned int parent_depth, unsigned int *total_depth, + unsigned int *node_count, unsigned int *leaf_count, unsigned long *leaf_size) { + if (node->is_leaf) { + *leaf_count += 1; *leaf_size += node->leaf_size; - *total_depth += parent_depth; - *node_count +=1; + *node_count += 1; + return; } - if(node->left_child) - { - traverse_tree(node->left_child, ++parent_depth, total_depth, node_count, leaf_count, leaf_size); + if (node->left_child) { + traverse_tree(node->left_child, ++parent_depth, total_depth, + node_count, leaf_count, leaf_size); } - if(node->right_child) - { - traverse_tree(node->right_child, ++parent_depth, total_depth, node_count, leaf_count, leaf_size); + if (node->right_child) { + traverse_tree(node->right_child, ++parent_depth, total_depth, + node_count, leaf_count, leaf_size); } + *total_depth += parent_depth; - *node_count +=1; + *node_count += 1; + return; } - diff --git a/src/ads/parallel_index_engine.c b/src/ads/parallel_index_engine.c index 3e350359..a2f221d6 100644 --- a/src/ads/parallel_index_engine.c +++ b/src/ads/parallel_index_engine.c @@ -1,11 +1,10 @@ // // parallel_index_engine.c -// +// // // Created by Botao PENG on 29/1/18. // - #include "../../config.h" #include "../../globals.h" #include @@ -15,7 +14,6 @@ #include #include #include -//#include #include #include "ads/isax_node.h" @@ -27,256 +25,260 @@ #include "ads/parallel_index_engine.h" #include "ads/parallel_query_engine.h" - -void isax_index_binary_file_m(const char *ifilename, int ts_num, isax_index *index,int calculate_thread) -{ +void isax_index_binary_file_m(const char *ifilename, int ts_num, isax_index *index, int calculate_thread) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE * ifile; - + COUNT_INPUT_TIME_START - ifile = fopen (ifilename,"rb"); + ifile = fopen(ifilename,"rb"); COUNT_INPUT_TIME_END - index_buffer_data *input_data=malloc(sizeof(index_buffer_data)*(calculate_thread-1)); - file_position_type *pos = malloc(sizeof(file_position_type)); - pthread_t threadid[calculate_thread-1]; + index_buffer_data *input_data = (index_buffer_data*)malloc(sizeof(index_buffer_data) * (calculate_thread - 1)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + pthread_t threadid[calculate_thread - 1]; bool sax_fist_time_check = false; long int ts_loaded = 0; - int j,conter=0; + int j; + int conter = 0; long long int i; - int prev_flush_time=0,now_flush_time=0; + int prev_flush_time = 0; + int now_flush_time = 0; int sax_save_number; - //initial the locks - pthread_mutex_t lock_record=PTHREAD_MUTEX_INITIALIZER,lockfbl=PTHREAD_MUTEX_INITIALIZER,lock_index=PTHREAD_MUTEX_INITIALIZER, - lock_firstnode=PTHREAD_MUTEX_INITIALIZER,lock_disk=PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_t *lockcbl; - pthread_barrier_t lock_barrier1, lock_barrier2; + + // initialize the locks + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t *lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t)*LOCK_SIZE); + pthread_barrier_t lock_barrier1; + pthread_barrier_t lock_barrier2; pthread_barrier_init(&lock_barrier1, NULL, calculate_thread); pthread_barrier_init(&lock_barrier2, NULL, calculate_thread); // set the thread on decided cpu - - lockcbl= malloc(sizeof(pthread_mutex_t)*LOCK_SIZE); - - for(i=0; isettings->ts_byte_size; + file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size*read_block_length*(calculate_thread-1)); + ts_type *ts1 = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size*read_block_length*(calculate_thread-1)); + ts_type *ts2; + sax_type *saxv = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments*read_block_length*(calculate_thread-1)); + sax_type *saxv1 = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments*read_block_length*(calculate_thread-1)); + sax_type *saxv2; - ts_type * ts = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts1 = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts2; - sax_type * saxv = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv1 = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv2; - - index->settings->raw_filename = malloc(256); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); - #ifdef BENCHMARK +#ifdef BENCHMARK int percentage = (int) (ts_num / (file_position_type) 100); - #endif - - *pos = ftell(ifile); +#endif + *pos = ftell(ifile); - if(ts_num>read_block_length*(calculate_thread-1)) - { COUNT_INPUT_TIME_START - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); + if (ts_num > read_block_length * (calculate_thread - 1)) { + COUNT_INPUT_TIME_START + fread(ts1, sizeof(ts_type), + index->settings->timeseries_size * read_block_length * (calculate_thread - 1), ifile); COUNT_INPUT_TIME_END - ts2 =ts; - ts =ts1; - ts1 =ts2; + ts2 = ts; + ts = ts1; + ts1 = ts2; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j *read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker,(void*)&(input_data[j])); + + for (j = 0; j < (calculate_thread - 1); j++) { + pthread_create(&(threadid[j]), NULL, indexbulkloadingworker, (void*)&(input_data[j])); } - for (i = read_block_length*(calculate_thread-1)*2; i <= ts_num; i+=read_block_length*(calculate_thread-1)) - { - + for (i = read_block_length*(calculate_thread-1)*2; i <= ts_num; i += read_block_length * (calculate_thread - 1)) { *pos = ftell(ifile); - //read the data of next round + + // read the data of next round COUNT_INPUT_TIME_START - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); + fread(ts1, sizeof(ts_type), index->settings->timeseries_size * read_block_length * (calculate_thread - 1), ifile); COUNT_INPUT_TIME_END - //write the sax in disk (last round) - if (sax_fist_time_check) - { + + // write the sax in disk (last round) + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, read_block_length * (calculate_thread - 1), index->sax_file); COUNT_OUTPUT_TIME_END - } - else - { - sax_fist_time_check=true; + } else { + sax_fist_time_check = true; } + // wait for the finish of other threads pthread_barrier_wait(&lock_barrier1); - //wait for the finish of other threads - ts2 =ts; - ts =ts1; - ts1 =ts2; - __sync_fetch_and_add(&(index->fbl->current_record_index),read_block_length*(calculate_thread-1)); - now_flush_time=i/(index->settings->max_total_buffer_size); - if(now_flush_time!=prev_flush_time) - { + ts2 = ts; + ts = ts1; + ts1 = ts2; + __sync_fetch_and_add(&(index->fbl->current_record_index), read_block_length * (calculate_thread - 1)); + now_flush_time = i / (index->settings->max_total_buffer_size); + + if (now_flush_time != prev_flush_time) { COUNT_QUEUE_TIME_START - indexconstruction(index->fbl, index,&lock_index,&lock_disk,calculate_thread); + indexconstruction(index->fbl, index, &lock_index, &lock_disk, calculate_thread); COUNT_QUEUE_TIME_END } - //printf("the saxv2 in the worker is %d\n",saxv2[0] ); - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - - prev_flush_time=now_flush_time; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + + prev_flush_time = now_flush_time; + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } + pthread_barrier_wait(&lock_barrier2); } pthread_barrier_wait(&lock_barrier1); - for (j = 0; j < (calculate_thread-1); j++) - { - input_data[j].finished=true; - } - //wait for the finish of other threads - __sync_fetch_and_add(&(index->fbl->current_record_index),read_block_length*(calculate_thread-1)); - now_flush_time=i/(index->settings->max_total_buffer_size); - if(now_flush_time!=prev_flush_time) - { + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].finished = true; + } + + // wait for the finish of other threads + __sync_fetch_and_add(&(index->fbl->current_record_index), read_block_length * (calculate_thread - 1)); + now_flush_time = i / (index->settings->max_total_buffer_size); + + if (now_flush_time != prev_flush_time) { COUNT_QUEUE_TIME_START - indexconstruction(index->fbl, index,&lock_index,&lock_disk,calculate_thread); + indexconstruction(index->fbl, index, &lock_index, &lock_disk, calculate_thread); COUNT_QUEUE_TIME_END } - prev_flush_time=now_flush_time; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + prev_flush_time = now_flush_time; + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } + pthread_barrier_wait(&lock_barrier2); - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_join(threadid[j],NULL); + + for (j = 0; j < (calculate_thread- 1); j++) { + pthread_join(threadid[j], NULL); } } + COUNT_INPUT_TIME_START - *pos = ftell(ifile); - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*(ts_num%(read_block_length*(calculate_thread-1))), ifile); + *pos = ftell(ifile); + fread(ts1, sizeof(ts_type), + index->settings->timeseries_size * (ts_num%(read_block_length * (calculate_thread - 1))), ifile); COUNT_INPUT_TIME_END - ts2 =ts; - ts =ts1; - ts1 =ts2; - - + ts2 = ts; + ts = ts1; + ts1 = ts2; - //handle the rest data - int conter_ts_number=ts_num%(read_block_length*(calculate_thread-1)); - sax_save_number=conter_ts_number; + // handle the rest of the data + int conter_ts_number = ts_num % (read_block_length * (calculate_thread - 1)); + sax_save_number = conter_ts_number; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos = *pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos+index->settings->timeseries_size * sizeof(ts_type) * j *read_block_length; conter++; - input_data[j].ts=&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].fin_number=min(conter_ts_number,read_block_length); - input_data[j].saxv=saxv; - conter_ts_number=conter_ts_number-read_block_length; - - if(conter_ts_number<0) + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].fin_number = min(conter_ts_number, read_block_length); + input_data[j].saxv = saxv; + conter_ts_number = conter_ts_number - read_block_length; + + if (conter_ts_number < 0) { break; + } } - pthread_barrier_init(&lock_barrier1, NULL, conter+1); - pthread_barrier_init(&lock_barrier2, NULL, conter+1); - for ( j = 0; j < conter; j++) - { - input_data[j].finished=false; - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker,(void*)&(input_data[j])); + pthread_barrier_init(&lock_barrier1, NULL, conter + 1); + pthread_barrier_init(&lock_barrier2, NULL, conter + 1); + + for (j = 0; j < conter; j++) { + input_data[j].finished = false; + pthread_create(&(threadid[j]), NULL, indexbulkloadingworker, (void*)&(input_data[j])); } - if (sax_fist_time_check) - { + if (sax_fist_time_check) { pthread_mutex_lock(&lock_disk); COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, read_block_length * (calculate_thread - 1), index->sax_file); COUNT_OUTPUT_TIME_END pthread_mutex_unlock(&lock_disk); + } else { + sax_fist_time_check = true; } - else - { - sax_fist_time_check=true; - } + pthread_barrier_wait(&lock_barrier1); - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - for ( j = 0; j < conter; j++) - { - input_data[j].finished=true; + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + + for (j = 0; j < conter; j++) { + input_data[j].finished = true; } + pthread_barrier_wait(&lock_barrier2); - for (j = 0; j < conter; j++) - { - pthread_join(threadid[j],NULL); + for (j = 0; j < conter; j++) { + pthread_join(threadid[j], NULL); } + pthread_mutex_lock(&lock_disk); COUNT_OUTPUT_TIME_START fwrite(saxv1, index->settings->sax_byte_size, sax_save_number, index->sax_file); COUNT_OUTPUT_TIME_END pthread_mutex_unlock(&lock_disk); - __sync_fetch_and_add(&(index->fbl->current_record_index),sax_save_number); + __sync_fetch_and_add(&(index->fbl->current_record_index), sax_save_number); COUNT_QUEUE_TIME_START - indexconstruction(index->fbl, index,&lock_index,&lock_disk,calculate_thread); + indexconstruction(index->fbl, index, &lock_index, &lock_disk, calculate_thread); COUNT_QUEUE_TIME_END free(ts); free(ts1); @@ -284,7 +286,6 @@ void isax_index_binary_file_m(const char *ifilename, int ts_num, isax_index *ind free(lockcbl); free(saxv); free(saxv1); - //free(sax); free(pos); pthread_barrier_destroy(&lock_barrier1); pthread_barrier_destroy(&lock_barrier2); @@ -293,288 +294,287 @@ void isax_index_binary_file_m(const char *ifilename, int ts_num, isax_index *ind COUNT_INPUT_TIME_END } -void isax_index_binary_file_m_new(const char *ifilename, int ts_num, isax_index *index,int calculate_thread) -{ +void isax_index_binary_file_m_new(const char *ifilename, int ts_num, isax_index *index, int calculate_thread) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE * ifile; COUNT_INPUT_TIME_START - ifile = fopen (ifilename,"rb"); + ifile = fopen(ifilename, "rb"); COUNT_INPUT_TIME_END - index_buffer_data *input_data=malloc(sizeof(index_buffer_data)*(calculate_thread-1)); - file_position_type *pos = malloc(sizeof(file_position_type)); - pthread_t threadid[calculate_thread-1]; + index_buffer_data *input_data = (index_buffer_data*)malloc(sizeof(index_buffer_data) * (calculate_thread - 1)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + pthread_t threadid[calculate_thread - 1]; bool sax_fist_time_check = false; long int ts_loaded = 0; - int j,conter=0; + int j; + int conter = 0; long long int i; - int prev_flush_time=0,now_flush_time=0; + int prev_flush_time = 0; + int now_flush_time = 0; int sax_save_number; - int nodecounter=0; + int nodecounter = 0; int bufferpresize[index->fbl->number_of_buffers]; - for (int i = 0; i < index->fbl->number_of_buffers; i++) - { - bufferpresize[i]=0; + for (int i = 0; i < index->fbl->number_of_buffers; i++) { + bufferpresize[i] = 0; } - //initial the locks - pthread_mutex_t lock_record=PTHREAD_MUTEX_INITIALIZER,lockfbl=PTHREAD_MUTEX_INITIALIZER,lock_index=PTHREAD_MUTEX_INITIALIZER, - lock_firstnode=PTHREAD_MUTEX_INITIALIZER,lock_disk=PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_t *lockcbl; - pthread_barrier_t lock_barrier1, lock_barrier2, lock_barrier3; + + // initialize the locks + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t *lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + pthread_barrier_t lock_barrier1; + pthread_barrier_t lock_barrier2; + pthread_barrier_t lock_barrier3; pthread_barrier_init(&lock_barrier1, NULL, calculate_thread); pthread_barrier_init(&lock_barrier2, NULL, calculate_thread); - pthread_barrier_init(&lock_barrier3, NULL, calculate_thread-1); - // set the thread on decided cpu - - lockcbl= malloc(sizeof(pthread_mutex_t)*LOCK_SIZE); + pthread_barrier_init(&lock_barrier3, NULL, calculate_thread - 1); - for(i=0; isettings->ts_byte_size; + file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size * read_block_length * (calculate_thread - 1)); + ts_type *ts1 = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size * read_block_length * (calculate_thread - 1)); + ts_type *ts2; + sax_type *saxv = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments * read_block_length * (calculate_thread - 1)); + sax_type *saxv1 = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments * read_block_length * (calculate_thread - 1)); + sax_type *saxv2; - ts_type * ts = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts1 = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts2; - sax_type * saxv = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv1 = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv2; - - index->settings->raw_filename = malloc(256); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); - - *pos = ftell(ifile); - - if(ts_num>read_block_length*(calculate_thread-1)) - { + if (ts_num > read_block_length * (calculate_thread - 1)) { COUNT_INPUT_TIME_START - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); + fread(ts1, sizeof(ts_type), index->settings->timeseries_size * read_block_length * (calculate_thread - 1), ifile); COUNT_INPUT_TIME_END - ts2 =ts; - ts =ts1; - ts1 =ts2; + ts2 = ts; + ts = ts1; + ts1 = ts2; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_new,(void*)&(input_data[j])); + + for (j = 0; j < (calculate_thread - 1); j++) { + pthread_create(&(threadid[j]), NULL, indexbulkloadingworker_new, (void*)&(input_data[j])); } - for (i = read_block_length*(calculate_thread-1)*2; i <= ts_num; i+=read_block_length*(calculate_thread-1)) - { - + for (i = read_block_length * (calculate_thread - 1) * 2; + i <= ts_num; i += read_block_length * (calculate_thread - 1)) { *pos = ftell(ifile); - //read the data of next round + + // read the data of next round COUNT_INPUT_TIME_START - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); + fread(ts1, sizeof(ts_type), index->settings->timeseries_size * read_block_length * (calculate_thread - 1), ifile); COUNT_INPUT_TIME_END - - //write the sax in disk (last round) - if (sax_fist_time_check) - { + + // write the sax in disk (last round) + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread - 1), index->sax_file); COUNT_OUTPUT_TIME_END - } - else - { - sax_fist_time_check=true; + } else { + sax_fist_time_check = true; } + // wait for the finish of other threads pthread_barrier_wait(&lock_barrier1); - //wait for the finish of other threads - ts2 =ts; - ts =ts1; - ts1 =ts2; - __sync_fetch_and_add(&(index->fbl->current_record_index),read_block_length*(calculate_thread-1)); - now_flush_time=i/(index->settings->max_total_buffer_size); - if(now_flush_time!=prev_flush_time) - { + + ts2 = ts; + ts = ts1; + ts1 = ts2; + __sync_fetch_and_add(&(index->fbl->current_record_index), read_block_length * (calculate_thread - 1)); + now_flush_time = i / (index->settings->max_total_buffer_size); + + if (now_flush_time != prev_flush_time) { COUNT_OUTPUT_TIME_START - indexflush(index->fbl, index,&lock_index,&lock_disk,calculate_thread); + indexflush(index->fbl, index, &lock_index, &lock_disk, calculate_thread); COUNT_OUTPUT_TIME_END - for (int i = 0; i < index->fbl->number_of_buffers; i++) - { - bufferpresize[i]=0; - } + + for (int i = 0; i < index->fbl->number_of_buffers; i++) { + bufferpresize[i] = 0; + } } - //printf("the saxv2 in the worker is %d\n",saxv2[0] ); - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - - prev_flush_time=now_flush_time; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + prev_flush_time = now_flush_time; + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } - nodecounter=0; + + nodecounter = 0; pthread_barrier_wait(&lock_barrier2); - } pthread_barrier_wait(&lock_barrier1); - for (j = 0; j < (calculate_thread-1); j++) - { - input_data[j].finished=true; - } - //wait for the finish of other threads - __sync_fetch_and_add(&(index->fbl->current_record_index),read_block_length*(calculate_thread-1)); - now_flush_time=i/(index->settings->max_total_buffer_size); - if(now_flush_time!=prev_flush_time) - { + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].finished = true; + } + + // wait for the finish of other threads + __sync_fetch_and_add(&(index->fbl->current_record_index), read_block_length * (calculate_thread - 1)); + now_flush_time = i / (index->settings->max_total_buffer_size); + + if (now_flush_time != prev_flush_time) { COUNT_OUTPUT_TIME_START - indexflush(index->fbl, index,&lock_index,&lock_disk,calculate_thread); + indexflush(index->fbl, index, &lock_index, &lock_disk, calculate_thread); COUNT_OUTPUT_TIME_END - for (int i = 0; i < index->fbl->number_of_buffers; i++) - { - bufferpresize[i]=0; + + for (int i = 0; i < index->fbl->number_of_buffers; i++) { + bufferpresize[i] = 0; } } - prev_flush_time=now_flush_time; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + prev_flush_time = now_flush_time; + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size *j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } - nodecounter=0; + + nodecounter = 0; pthread_barrier_wait(&lock_barrier2); - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_join(threadid[j],NULL); + + for (j = 0; j < (calculate_thread - 1); j++) { + pthread_join(threadid[j], NULL); } } - *pos = ftell(ifile); + + *pos = ftell(ifile); COUNT_INPUT_TIME_START - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*(ts_num%(read_block_length*(calculate_thread-1))), ifile); + fread(ts1, sizeof(ts_type), index->settings->timeseries_size * (ts_num % (read_block_length * (calculate_thread - 1))), ifile); COUNT_INPUT_TIME_END - ts2 =ts; - ts =ts1; - ts1 =ts2; - + ts2 = ts; + ts = ts1; + ts1 = ts2; + // handle the rest of the data + int conter_ts_number = ts_num % (read_block_length * (calculate_thread - 1)); + sax_save_number = conter_ts_number; - //handle the rest data - int conter_ts_number=ts_num%(read_block_length*(calculate_thread-1)); - sax_save_number=conter_ts_number; - - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos = *pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; conter++; - input_data[j].ts=&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].fin_number=min(conter_ts_number,read_block_length); - input_data[j].saxv=saxv; - conter_ts_number=conter_ts_number-read_block_length; - - if(conter_ts_number<0) + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].fin_number = min(conter_ts_number, read_block_length); + input_data[j].saxv = saxv; + conter_ts_number = conter_ts_number - read_block_length; + + if (conter_ts_number < 0) { break; + } } - pthread_barrier_init(&lock_barrier1, NULL, conter+1); - pthread_barrier_init(&lock_barrier2, NULL, conter+1); + pthread_barrier_init(&lock_barrier1, NULL, conter + 1); + pthread_barrier_init(&lock_barrier2, NULL, conter + 1); pthread_barrier_init(&lock_barrier3, NULL, conter); - for ( j = 0; j < conter; j++) - { - input_data[j].finished=false; - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_new,(void*)&(input_data[j])); + + for (j = 0; j < conter; j++) { + input_data[j].finished = false; + pthread_create(&(threadid[j]), NULL, indexbulkloadingworker_new, (void*)&(input_data[j])); } - if (sax_fist_time_check) - { + if (sax_fist_time_check) { pthread_mutex_lock(&lock_disk); COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, read_block_length * (calculate_thread - 1), index->sax_file); COUNT_OUTPUT_TIME_END pthread_mutex_unlock(&lock_disk); - } - else - { - sax_fist_time_check=true; + } else { + sax_fist_time_check = true; } pthread_barrier_wait(&lock_barrier1); - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - for ( j = 0; j < conter; j++) - { - input_data[j].finished=true; - } - nodecounter=0; + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + + for (j = 0; j < conter; j++) { + input_data[j].finished = true; + } + + nodecounter = 0; pthread_barrier_wait(&lock_barrier2); - for (j = 0; j < conter; j++) - { - pthread_join(threadid[j],NULL); + for (j = 0; j < conter; j++) { + pthread_join(threadid[j], NULL); } + pthread_mutex_lock(&lock_disk); COUNT_OUTPUT_TIME_START fwrite(saxv1, index->settings->sax_byte_size, sax_save_number, index->sax_file); COUNT_OUTPUT_TIME_END pthread_mutex_unlock(&lock_disk); - __sync_fetch_and_add(&(index->fbl->current_record_index),sax_save_number); + __sync_fetch_and_add(&(index->fbl->current_record_index), sax_save_number); COUNT_OUTPUT_TIME_START - indexflush(index->fbl, index,&lock_index,&lock_disk,calculate_thread); + indexflush(index->fbl, index, &lock_index, &lock_disk, calculate_thread); COUNT_OUTPUT_TIME_END - for (int i = 0; i < index->fbl->number_of_buffers; i++) - { - bufferpresize[i]=0; + + for (int i = 0; i < index->fbl->number_of_buffers; i++) { + bufferpresize[i] = 0; } + free(ts); free(ts1); free(input_data); free(lockcbl); free(saxv); free(saxv1); - //free(sax); free(pos); pthread_barrier_destroy(&lock_barrier1); pthread_barrier_destroy(&lock_barrier2); @@ -584,269 +584,267 @@ void isax_index_binary_file_m_new(const char *ifilename, int ts_num, isax_index COUNT_INPUT_TIME_END } -void isax_index_binary_file_pRecBuf(const char *ifilename, int ts_num, isax_index *index,int calculate_thread) -{ +void isax_index_binary_file_pRecBuf(const char *ifilename, int ts_num, isax_index *index, int calculate_thread) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE * ifile; - - ifile = fopen (ifilename,"rb"); - index_buffer_data *input_data=malloc(sizeof(index_buffer_data)*(calculate_thread-1)); - file_position_type *pos = malloc(sizeof(file_position_type)); - pthread_t threadid[calculate_thread-1]; + + ifile = fopen(ifilename, "rb"); + index_buffer_data *input_data = (index_buffer_data*)malloc(sizeof(index_buffer_data) * (calculate_thread - 1)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + pthread_t threadid[calculate_thread - 1]; bool sax_fist_time_check = false; long int ts_loaded = 0; - int j,conter=0; + int j; + int conter = 0; long long int i; - int prev_flush_time=0,now_flush_time=0; + int prev_flush_time = 0; + int now_flush_time = 0; int sax_save_number; - //initial the locks - pthread_mutex_t lock_record=PTHREAD_MUTEX_INITIALIZER,lockfbl=PTHREAD_MUTEX_INITIALIZER,lock_index=PTHREAD_MUTEX_INITIALIZER, - lock_firstnode=PTHREAD_MUTEX_INITIALIZER,lock_disk=PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_t *lockcbl; - pthread_barrier_t lock_barrier1, lock_barrier2; + + // initialize the locks + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t *lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + pthread_barrier_t lock_barrier1; + pthread_barrier_t lock_barrier2; pthread_barrier_init(&lock_barrier1, NULL, calculate_thread); pthread_barrier_init(&lock_barrier2, NULL, calculate_thread); destroy_fbl(index->fbl); - index->fbl = (first_buffer_layer*)initialize_pRecBuf(index->settings->initial_fbl_buffer_size, - pow(2, index->settings->paa_segments), - index->settings->max_total_buffer_size+DISK_BUFFER_SIZE*(PROGRESS_CALCULATE_THREAD_NUMBER-1), index); - // set the thread on decided cpu - - lockcbl= malloc(sizeof(pthread_mutex_t)*LOCK_SIZE); + index->fbl = (first_buffer_layer*)initialize_pRecBuf(index->settings->initial_fbl_buffer_size, + pow(2, index->settings->paa_segments), + index->settings->max_total_buffer_size + DISK_BUFFER_SIZE * (PROGRESS_CALCULATE_THREAD_NUMBER - 1), index); - for(i=0; isettings->ts_byte_size; + file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size * read_block_length * (calculate_thread - 1)); + ts_type *ts1 = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size * read_block_length * (calculate_thread - 1)); + ts_type *ts2; + sax_type *saxv = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments * read_block_length * (calculate_thread - 1)); + sax_type *saxv1 = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments * read_block_length * (calculate_thread - 1)); + sax_type *saxv2; - ts_type * ts = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts1 = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts2; - sax_type * saxv = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv1 = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv2; - - index->settings->raw_filename = malloc(256); + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); - #ifdef BENCHMARK +#ifdef BENCHMARK int percentage = (int) (ts_num / (file_position_type) 100); - #endif - - *pos = ftell(ifile); +#endif + *pos = ftell(ifile); - if(ts_num>read_block_length*(calculate_thread-1)) - { - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); - ts2 =ts; - ts =ts1; - ts1 =ts2; + if (ts_num > read_block_length * (calculate_thread - 1)) { + fread(ts1, sizeof(ts_type), index->settings->timeseries_size * read_block_length * (calculate_thread - 1), ifile); + ts2 = ts; + ts = ts1; + ts1 = ts2; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_pRecBuf,(void*)&(input_data[j])); + + for (j = 0; j < (calculate_thread - 1); j++) { + pthread_create(&(threadid[j]), NULL, indexbulkloadingworker_pRecBuf, (void*)&(input_data[j])); } - for (i = read_block_length*(calculate_thread-1); i < ts_num; i+=read_block_length*(calculate_thread-1)) - { - + for (i = read_block_length * (calculate_thread-1); + i < ts_num; i += read_block_length * (calculate_thread - 1)) { *pos = ftell(ifile); - - //read the data of next round - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); - - //write the sax in disk (last round) - if (sax_fist_time_check) - { - //printf("the sax0 is %d\n",saxv[0] ); + + // read the data of next round + fread(ts1, sizeof(ts_type), index->settings->timeseries_size * read_block_length * (calculate_thread - 1), ifile); + + // write the sax in disk (last round) + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, read_block_length * (calculate_thread - 1), index->sax_file); COUNT_OUTPUT_TIME_END - } - else - { - sax_fist_time_check=true; + } else { + sax_fist_time_check = true; } + // wait for the finish of other threads pthread_barrier_wait(&lock_barrier1); - //wait for the finish of other threads - ts2 =ts; - ts =ts1; - ts1 =ts2; - now_flush_time=i/(index->settings->max_total_buffer_size); - __sync_fetch_and_add(&(index->total_records),read_block_length*(calculate_thread-1)); + ts2 = ts; + ts = ts1; + ts1 = ts2; - __sync_fetch_and_add(&(index->fbl->current_record_index),read_block_length*(calculate_thread-1)); - if(now_flush_time!=prev_flush_time) - { + now_flush_time = i / (index->settings->max_total_buffer_size); + __sync_fetch_and_add(&(index->total_records), read_block_length * (calculate_thread - 1)); + __sync_fetch_and_add(&(index->fbl->current_record_index), read_block_length * (calculate_thread - 1)); + + if (now_flush_time != prev_flush_time) { COUNT_QUEUE_TIME_START - indexconstruction_pRecBuf(index->fbl, index,&lock_index,calculate_thread); + indexconstruction_pRecBuf(index->fbl, index, &lock_index, calculate_thread); COUNT_QUEUE_TIME_END } - //printf("the saxv2 in the worker is %d\n",saxv2[0] ); - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - - prev_flush_time=now_flush_time; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + + prev_flush_time = now_flush_time; + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } + pthread_barrier_wait(&lock_barrier2); } pthread_barrier_wait(&lock_barrier1); - for (j = 0; j < (calculate_thread-1); j++) - { - input_data[j].finished=true; - } - //wait for the finish of other threads - __sync_fetch_and_add(&(index->total_records),read_block_length*(calculate_thread-1)); - __sync_fetch_and_add(&(index->fbl->current_record_index),read_block_length*(calculate_thread-1)); - now_flush_time=i/(index->settings->max_total_buffer_size); - if(now_flush_time!=prev_flush_time) - { + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].finished = true; + } + + // wait for the finish of other threads + __sync_fetch_and_add(&(index->total_records), read_block_length * (calculate_thread - 1)); + __sync_fetch_and_add(&(index->fbl->current_record_index), read_block_length * (calculate_thread - 1)); + now_flush_time = i / (index->settings->max_total_buffer_size); + + if (now_flush_time != prev_flush_time) { COUNT_QUEUE_TIME_START - indexconstruction_pRecBuf(index->fbl, index,&lock_index,calculate_thread); + indexconstruction_pRecBuf(index->fbl, index, &lock_index, calculate_thread); COUNT_QUEUE_TIME_END } - prev_flush_time=now_flush_time; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; + prev_flush_time = now_flush_time; + + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } + pthread_barrier_wait(&lock_barrier2); - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_join(threadid[j],NULL); + + for (j = 0; j < (calculate_thread - 1); j++) { + pthread_join(threadid[j], NULL); } } - - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*(ts_num%(read_block_length*(calculate_thread-1))), ifile); - ts2 =ts; - ts =ts1; - ts1 =ts2; - + fread(ts1, sizeof(ts_type), index->settings->timeseries_size * (ts_num % (read_block_length * (calculate_thread - 1))), ifile); + ts2 = ts; + ts = ts1; + ts1 = ts2; + // handle the rest of the data + int conter_ts_number = ts_num % (read_block_length * (calculate_thread - 1)); + sax_save_number = conter_ts_number; - //handle the rest data - int conter_ts_number=ts_num%(read_block_length*(calculate_thread-1)); - sax_save_number=conter_ts_number; - - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos = *pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; + for (j = 0; j < (calculate_thread - 1); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; conter++; - input_data[j].ts=&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].fin_number=min(conter_ts_number,read_block_length); - conter_ts_number=conter_ts_number-read_block_length; - - if(conter_ts_number<0) + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].fin_number = min(conter_ts_number, read_block_length); + conter_ts_number = conter_ts_number - read_block_length; + + if (conter_ts_number < 0) { break; + } } - pthread_barrier_init(&lock_barrier1, NULL, conter+1); - pthread_barrier_init(&lock_barrier2, NULL, conter+1); - for ( j = 0; j < conter; j++) - { - input_data[j].finished=false; - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_pRecBuf,(void*)&(input_data[j])); + pthread_barrier_init(&lock_barrier1, NULL, conter + 1); + pthread_barrier_init(&lock_barrier2, NULL, conter + 1); + + for (j = 0; j < conter; j++) { + input_data[j].finished = false; + pthread_create(&(threadid[j]), NULL, indexbulkloadingworker_pRecBuf, (void*)&(input_data[j])); } - if (sax_fist_time_check) - { + if (sax_fist_time_check) { pthread_mutex_lock(&lock_disk); COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, read_block_length * (calculate_thread - 1), index->sax_file); COUNT_OUTPUT_TIME_END pthread_mutex_unlock(&lock_disk); + } else { + sax_fist_time_check = true; } - else - { - sax_fist_time_check=true; - } + pthread_barrier_wait(&lock_barrier1); - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - for ( j = 0; j < conter; j++) - { - input_data[j].finished=true; + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + + for (j = 0; j < conter; j++) { + input_data[j].finished = true; } - __sync_fetch_and_add(&(index->total_records),conter_ts_number); - __sync_fetch_and_add(&(index->fbl->current_record_index),conter_ts_number); + + __sync_fetch_and_add(&(index->total_records), conter_ts_number); + __sync_fetch_and_add(&(index->fbl->current_record_index), conter_ts_number); pthread_barrier_wait(&lock_barrier2); - for (j = 0; j < conter; j++) - { - pthread_join(threadid[j],NULL); + for (j = 0; j < conter; j++) { + pthread_join(threadid[j], NULL); } + pthread_mutex_lock(&lock_disk); COUNT_OUTPUT_TIME_START fwrite(saxv, index->settings->sax_byte_size, sax_save_number, index->sax_file); COUNT_OUTPUT_TIME_END pthread_mutex_unlock(&lock_disk); - - indexconstruction_pRecBuf(index->fbl, index,&lock_index,calculate_thread); - + + indexconstruction_pRecBuf(index->fbl, index, &lock_index, calculate_thread); + free(ts); free(ts1); free(input_data); free(lockcbl); free(saxv); free(saxv1); - //free(sax); free(pos); pthread_barrier_destroy(&lock_barrier1); pthread_barrier_destroy(&lock_barrier2); @@ -854,378 +852,310 @@ void isax_index_binary_file_pRecBuf(const char *ifilename, int ts_num, isax_inde fclose(ifile); COUNT_INPUT2_TIME_END } -void isax_index_binary_file_2RecBuf(const char *ifilename, int ts_num, isax_index *index,int calculate_thread) -{ + +void isax_index_binary_file_2RecBuf(const char *ifilename, int ts_num, isax_index *index, int calculate_thread) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE * ifile; int propotion_number = 0; - ifile = fopen (ifilename,"rb"); - index_buffer_data *input_data=malloc(sizeof(index_buffer_data)*(calculate_thread/2+propotion_number)); - file_position_type *pos = malloc(sizeof(file_position_type)); - pthread_t threadid[calculate_thread/2+propotion_number]; + ifile = fopen(ifilename, "rb"); + index_buffer_data *input_data = (index_buffer_data*)malloc(sizeof(index_buffer_data) * (calculate_thread / 2 + propotion_number)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + pthread_t threadid[calculate_thread / 2 + propotion_number]; bool sax_fist_time_check = false; - + long int ts_loaded = 0; - int j,conter=0; + int j; + int conter = 0; long long int i; - int prev_flush_time=0,now_flush_time=0; + int prev_flush_time = 0; + int now_flush_time = 0; int sax_save_number; - //initial the locks - pthread_mutex_t lock_record=PTHREAD_MUTEX_INITIALIZER,lockfbl=PTHREAD_MUTEX_INITIALIZER,lock_index=PTHREAD_MUTEX_INITIALIZER, - lock_firstnode=PTHREAD_MUTEX_INITIALIZER,lock_disk=PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_t *lockcbl; - lockcbl= malloc(sizeof(pthread_mutex_t)*LOCK_SIZE); - pthread_barrier_t lock_barrier1, lock_barrier2, lock_barrier3, lock_barrier4; - pthread_barrier_init(&lock_barrier1, NULL, calculate_thread/2+propotion_number+1); - pthread_barrier_init(&lock_barrier2, NULL, calculate_thread/2+propotion_number+1); - pthread_barrier_init(&lock_barrier3, NULL, calculate_thread/2-propotion_number); - pthread_barrier_init(&lock_barrier4, NULL, calculate_thread/2-propotion_number); + + // initialize the locks + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t *lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + pthread_barrier_t lock_barrier1; + pthread_barrier_t lock_barrier2; + pthread_barrier_t lock_barrier3; + pthread_barrier_t lock_barrier4; + pthread_barrier_init(&lock_barrier1, NULL, calculate_thread / 2 + propotion_number + 1); + pthread_barrier_init(&lock_barrier2, NULL, calculate_thread / 2 + propotion_number + 1); + pthread_barrier_init(&lock_barrier3, NULL, calculate_thread / 2 - propotion_number); + pthread_barrier_init(&lock_barrier4, NULL, calculate_thread / 2 - propotion_number); destroy_fbl(index->fbl); - index->fbl = (first_buffer_layer*)initialize_pRecBuf(index->settings->initial_fbl_buffer_size, - pow(2, index->settings->paa_segments), - index->settings->max_total_buffer_size+DISK_BUFFER_SIZE*(PROGRESS_CALCULATE_THREAD_NUMBER-1), index); + index->fbl = (first_buffer_layer*)initialize_pRecBuf(index->settings->initial_fbl_buffer_size, + pow(2, index->settings->paa_segments), + index->settings->max_total_buffer_size + DISK_BUFFER_SIZE * (PROGRESS_CALCULATE_THREAD_NUMBER - 1), index); + // set the thread on decided cpu - int indexconstructionroundchose=0; - bool firstflush=true; - for(i=0; ifbl->number_of_buffers*2]; - for (int i = 0; i < index->fbl->number_of_buffers*2; i++) - { - bufferpresize[i]=0; + int bufferpresize[index->fbl->number_of_buffers * 2]; + + for (int i = 0; i < index->fbl->number_of_buffers * 2; i++) { + bufferpresize[i] = 0; } trans_fbl_input constructioninput_data; - pthread_t threadconstructionid[calculate_thread/2-propotion_number-1]; - pthread_mutex_t lock_fbl_conter=PTHREAD_MUTEX_INITIALIZER; - constructioninput_data.index=index; - constructioninput_data.lock_index=&lock_index; - constructioninput_data.lock_fbl_conter=&lock_fbl_conter; - constructioninput_data.conternumber=0; - constructioninput_data.stop_number=index->fbl->number_of_buffers; - constructioninput_data.preworkernumber=2; - constructioninput_data.fbloffset=indexconstructionroundchose; - constructioninput_data.lock_barrier1=&lock_barrier3; - constructioninput_data.lock_barrier2=&lock_barrier4; - constructioninput_data.buffersize=bufferpresize; - constructioninput_data.finished=false; - + pthread_t threadconstructionid[calculate_thread / 2 - propotion_number - 1]; + pthread_mutex_t lock_fbl_conter = PTHREAD_MUTEX_INITIALIZER; + constructioninput_data.index = index; + constructioninput_data.lock_index = &lock_index; + constructioninput_data.lock_fbl_conter = &lock_fbl_conter; + constructioninput_data.conternumber = 0; + constructioninput_data.stop_number = index->fbl->number_of_buffers; + constructioninput_data.preworkernumber = 2; + constructioninput_data.fbloffset = indexconstructionroundchose; + constructioninput_data.lock_barrier1 = &lock_barrier3; + constructioninput_data.lock_barrier2 = &lock_barrier4; + constructioninput_data.buffersize = bufferpresize; + constructioninput_data.finished = false; if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); - file_position_type total_records = sz/index->settings->ts_byte_size; + file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } - - ts_type * ts = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread/2+propotion_number)); - ts_type * ts1 = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread/2+propotion_number)); - ts_type * ts2; - sax_type * saxv = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread/2+propotion_number)); - sax_type * saxv1 = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread/2+propotion_number)); - sax_type * saxv2; - - for (i = 0; i < (calculate_thread/2+propotion_number); i++) - { - input_data[i].index=index; - input_data[i].lock_fbl=&lockfbl; - input_data[i].lock_cbl=lockcbl; - input_data[i].lock_record=&lock_record; - input_data[i].bufferpresize=bufferpresize; - input_data[i].lock_firstnode =&lock_firstnode; - input_data[i].lock_index=&lock_index; - input_data[i].blocid=i*read_block_length; - input_data[i].lock_disk=&lock_disk; - input_data[i].workernumber=0; - input_data[i].total_workernumber=2; - input_data[i].lock_barrier1=&lock_barrier1; - input_data[i].lock_barrier2=&lock_barrier2; - input_data[i].saxv =saxv; - input_data[i].finished=false; - } - index->settings->raw_filename = malloc(256); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size * read_block_length * (calculate_thread / 2 + propotion_number)); + ts_type *ts1 = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size * read_block_length * (calculate_thread / 2 + propotion_number)); + ts_type *ts2; + sax_type *saxv = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments * read_block_length * (calculate_thread / 2 + propotion_number)); + sax_type *saxv1 = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments * read_block_length * (calculate_thread / 2 + propotion_number)); + sax_type *saxv2; + + for (i = 0; i < (calculate_thread / 2 + propotion_number); i++) { + input_data[i].index = index; + input_data[i].lock_fbl = &lockfbl; + input_data[i].lock_cbl = lockcbl; + input_data[i].lock_record = &lock_record; + input_data[i].bufferpresize = bufferpresize; + input_data[i].lock_firstnode = &lock_firstnode; + input_data[i].lock_index = &lock_index; + input_data[i].blocid = i * read_block_length; + input_data[i].lock_disk = &lock_disk; + input_data[i].workernumber = 0; + input_data[i].total_workernumber = 2; + input_data[i].lock_barrier1 = &lock_barrier1; + input_data[i].lock_barrier2 = &lock_barrier2; + input_data[i].saxv = saxv; + input_data[i].finished = false; + } + + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); - #ifdef BENCHMARK +#ifdef BENCHMARK int percentage = (int) (ts_num / (file_position_type) 100); - #endif +#endif *pos = ftell(ifile); - if(ts_num>read_block_length*(calculate_thread/2+propotion_number)) - { - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread/2+propotion_number), ifile); - ts2 =ts; - ts =ts1; - ts1 =ts2; + if (ts_num > read_block_length * (calculate_thread / 2 + propotion_number)) { + fread(ts1, sizeof(ts_type), index->settings->timeseries_size * read_block_length * (calculate_thread / 2 + propotion_number), ifile); + ts2 = ts; + ts = ts1; + ts1 = ts2; - for ( j = 0; j < (calculate_thread/2+propotion_number); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; - } - for (j = 0; j < (calculate_thread/2+propotion_number); j++) - { - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_2RecBuf,(void*)&(input_data[j])); + for (j = 0; j < (calculate_thread / 2 + propotion_number); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; } - for (int k = 0; k < calculate_thread/2-propotion_number-1; k++) - { - pthread_create(&(threadconstructionid[k]),NULL,indexconstructionworker_2RecBuf,(void*)&(constructioninput_data)); + + for (j = 0; j < (calculate_thread / 2 + propotion_number); j++) { + pthread_create(&(threadid[j]), NULL, indexbulkloadingworker_2RecBuf, (void*)&(input_data[j])); } - for (i = read_block_length*(calculate_thread/2+propotion_number); i < ts_num; i+=read_block_length*(calculate_thread/2+propotion_number)) - { - + for (int k = 0; k < calculate_thread / 2 - propotion_number - 1; k++) { + pthread_create(&(threadconstructionid[k]), NULL, indexconstructionworker_2RecBuf, (void*)&(constructioninput_data)); + } + for (i = read_block_length * (calculate_thread /2 + propotion_number); + i < ts_num; i += read_block_length * (calculate_thread / 2 + propotion_number)) { *pos = ftell(ifile); - //read the data of next round - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread/2+propotion_number), ifile); - //write the sax in disk (last round) - if (sax_fist_time_check) - { - //printf("the sax0 is %d\n",saxv[0] ); + + // read the data of next round + fread(ts1, sizeof(ts_type), + index->settings->timeseries_size * read_block_length * (calculate_thread / 2 + propotion_number), ifile); + + // write the sax in disk (last round) + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread/2+propotion_number), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, read_block_length * (calculate_thread / 2 + propotion_number), index->sax_file); COUNT_OUTPUT_TIME_END + } else { + sax_fist_time_check = true; } - else - { - sax_fist_time_check=true; - } - + + // wait for the finish of other threads pthread_barrier_wait(&lock_barrier1); pthread_barrier_wait(&lock_barrier3); - //wait for the finish of other threads - ts2 =ts; - ts =ts1; - ts1 =ts2; - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - now_flush_time=i/(index->settings->max_total_buffer_size); - __sync_fetch_and_add(&(index->total_records),read_block_length*(calculate_thread/2+propotion_number)); - __sync_fetch_and_add(&(index->fbl->current_record_index),read_block_length*(calculate_thread/2+propotion_number)); - - for ( j = 0; j < calculate_thread/2+propotion_number; j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; - if(input_data[j].workernumber==0) - input_data[j].workernumber=1; - else - input_data[j].workernumber=0; + + ts2 = ts; + ts = ts1; + ts1 = ts2; + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + now_flush_time = i / (index->settings->max_total_buffer_size); + __sync_fetch_and_add(&(index->total_records), read_block_length * (calculate_thread / 2 + propotion_number)); + __sync_fetch_and_add(&(index->fbl->current_record_index), read_block_length * (calculate_thread / 2 + propotion_number)); + + for (j = 0; j < calculate_thread / 2 + propotion_number; j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; + + if (input_data[j].workernumber == 0) { + input_data[j].workernumber = 1; + } else { + input_data[j].workernumber = 0; + } + } + + if (constructioninput_data.fbloffset == 0) { + constructioninput_data.fbloffset = 1; + } else { + constructioninput_data.fbloffset = 0; } - if(constructioninput_data.fbloffset==0) - constructioninput_data.fbloffset=1; - else - constructioninput_data.fbloffset=0; - constructioninput_data.conternumber=0; + constructioninput_data.conternumber = 0; pthread_barrier_wait(&lock_barrier2); pthread_barrier_wait(&lock_barrier4); } *pos = ftell(ifile); - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*(ts_num%(read_block_length*(calculate_thread/2+propotion_number))), ifile); - if (sax_fist_time_check) - { - //printf("the sax0 is %d\n",saxv[0] ); + fread(ts1, sizeof(ts_type), + index->settings->timeseries_size * (ts_num % (read_block_length * (calculate_thread / 2 + propotion_number))), ifile); + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread/2+propotion_number), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, read_block_length * (calculate_thread / 2 + propotion_number), index->sax_file); COUNT_OUTPUT_TIME_END + } else { + sax_fist_time_check = true; } - else - { - sax_fist_time_check=true; - } + pthread_barrier_wait(&lock_barrier1); pthread_barrier_wait(&lock_barrier3); - ts2 =ts; - ts =ts1; - ts1 =ts2; - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - int conter_ts_number=ts_num%(read_block_length*(calculate_thread/2+propotion_number)); - sax_save_number=conter_ts_number; - int threadnumber=0; - pthread_barrier_t lock_barrier1_bas,lock_barrier2_bas; - - - for ( j = 0; j < calculate_thread/2+propotion_number; j++) - { - input_data[j].pos = *pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; + ts2 = ts; + ts = ts1; + ts1 = ts2; + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + int conter_ts_number = ts_num % (read_block_length * (calculate_thread / 2 + propotion_number)); + sax_save_number = conter_ts_number; + int threadnumber = 0; + pthread_barrier_t lock_barrier1_bas; + pthread_barrier_t lock_barrier2_bas; + + for (j = 0; j < calculate_thread / 2 + propotion_number; j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; conter++; - input_data[j].ts=&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].fin_number=min(conter_ts_number,read_block_length); - conter_ts_number=conter_ts_number-read_block_length; - - if(input_data[j].workernumber==0) - input_data[j].workernumber=1; - else - input_data[j].workernumber=0; - if((conter_ts_number+read_block_length)<=0) - input_data[j].finished=true; - else - threadnumber=j+2; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].fin_number = min(conter_ts_number, read_block_length); + conter_ts_number = conter_ts_number - read_block_length; + + if (input_data[j].workernumber == 0) { + input_data[j].workernumber = 1; + } else { + input_data[j].workernumber = 0; + } + + if ((conter_ts_number + read_block_length) <= 0) { + input_data[j].finished = true; + } else { + threadnumber = j + 2; + } } + pthread_barrier_init(&lock_barrier1_bas, NULL, threadnumber); pthread_barrier_init(&lock_barrier2_bas, NULL, threadnumber); - for ( j = 0; j < calculate_thread/2+propotion_number; j++) - { - input_data[j].lock_barrier1=&lock_barrier1_bas; - input_data[j].lock_barrier2=&lock_barrier2_bas; - } - - if(constructioninput_data.fbloffset==0) - constructioninput_data.fbloffset=1; - else - constructioninput_data.fbloffset=0; - constructioninput_data.conternumber=0; - + + for (j = 0; j < calculate_thread / 2 + propotion_number; j++) { + input_data[j].lock_barrier1 = &lock_barrier1_bas; + input_data[j].lock_barrier2 = &lock_barrier2_bas; + } + + if (constructioninput_data.fbloffset == 0) { + constructioninput_data.fbloffset = 1; + } else { + constructioninput_data.fbloffset = 0; + } + + constructioninput_data.conternumber = 0; + pthread_barrier_wait(&lock_barrier2); pthread_barrier_wait(&lock_barrier4); - - if (sax_fist_time_check) - { - //printf("the sax0 is %d\n",saxv[0] ); + + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv, index->settings->sax_byte_size, ts_num%read_block_length*(calculate_thread/2+propotion_number), index->sax_file); + fwrite(saxv, index->settings->sax_byte_size, + ts_num % read_block_length * (calculate_thread / 2 + propotion_number), index->sax_file); COUNT_OUTPUT_TIME_END + } else { + sax_fist_time_check = true; } - else - { - sax_fist_time_check=true; - } + pthread_barrier_wait(&lock_barrier1_bas); pthread_barrier_wait(&lock_barrier3); - for ( j = 0; j < calculate_thread/2+propotion_number; j++) - { - input_data[j].finished=true; - } - if(input_data[0].workernumber==0) - constructioninput_data.fbloffset=1; - else - constructioninput_data.fbloffset=0; - constructioninput_data.conternumber=0; - constructioninput_data.finished=1; - pthread_barrier_wait(&lock_barrier2_bas); - pthread_barrier_wait(&lock_barrier4); - - - for (int k = 0; k < calculate_thread/2+propotion_number; k++) - { - pthread_join(threadid[k],NULL); - } - for (int k = 0; k < calculate_thread/2-propotion_number-1; k++) - { - pthread_join(threadconstructionid[k],NULL); - } - - } - - /* - { - - - - constructioninput_data.finished=1; - - - - - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*(ts_num%(read_block_length*(calculate_thread/2-1))), ifile); - ts2 =ts; - ts =ts1; - ts1 =ts2; - //handle the rest data - int conter_ts_number=ts_num%(read_block_length*(calculate_thread/2-1)); - sax_save_number=conter_ts_number; - for ( j = 0; j < (calculate_thread/2-1); j++) - { - input_data[j].pos = *pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - conter++; - input_data[j].ts=&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].fin_number=min(conter_ts_number,read_block_length); - conter_ts_number=conter_ts_number-read_block_length; - - if(conter_ts_number<0) - break; + for (j = 0; j < calculate_thread / 2 + propotion_number; j++) { + input_data[j].finished = true; } - pthread_barrier_destroy(&lock_barrier1); - pthread_barrier_destroy(&lock_barrier2); - - pthread_barrier_init(&lock_barrier1, NULL, conter+1); - pthread_barrier_init(&lock_barrier2, NULL, conter+1); - - for (j = 0; j < (calculate_thread/2+propotion_number); j++) - { - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_pRecBuf,(void*)&(input_data[j])); + if (input_data[0].workernumber == 0) { + constructioninput_data.fbloffset = 1; + } else { + constructioninput_data.fbloffset = 0; } - - pthread_barrier_wait(&lock_barrier1); - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - for ( j = 0; j < conter; j++) - { - input_data[j].finished=true; - } - __sync_fetch_and_add(&(index->total_records),conter_ts_number); - __sync_fetch_and_add(&(index->fbl->current_record_index),conter_ts_number); - pthread_barrier_wait(&lock_barrier2); - for (j = 0; j < conter; j++) - { - pthread_join(threadid[j],NULL); - } - pthread_mutex_lock(&lock_disk); - COUNT_OUTPUT_TIME_START - fwrite(saxv, index->settings->sax_byte_size, sax_save_number, index->sax_file); - COUNT_OUTPUT_TIME_END - pthread_mutex_unlock(&lock_disk); - constructioninput_data.stop_number=index->fbl->number_of_buffers; - constructioninput_data.fbloffset=0; - constructioninput_data.preworkernumber=calculate_thread-2; - constructioninput_data.conternumber=0; - for (int k = 0; k < calculate_thread/2; k++) - { - pthread_create(&(threadconstructionid[k]),NULL,indexconstructionworker_pRecBuf_new,(void*)&(constructioninput_data)); - } + constructioninput_data.conternumber = 0; + constructioninput_data.finished = 1; + pthread_barrier_wait(&lock_barrier2_bas); + pthread_barrier_wait(&lock_barrier4); - for (int k = 0; k < calculate_thread/2; k++) - { - pthread_join(threadconstructionid[k],NULL); - } - }*/ + for (int k = 0; k < calculate_thread / 2 + propotion_number; k++) { + pthread_join(threadid[k], NULL); + } + for (int k = 0; k < calculate_thread /2 - propotion_number - 1; k++) { + pthread_join(threadconstructionid[k], NULL); + } + } - //indexflush(index->fbl, index,&lock_index,&lock_disk,calculate_thread); printf("this is the check point 7\n"); free(ts); free(ts1); free(input_data); free(saxv); free(saxv1); - //free(sax); free(pos); pthread_barrier_destroy(&lock_barrier1); pthread_barrier_destroy(&lock_barrier2); @@ -1235,299 +1165,284 @@ void isax_index_binary_file_2RecBuf(const char *ifilename, int ts_num, isax_inde fclose(ifile); COUNT_INPUT2_TIME_END } - -void isax_index_binary_file_2nRecBuf(const char *ifilename, int ts_num, isax_index *index,int calculate_thread) -{ + +void isax_index_binary_file_2nRecBuf(const char *ifilename, int ts_num, isax_index *index, int calculate_thread) { fprintf(stderr, ">>> Indexing: %s\n", ifilename); FILE * ifile; int propotion_number = 0; - ifile = fopen (ifilename,"rb"); - index_buffer_data *input_data=malloc(sizeof(index_buffer_data)*(calculate_thread/2+propotion_number)); - file_position_type *pos = malloc(sizeof(file_position_type)); - pthread_t threadid[calculate_thread/2+propotion_number]; + ifile = fopen(ifilename, "rb"); + index_buffer_data *input_data = (index_buffer_data*)malloc(sizeof(index_buffer_data) * (calculate_thread / 2 + propotion_number)); + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + pthread_t threadid[calculate_thread / 2 + propotion_number]; bool sax_fist_time_check = false; - + long int ts_loaded = 0; - int j,conter=0; + int j; + int conter = 0; long long int i; - int prev_flush_time=0,now_flush_time=0; + int prev_flush_time = 0; + int now_flush_time = 0; int sax_save_number; - //initial the locks - pthread_mutex_t lock_record=PTHREAD_MUTEX_INITIALIZER,lockfbl=PTHREAD_MUTEX_INITIALIZER,lock_index=PTHREAD_MUTEX_INITIALIZER, - lock_firstnode=PTHREAD_MUTEX_INITIALIZER,lock_disk=PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_t *lockcbl; - lockcbl= malloc(sizeof(pthread_mutex_t)*LOCK_SIZE); - pthread_barrier_t lock_barrier1, lock_barrier2, lock_barrier3, lock_barrier4; + // initialize the locks + pthread_mutex_t lock_record = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lockfbl = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_firstnode = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_disk = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t *lockcbl = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t) * LOCK_SIZE); + + pthread_barrier_t lock_barrier1; + pthread_barrier_t lock_barrier2; + pthread_barrier_t lock_barrier3; + pthread_barrier_t lock_barrier4; pthread_barrier_init(&lock_barrier1, NULL, calculate_thread); pthread_barrier_init(&lock_barrier2, NULL, calculate_thread); - pthread_barrier_init(&lock_barrier3, NULL, calculate_thread/2-propotion_number); - pthread_barrier_init(&lock_barrier4, NULL, calculate_thread/2-propotion_number); + pthread_barrier_init(&lock_barrier3, NULL, calculate_thread / 2 - propotion_number); + pthread_barrier_init(&lock_barrier4, NULL, calculate_thread / 2 - propotion_number); destroy_fbl(index->fbl); index->fbl = (first_buffer_layer*)initialize_2pRecBuf(index->settings->initial_fbl_buffer_size, - pow(2, index->settings->paa_segments), - index->settings->max_total_buffer_size+DISK_BUFFER_SIZE*(PROGRESS_CALCULATE_THREAD_NUMBER-1), index); + pow(2, index->settings->paa_segments), + index->settings->max_total_buffer_size + DISK_BUFFER_SIZE * (PROGRESS_CALCULATE_THREAD_NUMBER - 1), index); first_buffer_layer *fbltran; + // set the thread on decided cpu - int indexbulkloadingroundchose=0; - bool firstflush=true; - for(i=0; ifbl)->number_of_buffers*(calculate_thread/2+propotion_number)*2); - for (long int i = 0; i < ((parallel_dfirst_buffer_layer*)index->fbl)->number_of_buffers*(calculate_thread/2+propotion_number)*2; i++) - { - bufferpresize[i]=0; + + int *bufferpresize = (int*)malloc(sizeof(int) + * ((parallel_dfirst_buffer_layer*)index->fbl)->number_of_buffers * (calculate_thread / 2 + propotion_number) * 2); + + for (long int i = 0; + i < ((parallel_dfirst_buffer_layer*)index->fbl)->number_of_buffers * (calculate_thread / 2 + propotion_number) * 2; + i++) { + bufferpresize[i] = 0; } trans_fbl_input constructioninput_data; - pthread_t threadconstructionid[calculate_thread/2-propotion_number-1]; - pthread_mutex_t lock_fbl_conter=PTHREAD_MUTEX_INITIALIZER; - constructioninput_data.index=index; - constructioninput_data.lock_index=&lock_index; - constructioninput_data.lock_fbl_conter=&lock_fbl_conter; - constructioninput_data.conternumber=0; - constructioninput_data.stop_number=((parallel_dfirst_buffer_layer*)index->fbl)->number_of_buffers; - constructioninput_data.preworkernumber=calculate_thread/2+propotion_number; - constructioninput_data.fbloffset=calculate_thread/2+propotion_number; - constructioninput_data.lock_barrier1=&lock_barrier1; - constructioninput_data.lock_barrier2=&lock_barrier2; - constructioninput_data.buffersize=bufferpresize; - constructioninput_data.finished=false; - + pthread_t threadconstructionid[calculate_thread / 2 - propotion_number - 1]; + pthread_mutex_t lock_fbl_conter = PTHREAD_MUTEX_INITIALIZER; + constructioninput_data.index = index; + constructioninput_data.lock_index = &lock_index; + constructioninput_data.lock_fbl_conter = &lock_fbl_conter; + constructioninput_data.conternumber = 0; + constructioninput_data.stop_number = ((parallel_dfirst_buffer_layer*)index->fbl)->number_of_buffers; + constructioninput_data.preworkernumber = calculate_thread / 2 + propotion_number; + constructioninput_data.fbloffset = calculate_thread / 2 + propotion_number; + constructioninput_data.lock_barrier1 = &lock_barrier1; + constructioninput_data.lock_barrier2 = &lock_barrier2; + constructioninput_data.buffersize = bufferpresize; + constructioninput_data.finished = false; if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); - file_position_type total_records = sz/index->settings->ts_byte_size; + file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); if (total_records < ts_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } - - ts_type * ts = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread/2+propotion_number)); - ts_type * ts1 = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread/2+propotion_number)); - ts_type * ts2; - sax_type * saxv = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread/2+propotion_number)); - sax_type * saxv1 = malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread/2+propotion_number)); - sax_type * saxv2; - - for (i = 0; i < (calculate_thread/2+propotion_number); i++) - { - input_data[i].index=index; - input_data[i].lock_fbl=&lockfbl; - input_data[i].lock_cbl=lockcbl; - input_data[i].lock_record=&lock_record; - input_data[i].bufferpresize=bufferpresize; - input_data[i].lock_firstnode =&lock_firstnode; - input_data[i].lock_index=&lock_index; - input_data[i].blocid=i*read_block_length; - input_data[i].lock_disk=&lock_disk; - input_data[i].workernumber=i; - input_data[i].total_workernumber=(calculate_thread/2+propotion_number)*2; - input_data[i].lock_barrier1=&lock_barrier1; - input_data[i].lock_barrier2=&lock_barrier2; - input_data[i].saxv =saxv; - input_data[i].finished=false; - } - index->settings->raw_filename = malloc(256); + ts_type *ts = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size * read_block_length * (calculate_thread / 2 + propotion_number)); + ts_type *ts1 = (ts_type*)malloc(sizeof(ts_type) * + index->settings->timeseries_size * read_block_length * (calculate_thread / 2 + propotion_number)); + ts_type *ts2; + sax_type *saxv = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments * read_block_length * (calculate_thread / 2 + propotion_number)); + sax_type *saxv1 = (sax_type*)malloc(sizeof(sax_type) * + index->settings->paa_segments * read_block_length * (calculate_thread / 2 + propotion_number)); + sax_type *saxv2; + + for (i = 0; i < (calculate_thread / 2 + propotion_number); i++) { + input_data[i].index = index; + input_data[i].lock_fbl = &lockfbl; + input_data[i].lock_cbl = lockcbl; + input_data[i].lock_record = &lock_record; + input_data[i].bufferpresize = bufferpresize; + input_data[i].lock_firstnode = &lock_firstnode; + input_data[i].lock_index = &lock_index; + input_data[i].blocid = i * read_block_length; + input_data[i].lock_disk = &lock_disk; + input_data[i].workernumber = i; + input_data[i].total_workernumber = (calculate_thread / 2 + propotion_number) * 2; + input_data[i].lock_barrier1 = &lock_barrier1; + input_data[i].lock_barrier2 = &lock_barrier2; + input_data[i].saxv = saxv; + input_data[i].finished = false; + } + + index->settings->raw_filename = (char*)malloc(256); strcpy(index->settings->raw_filename, ifilename); - #ifdef BENCHMARK +#ifdef BENCHMARK int percentage = (int) (ts_num / (file_position_type) 100); - #endif +#endif *pos = ftell(ifile); - if(ts_num>read_block_length*(calculate_thread/2+propotion_number)) - { - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread/2+propotion_number), ifile); - ts2 =ts; - ts =ts1; - ts1 =ts2; - for ( j = 0; j < (calculate_thread/2+propotion_number); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; - } - for (j = 0; j < (calculate_thread/2+propotion_number); j++) - { - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_2RecBuf,(void*)&(input_data[j])); - } - for (int k = 0; k < calculate_thread/2-propotion_number-1; k++) - { - pthread_create(&(threadconstructionid[k]),NULL,indexconstructionworker_2nRecBuf,(void*)&(constructioninput_data)); - } - - for (i = read_block_length*(calculate_thread/2+propotion_number); i < ts_num; i+=read_block_length*(calculate_thread/2+propotion_number)) - { + if (ts_num > read_block_length * (calculate_thread / 2 + propotion_number)) { + fread(ts1, sizeof(ts_type), + index->settings->timeseries_size * read_block_length * (calculate_thread / 2 + propotion_number), ifile); + ts2 = ts; + ts = ts1; + ts1 = ts2; + + for (j = 0; j < (calculate_thread / 2 + propotion_number); j++) { + input_data[j].pos = *pos + index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; + } + + for (j = 0; j < (calculate_thread / 2 + propotion_number); j++) { + pthread_create(&(threadid[j]), NULL, indexbulkloadingworker_2RecBuf, (void*)&(input_data[j])); + } + + for (int k = 0; k < calculate_thread / 2 - propotion_number - 1; k++) { + pthread_create(&(threadconstructionid[k]), NULL, indexconstructionworker_2nRecBuf, (void*)&(constructioninput_data)); + } + + for (i = read_block_length * (calculate_thread / 2 + propotion_number); + i < ts_num; i += read_block_length * (calculate_thread / 2 + propotion_number)) { *pos = ftell(ifile); - //read the data of next round - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread/2+propotion_number), ifile); - //write the sax in disk (last round) - if (sax_fist_time_check) - { - //printf("the sax0 is %d\n",saxv[0] ); + + // read the data of next round + fread(ts1, sizeof(ts_type), + index->settings->timeseries_size * read_block_length * (calculate_thread / 2 + propotion_number), ifile); + + // write the sax in disk (last round) + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread/2+propotion_number), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, + read_block_length * (calculate_thread / 2 + propotion_number), index->sax_file); COUNT_OUTPUT_TIME_END + } else { + sax_fist_time_check = true; } - else - { - sax_fist_time_check=true; + + ts2 = ts; + ts = ts1; + ts1 = ts2; + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + now_flush_time = i / (index->settings->max_total_buffer_size); + __sync_fetch_and_add(&(index->total_records), read_block_length * (calculate_thread / 2 + propotion_number)); + __sync_fetch_and_add(&(index->fbl->current_record_index), read_block_length * (calculate_thread / 2 + propotion_number)); + + if (indexbulkloadingroundchose == 0) { + indexbulkloadingroundchose = calculate_thread / 2 + propotion_number; + } else { + indexbulkloadingroundchose = 0; + } + + for (j = 0; j < calculate_thread / 2 + propotion_number; j++) { + input_data[j].pos = *pos+index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].saxv = saxv; + input_data[j].fin_number = read_block_length; + input_data[j].workernumber = j + indexbulkloadingroundchose; } - - //pthread_barrier_wait(&lock_barrier1); - //pthread_barrier_wait(&lock_barrier3); - //wait for the finish of other threads - ts2 =ts; - ts =ts1; - ts1 =ts2; - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - now_flush_time=i/(index->settings->max_total_buffer_size); - __sync_fetch_and_add(&(index->total_records),read_block_length*(calculate_thread/2+propotion_number)); - __sync_fetch_and_add(&(index->fbl->current_record_index),read_block_length*(calculate_thread/2+propotion_number)); - if(indexbulkloadingroundchose==0) - indexbulkloadingroundchose=calculate_thread/2+propotion_number; - else - indexbulkloadingroundchose=0; - - for ( j = 0; j < calculate_thread/2+propotion_number; j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; - input_data[j].workernumber=j+indexbulkloadingroundchose; + if (constructioninput_data.fbloffset == 0) { + constructioninput_data.fbloffset = calculate_thread / 2 + propotion_number; + } else { + constructioninput_data.fbloffset = 0; } - if(constructioninput_data.fbloffset==0) - constructioninput_data.fbloffset=calculate_thread/2+propotion_number; - else - constructioninput_data.fbloffset=0; - constructioninput_data.conternumber=0; + constructioninput_data.conternumber = 0; pthread_barrier_wait(&lock_barrier2); - // pthread_barrier_wait(&lock_barrier4); } *pos = ftell(ifile); - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*(ts_num%(read_block_length*(calculate_thread/2+propotion_number))), ifile); - if (sax_fist_time_check) - { - //printf("the sax0 is %d\n",saxv[0] ); + fread(ts1, sizeof(ts_type), + index->settings->timeseries_size * (ts_num % (read_block_length * (calculate_thread / 2 + propotion_number))), ifile); + + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread/2+propotion_number), index->sax_file); + fwrite(saxv1, index->settings->sax_byte_size, + read_block_length * (calculate_thread / 2 + propotion_number), index->sax_file); COUNT_OUTPUT_TIME_END - } - else - { - sax_fist_time_check=true; - } - //pthread_barrier_wait(&lock_barrier1); - // pthread_barrier_wait(&lock_barrier3); - ts2 =ts; - ts =ts1; - ts1 =ts2; - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - int conter_ts_number=ts_num%(read_block_length*(calculate_thread/2+propotion_number)); - sax_save_number=conter_ts_number; - int threadnumber=0; - pthread_barrier_t lock_barrier1_bas,lock_barrier2_bas; - - - for ( j = 0; j < calculate_thread/2+propotion_number; j++) - { - input_data[j].pos = *pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - //conter++; - input_data[j].ts=&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].fin_number=min(conter_ts_number,read_block_length); - conter_ts_number=conter_ts_number-read_block_length; - - input_data[j].workernumber=j+indexbulkloadingroundchose; - - //if((conter_ts_number+read_block_length)<=0) - input_data[j].finished=true; - // else - // threadnumber=j+2; - } - //pthread_barrier_init(&lock_barrier1_bas, NULL, threadnumber); - //pthread_barrier_init(&lock_barrier2_bas, NULL, threadnumber); - for ( j = 0; j < calculate_thread/2+propotion_number; j++) - { - // input_data[j].lock_barrier1=&lock_barrier1_bas; - //input_data[j].lock_barrier2=&lock_barrier2_bas; - } - - if(constructioninput_data.fbloffset==0) - constructioninput_data.fbloffset=calculate_thread/2+propotion_number; - else - constructioninput_data.fbloffset=0; - constructioninput_data.conternumber=0; - constructioninput_data.finished=1; + } else { + sax_fist_time_check = true; + } + + ts2 = ts; + ts = ts1; + ts1 = ts2; + saxv2 = saxv; + saxv = saxv1; + saxv1 = saxv2; + int conter_ts_number = ts_num % (read_block_length * (calculate_thread / 2 + propotion_number)); + sax_save_number = conter_ts_number; + int threadnumber = 0; + pthread_barrier_t lock_barrier1_bas; + pthread_barrier_t lock_barrier2_bas; + + for (j = 0; j < calculate_thread / 2 + propotion_number; j++) { + input_data[j].pos = *pos+index->settings->timeseries_size * sizeof(ts_type) * j * read_block_length; + input_data[j].ts = &(ts[index->settings->timeseries_size * j * read_block_length]); + input_data[j].fin_number = min(conter_ts_number, read_block_length); + conter_ts_number = conter_ts_number - read_block_length; + input_data[j].workernumber = j + indexbulkloadingroundchose; + input_data[j].finished = true; + } + + if (constructioninput_data.fbloffset == 0) { + constructioninput_data.fbloffset = calculate_thread / 2 + propotion_number; + } else { + constructioninput_data.fbloffset = 0; + } + + constructioninput_data.conternumber = 0; + constructioninput_data.finished = 1; pthread_barrier_wait(&lock_barrier2); - //pthread_barrier_wait(&lock_barrier4); - - if (sax_fist_time_check) - { - //printf("the sax0 is %d\n",saxv[0] ); + + if (sax_fist_time_check) { COUNT_OUTPUT_TIME_START - fwrite(saxv, index->settings->sax_byte_size, ts_num%read_block_length*(calculate_thread/2+propotion_number), index->sax_file); + fwrite(saxv, index->settings->sax_byte_size, + ts_num % read_block_length * (calculate_thread / 2 + propotion_number), index->sax_file); COUNT_OUTPUT_TIME_END + } else { + sax_fist_time_check = true; } - else - { - sax_fist_time_check=true; - } - //pthread_barrier_wait(&lock_barrier1_bas); - //pthread_barrier_wait(&lock_barrier3); - for ( j = 0; j < calculate_thread/2+propotion_number; j++) - { - //input_data[j].finished=true; - } - if(input_data[0].workernumber==0) - constructioninput_data.fbloffset=calculate_thread/2+propotion_number; - else - constructioninput_data.fbloffset=0; - constructioninput_data.conternumber=0; - constructioninput_data.finished=1; - //pthread_barrier_wait(&lock_barrier2_bas); - //pthread_barrier_wait(&lock_barrier4); + if (input_data[0].workernumber == 0) { + constructioninput_data.fbloffset = calculate_thread / 2 + propotion_number; + } else { + constructioninput_data.fbloffset = 0; + } + constructioninput_data.conternumber = 0; + constructioninput_data.finished = 1; - for (int k = 0; k < calculate_thread/2+propotion_number; k++) - { - pthread_join(threadid[k],NULL); - } - for (int k = 0; k < calculate_thread/2-propotion_number-1; k++) - { - pthread_join(threadconstructionid[k],NULL); - } + for (int k = 0; k < calculate_thread / 2 + propotion_number; k++) { + pthread_join(threadid[k], NULL); + } + for (int k = 0; k < calculate_thread / 2-propotion_number - 1; k++) { + pthread_join(threadconstructionid[k], NULL); + } } - //indexpRecBufflush(index->fbl, index,&lock_index,&lock_disk,calculate_thread,calculate_thread/2+propotion_number); free(ts); free(ts1); free(input_data); free(saxv); free(saxv1); - //free(sax); free(pos); pthread_barrier_destroy(&lock_barrier1); pthread_barrier_destroy(&lock_barrier2); @@ -1537,2122 +1452,1314 @@ void isax_index_binary_file_2nRecBuf(const char *ifilename, int ts_num, isax_ind COUNT_INPUT2_TIME_START fclose(ifile); COUNT_INPUT2_TIME_END -} - - -void* indexbulkloadingworker(void *transferdata) -{ - sax_type * sax = malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); - - int fin_number=((index_buffer_data*)transferdata)->fin_number; - file_position_type *pos = malloc(sizeof(file_position_type)); - sax_type * saxv; - int offset_saxv=((index_buffer_data*)transferdata)->blocid*((index_buffer_data*)transferdata)->index->settings->paa_segments; - int paa_segments=((index_buffer_data*)transferdata)->index->settings->paa_segments; - isax_index *index= ((index_buffer_data*)transferdata)->index; - int i=0; - pthread_barrier_t *lock_barrier1, *lock_barrier2; - - while(!((index_buffer_data*)transferdata)->finished) - { - saxv=(((index_buffer_data*)transferdata)->saxv); - lock_barrier1=((index_buffer_data*)transferdata)->lock_barrier1; - lock_barrier2=((index_buffer_data*)transferdata)->lock_barrier2; - for (i=0;its)+i*index->settings->timeseries_size), sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) - { - *pos= ((index_buffer_data*)transferdata)->pos+index->settings->timeseries_size*sizeof(ts_type)*i; +} + +void* indexbulkloadingworker(void *transferdata) { + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); + int fin_number = ((index_buffer_data*)transferdata)->fin_number; + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + sax_type *saxv; + int offset_saxv = ((index_buffer_data*)transferdata)->blocid * ((index_buffer_data*)transferdata)->index->settings->paa_segments; + int paa_segments = ((index_buffer_data*)transferdata)->index->settings->paa_segments; + isax_index *index = ((index_buffer_data*)transferdata)->index; + int i = 0; + pthread_barrier_t *lock_barrier1; + pthread_barrier_t *lock_barrier2; + + while (!((index_buffer_data*)transferdata)->finished) { + saxv = (((index_buffer_data*)transferdata)->saxv); + lock_barrier1 = ((index_buffer_data*)transferdata)->lock_barrier1; + lock_barrier2 = ((index_buffer_data*)transferdata)->lock_barrier2; + + for (i = 0; i < fin_number; i++) { + if (sax_from_ts(((ts_type*)(((index_buffer_data*)transferdata)->ts) + i * index->settings->timeseries_size), + sax, index->settings->ts_values_per_paa_segment, + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { + *pos = ((index_buffer_data*)transferdata)->pos + index->settings->timeseries_size * sizeof(ts_type) * i; memcpy(&(saxv[offset_saxv+i*paa_segments]), sax, sizeof(sax_type) * paa_segments); - isax_fbl_index_insert_m(index, sax, pos, ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_fbl, - ((index_buffer_data*)transferdata)->lock_cbl,((index_buffer_data*)transferdata)->lock_firstnode,((index_buffer_data*)transferdata)->lock_index,((index_buffer_data*)transferdata)->lock_disk); - } - else - { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + isax_fbl_index_insert_m(index, sax, pos, + ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_fbl, + ((index_buffer_data*)transferdata)->lock_cbl, ((index_buffer_data*)transferdata)->lock_firstnode, + ((index_buffer_data*)transferdata)->lock_index, ((index_buffer_data*)transferdata)->lock_disk); + } else { + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } - } + pthread_barrier_wait(lock_barrier1); pthread_barrier_wait(lock_barrier2); } + free(pos); free(sax); } -void* indexbulkloadingworker_new2(void *transferdata) -{ - sax_type * sax = malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); - - int fin_number=((index_buffer_data*)transferdata)->fin_number; - file_position_type *pos = malloc(sizeof(file_position_type)); - sax_type * saxv; - int offset_saxv=((index_buffer_data*)transferdata)->blocid*((index_buffer_data*)transferdata)->index->settings->paa_segments; - int paa_segments=((index_buffer_data*)transferdata)->index->settings->paa_segments; - isax_index *index= ((index_buffer_data*)transferdata)->index; - int i=0; - pthread_barrier_t *lock_barrier1=((index_buffer_data*)transferdata)->lock_barrier1; - pthread_barrier_t *lock_barrier2=((index_buffer_data*)transferdata)->lock_barrier2; - - while(!((index_buffer_data*)transferdata)->finished) - { - saxv=(((index_buffer_data*)transferdata)->saxv); - - for (i=0;its)+i*index->settings->timeseries_size), sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) - { - *pos= ((index_buffer_data*)transferdata)->pos+index->settings->timeseries_size*sizeof(ts_type)*i; + +void* indexbulkloadingworker_new2(void *transferdata) { + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); + int fin_number = ((index_buffer_data*)transferdata)->fin_number; + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + sax_type *saxv; + int offset_saxv = ((index_buffer_data*)transferdata)->blocid * ((index_buffer_data*)transferdata)->index->settings->paa_segments; + int paa_segments = ((index_buffer_data*)transferdata)->index->settings->paa_segments; + isax_index *index = ((index_buffer_data*)transferdata)->index; + int i = 0; + pthread_barrier_t *lock_barrier1 = ((index_buffer_data*)transferdata)->lock_barrier1; + pthread_barrier_t *lock_barrier2 = ((index_buffer_data*)transferdata)->lock_barrier2; + + while (!((index_buffer_data*)transferdata)->finished) { + saxv = (((index_buffer_data*)transferdata)->saxv); + + for (i = 0; i < fin_number; i++) { + if (sax_from_ts(((ts_type*)(((index_buffer_data*)transferdata)->ts) + i * index->settings->timeseries_size), + sax, index->settings->ts_values_per_paa_segment, + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { + *pos = ((index_buffer_data*)transferdata)->pos + index->settings->timeseries_size * sizeof(ts_type) * i; memcpy(&(saxv[offset_saxv+i*paa_segments]), sax, sizeof(sax_type) * paa_segments); - isax_fbl_index_insert_m_new(index, sax, pos, ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_fbl, - ((index_buffer_data*)transferdata)->lock_cbl,((index_buffer_data*)transferdata)->lock_firstnode,((index_buffer_data*)transferdata)->lock_index,((index_buffer_data*)transferdata)->lock_disk); + isax_fbl_index_insert_m_new(index, sax, pos, + ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_fbl, + ((index_buffer_data*)transferdata)->lock_cbl, ((index_buffer_data*)transferdata)->lock_firstnode, + ((index_buffer_data*)transferdata)->lock_index, ((index_buffer_data*)transferdata)->lock_disk); + } else { + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } - else - { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); - } - } + pthread_barrier_wait(lock_barrier1); pthread_barrier_wait(lock_barrier2); } + free(pos); free(sax); } -void* indexbulkloadingworker_new(void *transferdata) -{ - sax_type * sax = malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); - - int fin_number=((index_buffer_data*)transferdata)->fin_number; - file_position_type *pos = malloc(sizeof(file_position_type)); - sax_type * saxv; - int offset_saxv=((index_buffer_data*)transferdata)->blocid*((index_buffer_data*)transferdata)->index->settings->paa_segments; - int paa_segments=((index_buffer_data*)transferdata)->index->settings->paa_segments; - isax_index *index= ((index_buffer_data*)transferdata)->index; - int i=0,j; - pthread_barrier_t *lock_barrier1=((index_buffer_data*)transferdata)->lock_barrier1; - pthread_barrier_t *lock_barrier2=((index_buffer_data*)transferdata)->lock_barrier2; - pthread_barrier_t *lock_barrier3=((index_buffer_data*)transferdata)->lock_barrier3; - isax_node_record *r = malloc(sizeof(isax_node_record)); - while(!((index_buffer_data*)transferdata)->finished) - { - saxv=(((index_buffer_data*)transferdata)->saxv); - - for (i=0;its)+i*index->settings->timeseries_size), sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) - { - *pos= ((index_buffer_data*)transferdata)->pos+index->settings->timeseries_size*sizeof(ts_type)*i; +void* indexbulkloadingworker_new(void *transferdata) { + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); + int fin_number = ((index_buffer_data*)transferdata)->fin_number; + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + sax_type *saxv; + int offset_saxv = ((index_buffer_data*)transferdata)->blocid * ((index_buffer_data*)transferdata)->index->settings->paa_segments; + int paa_segments = ((index_buffer_data*)transferdata)->index->settings->paa_segments; + isax_index *index = ((index_buffer_data*)transferdata)->index; + int i = 0; + int j; + pthread_barrier_t *lock_barrier1 = ((index_buffer_data*)transferdata)->lock_barrier1; + pthread_barrier_t *lock_barrier2 = ((index_buffer_data*)transferdata)->lock_barrier2; + pthread_barrier_t *lock_barrier3 = ((index_buffer_data*)transferdata)->lock_barrier3; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + + while (!((index_buffer_data*)transferdata)->finished) { + saxv = (((index_buffer_data*)transferdata)->saxv); + + for (i = 0; i < fin_number; i++) { + if (sax_from_ts(((ts_type*)(((index_buffer_data*)transferdata)->ts) + i * index->settings->timeseries_size), + sax, index->settings->ts_values_per_paa_segment, + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { + *pos = ((index_buffer_data*)transferdata)->pos+index->settings->timeseries_size * sizeof(ts_type) * i; memcpy(&(saxv[offset_saxv+i*paa_segments]), sax, sizeof(sax_type) * paa_segments); - isax_fbl_index_insert_m(index, sax, pos, ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_fbl, - ((index_buffer_data*)transferdata)->lock_cbl,((index_buffer_data*)transferdata)->lock_firstnode,((index_buffer_data*)transferdata)->lock_index,((index_buffer_data*)transferdata)->lock_disk); - } - else - { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + isax_fbl_index_insert_m(index, sax, pos, + ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_fbl, + ((index_buffer_data*)transferdata)->lock_cbl, ((index_buffer_data*)transferdata)->lock_firstnode, + ((index_buffer_data*)transferdata)->lock_index, ((index_buffer_data*)transferdata)->lock_disk); + } else { + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } - } + pthread_barrier_wait(lock_barrier3); - while(1) - { - j=__sync_fetch_and_add(((index_buffer_data*)transferdata)->nodecounter,1); - if(j>=index->fbl->number_of_buffers) - { + + while (1) { + j = __sync_fetch_and_add(((index_buffer_data*)transferdata)->nodecounter, 1); + + if (j >= index->fbl->number_of_buffers) { break; } + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } - for (i=((index_buffer_data*)transferdata)->bufferpresize[j]; ibuffer_size; i++) - { + + for (i = ((index_buffer_data*)transferdata)->bufferpresize[j]; i < current_fbl_node->buffer_size; i++) { r->sax = (sax_type *) current_fbl_node->sax_records[i]; r->position = (file_position_type *) current_fbl_node->pos_records[i]; - r->insertion_mode = NO_TMP | PARTIAL; - + r->insertion_mode = PARTIAL_OR_NO_TMP; + // Add record to index add_record_to_node(index, current_fbl_node->node, r, 1); - } - ((index_buffer_data*)transferdata)->bufferpresize[j]=current_fbl_node->buffer_size; + + ((index_buffer_data*)transferdata)->bufferpresize[j] = current_fbl_node->buffer_size; } - + pthread_barrier_wait(lock_barrier1); pthread_barrier_wait(lock_barrier2); } + free(pos); free(sax); } -/*void* indexbulkloadingworker_pRecBuf_old(void *transferdata) -{ - sax_type * sax = malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); - - int fin_number=((index_buffer_data*)transferdata)->fin_number; - file_position_type *pos = malloc(sizeof(file_position_type)); - sax_type * saxv=(((index_buffer_data*)transferdata)->saxv); - int offset_saxv=((index_buffer_data*)transferdata)->blocid*((index_buffer_data*)transferdata)->index->settings->paa_segments; - int paa_segments=((index_buffer_data*)transferdata)->index->settings->paa_segments; - isax_index *index= ((index_buffer_data*)transferdata)->index; - int i=0; - for (i=0;its)+i*index->settings->timeseries_size), sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) - { - *pos= ((index_buffer_data*)transferdata)->pos+index->settings->timeseries_size*sizeof(ts_type)*i; - - //for(j=0;j<((index_buffer_data*)transferdata)->index->settings->paa_segments;j++) - //{ - //saxv[offset_saxv+i*paa_segments+j]=sax[j]; - //printf("the sax [%d ]%d\n",i,(int)saxv[offset_saxv+i*paa_segments+j]); - //printf("the sax [%d ]%d\n",i,(int)sax[j]); - //} - - memcpy(&(saxv[offset_saxv+i*paa_segments]), sax, sizeof(sax_type) * paa_segments); - - #ifdef CLUSTERED - root_mask_type first_bit_mask = 0x00; - * pos=(index_buffer_data)transferdata->pos+index->settings->timeseries_size*sizeof(ts_type)*i; - CREATE_MASK(first_bit_mask, index, sax); - char* pfilename = malloc(255); - snprintf(pfilename, 255, "%s.%llu",index->settings->raw_filename,first_bit_mask); - FILE *pfile = fopen(pfilename, "a+"); - * pos=(index_buffer_data)transferdata->pos+index->settings->timeseries_size*sizeof(ts_type)*i; - // - fwrite(ts, sizeof(ts_type), index->settings->timeseries_size, pfile); - // - fclose(pfile); - free(pfilename); - #endif - - //printf("the pos is %lld\n",*pos); - //isax_fbl_index_insert(index, sax, pos); - isax_pRecBuf_index_insert(index, sax, pos, ((index_buffer_data*)transferdata)->lock_record,((index_buffer_data*)transferdata)->lock_firstnode,((index_buffer_data*)transferdata)->workernumber,((index_buffer_data*)transferdata)->total_workernumber); - - } - else - { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); - } +void* indexbulkloadingworker_pRecBuf(void *transferdata) { + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); + int fin_number = ((index_buffer_data*)transferdata)->fin_number; + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + sax_type *saxv; + int offset_saxv = ((index_buffer_data*)transferdata)->blocid * ((index_buffer_data*)transferdata)->index->settings->paa_segments; + int paa_segments = ((index_buffer_data*)transferdata)->index->settings->paa_segments; + isax_index *index = ((index_buffer_data*)transferdata)->index; + pthread_barrier_t *lock_barrier1 = ((index_buffer_data*)transferdata)->lock_barrier1; + pthread_barrier_t *lock_barrier2 = ((index_buffer_data*)transferdata)->lock_barrier2; + + while (!((index_buffer_data*)transferdata)->finished) { + saxv = (((index_buffer_data*)transferdata)->saxv); + printf("this is the bulkloading worker"); + + for (int i = 0; i < fin_number; i++) { + if (sax_from_ts(((ts_type*)(((index_buffer_data*)transferdata)->ts) + i * index->settings->timeseries_size), + sax, index->settings->ts_values_per_paa_segment, + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { + *pos = ((index_buffer_data*)transferdata)->pos + index->settings->timeseries_size * sizeof(ts_type) * i; + memcpy(&(saxv[offset_saxv+i*paa_segments]), sax, sizeof(sax_type) * paa_segments); + isax_pRecBuf_index_insert(index, sax, pos, + ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_firstnode, + ((index_buffer_data*)transferdata)->workernumber, ((index_buffer_data*)transferdata)->total_workernumber); + } else { + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); + } + } + pthread_barrier_wait(lock_barrier1); + pthread_barrier_wait(lock_barrier2); } + free(pos); free(sax); +} -}*/ -void* indexbulkloadingworker_pRecBuf(void *transferdata) -{ - sax_type * sax = malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); - - int fin_number=((index_buffer_data*)transferdata)->fin_number; +void* indexbulkloadingworker_2RecBuf(void *transferdata) { + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); + int fin_number = ((index_buffer_data*)transferdata)->fin_number; + file_position_type *pos = (file_position_type*)malloc(sizeof(file_position_type)); + sax_type *saxv; + file_position_type readpos; + int offset_saxv = ((index_buffer_data*)transferdata)->blocid * ((index_buffer_data*)transferdata)->index->settings->paa_segments; + int paa_segments = ((index_buffer_data*)transferdata)->index->settings->paa_segments; + isax_index *index = ((index_buffer_data*)transferdata)->index; + int initialworkernumber = ((index_buffer_data*)transferdata)->workernumber; + int workernumber = initialworkernumber; + int total_workernumber = ((index_buffer_data*)transferdata)->total_workernumber; + int i = 0; + int offsetvalue = 0; + pthread_barrier_t *lock_barrier1 = ((index_buffer_data*)transferdata)->lock_barrier1; + pthread_barrier_t *lock_barrier2 = ((index_buffer_data*)transferdata)->lock_barrier2; + ts_type *ts; - file_position_type *pos = malloc(sizeof(file_position_type)); - sax_type * saxv; - - int offset_saxv=((index_buffer_data*)transferdata)->blocid*((index_buffer_data*)transferdata)->index->settings->paa_segments; - int paa_segments=((index_buffer_data*)transferdata)->index->settings->paa_segments; - isax_index *index= ((index_buffer_data*)transferdata)->index; - int i=0; - pthread_barrier_t *lock_barrier1=((index_buffer_data*)transferdata)->lock_barrier1; - - pthread_barrier_t *lock_barrier2=((index_buffer_data*)transferdata)->lock_barrier2; - - while(!((index_buffer_data*)transferdata)->finished) - { - saxv=(((index_buffer_data*)transferdata)->saxv); - printf("this is the bulkloading worker"); - for (i=0;its)+i*index->settings->timeseries_size), sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) - { - *pos= ((index_buffer_data*)transferdata)->pos+index->settings->timeseries_size*sizeof(ts_type)*i; + while (!((index_buffer_data*)transferdata)->finished) { + lock_barrier1 = ((index_buffer_data*)transferdata)->lock_barrier1; + lock_barrier2 = ((index_buffer_data*)transferdata)->lock_barrier2; + ts = (ts_type*)(((index_buffer_data*)transferdata)->ts); + saxv = (((index_buffer_data*)transferdata)->saxv); + readpos = ((index_buffer_data*)transferdata)->pos; + + for (i = 0; i < fin_number; i++) { + if (sax_from_ts((ts + i * index->settings->timeseries_size), sax, + index->settings->ts_values_per_paa_segment, + index->settings->paa_segments, index->settings->sax_alphabet_cardinality, + index->settings->sax_bit_cardinality, + index->settings->timeseries_size) == SUCCESS) { + *pos = readpos + index->settings->timeseries_size * sizeof(ts_type) * i; memcpy(&(saxv[offset_saxv+i*paa_segments]), sax, sizeof(sax_type) * paa_segments); - isax_pRecBuf_index_insert(index, sax, pos, ((index_buffer_data*)transferdata)->lock_record,((index_buffer_data*)transferdata)->lock_firstnode,((index_buffer_data*)transferdata)->workernumber,((index_buffer_data*)transferdata)->total_workernumber); - - } - else - { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); + isax_2pRecBuf_index_insert(index, sax, pos, + ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_firstnode, + workernumber, total_workernumber); + } else { + fprintf(stderr, "error: cannot insert record in index, since sax representation failed to be created"); } - } - pthread_barrier_wait(lock_barrier1); - //printf("the work ID is %d\n",((index_buffer_data*)transferdata)->workernumber ); pthread_barrier_wait(lock_barrier2); + offsetvalue = 1 - offsetvalue; + workernumber = initialworkernumber + offsetvalue * total_workernumber / 2; } - free(pos); - free(sax); -} -void* indexbulkloadingworker_2RecBuf(void *transferdata) -{ - sax_type * sax = malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); - int fin_number=((index_buffer_data*)transferdata)->fin_number; - - file_position_type *pos = malloc(sizeof(file_position_type)); - sax_type * saxv; - file_position_type readpos; - int offset_saxv=((index_buffer_data*)transferdata)->blocid*((index_buffer_data*)transferdata)->index->settings->paa_segments; - int paa_segments=((index_buffer_data*)transferdata)->index->settings->paa_segments; - isax_index *index= ((index_buffer_data*)transferdata)->index; - int initialworkernumber=((index_buffer_data*)transferdata)->workernumber; - int workernumber=initialworkernumber; - int total_workernumber=((index_buffer_data*)transferdata)->total_workernumber; - int i=0,offsetvalue=0; - pthread_barrier_t *lock_barrier1=((index_buffer_data*)transferdata)->lock_barrier1; - pthread_barrier_t *lock_barrier2=((index_buffer_data*)transferdata)->lock_barrier2; - ts_type *ts; - while(!((index_buffer_data*)transferdata)->finished) - { - lock_barrier1=((index_buffer_data*)transferdata)->lock_barrier1; - lock_barrier2=((index_buffer_data*)transferdata)->lock_barrier2; - ts=(ts_type*)(((index_buffer_data*)transferdata)->ts); - saxv=(((index_buffer_data*)transferdata)->saxv); - readpos=((index_buffer_data*)transferdata)->pos; - - for (i=0;isettings->timeseries_size), sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) - { - *pos=readpos +index->settings->timeseries_size*sizeof(ts_type)*i; - memcpy(&(saxv[offset_saxv+i*paa_segments]), sax, sizeof(sax_type) * paa_segments); - isax_2pRecBuf_index_insert(index, sax, pos, ((index_buffer_data*)transferdata)->lock_record,((index_buffer_data*)transferdata)->lock_firstnode,workernumber,total_workernumber); - } - else - { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); - } - - } - - //spthread_barrier_wait(lock_barrier1); - //printf("the work ID is %d\n",((index_buffer_data*)transferdata)->workernumber ); - pthread_barrier_wait(lock_barrier2); - offsetvalue=1-offsetvalue; - workernumber=initialworkernumber+offsetvalue*total_workernumber/2; - } - free(pos); free(sax); } -isax_node * insert_to_fbl_m(first_buffer_layer *fbl, sax_type *sax, - file_position_type *pos,root_mask_type mask, - isax_index *index, pthread_mutex_t *lock_firstnode,pthread_mutex_t *lockfbl) -{ - //pthread_rwlock_wrlock(lockfbl); - +isax_node * insert_to_fbl_m(first_buffer_layer *fbl, sax_type *sax, file_position_type *pos, root_mask_type mask, + isax_index *index, pthread_mutex_t *lock_firstnode, pthread_mutex_t *lockfbl) { fbl_soft_buffer *current_buffer = &fbl->soft_buffers[(int) mask]; - char * cd_s,*cd_p; + char *cd_s; + char *cd_p; + // Check if this buffer is initialized if (!current_buffer->initialized) { - #ifdef DEBUG +#ifdef DEBUG printf("*** Creating new FBL node. ***\n\n"); - #endif +#endif current_buffer->initialized = 1; current_buffer->max_buffer_size = 0; current_buffer->buffer_size = 0; - - current_buffer->node = isax_root_node_init(mask, - index->settings->initial_leaf_buffer_size); - + current_buffer->node = isax_root_node_init(mask, index->settings->initial_leaf_buffer_size); current_buffer->node->is_leaf = 1; pthread_mutex_lock(lock_firstnode); - index->root_nodes++;//counter + index->root_nodes++; // counter - - if(index->first_node == NULL) - { + if (index->first_node == NULL) { index->first_node = current_buffer->node; pthread_mutex_unlock(lock_firstnode); current_buffer->node->next = NULL; current_buffer->node->previous = NULL; - - } - else - { + } else { isax_node * prev_first = index->first_node; index->first_node = current_buffer->node; index->first_node->next = prev_first; - prev_first->previous = current_buffer->node; pthread_mutex_unlock(lock_firstnode); } - } + } // Check if this buffer is not full! if (current_buffer->buffer_size >= current_buffer->max_buffer_size) { - - if(current_buffer->max_buffer_size == 0) { + if (current_buffer->max_buffer_size == 0) { current_buffer->max_buffer_size = fbl->initial_buffer_size; - - current_buffer->sax_records = malloc(sizeof(sax_type *) * - current_buffer->max_buffer_size); - current_buffer->pos_records = malloc(sizeof(file_position_type *) * - current_buffer->max_buffer_size); - } - else { + current_buffer->sax_records = (sax_type**)malloc(sizeof(sax_type *) * current_buffer->max_buffer_size); + current_buffer->pos_records = + (file_position_type**)malloc(sizeof(file_position_type *) * current_buffer->max_buffer_size); + } else { current_buffer->max_buffer_size *= BUFFER_REALLOCATION_RATE; - - current_buffer->sax_records = realloc(current_buffer->sax_records, - sizeof(sax_type *) * - current_buffer->max_buffer_size); - current_buffer->pos_records = realloc(current_buffer->pos_records, - sizeof(file_position_type *) * - current_buffer->max_buffer_size); - + current_buffer->sax_records = (sax_type**)realloc(current_buffer->sax_records, + sizeof(sax_type *) * current_buffer->max_buffer_size); + current_buffer->pos_records = (file_position_type**)realloc(current_buffer->pos_records, + sizeof(file_position_type *) * current_buffer->max_buffer_size); } } + if (current_buffer->sax_records == NULL || current_buffer->pos_records == NULL) { fprintf(stderr, "error: Could not allocate memory in FBL."); - return OUT_OF_MEMORY_FAILURE; + + exit(-1); } // Copy data to hard buffer and make current buffer point to the hard one - //pthread_mutex_lock(lockfbl); - //COUNT_CAL_TIME_START - //fbl->current_record_index++; - //cd_s=fbl->current_record; - //fbl->current_record += index->settings->sax_byte_size; - cd_s= __sync_fetch_and_add(&(fbl->current_record),index->settings->sax_byte_size); - - //cd_p=fbl->current_record; - //fbl->current_record += index->settings->position_byte_size; - cd_p= __sync_fetch_and_add(&(fbl->current_record),index->settings->position_byte_size); - //pthread_mutex_unlock(lockfbl); - - current_buffer->sax_records[current_buffer->buffer_size] = (sax_type*) cd_s; + cd_s = __sync_fetch_and_add(&(fbl->current_record), index->settings->sax_byte_size); + cd_p = __sync_fetch_and_add(&(fbl->current_record), index->settings->position_byte_size); + current_buffer->sax_records[current_buffer->buffer_size] = (sax_type*) cd_s; memcpy((void *) cd_s, (void *) sax, index->settings->sax_byte_size); - - - current_buffer->pos_records[current_buffer->buffer_size] = (file_position_type*) cd_p; + current_buffer->pos_records[current_buffer->buffer_size] = (file_position_type*) cd_p; memcpy((void *) cd_p, (void *) pos, index->settings->position_byte_size); - - - - - #ifdef DEBUG +#ifdef DEBUG printf("*** Added to node ***\n\n"); - #ifdef TOY - sax_print(sax, index->settings->paa_segments, - index->settings->sax_bit_cardinality); - #endif - #endif - - - //COUNT_CAL_TIME_END - +#ifdef TOY + sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); +#endif +#endif + current_buffer->buffer_size++; + return current_buffer->node; } -isax_node * insert_to_fbl_m_new(first_buffer_layer *fbl, sax_type *sax, - file_position_type *pos,root_mask_type mask, - isax_index *index, pthread_mutex_t *lock_firstnode,pthread_mutex_t *lockfbl) -{ - //pthread_rwlock_wrlock(lockfbl); +isax_node *insert_to_fbl_m_new(first_buffer_layer *fbl, sax_type *sax, file_position_type *pos, + root_mask_type mask, isax_index *index, pthread_mutex_t *lock_firstnode, pthread_mutex_t *lockfbl) { fbl_soft_buffer *current_buffer = &fbl->soft_buffers[(int) mask]; - char * cd_s,*cd_p; + char *cd_s; + char *cd_p; + // Check if this buffer is initialized if (!current_buffer->initialized) { - #ifdef DEBUG +#ifdef DEBUG printf("*** Creating new FBL node. ***\n\n"); - #endif +#endif current_buffer->initialized = 1; current_buffer->max_buffer_size = 0; current_buffer->buffer_size = 0; - - current_buffer->node = isax_root_node_init(mask, - index->settings->initial_leaf_buffer_size); - + current_buffer->node = isax_root_node_init(mask, index->settings->initial_leaf_buffer_size); current_buffer->node->is_leaf = 1; pthread_mutex_lock(lock_firstnode); + index->root_nodes++; // counter - index->root_nodes++;//counter - - - if(index->first_node == NULL) - { + if (index->first_node == NULL) { index->first_node = current_buffer->node; pthread_mutex_unlock(lock_firstnode); current_buffer->node->next = NULL; current_buffer->node->previous = NULL; - - } - else - { + } else { isax_node * prev_first = index->first_node; index->first_node = current_buffer->node; index->first_node->next = prev_first; - prev_first->previous = current_buffer->node; pthread_mutex_unlock(lock_firstnode); } - } + } // Check if this buffer is not full! if (current_buffer->buffer_size >= current_buffer->max_buffer_size) { - - if(current_buffer->max_buffer_size == 0) { + if (current_buffer->max_buffer_size == 0) { current_buffer->max_buffer_size = fbl->initial_buffer_size; - - current_buffer->sax_records = malloc(sizeof(sax_type *) * - current_buffer->max_buffer_size); - current_buffer->pos_records = malloc(sizeof(file_position_type *) * - current_buffer->max_buffer_size); - } - else { + current_buffer->sax_records = (sax_type**)malloc(sizeof(sax_type *) * current_buffer->max_buffer_size); + current_buffer->pos_records = + (file_position_type**)malloc(sizeof(file_position_type *) * current_buffer->max_buffer_size); + } else { current_buffer->max_buffer_size *= BUFFER_REALLOCATION_RATE; - - current_buffer->sax_records = realloc(current_buffer->sax_records, - sizeof(sax_type *) * - current_buffer->max_buffer_size); - current_buffer->pos_records = realloc(current_buffer->pos_records, - sizeof(file_position_type *) * - current_buffer->max_buffer_size); - + current_buffer->sax_records = (sax_type**)realloc(current_buffer->sax_records, + sizeof(sax_type *) * current_buffer->max_buffer_size); + current_buffer->pos_records = (file_position_type**)realloc(current_buffer->pos_records, + sizeof(file_position_type *) * current_buffer->max_buffer_size); } } + if (current_buffer->sax_records == NULL || current_buffer->pos_records == NULL) { fprintf(stderr, "error: Could not allocate memory in FBL."); - return OUT_OF_MEMORY_FAILURE; + + exit(-1); } // Copy data to hard buffer and make current buffer point to the hard one - //pthread_mutex_lock(lockfbl); - //COUNT_CAL_TIME_START - //fbl->current_record_index++; - //cd_s=fbl->current_record; - //fbl->current_record += index->settings->sax_byte_size; - cd_s= __sync_fetch_and_add(&(fbl->current_record),index->settings->sax_byte_size); - - //cd_p=fbl->current_record; - //fbl->current_record += index->settings->position_byte_size; - cd_p= __sync_fetch_and_add(&(fbl->current_record),index->settings->position_byte_size); - //pthread_mutex_unlock(lockfbl); - - current_buffer->sax_records[current_buffer->buffer_size] = (sax_type*) cd_s; + cd_s = __sync_fetch_and_add(&(fbl->current_record), index->settings->sax_byte_size); + cd_p = __sync_fetch_and_add(&(fbl->current_record), index->settings->position_byte_size); + current_buffer->sax_records[current_buffer->buffer_size] = (sax_type*) cd_s; memcpy((void *) cd_s, (void *) sax, index->settings->sax_byte_size); - - - current_buffer->pos_records[current_buffer->buffer_size] = (file_position_type*) cd_p; + current_buffer->pos_records[current_buffer->buffer_size] = (file_position_type*) cd_p; memcpy((void *) cd_p, (void *) pos, index->settings->position_byte_size); - isax_node_record *r = malloc(sizeof(isax_node_record)); + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); r->sax = (sax_type*) cd_s; - r->position = (file_position_type*) cd_p; - r->insertion_mode = NO_TMP | PARTIAL; - // Add record to index + r->position = (file_position_type*) cd_p; + r->insertion_mode = PARTIAL_OR_NO_TMP; + // Add record to index add_record_to_node(index, current_buffer->node, r, 1); - free(r); - #ifdef DEBUG +#ifdef DEBUG printf("*** Added to node ***\n\n"); - #ifdef TOY - sax_print(sax, index->settings->paa_segments, - index->settings->sax_bit_cardinality); - #endif - #endif - - - //COUNT_CAL_TIME_END - +#ifdef TOY + sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); +#endif +#endif + current_buffer->buffer_size++; + return current_buffer->node; } - isax_node * insert_to_pRecBuf(parallel_first_buffer_layer *fbl, sax_type *sax, - file_position_type *pos,root_mask_type mask, - isax_index *index, pthread_mutex_t *lock_firstnode, int workernumber,int total_workernumber) -{ - //pthread_rwlock_wrlock(lockfbl); + file_position_type *pos, root_mask_type mask, isax_index *index, + pthread_mutex_t *lock_firstnode, int workernumber, int total_workernumber) { parallel_fbl_soft_buffer *current_buffer = &fbl->soft_buffers[(int) mask]; - file_position_type *filepointer; sax_type *saxpointer; - int current_buffer_number; - char * cd_s,*cd_p; - // Check if this buffer is initialized - + char *cd_s; + char *cd_p; - if (!current_buffer->initialized) - { + // Check if this buffer is initialized + if (!current_buffer->initialized) { pthread_mutex_lock(lock_firstnode); - if (!current_buffer->initialized) - { - - current_buffer->max_buffer_size = malloc(sizeof(int)*total_workernumber); - current_buffer->buffer_size = malloc(sizeof(int)*total_workernumber); - current_buffer->sax_records=malloc(sizeof(sax_type *)*total_workernumber); - current_buffer->pos_records=malloc(sizeof(file_position_type *)*total_workernumber); - for (int i = 0; i < total_workernumber; i++) - { - current_buffer->max_buffer_size[i]=0; - current_buffer->buffer_size[i]=0; - current_buffer->pos_records[i]=NULL; - current_buffer->sax_records[i]=NULL; + if (!current_buffer->initialized) { + current_buffer->max_buffer_size = (int*)malloc(sizeof(int) * total_workernumber); + current_buffer->buffer_size = (int*)malloc(sizeof(int) * total_workernumber); + current_buffer->sax_records = (sax_type**)malloc(sizeof(sax_type *) * total_workernumber); + current_buffer->pos_records = (file_position_type**)malloc(sizeof(file_position_type *) * total_workernumber); + + for (int i = 0; i < total_workernumber; i++) { + current_buffer->max_buffer_size[i] = 0; + current_buffer->buffer_size[i] = 0; + current_buffer->pos_records[i] = NULL; + current_buffer->sax_records[i] = NULL; } - current_buffer->node = isax_root_node_init(mask,index->settings->initial_leaf_buffer_size); + + current_buffer->node = isax_root_node_init(mask, index->settings->initial_leaf_buffer_size); current_buffer->node->is_leaf = 1; - //current_buffer->finished=1; current_buffer->initialized = 1; - //__sync_synchronize(); - if(index->first_node == NULL) - { + + if (index->first_node == NULL) { index->first_node = current_buffer->node; pthread_mutex_unlock(lock_firstnode); current_buffer->node->next = NULL; current_buffer->node->previous = NULL; - - } - else - { + } else { isax_node * prev_first = index->first_node; index->first_node = current_buffer->node; index->first_node->next = prev_first; prev_first->previous = current_buffer->node; pthread_mutex_unlock(lock_firstnode); } - __sync_fetch_and_add(&(index->root_nodes),1); - } - else - { - pthread_mutex_unlock(lock_firstnode); + + __sync_fetch_and_add(&(index->root_nodes), 1); + } else { + pthread_mutex_unlock(lock_firstnode); } - } - + } + // Check if this buffer is not full! if (current_buffer->buffer_size[workernumber] >= current_buffer->max_buffer_size[workernumber]) { - if(current_buffer->max_buffer_size[workernumber] == 0) { + if (current_buffer->max_buffer_size[workernumber] == 0) { current_buffer->max_buffer_size[workernumber] = fbl->initial_buffer_size; - current_buffer->sax_records[workernumber] = malloc(index->settings->sax_byte_size * - current_buffer->max_buffer_size[workernumber]); - current_buffer->pos_records[workernumber] = malloc(index->settings->position_byte_size* - current_buffer->max_buffer_size[workernumber]); - } - else { + current_buffer->sax_records[workernumber] = (sax_type*)malloc(index->settings->sax_byte_size * + current_buffer->max_buffer_size[workernumber]); + current_buffer->pos_records[workernumber] = (file_position_type*)malloc(index->settings->position_byte_size * + current_buffer->max_buffer_size[workernumber]); + } else { current_buffer->max_buffer_size[workernumber] *= BUFFER_REALLOCATION_RATE; - - current_buffer->sax_records[workernumber] = realloc(current_buffer->sax_records[workernumber], - index->settings->sax_byte_size * - current_buffer->max_buffer_size[workernumber]); - current_buffer->pos_records[workernumber] = realloc(current_buffer->pos_records[workernumber], - index->settings->position_byte_size * - current_buffer->max_buffer_size[workernumber]); - + current_buffer->sax_records[workernumber] = (sax_type*)realloc(current_buffer->sax_records[workernumber], + index->settings->sax_byte_size * current_buffer->max_buffer_size[workernumber]); + current_buffer->pos_records[workernumber] = (file_position_type*)realloc(current_buffer->pos_records[workernumber], + index->settings->position_byte_size * current_buffer->max_buffer_size[workernumber]); } } if (current_buffer->sax_records[workernumber] == NULL || current_buffer->pos_records[workernumber] == NULL) { fprintf(stderr, "error: Could not allocate memory in FBL."); - return OUT_OF_MEMORY_FAILURE; + + exit(-1); } + // Copy data to hard buffer and make current buffer point to the hard one - //pthread_mutex_lock(lockfbl); - //COUNT_CAL_TIME_START - //fbl->current_record_index++; - - //cd_s=fbl->current_record; - //fbl->current_record += index->settings->sax_byte_size; - //cd_s= __sync_fetch_and_add(&(fbl->current_record),index->settings->sax_byte_size+index->settings->position_byte_size); - //cd_p=fbl->current_record; - //fbl->current_record += index->settings->position_byte_size; - //cd_p= cd_s+index->settings->sax_byte_size; - //pthread_mutex_unlock(lockfbl); - current_buffer_number=current_buffer->buffer_size[workernumber]; - filepointer=(file_position_type *)current_buffer->pos_records[workernumber]; - saxpointer=(sax_type *)current_buffer->sax_records[workernumber]; - //printf("the work number is %d sax is %d \n",workernumber,saxpointer[current_buffer_number*index->settings->paa_segments]); + current_buffer_number = current_buffer->buffer_size[workernumber]; + filepointer = (file_position_type *)current_buffer->pos_records[workernumber]; + saxpointer = (sax_type *)current_buffer->sax_records[workernumber]; memcpy((void *) (&saxpointer[current_buffer_number*index->settings->paa_segments]), (void *) sax, index->settings->sax_byte_size); memcpy((void *) (&filepointer[current_buffer_number]), (void *) pos, index->settings->position_byte_size); - - - #ifdef DEBUG + +#ifdef DEBUG printf("*** Added to node ***\n\n"); - #ifdef TOY - sax_print(sax, index->settings->paa_segments, - index->settings->sax_bit_cardinality); - #endif - #endif - //printf("this is befor the checke \n"); - //__sync_fetch_and_add(&((current_buffer->buffer_size[workernumber])),1); - //printf("this is after the checke \n"); +#ifdef TOY + sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); +#endif +#endif (current_buffer->buffer_size[workernumber])++; return current_buffer->node; } -isax_node * insert_to_2pRecBuf(parallel_dfirst_buffer_layer *fbl, sax_type *sax, - file_position_type *pos,root_mask_type mask, - isax_index *index, pthread_mutex_t *lock_firstnode, int workernumber,int total_workernumber) -{ - //pthread_rwlock_wrlock(lockfbl); - parallel_dfbl_soft_buffer *current_buffer = &fbl->soft_buffers[(int) mask]; +isax_node * insert_to_2pRecBuf(parallel_dfirst_buffer_layer *fbl, sax_type *sax, file_position_type *pos, + root_mask_type mask, isax_index *index, pthread_mutex_t *lock_firstnode, int workernumber, int total_workernumber) { + parallel_dfbl_soft_buffer *current_buffer = &fbl->soft_buffers[(int) mask]; file_position_type **filepointer; sax_type **saxpointer; - int current_buffer_number; - char * cd_s,*cd_p; - // Check if this buffer is initialized - + char *cd_s; + char *cd_p; - if (!current_buffer->initialized) - { + // Check if this buffer is initialized + if (!current_buffer->initialized) { pthread_mutex_lock(lock_firstnode); - if (!current_buffer->initialized) - { - - current_buffer->max_buffer_size = malloc(sizeof(int)*total_workernumber); - current_buffer->buffer_size = malloc(sizeof(int)*total_workernumber); - current_buffer->sax_records=malloc(sizeof(sax_type **)*total_workernumber); - current_buffer->pos_records=malloc(sizeof(file_position_type **)*total_workernumber); - for (int i = 0; i < total_workernumber; i++) - { - current_buffer->max_buffer_size[i]=0; - current_buffer->buffer_size[i]=0; - current_buffer->pos_records[i]=NULL; - current_buffer->sax_records[i]=NULL; + if (!current_buffer->initialized) { + current_buffer->max_buffer_size = (int*)malloc(sizeof(int) * total_workernumber); + current_buffer->buffer_size = (int*)malloc(sizeof(int) * total_workernumber); + current_buffer->sax_records = (sax_type***)malloc(sizeof(sax_type **) * total_workernumber); + current_buffer->pos_records = (file_position_type***)malloc(sizeof(file_position_type **) * total_workernumber); + + for (int i = 0; i < total_workernumber; i++) { + current_buffer->max_buffer_size[i] = 0; + current_buffer->buffer_size[i] = 0; + current_buffer->pos_records[i] = NULL; + current_buffer->sax_records[i] = NULL; } - current_buffer->node = isax_root_node_init(mask,index->settings->initial_leaf_buffer_size); + + current_buffer->node = isax_root_node_init(mask, index->settings->initial_leaf_buffer_size); current_buffer->node->is_leaf = 1; - //current_buffer->finished=1; current_buffer->initialized = 1; - //__sync_synchronize(); - if(index->first_node == NULL) - { + + if (index->first_node == NULL) { index->first_node = current_buffer->node; pthread_mutex_unlock(lock_firstnode); current_buffer->node->next = NULL; current_buffer->node->previous = NULL; - - } - else - { + } else { isax_node * prev_first = index->first_node; index->first_node = current_buffer->node; index->first_node->next = prev_first; prev_first->previous = current_buffer->node; pthread_mutex_unlock(lock_firstnode); } - __sync_fetch_and_add(&(index->root_nodes),1); - } - else - { - pthread_mutex_unlock(lock_firstnode); + + __sync_fetch_and_add(&(index->root_nodes), 1); + } else { + pthread_mutex_unlock(lock_firstnode); } - } - + } + // Check if this buffer is not full! if (current_buffer->buffer_size[workernumber] >= current_buffer->max_buffer_size[workernumber]) { - if(current_buffer->max_buffer_size[workernumber] == 0) { + if (current_buffer->max_buffer_size[workernumber] == 0) { current_buffer->max_buffer_size[workernumber] = fbl->initial_buffer_size; - current_buffer->sax_records[workernumber] = malloc(sizeof(sax_type *) * - current_buffer->max_buffer_size[workernumber]); - current_buffer->pos_records[workernumber] = malloc(sizeof(file_position_type *)* - current_buffer->max_buffer_size[workernumber]); - } - else { + current_buffer->sax_records[workernumber] = (sax_type**)malloc(sizeof(sax_type *) * + current_buffer->max_buffer_size[workernumber]); + current_buffer->pos_records[workernumber] = (file_position_type**)malloc(sizeof(file_position_type *) * + current_buffer->max_buffer_size[workernumber]); + } else { current_buffer->max_buffer_size[workernumber] *= BUFFER_REALLOCATION_RATE; - - current_buffer->sax_records[workernumber] = realloc(current_buffer->sax_records[workernumber], - sizeof(sax_type *) * - current_buffer->max_buffer_size[workernumber]); - current_buffer->pos_records[workernumber] = realloc(current_buffer->pos_records[workernumber], - sizeof(file_position_type *) * - current_buffer->max_buffer_size[workernumber]); - + current_buffer->sax_records[workernumber] = (sax_type**)realloc(current_buffer->sax_records[workernumber], + sizeof(sax_type *) * current_buffer->max_buffer_size[workernumber]); + current_buffer->pos_records[workernumber] = (file_position_type**)realloc(current_buffer->pos_records[workernumber], + sizeof(file_position_type *) * current_buffer->max_buffer_size[workernumber]); } } if (current_buffer->sax_records[workernumber] == NULL || current_buffer->pos_records[workernumber] == NULL) { fprintf(stderr, "error: Could not allocate memory in FBL."); - return OUT_OF_MEMORY_FAILURE; + + exit(-1); } + // Copy data to hard buffer and make current buffer point to the hard one - //pthread_mutex_lock(lockfbl); - //COUNT_CAL_TIME_START - //fbl->current_record_index++; - - //cd_s=fbl->current_record; - //fbl->current_record += index->settings->sax_byte_size; - //cd_s= __sync_fetch_and_add(&(fbl->current_record),index->settings->sax_byte_size+index->settings->position_byte_size); - //cd_p=fbl->current_record; - //fbl->current_record += index->settings->position_byte_size; - //cd_p= cd_s+index->settings->sax_byte_size; - //pthread_mutex_unlock(lockfbl); - current_buffer_number=current_buffer->buffer_size[workernumber]; - filepointer=(file_position_type **)current_buffer->pos_records[workernumber]; - saxpointer=(sax_type **)current_buffer->sax_records[workernumber]; - saxpointer[current_buffer_number]=((parallel_dfirst_buffer_layer*)index->fbl)->hard_buffer+*pos/sizeof(ts_type)/index->settings->timeseries_size*index->settings->sax_byte_size; - filepointer[current_buffer_number]=(file_position_type *)(((parallel_dfirst_buffer_layer*)index->fbl)->hard_buffer+*pos/sizeof(ts_type)/index->settings->timeseries_size*index->settings->sax_byte_size+index->settings->sax_byte_size); - //printf("the work number is %d sax is %d \n",workernumber,saxpointer[current_buffer_number*index->settings->paa_segments]); - //memcpy((void *) (&saxpointer[current_buffer_number]), (void *) ((parallel_dfirst_buffer_layer*)index->fbl)->hard_buffer+*pos/sizeof(ts_type)/index->settings->timeseries_size*index->settings->sax_byte_size , sizeof(sax_type *)); - //memcpy((void *) (&filepointer[current_buffer_number]), (void *) ((parallel_dfirst_buffer_layer*)index->fbl)->hard_buffer+*pos/sizeof(ts_type)/index->settings->timeseries_size*index->settings->sax_byte_size+index->settings->sax_byte_size, sizeof(file_position_type *)); - - #ifdef DEBUG + current_buffer_number = current_buffer->buffer_size[workernumber]; + filepointer = (file_position_type **)current_buffer->pos_records[workernumber]; + saxpointer = (sax_type **)current_buffer->sax_records[workernumber]; + saxpointer[current_buffer_number] = + (sax_type*)((parallel_dfirst_buffer_layer*)index->fbl)->hard_buffer + + *pos / sizeof(ts_type) / index->settings->timeseries_size * index->settings->sax_byte_size; + filepointer[current_buffer_number] = + (file_position_type *)(((parallel_dfirst_buffer_layer*)index->fbl)->hard_buffer + + *pos / sizeof(ts_type)/index->settings->timeseries_size * index->settings->sax_byte_size + index->settings->sax_byte_size); + +#ifdef DEBUG printf("*** Added to node ***\n\n"); - #ifdef TOY - sax_print(sax, index->settings->paa_segments, - index->settings->sax_bit_cardinality); - #endif - #endif - //printf("this is befor the checke \n"); - //__sync_fetch_and_add(&((current_buffer->buffer_size[workernumber])),1); - //printf("this is after the checke \n"); +#ifdef TOY + sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); +#endif +#endif + (current_buffer->buffer_size[workernumber])++; return current_buffer->node; } -enum response indexconstruction(first_buffer_layer *fbl, isax_index *index,pthread_mutex_t *lock_index,pthread_mutex_t *lock_disk,int calculate_thread) -{ - #ifdef DEBUG + +enum response indexconstruction(first_buffer_layer *fbl, isax_index *index, + pthread_mutex_t *lock_index, pthread_mutex_t *lock_disk, int calculate_thread) { +#ifdef DEBUG printf("*** FLUSHING ***\n\n"); - #else - #if VERBOSE_LEVEL == 2 +#else +#if VERBOSE_LEVEL == 2 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); - #endif - #if VERBOSE_LEVEL == 1 +#endif +#if VERBOSE_LEVEL == 1 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "Flushing...\n"); - #endif - #endif +#endif +#endif + int j; trans_fbl_input input_data; pthread_t threadid[calculate_thread]; - pthread_mutex_t lock_fbl_conter=PTHREAD_MUTEX_INITIALIZER; - input_data.index=index; - input_data.lock_index=lock_index; - input_data.lock_fbl_conter=&lock_fbl_conter; - input_data.lock_write=lock_disk; - input_data.conternumber=0; - input_data.stop_number=fbl->number_of_buffers; - //start the loop + pthread_mutex_t lock_fbl_conter = PTHREAD_MUTEX_INITIALIZER; + input_data.index = index; + input_data.lock_index = lock_index; + input_data.lock_fbl_conter = &lock_fbl_conter; + input_data.lock_write = lock_disk; + input_data.conternumber = 0; + input_data.stop_number = fbl->number_of_buffers; + + // start the loop COUNT_QUEUE_TIME_START - for (int k = 0; k < calculate_thread; k++) - { - pthread_create(&(threadid[k]),NULL,indexconstructionworker,(void*)&(input_data)); - } - for (int k = 0; k < calculate_thread; k++) - { - pthread_join(threadid[k],NULL); - } - + + for (int k = 0; k < calculate_thread; k++) { + pthread_create(&(threadid[k]), NULL, indexconstructionworker, (void*)&(input_data)); + } + + for (int k = 0; k < calculate_thread; k++) { + pthread_join(threadid[k], NULL); + } + fbl->current_record_index = 0; fbl->current_record = fbl->hard_buffer; - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 printf("\n"); - #endif - #endif - +#endif +#endif + return SUCCESS; } -enum response indexflush(first_buffer_layer *fbl, isax_index *index,pthread_mutex_t *lock_index,pthread_mutex_t *lock_disk,int calculate_thread) -{ - #ifdef DEBUG + +enum response indexflush(first_buffer_layer *fbl, isax_index *index, + pthread_mutex_t *lock_index, pthread_mutex_t *lock_disk, int calculate_thread) { +#ifdef DEBUG printf("*** FLUSHING ***\n\n"); - #else - #if VERBOSE_LEVEL == 2 +#else +#if VERBOSE_LEVEL == 2 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); - #endif - #if VERBOSE_LEVEL == 1 +#endif +#if VERBOSE_LEVEL == 1 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "Flushing...\n"); - #endif - #endif +#endif +#endif + int j; trans_fbl_input input_data; pthread_t threadid[calculate_thread]; - pthread_mutex_t lock_fbl_conter=PTHREAD_MUTEX_INITIALIZER; - input_data.index=index; - input_data.lock_index=lock_index; - input_data.lock_fbl_conter=&lock_fbl_conter; - input_data.lock_write=lock_disk; - input_data.conternumber=0; - input_data.stop_number=fbl->number_of_buffers; - //start the loop + pthread_mutex_t lock_fbl_conter = PTHREAD_MUTEX_INITIALIZER; + input_data.index = index; + input_data.lock_index = lock_index; + input_data.lock_fbl_conter = &lock_fbl_conter; + input_data.lock_write = lock_disk; + input_data.conternumber = 0; + input_data.stop_number = fbl->number_of_buffers; + + // start the loop COUNT_QUEUE_TIME_START - for (int k = 0; k < calculate_thread; k++) - { - pthread_create(&(threadid[k]),NULL,indexflushworker,(void*)&(input_data)); + + for (int k = 0; k < calculate_thread; k++) { + pthread_create(&(threadid[k]), NULL, indexflushworker, (void*)&(input_data)); } - for (int k = 0; k < calculate_thread; k++) - { - pthread_join(threadid[k],NULL); + + for (int k = 0; k < calculate_thread; k++) { + pthread_join(threadid[k], NULL); } - - + fbl->current_record_index = 0; fbl->current_record = fbl->hard_buffer; - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 printf("\n"); - #endif - #endif - +#endif +#endif + return SUCCESS; } -enum response indexpRecBufflush(parallel_first_buffer_layer *fbl, isax_index *index,pthread_mutex_t *lock_index,pthread_mutex_t *lock_disk,int calculate_thread,int preworkernumber) -{ - #ifdef DEBUG + +enum response indexpRecBufflush(parallel_first_buffer_layer *fbl, isax_index *index, + pthread_mutex_t *lock_index, pthread_mutex_t *lock_disk, int calculate_thread, int preworkernumber) { +#ifdef DEBUG printf("*** FLUSHING ***\n\n"); - #else - #if VERBOSE_LEVEL == 2 +#else +#if VERBOSE_LEVEL == 2 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); - #endif - #if VERBOSE_LEVEL == 1 +#endif +#if VERBOSE_LEVEL == 1 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "Flushing...\n"); - #endif - #endif +#endif +#endif + int j; trans_fbl_input input_data; pthread_t threadid[calculate_thread]; - pthread_mutex_t lock_fbl_conter=PTHREAD_MUTEX_INITIALIZER; - input_data.index=index; - input_data.lock_index=lock_index; - input_data.lock_fbl_conter=&lock_fbl_conter; - input_data.lock_write=lock_disk; - input_data.conternumber=0; - input_data.stop_number=fbl->number_of_buffers; - input_data.preworkernumber=preworkernumber; - //start the loop + pthread_mutex_t lock_fbl_conter = PTHREAD_MUTEX_INITIALIZER; + input_data.index = index; + input_data.lock_index = lock_index; + input_data.lock_fbl_conter = &lock_fbl_conter; + input_data.lock_write = lock_disk; + input_data.conternumber = 0; + input_data.stop_number = fbl->number_of_buffers; + input_data.preworkernumber = preworkernumber; + + // start the loop COUNT_QUEUE_TIME_START - for (int k = 0; k < calculate_thread; k++) - { - pthread_create(&(threadid[k]),NULL,indexpRecBufflushworker,(void*)&(input_data)); + + for (int k = 0; k < calculate_thread; k++) { + pthread_create(&(threadid[k]), NULL, indexpRecBufflushworker, (void*)&(input_data)); } - for (int k = 0; k < calculate_thread; k++) - { - pthread_join(threadid[k],NULL); + + for (int k = 0; k < calculate_thread; k++) { + pthread_join(threadid[k], NULL); } - - + fbl->current_record_index = 0; fbl->current_record = fbl->hard_buffer; - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 printf("\n"); - #endif - #endif - +#endif +#endif + return SUCCESS; } -enum response indexconstruction_pRecBuf(first_buffer_layer *fbl, isax_index *index,pthread_mutex_t *lock_index,int calculate_thread) -{ - #ifdef DEBUG + +enum response indexconstruction_pRecBuf(first_buffer_layer *fbl, isax_index *index, + pthread_mutex_t *lock_index, int calculate_thread) { +#ifdef DEBUG printf("*** FLUSHING ***\n\n"); - #else - #if VERBOSE_LEVEL == 2 +#else +#if VERBOSE_LEVEL == 2 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "\x1b[31mFlushing: \x1b[36m00.00%%\x1b[0m"); - #endif - #if VERBOSE_LEVEL == 1 +#endif +#if VERBOSE_LEVEL == 1 printf("\n"); fflush(stdout); - int i=1; + int i = 1; fprintf(stdout, "Flushing...\n"); - #endif - #endif +#endif +#endif + int j; trans_fbl_input input_data; pthread_t threadid[maxreadthread]; - pthread_mutex_t lock_fbl_conter=PTHREAD_MUTEX_INITIALIZER; - input_data.index=index; - input_data.lock_index=lock_index; - input_data.lock_fbl_conter=&lock_fbl_conter; - input_data.conternumber=0; - input_data.stop_number=fbl->number_of_buffers; - input_data.preworkernumber=calculate_thread-1; - //start the loop - - for (int k = 0; k < calculate_thread; k++) - { - pthread_create(&(threadid[k]),NULL,indexconstructionworker_pRecBuf,(void*)&(input_data)); - } - - for (int k = 0; k < calculate_thread; k++) - { - pthread_join(threadid[k],NULL); - } - + pthread_mutex_t lock_fbl_conter = PTHREAD_MUTEX_INITIALIZER; + input_data.index = index; + input_data.lock_index = lock_index; + input_data.lock_fbl_conter = &lock_fbl_conter; + input_data.conternumber = 0; + input_data.stop_number = fbl->number_of_buffers; + input_data.preworkernumber = calculate_thread - 1; + + // start the loop + for (int k = 0; k < calculate_thread; k++) { + pthread_create(&(threadid[k]), NULL, indexconstructionworker_pRecBuf, (void*)&(input_data)); + } + + for (int k = 0; k < calculate_thread; k++) { + pthread_join(threadid[k], NULL); + } + fbl->current_record_index = 0; fbl->current_record = fbl->hard_buffer; - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 printf("\n"); - #endif - #endif - +#endif +#endif + return SUCCESS; } -/*void* fonction3(void *input) -{ - isax_index *index=((trans_fbl_input*)input)->index; - pthread_mutex_t *lock_index=((trans_fbl_input*)input)->lock_index; - pthread_mutex_t *lock_write=((trans_fbl_input*)input)->lock_write; - int j,c=1; - isax_node_record *r = malloc(sizeof(isax_node_record)); - for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) - { - - fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; - if (!current_fbl_node->initialized) { - continue; - } - - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); - c++; - fflush(stdout); - #endif - #endif - int i; - if (current_fbl_node->buffer_size > 0) { - // For all records in this buffer - //COUNT_CAL_TIME_START - //printf("current_fbl_node->buffer_size is %d\n",current_fbl_node->buffer_size ); - for (i=0; ibuffer_size; i++) { - r->sax = (sax_type *) current_fbl_node->sax_records[i]; - r->position = (file_position_type *) current_fbl_node->pos_records[i]; - r->insertion_mode = NO_TMP | PARTIAL; - // Add record to index - - add_record_to_node(index, current_fbl_node->node, r, 1); - - } - - // flush index node - //COUNT_CAL_TIME_START - flush_subtree_leaf_buffers_m(index, current_fbl_node->node,lock_index,lock_write); - //COUNT_CAL_TIME_END - // clear FBL records moved in LBL buffers - free(current_fbl_node->sax_records); - free(current_fbl_node->pos_records); - // clear records read from files (free only prev sax buffers) - - isax_index_clear_node_buffers(index, current_fbl_node->node, - INCLUDE_CHILDREN, - TMP_AND_TS_CLEAN); - - index->allocated_memory = 0; - // Set to 0 in order to re-allocate original space for buffers. - current_fbl_node->buffer_size = 0; - current_fbl_node->max_buffer_size = 0; - } - - } -}*/ -void* indexconstructionworker(void *input) -{ - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,write_total_time; - //gettimeofday(&workertimestart, NULL); - +void* indexconstructionworker(void *input) { + isax_index *index = ((trans_fbl_input*)input)->index; + pthread_mutex_t *lock_index = ((trans_fbl_input*)input)->lock_index; + pthread_mutex_t *lock_write = ((trans_fbl_input*)input)->lock_write; + int j; + int c = 1; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); - isax_index *index=((trans_fbl_input*)input)->index; - pthread_mutex_t *lock_index=((trans_fbl_input*)input)->lock_index; - pthread_mutex_t *lock_write=((trans_fbl_input*)input)->lock_write; - int j,c=1; - isax_node_record *r = malloc(sizeof(isax_node_record)); - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) - while(1) - { + while (1) { pthread_mutex_lock(((trans_fbl_input*)input)->lock_fbl_conter); - //COUNT_CAL_TIME_START - j=((trans_fbl_input*)input)->conternumber; + j = ((trans_fbl_input*)input)->conternumber; ((trans_fbl_input*)input)->conternumber++; - //COUNT_CAL_TIME_END pthread_mutex_unlock(((trans_fbl_input*)input)->lock_fbl_conter); - if(j>=((trans_fbl_input*)input)->stop_number) - { + + if (j >= ((trans_fbl_input*)input)->stop_number) { break; } + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c / (float)index->root_nodes) * 100); c++; fflush(stdout); - #endif - #endif +#endif +#endif + int i; - if (current_fbl_node->buffer_size > 0) - { - // For all records in this buffer - //COUNT_CAL_TIME_START - //printf("current_fbl_node->buffer_size is %d\n",current_fbl_node->buffer_size ); - for (i=0; ibuffer_size; i++) - { + + if (current_fbl_node->buffer_size > 0) { + // For all records in this buffer + for (i = 0; i < current_fbl_node->buffer_size; i++) { r->sax = (sax_type *) current_fbl_node->sax_records[i]; r->position = (file_position_type *) current_fbl_node->pos_records[i]; - r->insertion_mode = NO_TMP | PARTIAL; - // Add record to index + r->insertion_mode = PARTIAL_OR_NO_TMP; add_record_to_node(index, current_fbl_node->node, r, 1); - } // flush index node - //COUNT_CAL_TIME_START - //gettimeofday(&writetiemstart, NULL); - flush_subtree_leaf_buffers_m(index, current_fbl_node->node,lock_index,lock_write); - //gettimeofday(&writecurenttime, NULL); - //write_total_time += writecurenttime.tv_sec*1000000 + (writecurenttime.tv_usec)-writetiemstart.tv_sec*1000000 - (writetiemstart.tv_usec); - //COUNT_CAL_TIME_END - // clear FBL records moved in LBL buffers + flush_subtree_leaf_buffers_m(index, current_fbl_node->node, lock_index, lock_write); free(current_fbl_node->sax_records); free(current_fbl_node->pos_records); - // clear records read from files (free only prev sax buffers) - isax_index_clear_node_buffers(index, current_fbl_node->node, - INCLUDE_CHILDREN, - TMP_AND_TS_CLEAN); - + // clear records read from files (free only prev sax buffers) + isax_index_clear_node_buffers(index, current_fbl_node->node, INCLUDE_CHILDREN, TMP_AND_TS_CLEAN); index->allocated_memory = 0; + // Set to 0 in order to re-allocate original space for buffers. current_fbl_node->buffer_size = 0; current_fbl_node->max_buffer_size = 0; } } - //gettimeofday(&workercurenttime, NULL); - //worker_total_time += workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec)-workertimestart.tv_sec*1000000 - (workertimestart.tv_usec); - //printf("the index construction worker time is %f \n",worker_total_time ); - //printf("the worker's write time is %f \n",write_total_time ); + free(r); - } -void* indexflushworker(void *input) -{ - isax_index *index=((trans_fbl_input*)input)->index; - pthread_mutex_t *lock_index=((trans_fbl_input*)input)->lock_index; - pthread_mutex_t *lock_write=((trans_fbl_input*)input)->lock_write; - int j,c=1; - isax_node_record *r = malloc(sizeof(isax_node_record)); - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) - while(1) - { + +void* indexflushworker(void *input) { + isax_index *index = ((trans_fbl_input*)input)->index; + pthread_mutex_t *lock_index =((trans_fbl_input*)input)->lock_index; + pthread_mutex_t *lock_write =((trans_fbl_input*)input)->lock_write; + int j; + int c = 1; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + + while (1) { pthread_mutex_lock(((trans_fbl_input*)input)->lock_fbl_conter); - //COUNT_CAL_TIME_START - j=((trans_fbl_input*)input)->conternumber; + j = ((trans_fbl_input*)input)->conternumber; ((trans_fbl_input*)input)->conternumber++; - //COUNT_CAL_TIME_END pthread_mutex_unlock(((trans_fbl_input*)input)->lock_fbl_conter); - if(j>=((trans_fbl_input*)input)->stop_number) - { + + if (j >= ((trans_fbl_input*)input)->stop_number) { break; } + fbl_soft_buffer *current_fbl_node = &index->fbl->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c / (float)index->root_nodes) * 100); c++; fflush(stdout); - #endif - #endif +#endif +#endif int i; - if (current_fbl_node->buffer_size > 0) - { - // For all records in this buffer - //COUNT_CAL_TIME_START - //printf("current_fbl_node->buffer_size is %d\n",current_fbl_node->buffer_size ); - - flush_subtree_leaf_buffers_m(index, current_fbl_node->node,lock_index,lock_write); + if (current_fbl_node->buffer_size > 0) { + // For all records in this buffer + flush_subtree_leaf_buffers_m(index, current_fbl_node->node, lock_index, lock_write); free(current_fbl_node->sax_records); free(current_fbl_node->pos_records); - // clear records read from files (free only prev sax buffers) - isax_index_clear_node_buffers(index, current_fbl_node->node, - INCLUDE_CHILDREN, - TMP_AND_TS_CLEAN); - + // clear records read from files (free only prev sax buffers) + isax_index_clear_node_buffers(index, current_fbl_node->node, INCLUDE_CHILDREN, TMP_AND_TS_CLEAN); index->allocated_memory = 0; + // Set to 0 in order to re-allocate original space for buffers. current_fbl_node->buffer_size = 0; current_fbl_node->max_buffer_size = 0; } } - //gettimeofday(&workercurenttime, NULL); - //worker_total_time += workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec)-workertimestart.tv_sec*1000000 - (workertimestart.tv_usec); - //printf("the index construction worker time is %f \n",worker_total_time ); - //printf("the worker's write time is %f \n",write_total_time ); + free(r); - } -void* indexpRecBufflushworker(void *input) -{ - isax_index *index=((trans_fbl_input*)input)->index; - pthread_mutex_t *lock_index=((trans_fbl_input*)input)->lock_index; - pthread_mutex_t *lock_write=((trans_fbl_input*)input)->lock_write; - int preworkernumber=((trans_fbl_input*)input)->preworkernumber; - int j,c=1; - bool have_record=false; - //for (j=((trans_fbl_input*)input)->start_number; j<((trans_fbl_input*)input)->stop_number; j++) - while(1) - { +void* indexpRecBufflushworker(void *input) { + isax_index *index = ((trans_fbl_input*)input)->index; + pthread_mutex_t *lock_index =((trans_fbl_input*)input)->lock_index; + pthread_mutex_t *lock_write =((trans_fbl_input*)input)->lock_write; + int preworkernumber = ((trans_fbl_input*)input)->preworkernumber; + int j; + int c = 1; + bool have_record = false; + + while (1) { pthread_mutex_lock(((trans_fbl_input*)input)->lock_fbl_conter); - //COUNT_CAL_TIME_START - j=((trans_fbl_input*)input)->conternumber; + j = ((trans_fbl_input*)input)->conternumber; ((trans_fbl_input*)input)->conternumber++; - //COUNT_CAL_TIME_END pthread_mutex_unlock(((trans_fbl_input*)input)->lock_fbl_conter); - if(j>=((trans_fbl_input*)input)->stop_number) - { + + if (j >= ((trans_fbl_input*)input)->stop_number) { break; } + parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer*)(index->fbl))->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c / (float)index->root_nodes) * 100); c++; fflush(stdout); - #endif - #endif +#endif +#endif + int i; - have_record=false; - for (int k = 0; k < preworkernumber; k++) - { - // For all records in this buffer - //COUNT_CAL_TIME_START - if (current_fbl_node->buffer_size[k] > 0) - have_record=true; - } - if (have_record) - { + have_record = false; + + for (int k = 0; k < preworkernumber; k++) { + // For all records in this buffer + if (current_fbl_node->buffer_size[k] > 0) { + have_record = true; + } + } + + if (have_record) { // flush index node - //COUNT_CAL_TIME_START - flush_subtree_leaf_buffers_m(index, current_fbl_node->node,lock_index,lock_write); - //COUNT_CAL_TIME_END + flush_subtree_leaf_buffers_m(index, current_fbl_node->node, lock_index, lock_write); + // clear FBL records moved in LBL buffers - for (int k = 0; k < preworkernumber; k++) - { - if(current_fbl_node->sax_records[k]!=NULL) - { + for (int k = 0; k < preworkernumber; k++) { + if (current_fbl_node->sax_records[k] != NULL) { free((current_fbl_node->sax_records[k])); free((current_fbl_node->pos_records[k])); - current_fbl_node->sax_records[k]=NULL; - current_fbl_node->pos_records[k]=NULL; + current_fbl_node->sax_records[k] = NULL; + current_fbl_node->pos_records[k] = NULL; } + current_fbl_node->buffer_size[k] = 0; current_fbl_node->max_buffer_size[k] = 0; } // clear records read from files (free only prev sax buffers) - - isax_index_clear_node_buffers(index, current_fbl_node->node, - INCLUDE_CHILDREN, - TMP_AND_TS_CLEAN); - - index->allocated_memory = 0; + isax_index_clear_node_buffers(index, current_fbl_node->node, INCLUDE_CHILDREN, TMP_AND_TS_CLEAN); + index->allocated_memory = 0; // Set to 0 in order to re-allocate original space for buffers. } } - //gettimeofday(&workercurenttime, NULL); - //worker_total_time += workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec)-workertimestart.tv_sec*1000000 - (workertimestart.tv_usec); - //printf("the index construction worker time is %f \n",worker_total_time ); - //printf("the worker's write time is %f \n",write_total_time ); - } -void* indexconstructionworker_pRecBuf(void *input) -{ - isax_index *index=((trans_fbl_input*)input)->index; - pthread_mutex_t *lock_index=((trans_fbl_input*)input)->lock_index; - pthread_mutex_t *lock_write=((trans_fbl_input*)input)->lock_write; - int j=0,k=0,c=1; - bool have_record=false; - int preworkernumber=((trans_fbl_input*)input)->preworkernumber; - isax_node_record *r = malloc(sizeof(isax_node_record)); - while(1) - { - - j=__sync_fetch_and_add(&(((trans_fbl_input*)input)->conternumber),1); - //pthread_mutex_unlock(((trans_fbl_input*)input)->lock_fbl_conter); - if(j>=((trans_fbl_input*)input)->stop_number) - { +void* indexconstructionworker_pRecBuf(void *input) { + isax_index *index = ((trans_fbl_input*)input)->index; + pthread_mutex_t *lock_index = ((trans_fbl_input*)input)->lock_index; + pthread_mutex_t *lock_write = ((trans_fbl_input*)input)->lock_write; + int j = 0; + int k = 0; + int c = 1; + bool have_record = false; + int preworkernumber = ((trans_fbl_input*)input)->preworkernumber; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + + while (1) { + j = __sync_fetch_and_add(&(((trans_fbl_input*)input)->conternumber), 1); + + if (j >= ((trans_fbl_input*)input)->stop_number) { break; } + parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer*)(index->fbl))->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); + +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c / (float)index->root_nodes) * 100); c++; fflush(stdout); - #endif - #endif +#endif +#endif + int i; - have_record=false; - for (int k = 0; k < preworkernumber; k++) - { - // For all records in this buffer - //COUNT_CAL_TIME_START - if (current_fbl_node->buffer_size[k] > 0) - have_record=true; - for (i=0; ibuffer_size[k]; i++) - { - r->sax = (sax_type *) &(((current_fbl_node->sax_records[k]))[i*index->settings->paa_segments]); - r->position = (file_position_type *) &((file_position_type *)(current_fbl_node->pos_records[k]))[i]; - r->insertion_mode = NO_TMP | PARTIAL; - // Add record to index + have_record = false; - sax_type* saxpointer=(sax_type *)current_fbl_node->sax_records[k]; + for (int k = 0; k < preworkernumber; k++) { + // For all records in this buffer + if (current_fbl_node->buffer_size[k] > 0) { + have_record = true; + } + for (i = 0; i < current_fbl_node->buffer_size[k]; i++) { + r->sax = (sax_type *) &(((current_fbl_node->sax_records[k]))[i * index->settings->paa_segments]); + r->position = (file_position_type *) &((file_position_type *)(current_fbl_node->pos_records[k]))[i]; + r->insertion_mode = PARTIAL_OR_NO_TMP; + + // Add record to index + sax_type* saxpointer = (sax_type *)current_fbl_node->sax_records[k]; add_record_to_node(index, current_fbl_node->node, r, 1); } } - if (have_record) - { + + if (have_record) { // flush index node - //COUNT_CAL_TIME_START - flush_subtree_leaf_buffers_m(index, current_fbl_node->node,lock_index,lock_write); - //COUNT_CAL_TIME_END + flush_subtree_leaf_buffers_m(index, current_fbl_node->node, lock_index, lock_write); + // clear FBL records moved in LBL buffers - for (int k = 0; k < preworkernumber; k++) - { - if(current_fbl_node->sax_records[k]!=NULL) - { + for (int k = 0; k < preworkernumber; k++) { + if (current_fbl_node->sax_records[k] != NULL) { free((current_fbl_node->sax_records[k])); free((current_fbl_node->pos_records[k])); - current_fbl_node->sax_records[k]=NULL; - current_fbl_node->pos_records[k]=NULL; + current_fbl_node->sax_records[k] = NULL; + current_fbl_node->pos_records[k] = NULL; } + current_fbl_node->buffer_size[k] = 0; current_fbl_node->max_buffer_size[k] = 0; } // clear records read from files (free only prev sax buffers) - - isax_index_clear_node_buffers(index, current_fbl_node->node, - INCLUDE_CHILDREN, - TMP_AND_TS_CLEAN); - - index->allocated_memory = 0; - // Set to 0 in order to re-allocate original space for buffers. - + isax_index_clear_node_buffers(index, current_fbl_node->node, INCLUDE_CHILDREN, TMP_AND_TS_CLEAN); + index->allocated_memory = 0; // Set to 0 in order to re-allocate original space for buffers. } - } + COUNT_QUEUE_TIME_START free(r); } -void* indexconstructionworker_pRecBuf_new(void *input) -{ - isax_index *index=((trans_fbl_input*)input)->index; - pthread_mutex_t *lock_index=((trans_fbl_input*)input)->lock_index; - pthread_mutex_t *lock_write=((trans_fbl_input*)input)->lock_write; - int fbloffset=((trans_fbl_input*)input)->fbloffset; - int j=0,c=1; - bool have_record=false; - int preworkernumber=((trans_fbl_input*)input)->preworkernumber; - isax_node_record *r = malloc(sizeof(isax_node_record)); - while(1) - { - //printf("this is the construction worker"); - - j=__sync_fetch_and_add(&(((trans_fbl_input*)input)->conternumber),1); - //pthread_mutex_unlock(((trans_fbl_input*)input)->lock_fbl_conter); - if(j>=((trans_fbl_input*)input)->stop_number) - { + +void* indexconstructionworker_pRecBuf_new(void *input) { + isax_index *index = ((trans_fbl_input*)input)->index; + pthread_mutex_t *lock_index = ((trans_fbl_input*)input)->lock_index; + pthread_mutex_t *lock_write = ((trans_fbl_input*)input)->lock_write; + int fbloffset = ((trans_fbl_input*)input)->fbloffset; + int j = 0; + int c = 1; + bool have_record = false; + int preworkernumber = ((trans_fbl_input*)input)->preworkernumber; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + + while (1) { + j = __sync_fetch_and_add(&(((trans_fbl_input*)input)->conternumber), 1); + + if (j >= ((trans_fbl_input*)input)->stop_number) { break; } + parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer*)(index->fbl))->soft_buffers[j]; + if (!current_fbl_node->initialized) { continue; } - #ifndef DEBUG - #if VERBOSE_LEVEL == 2 - fprintf(stdout,"\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c/(float)index->root_nodes)*100); + +#ifndef DEBUG +#if VERBOSE_LEVEL == 2 + fprintf(stdout, "\r\x1b[31mFlushing: \x1b[36m%2.2lf%%\x1b[0m", ((float)c / (float)index->root_nodes) * 100); c++; fflush(stdout); - #endif - #endif +#endif +#endif + int i; - have_record=false; - - for (int k = fbloffset; k < fbloffset+preworkernumber; k++) - { - // For all records in this buffer - //COUNT_CAL_TIME_START - if (current_fbl_node->buffer_size[k] > 0) - have_record=true; - for (i=0; ibuffer_size[k]; i++) - { - r->sax = (sax_type *) &(((current_fbl_node->sax_records[k]))[i*index->settings->paa_segments]); - r->position = (file_position_type *) &((file_position_type *)(current_fbl_node->pos_records[k]))[i]; - r->insertion_mode = NO_TMP | PARTIAL; - // Add record to index + have_record = false; - sax_type* saxpointer=(sax_type *)current_fbl_node->sax_records[k]; + for (int k = fbloffset; k < fbloffset + preworkernumber; k++) { + // For all records in this buffer + if (current_fbl_node->buffer_size[k] > 0) { + have_record = true; + } + for (i = 0; i < current_fbl_node->buffer_size[k]; i++) { + r->sax = (sax_type *) &(((current_fbl_node->sax_records[k]))[i * index->settings->paa_segments]); + r->position = (file_position_type *) &((file_position_type *)(current_fbl_node->pos_records[k]))[i]; + r->insertion_mode = PARTIAL_OR_NO_TMP; + sax_type* saxpointer = (sax_type *)current_fbl_node->sax_records[k]; add_record_to_node(index, current_fbl_node->node, r, 1); } } - if (have_record) - { + if (have_record) { // flush index node - //COUNT_CAL_TIME_START - flush_subtree_leaf_buffers_m(index, current_fbl_node->node,lock_index,lock_write); + flush_subtree_leaf_buffers_m(index, current_fbl_node->node, lock_index, lock_write); - //COUNT_CAL_TIME_END - // clear FBL records moved in LBL buffers - for (int k = fbloffset; k < fbloffset+preworkernumber; k++) - { - if(current_fbl_node->sax_records[k]!=NULL) - { + for (int k = fbloffset; k < fbloffset + preworkernumber; k++) { + if (current_fbl_node->sax_records[k] != NULL) { free((current_fbl_node->sax_records[k])); free((current_fbl_node->pos_records[k])); - current_fbl_node->sax_records[k]=NULL; - current_fbl_node->pos_records[k]=NULL; + current_fbl_node->sax_records[k] = NULL; + current_fbl_node->pos_records[k] = NULL; } - + current_fbl_node->buffer_size[k] = 0; current_fbl_node->max_buffer_size[k] = 0; } // clear records read from files (free only prev sax buffers) - - isax_index_clear_node_buffers(index, current_fbl_node->node, - INCLUDE_CHILDREN, - TMP_AND_TS_CLEAN); - - index->allocated_memory = 0; - // Set to 0 in order to re-allocate original space for buffers. - + isax_index_clear_node_buffers(index, current_fbl_node->node, INCLUDE_CHILDREN, TMP_AND_TS_CLEAN); + index->allocated_memory = 0; // Set to 0 in order to re-allocate original space for buffers. } - } + COUNT_QUEUE_TIME_START free(r); } -void* indexconstructionworker_2RecBuf(void *input) -{ - isax_index *index=((trans_fbl_input*)input)->index; - pthread_mutex_t *lock_index=((trans_fbl_input*)input)->lock_index; - pthread_mutex_t *lock_write=((trans_fbl_input*)input)->lock_write; - int fbloffset=((trans_fbl_input*)input)->fbloffset; - int j=0,c=1; - bool have_record=false; - - int preworkernumber=((trans_fbl_input*)input)->preworkernumber; - isax_node_record *r = malloc(sizeof(isax_node_record)); - while(!((trans_fbl_input*)input)->finished) - { + +void* indexconstructionworker_2RecBuf(void *input) { + isax_index *index = ((trans_fbl_input*)input)->index; + pthread_mutex_t *lock_index = ((trans_fbl_input*)input)->lock_index; + pthread_mutex_t *lock_write = ((trans_fbl_input*)input)->lock_write; + int fbloffset = ((trans_fbl_input*)input)->fbloffset; + int j = 0; + int c = 1; + bool have_record = false; + int preworkernumber = ((trans_fbl_input*)input)->preworkernumber; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + + while (!((trans_fbl_input*)input)->finished) { pthread_barrier_wait(((trans_fbl_input*)input)->lock_barrier1); pthread_barrier_wait(((trans_fbl_input*)input)->lock_barrier2); - while(1) - { - //printf("this is the construction worker"); - - j=__sync_fetch_and_add(&(((trans_fbl_input*)input)->conternumber),1); - //pthread_mutex_unlock(((trans_fbl_input*)input)->lock_fbl_conter); - if(j>=index->fbl->number_of_buffers) - break; + + while (1) { + j = __sync_fetch_and_add(&(((trans_fbl_input*)input)->conternumber), 1); + + if (j >= index->fbl->number_of_buffers) { + break; + } + parallel_fbl_soft_buffer *current_fbl_node = &((parallel_first_buffer_layer*)(index->fbl))->soft_buffers[j]; - if (!current_fbl_node->initialized) - continue; + + if (!current_fbl_node->initialized) { + continue; + } + int i; - have_record=false; - - // For all records in this buffer - //COUNT_CAL_TIME_START - if (current_fbl_node->buffer_size[fbloffset] > 0) - { - //for (i=((index_buffer_data*)transferdata)->bufferpresize[j]; ibuffer_size; i++) - for (i=((trans_fbl_input*)input)->buffersize[j+fbloffset*index->fbl->number_of_buffers]; ibuffer_size[fbloffset]; i++) - { - r->sax = (sax_type *) &(((current_fbl_node->sax_records[fbloffset]))[i*index->settings->paa_segments]); - r->position = (file_position_type *) &((file_position_type *)(current_fbl_node->pos_records[fbloffset]))[i]; - r->insertion_mode = NO_TMP | PARTIAL; - // Add record to index - add_record_to_node(index, current_fbl_node->node, r, 1); + have_record = false; + + // For all records in this buffer + if (current_fbl_node->buffer_size[fbloffset] > 0) { + for (i = ((trans_fbl_input*)input)->buffersize[j + fbloffset * index->fbl->number_of_buffers]; + i < current_fbl_node->buffer_size[fbloffset]; i++) { + r->sax = (sax_type *) &(((current_fbl_node->sax_records[fbloffset]))[i * index->settings->paa_segments]); + r->position = (file_position_type *) &((file_position_type *)(current_fbl_node->pos_records[fbloffset]))[i]; + r->insertion_mode = PARTIAL_OR_NO_TMP; + + // Add record to index + add_record_to_node(index, current_fbl_node->node, r, 1); + } + + ((trans_fbl_input*)input)->buffersize[j + fbloffset * index->fbl->number_of_buffers] = current_fbl_node->buffer_size[fbloffset]; } - ((trans_fbl_input*)input)->buffersize[j+fbloffset*index->fbl->number_of_buffers]=current_fbl_node->buffer_size[fbloffset]; - } - //((index_buffer_data*)transferdata)->bufferpresize[j]=current_fbl_node->buffer_size; } } + COUNT_QUEUE_TIME_START free(r); } -void* indexconstructionworker_2nRecBuf(void *input) -{ - isax_index *index=((trans_fbl_input*)input)->index; - pthread_mutex_t *lock_index=((trans_fbl_input*)input)->lock_index; - pthread_mutex_t *lock_write=((trans_fbl_input*)input)->lock_write; - int fbloffset=0; - int j=0,k=0,c=1; - bool have_record=false; - - int preworkernumber=((trans_fbl_input*)input)->preworkernumber; - isax_node_record *r = malloc(sizeof(isax_node_record)); - while(!((trans_fbl_input*)input)->finished) - { - fbloffset=preworkernumber-fbloffset; - //pthread_barrier_wait(((trans_fbl_input*)input)->lock_barrier1); +void* indexconstructionworker_2nRecBuf(void *input) { + isax_index *index = ((trans_fbl_input*)input)->index; + pthread_mutex_t *lock_index = ((trans_fbl_input*)input)->lock_index; + pthread_mutex_t *lock_write = ((trans_fbl_input*)input)->lock_write; + int fbloffset = 0; + int j = 0; + int k = 0; + int c = 1; + bool have_record = false; + int preworkernumber = ((trans_fbl_input*)input)->preworkernumber; + isax_node_record *r = (isax_node_record*)malloc(sizeof(isax_node_record)); + + while (!((trans_fbl_input*)input)->finished) { + fbloffset = preworkernumber-fbloffset; pthread_barrier_wait(((trans_fbl_input*)input)->lock_barrier2); - if(((trans_fbl_input*)input)->finished) - break; - - while(1) - { - //printf("this is the construction worker"); - - j=__sync_fetch_and_add(&(((trans_fbl_input*)input)->conternumber),1); - //pthread_mutex_unlock(((trans_fbl_input*)input)->lock_fbl_conter); - if(j>=index->fbl->number_of_buffers) + + if (((trans_fbl_input*)input)->finished) { break; + } + + while (1) { + j = __sync_fetch_and_add(&(((trans_fbl_input*)input)->conternumber), 1); + + if (j >= index->fbl->number_of_buffers) { + break; + } parallel_dfbl_soft_buffer *current_fbl_node = &((parallel_dfirst_buffer_layer*)(index->fbl))->soft_buffers[j]; - if (!current_fbl_node->initialized) - continue; - - // For all records in this buffer - //COUNT_CAL_TIME_START - //for (i=((index_buffer_data*)transferdata)->bufferpresize[j]; ibuffer_size; i++) - - for( k = fbloffset; k < fbloffset+preworkernumber; k++) - { - for (int i=((trans_fbl_input*)input)->buffersize[j+k*index->fbl->number_of_buffers]; ibuffer_size[k]; i++) - { - r->sax = (((current_fbl_node->sax_records[k]))[i]); - r->position = (file_position_type *)(((current_fbl_node->pos_records[k]))[i]); - r->insertion_mode = NO_TMP | PARTIAL; - // Add record to index - add_record_to_node(index, current_fbl_node->node, r, 1); + if (!current_fbl_node->initialized) { + continue; } - ((trans_fbl_input*)input)->buffersize[j+k*index->fbl->number_of_buffers]=current_fbl_node->buffer_size[k]; - + + // For all records in this buffer + for (k = fbloffset; k < fbloffset + preworkernumber; k++) { + for (int i = ((trans_fbl_input*)input)->buffersize[j + k * index->fbl->number_of_buffers]; + i < current_fbl_node->buffer_size[k]; i++) { + r->sax = (((current_fbl_node->sax_records[k]))[i]); + r->position = (file_position_type *)(((current_fbl_node->pos_records[k]))[i]); + r->insertion_mode = PARTIAL_OR_NO_TMP; + + // Add record to index + add_record_to_node(index, current_fbl_node->node, r, 1); + } + + ((trans_fbl_input*)input)->buffersize[j + k * index->fbl->number_of_buffers] = current_fbl_node->buffer_size[k]; } } - - //((index_buffer_data*)transferdata)->bufferpresize[j]=current_fbl_node->buffer_size; } - + COUNT_QUEUE_TIME_START free(r); } -root_mask_type isax_fbl_index_insert_m(isax_index *index, - sax_type * sax, - file_position_type * pos, pthread_mutex_t *lock_record, pthread_mutex_t *lock_fbl, pthread_mutex_t *lock_cbl,pthread_mutex_t *lock_firstnode,pthread_mutex_t *lock_index,pthread_mutex_t *lock_disk) -{ - int i,t; + +root_mask_type isax_fbl_index_insert_m(isax_index *index, sax_type * sax, file_position_type * pos, + pthread_mutex_t *lock_record, pthread_mutex_t *lock_fbl, pthread_mutex_t *lock_cbl, + pthread_mutex_t *lock_firstnode, pthread_mutex_t *lock_index, pthread_mutex_t *lock_disk) { + int i; + int t; int totalsize = index->settings->max_total_buffer_size; // Create mask for the first bit of the sax representation - - // Step 1: Check if there is a root node that represents the - // current node's sax representation - - - root_mask_type first_bit_mask = 0x00; + // Step 1: Check if there is a root node that represents the + // current node's sax representation + root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); + pthread_mutex_lock(&(lock_cbl[first_bit_mask % LOCK_SIZE])); + insert_to_fbl_m(index->fbl, sax, pos, first_bit_mask, index, lock_firstnode, lock_fbl); + pthread_mutex_unlock(&(lock_cbl[first_bit_mask % LOCK_SIZE])); - pthread_mutex_lock(&(lock_cbl[first_bit_mask%LOCK_SIZE])); - insert_to_fbl_m(index->fbl, sax, pos, first_bit_mask, index,lock_firstnode,lock_fbl); - pthread_mutex_unlock(&(lock_cbl[first_bit_mask%LOCK_SIZE])); - return first_bit_mask; } -root_mask_type isax_fbl_index_insert_m_new(isax_index *index, - sax_type * sax, - file_position_type * pos, pthread_mutex_t *lock_record, pthread_mutex_t *lock_fbl, pthread_mutex_t *lock_cbl,pthread_mutex_t *lock_firstnode,pthread_mutex_t *lock_index,pthread_mutex_t *lock_disk) -{ - int i,t; + +root_mask_type isax_fbl_index_insert_m_new(isax_index *index, sax_type * sax, file_position_type * pos, + pthread_mutex_t *lock_record, pthread_mutex_t *lock_fbl, pthread_mutex_t *lock_cbl, + pthread_mutex_t *lock_firstnode, pthread_mutex_t *lock_index, pthread_mutex_t *lock_disk) { + int i; + int t; int totalsize = index->settings->max_total_buffer_size; // Create mask for the first bit of the sax representation - - // Step 1: Check if there is a root node that represents the - // current node's sax representation - - - root_mask_type first_bit_mask = 0x00; + // Step 1: Check if there is a root node that represents the + // current node's sax representation + root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); + pthread_mutex_lock(&(lock_cbl[first_bit_mask % LOCK_SIZE])); + insert_to_fbl_m_new(index->fbl, sax, pos, first_bit_mask, index, lock_firstnode, lock_fbl); + pthread_mutex_unlock(&(lock_cbl[first_bit_mask % LOCK_SIZE])); - pthread_mutex_lock(&(lock_cbl[first_bit_mask%LOCK_SIZE])); - insert_to_fbl_m_new(index->fbl, sax, pos, first_bit_mask, index,lock_firstnode,lock_fbl); - pthread_mutex_unlock(&(lock_cbl[first_bit_mask%LOCK_SIZE])); - return first_bit_mask; } -root_mask_type isax_pRecBuf_index_insert(isax_index *index, - sax_type * sax, - file_position_type * pos, pthread_mutex_t *lock_record,pthread_mutex_t *lock_firstnode,int workernumber,int total_workernumber) -{ - int i,t; +root_mask_type isax_pRecBuf_index_insert(isax_index *index, sax_type * sax, file_position_type * pos, + pthread_mutex_t *lock_record, pthread_mutex_t *lock_firstnode, int workernumber, int total_workernumber) { + int i; + int t; int totalsize = index->settings->max_total_buffer_size; // Create mask for the first bit of the sax representation - - // Step 1: Check if there is a root node that represents the - // current node's sax representation - - root_mask_type first_bit_mask = 0x00; + // Step 1: Check if there is a root node that represents the + // current node's sax representation + root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); - - insert_to_pRecBuf((parallel_first_buffer_layer*)(index->fbl), sax, pos,first_bit_mask, index,lock_firstnode,workernumber,total_workernumber); - + insert_to_pRecBuf((parallel_first_buffer_layer*)(index->fbl), sax, pos, first_bit_mask, + index, lock_firstnode, workernumber, total_workernumber); return first_bit_mask; } -root_mask_type isax_2pRecBuf_index_insert(isax_index *index, - sax_type * sax, - file_position_type * pos, pthread_mutex_t *lock_record,pthread_mutex_t *lock_firstnode,int workernumber,int total_workernumber) -{ - int i,t; + +root_mask_type isax_2pRecBuf_index_insert(isax_index *index, sax_type * sax, file_position_type * pos, + pthread_mutex_t *lock_record, pthread_mutex_t *lock_firstnode, int workernumber, int total_workernumber) { + int i; + int t; int totalsize = index->settings->max_total_buffer_size; // Create mask for the first bit of the sax representation - - // Step 1: Check if there is a root node that represents the - // current node's sax representation - - root_mask_type first_bit_mask = 0x00; + // Step 1: Check if there is a root node that represents the + // current node's sax representation + root_mask_type first_bit_mask = 0x00; CREATE_MASK(first_bit_mask, index, sax); - //printf("the pos is %d\n",*pos); - - void* current_recode=((parallel_dfirst_buffer_layer*)(index->fbl))->hard_buffer; - //if(current_recode==NULL), - //memcpy(current_recode,sax,index->settings->sax_byte_size); - //printf("the posewfewjewooifwjo %d\n",current_recode); - memcpy(current_recode+*pos/sizeof(ts_type)/index->settings->timeseries_size*index->settings->sax_byte_size,sax,index->settings->sax_byte_size); - memcpy(current_recode+*pos/sizeof(ts_type)/index->settings->timeseries_size*index->settings->sax_byte_size+index->settings->sax_byte_size,pos,index->settings->position_byte_size); - insert_to_2pRecBuf((parallel_dfirst_buffer_layer*)(index->fbl), sax, pos,first_bit_mask, index,lock_firstnode,workernumber,total_workernumber); + void* current_recode = ((parallel_dfirst_buffer_layer*)(index->fbl))->hard_buffer; + memcpy(current_recode + *pos / sizeof(ts_type) / index->settings->timeseries_size * index->settings->sax_byte_size, + sax, index->settings->sax_byte_size); + memcpy(current_recode + *pos / sizeof(ts_type) / index->settings->timeseries_size * + index->settings->sax_byte_size + index->settings->sax_byte_size, pos, index->settings->position_byte_size); + insert_to_2pRecBuf((parallel_dfirst_buffer_layer*)(index->fbl), sax, pos, first_bit_mask, + index, lock_firstnode, workernumber, total_workernumber); + return first_bit_mask; } - -/*void isax_index_binary_file_pRecBuf_old(const char *ifilename, int ts_num, isax_index *index,int calculate_thread) -{ - fprintf(stderr, ">>> Indexing: %s\n", ifilename); - FILE * ifile; - - ifile = fopen (ifilename,"rb"); - index_buffer_data *input_data=malloc(sizeof(index_buffer_data)*(calculate_thread-1)); - index_buffer_data transferdata; - file_position_type *pos = malloc(sizeof(file_position_type)); - pthread_t threadid[calculate_thread-1]; - bool sax_fist_time_check = false; - - long long int i; - int prev_flush_time=0,now_flush_time=0; - //initial the locks - pthread_mutex_t lock_record=PTHREAD_MUTEX_INITIALIZER,lockfbl=PTHREAD_MUTEX_INITIALIZER,lock_index=PTHREAD_MUTEX_INITIALIZER, - lock_firstnode=PTHREAD_MUTEX_INITIALIZER,lock_disk=PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_t *lockcbl; - // set the thread on decided cpu - destroy_fbl(index->fbl); - index->fbl = initialize_pRecBuf(index->settings->initial_fbl_buffer_size, - pow(2, index->settings->paa_segments), - index->settings->max_total_buffer_size+DISK_BUFFER_SIZE*(PROGRESS_CALCULATE_THREAD_NUMBER-1), index); - - - - - for (i = 0; i < (calculate_thread-1); i++) - { - input_data[i].index=index; - input_data[i].lock_fbl=&lockfbl; - input_data[i].lock_record=&lock_record; - input_data[i].lock_firstnode =&lock_firstnode; - input_data[i].lock_index=&lock_index; - input_data[i].blocid=i*read_block_length; - input_data[i].lock_disk=&lock_disk; - input_data[i].workernumber=i; - input_data[i].total_workernumber=calculate_thread-1; - } - if (ifile == NULL) { - fprintf(stderr, "File %s not found!\n", ifilename); - exit(-1); - } - - fseek(ifile, 0L, SEEK_END); - file_position_type sz = (file_position_type) ftell(ifile); - file_position_type total_records = sz/index->settings->ts_byte_size; - fseek(ifile, 0L, SEEK_SET); - if (total_records < ts_num) { - fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); - exit(-1); - } - long int ts_loaded = 0; - int j,conter=0; - ts_type * ts = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts1 = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts2; - sax_type * saxv =malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv1 =malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv2; - - - - index->settings->raw_filename = malloc(256); - strcpy(index->settings->raw_filename, ifilename); - - #ifdef BENCHMARK - int percentage = (int) (ts_num / (file_position_type) 100); - #endif - - *pos = ftell(ifile); - COUNT_INPUT_TIME_START - //pre read the data of first round - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); - COUNT_INPUT_TIME_END - if(ts_num>read_block_length*(calculate_thread-1)) - { - for (i = read_block_length*(calculate_thread-1); i < ts_num; i+=read_block_length*(calculate_thread-1)) - { - //quan bu yunxing wan hou - ts2 =ts; - ts =ts1; - ts1 =ts2; - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - //printf("pos is %lld\n",*pos); - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; - } - //create multiple threads - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_pRecBuf,(void*)&(input_data[j])); - - } - *pos = ftell(ifile); - //pthread_mutex_lock(&lock_disk); - COUNT_INPUT_TIME_START - //read the data of next round - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); - COUNT_INPUT_TIME_END - //write the sax in disk (last round) - if (sax_fist_time_check) - { - COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); - COUNT_OUTPUT_TIME_END - } - else - { - sax_fist_time_check=true; - } - //wait for the finish of other threads - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_join(threadid[j],NULL); - } - now_flush_time=i/(index->settings->max_total_buffer_size); - if(now_flush_time!=prev_flush_time) - { - COUNT_QUEUE_TIME_START - indexconstruction_pRecBuf(index->fbl, index,&lock_index,calculate_thread); - COUNT_QUEUE_TIME_END - } - prev_flush_time=now_flush_time; - } - } - - ts2 =ts; - ts =ts1; - ts1 =ts2; - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - //handle the rest data - int conter_ts_number=ts_num%(read_block_length*(calculate_thread-1)); - int sax_save_number=conter_ts_number; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos = *pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - conter++; - input_data[j].ts=&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].fin_number=min(conter_ts_number,read_block_length); - conter_ts_number=conter_ts_number-read_block_length; - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker_pRecBuf,(void*)&(input_data[j])); - if(conter_ts_number<0) - break; - } - if (sax_fist_time_check) - { - // pthread_mutex_lock(&lock_disk); - COUNT_OUTPUT_TIME_START - //fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); - COUNT_OUTPUT_TIME_END - //pthread_mutex_unlock(&lock_disk); - } - else - { - sax_fist_time_check=true; - } - for (j = 0; j < conter; j++) - { - pthread_join(threadid[j],NULL); - } - //pthread_mutex_lock(&lock_disk); - COUNT_OUTPUT_TIME_START - //fwrite(saxv, index->settings->sax_byte_size, sax_save_number, index->sax_file); - COUNT_OUTPUT_TIME_END - //pthread_mutex_unlock(&lock_disk); - COUNT_QUEUE_TIME_START - indexconstruction_pRecBuf(index->fbl, index,&lock_index,calculate_thread); - COUNT_QUEUE_TIME_END - free(ts); - free(ts1); - free(input_data); - free(lockcbl); - free(saxv); - free(saxv1); - //free(sax); - free(pos); - COUNT_INPUT2_TIME_START - fclose(ifile); - COUNT_INPUT2_TIME_END -}*/ - - -/*void isax_index_binary_file_mold(const char *ifilename, int ts_num, isax_index *index,int calculate_thread) -{ - fprintf(stderr, ">>> Indexing: %s\n", ifilename); - FILE * ifile; - - ifile = fopen (ifilename,"rb"); - index_buffer_data *input_data=malloc(sizeof(index_buffer_data)*(calculate_thread-1)); - index_buffer_data transferdata; - file_position_type *pos = malloc(sizeof(file_position_type)); - pthread_t threadid[calculate_thread-1]; - bool sax_fist_time_check = false; - - long long int i; - int prev_flush_time=0,now_flush_time=0; - //initial the locks - pthread_mutex_t lock_record=PTHREAD_MUTEX_INITIALIZER,lockfbl=PTHREAD_MUTEX_INITIALIZER,lock_index=PTHREAD_MUTEX_INITIALIZER, - lock_firstnode=PTHREAD_MUTEX_INITIALIZER,lock_disk=PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_t *lockcbl; - // set the thread on decided cpu - - lockcbl= malloc(sizeof(pthread_mutex_t)*LOCK_SIZE); - - for(i=0; isettings->ts_byte_size; - fseek(ifile, 0L, SEEK_SET); - if (total_records < ts_num) { - fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); - exit(-1); - } - long int ts_loaded = 0; - int j,conter=0; - ts_type * ts = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts1 = malloc(sizeof(ts_type) * index->settings->timeseries_size*read_block_length*(calculate_thread-1)); - ts_type * ts2; - sax_type * saxv =malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv1 =malloc(sizeof(sax_type) * index->settings->paa_segments*read_block_length*(calculate_thread-1)); - sax_type * saxv2; - - - - index->settings->raw_filename = malloc(256); - strcpy(index->settings->raw_filename, ifilename); - - #ifdef BENCHMARK - int percentage = (int) (ts_num / (file_position_type) 100); - #endif - - *pos = ftell(ifile); - COUNT_INPUT_TIME_START - //pre read the data of first round - - COUNT_INPUT_TIME_END - if(ts_num>read_block_length*(calculate_thread-1)) - { - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); - for (i = read_block_length*(calculate_thread-1); i < ts_num; i+=read_block_length*(calculate_thread-1)) - { - //quan bu yunxing wan hou - ts2 =ts; - ts =ts1; - ts1 =ts2; - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - //printf("pos is %lld\n",*pos); - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos =*pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - input_data[j].ts =&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].saxv =saxv; - input_data[j].fin_number =read_block_length; - } - - //create multiple threads - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker,(void*)&(input_data[j])); - } - *pos = ftell(ifile); - // pthread_mutex_lock(&lock_disk); - COUNT_INPUT_TIME_START - //read the data of next round - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*read_block_length*(calculate_thread-1), ifile); - COUNT_INPUT_TIME_END - //write the sax in disk (last round) - if (sax_fist_time_check) - { - COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); - COUNT_OUTPUT_TIME_END - } - else - { - sax_fist_time_check=true; - } - - //wait for the finish of other threads - for (j = 0; j < (calculate_thread-1); j++) - { - pthread_join(threadid[j],NULL); - } - now_flush_time=i/(index->settings->max_total_buffer_size); - if(now_flush_time!=prev_flush_time) - { - COUNT_QUEUE_TIME_START - indexconstruction(index->fbl, index,&lock_index,&lock_disk,calculate_thread); - COUNT_QUEUE_TIME_END - } - prev_flush_time=now_flush_time; - - - } - } - else - { - fread(ts1, sizeof(ts_type), index->settings->timeseries_size*ts_num, ifile); - } - ts2 =ts; - ts =ts1; - ts1 =ts2; - saxv2 =saxv; - saxv =saxv1; - saxv1 =saxv2; - //handle the rest data - int conter_ts_number=ts_num%(read_block_length*(calculate_thread-1)); - int sax_save_number=conter_ts_number; - for ( j = 0; j < (calculate_thread-1); j++) - { - input_data[j].pos = *pos+index->settings->timeseries_size*sizeof(ts_type)*j*read_block_length; - conter++; - input_data[j].ts=&(ts[index->settings->timeseries_size*j*read_block_length]); - input_data[j].fin_number=min(conter_ts_number,read_block_length); - conter_ts_number=conter_ts_number-read_block_length; - pthread_create(&(threadid[j]),NULL,indexbulkloadingworker,(void*)&(input_data[j])); - if(conter_ts_number<0) - break; - } - if (sax_fist_time_check) - { - pthread_mutex_lock(&lock_disk); - COUNT_OUTPUT_TIME_START - fwrite(saxv1, index->settings->sax_byte_size, read_block_length*(calculate_thread-1), index->sax_file); - COUNT_OUTPUT_TIME_END - pthread_mutex_unlock(&lock_disk); - } - else - { - sax_fist_time_check=true; - } - for (j = 0; j < conter; j++) - { - pthread_join(threadid[j],NULL); - } - pthread_mutex_lock(&lock_disk); - COUNT_OUTPUT_TIME_START - fwrite(saxv, index->settings->sax_byte_size, sax_save_number, index->sax_file); - COUNT_OUTPUT_TIME_END - pthread_mutex_unlock(&lock_disk); - COUNT_QUEUE_TIME_START - indexconstruction(index->fbl, index,&lock_index,&lock_disk,calculate_thread); - COUNT_QUEUE_TIME_END - free(ts); - free(ts1); - free(input_data); - free(lockcbl); - free(saxv); - free(saxv1); - //free(sax); - free(pos); - COUNT_INPUT2_TIME_START - fclose(ifile); - COUNT_INPUT2_TIME_END -}*/ - - - -/*void* indexbulkloadingworker_old(void *transferdata) - { - sax_type * sax = malloc(sizeof(sax_type) * ((index_buffer_data*)transferdata)->index->settings->paa_segments); - - int fin_number=((index_buffer_data*)transferdata)->fin_number; - file_position_type *pos = malloc(sizeof(file_position_type)); - sax_type * saxv=(((index_buffer_data*)transferdata)->saxv); - int offset_saxv=((index_buffer_data*)transferdata)->blocid*((index_buffer_data*)transferdata)->index->settings->paa_segments; - int paa_segments=((index_buffer_data*)transferdata)->index->settings->paa_segments; - isax_index *index= ((index_buffer_data*)transferdata)->index; - int i=0; - for (i=0;its)+i*index->settings->timeseries_size), sax, index->settings->ts_values_per_paa_segment, - index->settings->paa_segments, index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality, - index->settings->timeseries_size) == SUCCESS) - { - *pos= ((index_buffer_data*)transferdata)->pos+index->settings->timeseries_size*sizeof(ts_type)*i; - - //for(j=0;j<((index_buffer_data*)transferdata)->index->settings->paa_segments;j++) - //{ - //saxv[offset_saxv+i*paa_segments+j]=sax[j]; - //printf("the sax [%d ]%d\n",i,(int)saxv[offset_saxv+i*paa_segments+j]); - //printf("the sax [%d ]%d\n",i,(int)sax[j]); - //} - - memcpy(&(saxv[offset_saxv+i*paa_segments]), sax, sizeof(sax_type) * paa_segments); - - - #ifdef CLUSTERED - root_mask_type first_bit_mask = 0x00; - * pos=(index_buffer_data)transferdata->pos+index->settings->timeseries_size*sizeof(ts_type)*i; - CREATE_MASK(first_bit_mask, index, sax); - char* pfilename = malloc(255); - snprintf(pfilename, 255, "%s.%llu",index->settings->raw_filename,first_bit_mask); - FILE *pfile = fopen(pfilename, "a+"); - * pos=(index_buffer_data)transferdata->pos+index->settings->timeseries_size*sizeof(ts_type)*i; - // - fwrite(ts, sizeof(ts_type), index->settings->timeseries_size, pfile); - // - fclose(pfile); - free(pfilename); - #endif - - //printf("the pos is %lld\n",*pos); - //isax_fbl_index_insert(index, sax, pos); - isax_fbl_index_insert_m(index, sax, pos, ((index_buffer_data*)transferdata)->lock_record, ((index_buffer_data*)transferdata)->lock_fbl, - ((index_buffer_data*)transferdata)->lock_cbl,((index_buffer_data*)transferdata)->lock_firstnode,((index_buffer_data*)transferdata)->lock_index,((index_buffer_data*)transferdata)->lock_disk); - } - else - { - fprintf(stderr, "error: cannot insert record in index, since sax representation\ - failed to be created"); - } - - - } - free(pos); - free(sax); -}*/ diff --git a/src/ads/parallel_inmemory_query_engine.c b/src/ads/parallel_inmemory_query_engine.c index 647cd0c7..c7b902b3 100644 --- a/src/ads/parallel_inmemory_query_engine.c +++ b/src/ads/parallel_inmemory_query_engine.c @@ -31,14 +31,12 @@ #define NTHREADS 4 - query_result approximate_search_inmemory_m(ts_type *ts, ts_type *paa, isax_index *index) { query_result result; - sax_type *sax = malloc(sizeof(sax_type) * index->settings->paa_segments); + sax_type *sax = (sax_type*)malloc(sizeof(sax_type) * index->settings->paa_segments); sax_from_paa(paa, sax, index->settings->paa_segments, - index->settings->sax_alphabet_cardinality, - index->settings->sax_bit_cardinality); + index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); root_mask_type root_mask = 0; CREATE_MASK(root_mask, index, sax); @@ -48,10 +46,9 @@ query_result approximate_search_inmemory_m(ts_type *ts, ts_type *paa, isax_index // Traverse tree // Adaptive splitting - while (!node->is_leaf) { int location = index->settings->sax_bit_cardinality - 1 - - node->split_data->split_mask[node->split_data->splitpoint]; + node->split_data->split_mask[node->split_data->splitpoint]; root_mask_type mask = index->settings->bit_masks[location]; if (sax[node->split_data->splitpoint] & mask) { @@ -59,9 +56,8 @@ query_result approximate_search_inmemory_m(ts_type *ts, ts_type *paa, isax_index } else { node = node->left_child; } - - // Adaptive splitting } + result.distance = calculate_node_distance_inmemory_m(index, node, ts, FLT_MAX); result.node = node; } else { @@ -80,36 +76,34 @@ float calculate_node_distance_inmemory_m(isax_index *index, isax_node *node, ts_ // If node has buffered data if (node->buffer != NULL) { int i; + #pragma omp parallel for num_threads(maxquerythread) reduction(min : bsf) for (i = 0; i < node->buffer->full_buffer_size; i++) { - // float dist = ts_euclidean_distance_SIMD(query, node->buffer->full_ts_buffer[i], - // index->settings->timeseries_size, bsf); float dist = ts_ed(query, node->buffer->full_ts_buffer[i], - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->timeseries_size, bsf, + index->settings->SIMD_flag, index->settings->is_norm); + if (dist < bsf) { bsf = dist; } } + #pragma omp parallel for num_threads(maxquerythread) reduction(min : bsf) for (i = 0; i < node->buffer->tmp_full_buffer_size; i++) { - // float dist = ts_euclidean_distance_SIMD(query, node->buffer->tmp_full_ts_buffer[i], - // index->settings->timeseries_size, bsf); float dist = ts_ed(query, node->buffer->tmp_full_ts_buffer[i], - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->timeseries_size, bsf, + index->settings->SIMD_flag, index->settings->is_norm); + if (dist < bsf) { bsf = dist; } } + #pragma omp parallel for num_threads(maxquerythread) reduction(min : bsf) for (i = 0; i < node->buffer->partial_buffer_size; i++) { - - // float dist = ts_euclidean_distance_SIMD(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - // index->settings->timeseries_size, bsf); float dist = ts_ed(query, &(rawfile[*node->buffer->partial_position_buffer[i]]), - index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->timeseries_size, bsf, + index->settings->SIMD_flag, index->settings->is_norm); if (dist < bsf) { bsf = dist; @@ -117,15 +111,11 @@ float calculate_node_distance_inmemory_m(isax_index *index, isax_node *node, ts_ } } - ////////////////////////////////////// - return bsf; } - query_result refine_answer_inmemory_m(ts_type *ts, ts_type *paa, isax_index *index, - query_result approximate_bsf_result, - float minimum_distance, int limit) { + query_result approximate_bsf_result, float minimum_distance, int limit) { query_result bsf_result = approximate_bsf_result; int tight_bound = index->settings->tight_bound; @@ -133,49 +123,52 @@ query_result refine_answer_inmemory_m(ts_type *ts, ts_type *paa, isax_index *ind int j = 0; pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; while (current_root_node != NULL) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); - //SFA + // SFA if (index->settings->function_type == 4) { mindist_result->distance = minidist_fft_to_sfa(index, paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, minimum_distance); + current_root_node->isax_cardinalities, minimum_distance); } else { mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); } + mindist_result->node = current_root_node; pqueue_insert(pq, mindist_result); current_root_node = current_root_node->next; } + query_result *n; int checks = 0; - while ((n = pqueue_pop(pq))) { + + while ((n = (query_result*)pqueue_pop(pq))) { // The best node has a worse mindist, so search is finished! if (n->distance >= bsf_result.distance || n->distance > minimum_distance) { pqueue_insert(pq, n); + break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) { + (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue - //split_node(index, n->node); - //pqueue_insert(pq, n); continue; } + // *** EXTRA BOUNDING *** if (tight_bound) { j++; @@ -183,81 +176,89 @@ query_result refine_answer_inmemory_m(ts_type *ts, ts_type *paa, isax_index *ind if (mindistance >= bsf_result.distance) { free(n); + continue; } } // *** REAL DISTANCE *** checks++; float distance = calculate_node_distance_inmemory_m(index, n->node, ts, bsf_result.distance); + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node; } + if (checks > limit) { pqueue_insert(pq, n); + break; } } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { - if (n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + if (n->node->left_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { float distance = calculate_node_distance_inmemory(index, n->node->left_child, ts, - bsf_result.distance); + bsf_result.distance); + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->left_child; } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); - //SFA + // SFA if (index->settings->function_type == 4) { mindist_result->distance = minidist_fft_to_sfa(index, paa, - n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - minimum_distance); + n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + minimum_distance); } else { mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); } mindist_result->node = n->node->left_child; pqueue_insert(pq, mindist_result); } } + if (n->node->right_child->isax_cardinalities != NULL) { if (n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + aggressive_check) { float distance = calculate_node_distance_inmemory(index, n->node->right_child, ts, - bsf_result.distance); + bsf_result.distance); + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->right_child; } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); - //SFA + // SFA if (index->settings->function_type == 4) { mindist_result->distance = minidist_fft_to_sfa(index, paa, - n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - minimum_distance); + n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + minimum_distance); } else { mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); } + mindist_result->node = n->node->right_child; pqueue_insert(pq, mindist_result); } @@ -268,26 +269,26 @@ query_result refine_answer_inmemory_m(ts_type *ts, ts_type *paa, isax_index *ind free(n); } } + // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { + while ((n = (query_result*)pqueue_pop(pq))) { free(n); } + // Free the priority queue. pqueue_free(pq); + return bsf_result; } - -query_result exact_search_serial_ParIS_nb_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves) { - +query_result exact_search_serial_ParIS_nb_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED - pthread_t threadid[maxquerythread]; COUNT_INPUT_TIME_START query_result approximate_result = approximate_search_inmemory(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; @@ -299,24 +300,26 @@ query_result exact_search_serial_ParIS_nb_inmemory(ts_type *ts, ts_type *paa, is if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + approximate_result = refine_answer_inmemory(ts, paa, index, + approximate_result, minimum_distance, min_checked_leaves); } + COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ unsigned long i; #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); #endif SET_APPROXIMATE(approximate_result.distance); - ParIS_LDCW_data *worker_data = malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); + ParIS_LDCW_data *worker_data = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; float bsfdistance = approximate_result.distance; COUNT_CAL_TIME_START + for (i = 0; i < (maxquerythread - 1); i++) { worker_data[i].index = index; worker_data[i].lock_bsf = &lock_bsf; @@ -329,6 +332,7 @@ query_result exact_search_serial_ParIS_nb_inmemory(ts_type *ts, ts_type *paa, is worker_data[i].minidisvector = &bsfdistance; worker_data[i].rawfile = rawfile; } + worker_data[maxquerythread - 1].index = index; worker_data[maxquerythread - 1].lock_bsf = &lock_bsf; worker_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (index->sax_cache_size / maxquerythread); @@ -339,94 +343,105 @@ query_result exact_search_serial_ParIS_nb_inmemory(ts_type *ts, ts_type *paa, is worker_data[maxquerythread - 1].sum_of_lab = 0; worker_data[maxquerythread - 1].minidisvector = &bsfdistance; worker_data[maxquerythread - 1].rawfile = rawfile; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, ParIS_nb_worker_inmemory, (void *) &(worker_data[i])); - } + for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); + if (worker_data[i].bsfdistance < approximate_result.distance) approximate_result.distance = worker_data[i].bsfdistance; } - COUNT_CAL_TIME_END free(worker_data); + return approximate_result; } -void exact_search_serial_ParIS_nb_batch_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves, int batch_number) { - +void exact_search_serial_ParIS_nb_batch_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves, int batch_number) { RESET_BYTES_ACCESSED query_result approximate_result[batch_number]; omp_lock_t bsflock[batch_number]; - - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); - //query_result bsf_result = approximate_result; + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; float bsf_distance; COUNT_INPUT_TIME_START + // Early termination... #pragma omp parallel for num_threads(maxquerythread) for (int i = 0; i < batch_number; i++) { omp_init_lock(&(bsflock[i])); approximate_result[i] = approximate_search_inmemory(&(ts[i * index->settings->timeseries_size]), - &(paa[i * index->settings->paa_segments]), index); + &(paa[i * index->settings->paa_segments]), index); + if (approximate_result[i].distance == FLT_MAX || min_checked_leaves > 1) { approximate_result[i] = refine_answer_inmemory(&(ts[i * index->settings->timeseries_size]), - &(paa[i * index->settings->paa_segments]), index, - approximate_result[i], minimum_distance, min_checked_leaves); + &(paa[i * index->settings->paa_segments]), index, + approximate_result[i], minimum_distance, min_checked_leaves); } - } + COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ COUNT_CAL_TIME_START -#pragma omp parallel for num_threads(maxquerythread) + + #pragma omp parallel for num_threads(maxquerythread) for (unsigned long j = 0; j < index->sax_cache_size; j++) { sax_type *sax = &index->sax_cache[j * index->settings->paa_segments]; + for (int i = 0; i < batch_number; i++) +#if defined(__x86_64__) if (minidist_paa_to_isax_raw_SIMD(&(paa[i * index->settings->paa_segments]), sax, - index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt) <= approximate_result[i].distance) { + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= approximate_result[i].distance) { +#else + if (minidist_paa_to_isax_raw(&(paa[i * index->settings->paa_segments]), sax, + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= approximate_result[i].distance) { +#endif ts_buffer = &rawfile[j * index->settings->timeseries_size]; - // float dist = ts_euclidean_distance_SIMD(&(ts[i * index->settings->timeseries_size]), ts_buffer, - // index->settings->timeseries_size, - // approximate_result[i].distance); float dist = ts_ed(&(ts[i * index->settings->timeseries_size]), ts_buffer, - index->settings->timeseries_size, - approximate_result[i].distance, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->timeseries_size, + approximate_result[i].distance, + index->settings->SIMD_flag, index->settings->is_norm); if (dist < approximate_result[i].distance) { omp_set_lock(&(bsflock[i])); + if (dist < approximate_result[i].distance) { approximate_result[i].distance = dist; } + omp_unset_lock(&(bsflock[i])); } } } + COUNT_CAL_TIME_END - //SET_APPROXIMATE(approximate_result.distance); + for (int i = 0; i < batch_number; i++) { PRINT_STATS(approximate_result[i].distance) } } void *ParIS_nb_worker_inmemory(void *worker_data) { - unsigned long i; - float bsfdistance, mindist; + float bsfdistance; + float mindist; isax_index *index = ((ParIS_LDCW_data *) worker_data)->index; ts_type *ts_buffer; @@ -436,28 +451,28 @@ void *ParIS_nb_worker_inmemory(void *worker_data) { ts_type *ts = ((ParIS_LDCW_data *) worker_data)->ts; for (i = start_number; i < stop_number; i++) { - sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - +#if defined(__x86_64__) mindist = minidist_paa_to_isax_raw_SIMD(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + mindist = minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif if (mindist <= ((ParIS_LDCW_data *) worker_data)->bsfdistance) { - /*bit_array_set_bit(bitarray, i);*/ - //COUNT_INPUT_TIME_START - ts_buffer = &((ParIS_LDCW_data *) worker_data)->rawfile[i * index->settings->ts_byte_size / sizeof(ts_type)]; COUNT_INPUT_TIME_END - - // float dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, - // ((ParIS_LDCW_data *) worker_data)->bsfdistance); float dist = ts_ed(ts, ts_buffer, index->settings->timeseries_size, - ((ParIS_LDCW_data *) worker_data)->bsfdistance, - index->settings->SIMD_flag, index->settings->is_norm); + ((ParIS_LDCW_data *) worker_data)->bsfdistance, + index->settings->SIMD_flag, index->settings->is_norm); if (dist < (((ParIS_LDCW_data *) worker_data)->bsfdistance)) { (((ParIS_LDCW_data *) worker_data)->bsfdistance) = dist; @@ -466,25 +481,26 @@ void *ParIS_nb_worker_inmemory(void *worker_data) { } } - -query_result exact_search_parads_inmemory(ts_type *ts, ts_type *paa, isax_index *index, - float minimum_distance, int min_checked_leaves) { +query_result exact_search_parads_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_inmemory_pRecBuf(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; int i; + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer_inmemory_m(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + min_checked_leaves); } pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); query_result *do_not_remove = &approximate_result; @@ -496,18 +512,18 @@ query_result exact_search_parads_inmemory(ts_type *ts, ts_type *paa, isax_index if (approximate_result.node != NULL) { // Insert approximate result in heap. pqueue_insert(pq, &approximate_result); - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; - pthread_t threadid[maxquerythread]; refind_answer_fonction_data rfdata; - pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER, lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, 1); @@ -520,7 +536,6 @@ query_result exact_search_parads_inmemory(ts_type *ts, ts_type *paa, isax_index rfdata.index = index; rfdata.minimum_distance = minimum_distance; - //rfdata.limit=limit/4; rfdata.pq = pq; // Insert all root nodes in heap. @@ -530,29 +545,29 @@ query_result exact_search_parads_inmemory(ts_type *ts, ts_type *paa, isax_index query_result *n; rfdata.lock_barrier = &lock_barrier; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, exact_search_old_worker_inmemory, (void *) &(rfdata)); } + for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } - // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { - if (n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. pthread_barrier_destroy(&lock_barrier); pqueue_free(pq); bsf_result = *(rfdata.bsf_result); - //free(rfdata); - return *(rfdata.bsf_result); - - // Free the nodes that where not popped. + return *(rfdata.bsf_result); } void *exact_search_old_worker_inmemory(void *rfdata) { @@ -570,27 +585,28 @@ void *exact_search_old_worker_inmemory(void *rfdata) { int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; query_result *bsf_result = (((refind_answer_fonction_data *) rfdata)->bsf_result); + while (1) { pthread_mutex_lock(((refind_answer_fonction_data *) rfdata)->lock_current_root_node); current_root_node = ((refind_answer_fonction_data *) rfdata)->current_root_node; + if (current_root_node != NULL) { ((refind_answer_fonction_data *) rfdata)->current_root_node = ((refind_answer_fonction_data *) rfdata)->current_root_node->next; pthread_mutex_unlock(((refind_answer_fonction_data *) rfdata)->lock_current_root_node); } else { pthread_mutex_unlock(((refind_answer_fonction_data *) rfdata)->lock_current_root_node); + break; } - - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = current_root_node; pthread_mutex_lock(((refind_answer_fonction_data *) rfdata)->lock_queue); @@ -598,54 +614,63 @@ void *exact_search_old_worker_inmemory(void *rfdata) { pthread_mutex_unlock(((refind_answer_fonction_data *) rfdata)->lock_queue); } - //printf("this is the check point 1 !!!!!!!!!!!!!!!!!!!\n"); + pthread_barrier_wait(((refind_answer_fonction_data *) rfdata)->lock_barrier); while (1) { - - pthread_mutex_lock(((refind_answer_fonction_data *) rfdata)->lock_queue); - n = pqueue_pop(pq); + n = (query_result*)pqueue_pop(pq); pthread_mutex_unlock(((refind_answer_fonction_data *) rfdata)->lock_queue); - if (n == NULL) + + if (n == NULL) { break; - //printf("this is the check point of e s !!!\n"); + } + pthread_rwlock_rdlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); bsfdisntance = bsf_result->distance; pthread_rwlock_unlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); // The best node has a worse mindist, so search is finished! + if (n->distance >= bsfdisntance || n->distance > minimum_distance) { pthread_mutex_lock(((refind_answer_fonction_data *) rfdata)->lock_queue); pqueue_insert(pq, n); pthread_mutex_unlock(((refind_answer_fonction_data *) rfdata)->lock_queue); + break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) { + (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue split_node(index, n->node); pthread_mutex_lock(((refind_answer_fonction_data *) rfdata)->lock_queue); pqueue_insert(pq, n); pthread_mutex_unlock(((refind_answer_fonction_data *) rfdata)->lock_queue); + continue; } + // *** EXTRA BOUNDING *** if (tight_bound) { float mindistance = calculate_minimum_distance_inmemory(index, n->node, ts, paa); if (mindistance >= bsfdisntance) { - if (n != do_not_remove) + if (n != do_not_remove) { free(n); + } + continue; } } + // *** REAL DISTANCE *** checks++; float distance = calculate_node_distance_inmemory(index, n->node, ts, bsfdisntance); + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; @@ -653,63 +678,64 @@ void *exact_search_old_worker_inmemory(void *rfdata) { pthread_rwlock_unlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); } - //if(checks > limit) { - // pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); - // pqueue_insert(pq, n); - // pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); - // break; - // } } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { if (n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + aggressive_check) { float distance = calculate_node_distance_inmemory(index, n->node, ts, bsfdisntance); + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node->left_child; } + pthread_rwlock_unlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = n->node->left_child; pthread_mutex_lock(((refind_answer_fonction_data *) rfdata)->lock_queue); pqueue_insert(pq, mindist_result); pthread_mutex_unlock(((refind_answer_fonction_data *) rfdata)->lock_queue); } } + if (n->node->right_child->isax_cardinalities != NULL) { if (n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + aggressive_check) { float distance = calculate_node_distance_inmemory(index, n->node, ts, bsfdisntance); + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node->right_child; } + pthread_rwlock_unlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = n->node->right_child; pthread_mutex_lock(((refind_answer_fonction_data *) rfdata)->lock_queue); pqueue_insert(pq, mindist_result); @@ -719,22 +745,20 @@ void *exact_search_old_worker_inmemory(void *rfdata) { } // Free the node currently popped. - if (n != do_not_remove) + if (n != do_not_remove) { free(n); + } } } } -query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves) { - +query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED - - pthread_t threadid[maxquerythread]; COUNT_INPUT_TIME_START query_result approximate_result = approximate_search_inmemory_pRecBuf(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; int sum_of_lab = 0; @@ -750,13 +774,10 @@ query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_ if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); + min_checked_leaves); } COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); unsigned long i; #ifdef AUTO_TUNE @@ -764,11 +785,10 @@ query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_ #endif SET_APPROXIMATE(approximate_result.distance); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - ParIS_LDCW_data *essdata = malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); + ParIS_LDCW_data *essdata = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; - //pthread_mutex_t lock_bsf2=PTHREAD_MUTEX_INITIALIZER; COUNT_CAL_TIME_START + for (i = 0; i < (maxquerythread - 1); i++) { essdata[i].index = index; essdata[i].lock_bsf = &lock_bsf; @@ -779,6 +799,7 @@ query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_ essdata[i].bsfdistance = approximate_result.distance; essdata[i].sum_of_lab = 0; } + essdata[maxquerythread - 1].index = index; essdata[maxquerythread - 1].lock_bsf = &lock_bsf; essdata[maxquerythread - 1].start_number = (maxquerythread - 1) * (index->sax_cache_size / maxquerythread); @@ -791,30 +812,32 @@ query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_ for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, mindistance_worker_inmemory, (void *) &(essdata[i])); } + for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); sum_of_lab += essdata[i].sum_of_lab; } + COUNT_CAL_TIME_END - unsigned long *label_number = malloc(sizeof(unsigned long) * (sum_of_lab)); - float *minidisvector = malloc(sizeof(float) * (sum_of_lab)); + unsigned long *label_number = (unsigned long*)malloc(sizeof(unsigned long) * (sum_of_lab)); + float *minidisvector = (float*)malloc(sizeof(float) * (sum_of_lab)); sum_of_lab = 0; COUNT_OUTPUT_TIME_START + for (i = 0; i < maxquerythread; i++) { memcpy(&(label_number[sum_of_lab]), essdata[i].label_number, sizeof(unsigned long) * essdata[i].sum_of_lab); memcpy(&(minidisvector[sum_of_lab]), essdata[i].minidisvector, sizeof(float) * essdata[i].sum_of_lab); free(essdata[i].label_number); free(essdata[i].minidisvector); sum_of_lab += essdata[i].sum_of_lab; - } + pthread_t readthread[maxquerythread * maxreadthread]; ParIS_read_worker_data readpointer; unsigned long readcounter = 0; float bsfdistance = (approximate_result.distance); - readpointer.ts = ts; readpointer.index = index; readpointer.counter = &readcounter; @@ -833,21 +856,18 @@ query_result exact_search_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_ for (i = 0; i < maxquerythread * maxreadthread; i++) { pthread_join(readthread[i], NULL); } + COUNT_OUTPUT_TIME_END approximate_result.distance = bsfdistance; free(essdata); free(minidisvector); free(label_number); - //printf("I need to check: %2.2lf%% of the data.\n", (double)tocheck*100/(double)index->sax_cache_size); - /*bit_array_free(bitarray);*/ - //printf("the new distance is: %f \n",approximate_result.distance); - //.sax_type *sax = &index->sax_cache[1 * index->settings->paa_segments]; + return approximate_result; } -pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves, int k) { - +pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves, int k) { RESET_BYTES_ACCESSED pqueue_bsf *pq_bsf = pqueue_bsf_init(k); @@ -855,7 +875,7 @@ pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_inde COUNT_INPUT_TIME_START approximate_topk_inmemory(ts, paa, index, pq_bsf); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; @@ -864,27 +884,22 @@ pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_inde unsigned long j; // Early termination... - - if (pq_bsf->knn[k - 1] == FLT_MAX || min_checked_leaves > 1) { refine_topk_answer_inmemory(ts, paa, index, pq_bsf, minimum_distance, min_checked_leaves); } COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); unsigned long i; #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); #endif SET_APPROXIMATE(pq_bsf->knn[k - 1]); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - ParIS_LDCW_data *essdata = malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); + ParIS_LDCW_data *essdata = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; - //pthread_mutex_t lock_bsf2=PTHREAD_MUTEX_INITIALIZER; COUNT_CAL_TIME_START + for (i = 0; i < (maxquerythread - 1); i++) { essdata[i].index = index; essdata[i].lock_bsf = &lock_bsf; @@ -895,6 +910,7 @@ pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_inde essdata[i].bsfdistance = pq_bsf->knn[k - 1]; essdata[i].sum_of_lab = 0; } + essdata[maxquerythread - 1].index = index; essdata[maxquerythread - 1].lock_bsf = &lock_bsf; essdata[maxquerythread - 1].start_number = (maxquerythread - 1) * (index->sax_cache_size / maxquerythread); @@ -907,24 +923,27 @@ pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_inde for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, mindistance_worker_inmemory, (void *) &(essdata[i])); } + for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); sum_of_lab += essdata[i].sum_of_lab; } + COUNT_CAL_TIME_END - unsigned long *label_number = malloc(sizeof(unsigned long) * (sum_of_lab)); - float *minidisvector = malloc(sizeof(float) * (sum_of_lab)); + unsigned long *label_number = (unsigned long*)malloc(sizeof(unsigned long) * (sum_of_lab)); + float *minidisvector = (float*)malloc(sizeof(float) * (sum_of_lab)); sum_of_lab = 0; COUNT_OUTPUT_TIME_START + for (i = 0; i < maxquerythread; i++) { memcpy(&(label_number[sum_of_lab]), essdata[i].label_number, sizeof(unsigned long) * essdata[i].sum_of_lab); memcpy(&(minidisvector[sum_of_lab]), essdata[i].minidisvector, sizeof(float) * essdata[i].sum_of_lab); free(essdata[i].label_number); free(essdata[i].minidisvector); sum_of_lab += essdata[i].sum_of_lab; - } + pthread_t readthread[maxquerythread * maxreadthread]; ParIS_read_worker_data readpointer; unsigned long readcounter = 0; @@ -947,27 +966,22 @@ pqueue_bsf exact_topk_serial_ParIS_inmemory(ts_type *ts, ts_type *paa, isax_inde for (i = 0; i < maxquerythread * maxreadthread; i++) { pthread_join(readthread[i], NULL); } + COUNT_OUTPUT_TIME_END free(essdata); free(minidisvector); free(label_number); - //printf("I need to check: %2.2lf%% of the data.\n", (double)tocheck*100/(double)index->sax_cache_size); - /*bit_array_free(bitarray);*/ - //printf("the new distance is: %f \n",approximate_result.distance); - //.sax_type *sax = &index->sax_cache[1 * index->settings->paa_segments]; + return *pq_bsf; } - -query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves) { - +query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED - pthread_t threadid[maxquerythread]; query_result approximate_result = approximate_search_inmemory(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; int sum_of_lab = 0; @@ -982,25 +996,20 @@ query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax } if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); + approximate_result = refine_answer_inmemory(ts, paa, index, + approximate_result, minimum_distance, min_checked_leaves); } - - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); unsigned long i; #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); #endif SET_APPROXIMATE(approximate_result.distance); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - ParIS_LDCW_data *essdata = malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); + ParIS_LDCW_data *essdata = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; - //pthread_mutex_t lock_bsf2=PTHREAD_MUTEX_INITIALIZER; + for (i = 0; i < (maxquerythread - 1); i++) { essdata[i].index = index; essdata[i].lock_bsf = &lock_bsf; @@ -1011,6 +1020,7 @@ query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax essdata[i].bsfdistance = approximate_result.distance; essdata[i].sum_of_lab = 0; } + essdata[maxquerythread - 1].index = index; essdata[maxquerythread - 1].lock_bsf = &lock_bsf; essdata[maxquerythread - 1].start_number = (maxquerythread - 1) * (index->sax_cache_size / maxquerythread); @@ -1023,12 +1033,14 @@ query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, mindistance_worker_inmemory, (void *) &(essdata[i])); } + for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); sum_of_lab += essdata[i].sum_of_lab; } - unsigned long *label_number = malloc(sizeof(unsigned long) * (sum_of_lab)); - float *minidisvector = malloc(sizeof(float) * (sum_of_lab)); + + unsigned long *label_number = (unsigned long*)malloc(sizeof(unsigned long) * (sum_of_lab)); + float *minidisvector = (float*)malloc(sizeof(float) * (sum_of_lab)); sum_of_lab = 0; @@ -1038,8 +1050,8 @@ query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax free(essdata[i].label_number); free(essdata[i].minidisvector); sum_of_lab += essdata[i].sum_of_lab; - } + pthread_t readthread[maxquerythread * maxreadthread]; ParIS_read_worker_data readpointer; unsigned long readcounter; @@ -1050,6 +1062,7 @@ query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax } else { readcounter = sum_of_lab - 1; } + readpointer.ts = ts; readpointer.index = index; readpointer.counter = &readcounter; @@ -1060,67 +1073,73 @@ query_result exact_search_serial_ParIS2_inmemory(ts_type *ts, ts_type *paa, isax readpointer.minidisvector = minidisvector; readpointer.sum_of_lab = sum_of_lab; readpointer.rawfile = rawfile; + for (i = 0; i < maxquerythread * maxreadthread; i++) { if (bf == 0) { pthread_create(&(readthread[i]), NULL, readworker_inmemory, (void *) &(readpointer)); } else { pthread_create(&(readthread[i]), NULL, readworker2_inmemory, (void *) &(readpointer)); } - } for (i = 0; i < maxquerythread * maxreadthread; i++) { pthread_join(readthread[i], NULL); } + approximate_result.distance = bsfdistance; + if (bf == 0) { bf = 1; } else { bf = 0; } + free(essdata); free(minidisvector); free(label_number); - //printf("the t is \n"); - //printf("I need to check: %2.2lf%% of the data.\n", (double)tocheck*100/(double)index->sax_cache_size); - /*bit_array_free(bitarray);*/ - //printf("the new distance is: %f \n",approximate_result.distance); - //.sax_type *sax = &index->sax_cache[1 * index->settings->paa_segments]; + return approximate_result; } void *mindistance_worker_inmemory(void *essdata) { - unsigned long i; - float bsfdistance, mindist; + float bsfdistance; + float mindist; isax_index *index = ((ParIS_LDCW_data *) essdata)->index; unsigned long start_number = ((ParIS_LDCW_data *) essdata)->start_number; unsigned long stop_number = ((ParIS_LDCW_data *) essdata)->stop_number; ts_type *paa = ((ParIS_LDCW_data *) essdata)->paa; ts_type *ts = ((ParIS_LDCW_data *) essdata)->ts; - ((ParIS_LDCW_data *) essdata)->label_number = malloc(sizeof(unsigned long) * 10000); - ((ParIS_LDCW_data *) essdata)->minidisvector = malloc(sizeof(float) * 10000); + ((ParIS_LDCW_data *) essdata)->label_number = (unsigned long*)malloc(sizeof(unsigned long) * 10000); + ((ParIS_LDCW_data *) essdata)->minidisvector = (float*)malloc(sizeof(float) * 10000); unsigned long max_number = 10000; for (i = start_number; i < stop_number; i++) { - sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - +#if defined(__x86_64__) mindist = minidist_paa_to_isax_rawa_SIMD(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + mindist = minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + if (mindist <= ((ParIS_LDCW_data *) essdata)->bsfdistance) { if (((ParIS_LDCW_data *) essdata)->sum_of_lab >= max_number) { max_number = (max_number + 10000); - ((ParIS_LDCW_data *) essdata)->label_number = (unsigned long *) realloc( + ((ParIS_LDCW_data *) essdata)->label_number = (unsigned long*) realloc( ((ParIS_LDCW_data *) essdata)->label_number, sizeof(unsigned long) * max_number); - ((ParIS_LDCW_data *) essdata)->minidisvector = (float *) realloc( + ((ParIS_LDCW_data *) essdata)->minidisvector = (float*) realloc( ((ParIS_LDCW_data *) essdata)->minidisvector, sizeof(float) * max_number); - } + ((ParIS_LDCW_data *) essdata)->label_number[((ParIS_LDCW_data *) essdata)->sum_of_lab] = i; ((ParIS_LDCW_data *) essdata)->minidisvector[((ParIS_LDCW_data *) essdata)->sum_of_lab] = mindist; ((ParIS_LDCW_data *) essdata)->sum_of_lab++; @@ -1130,10 +1149,12 @@ void *mindistance_worker_inmemory(void *essdata) { void *readworker_inmemory(void *read_pointer) { isax_index *index = ((ParIS_read_worker_data *) read_pointer)->index; - float bsf, dist; + float bsf; + float dist; ts_type *ts_buffer; ts_type *ts = ((ParIS_read_worker_data *) read_pointer)->ts; - unsigned long t = 0, p; + unsigned long t = 0; + unsigned long p; unsigned long sum_of_lab = ((ParIS_read_worker_data *) read_pointer)->sum_of_lab; float *minidisvector = ((ParIS_read_worker_data *) read_pointer)->minidisvector; bsf = *(((ParIS_read_worker_data *) read_pointer)->bsf2); @@ -1143,23 +1164,26 @@ void *readworker_inmemory(void *read_pointer) { bsf = *(((ParIS_read_worker_data *) read_pointer)->bsf2); pthread_rwlock_unlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); t = __sync_fetch_and_add(((ParIS_read_worker_data *) read_pointer)->counter, 1); + if (t >= sum_of_lab) { break; } + p = ((ParIS_read_worker_data *) read_pointer)->load_point[t]; + if (minidisvector[t] < bsf) { ts_buffer = &((ParIS_read_worker_data *) read_pointer)->rawfile[p * index->settings->ts_byte_size / sizeof(ts_type)]; - // dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf); - dist = ts_ed(ts, ts_buffer, index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->SIMD_flag, index->settings->is_norm); if (dist < bsf) { pthread_rwlock_wrlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); + if (dist < *(((ParIS_read_worker_data *) read_pointer)->bsf2)) { *(((ParIS_read_worker_data *) read_pointer)->bsf2) = dist; } + pthread_rwlock_unlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); } } @@ -1168,11 +1192,13 @@ void *readworker_inmemory(void *read_pointer) { void *topk_readworker_inmemory(void *read_pointer) { isax_index *index = ((ParIS_read_worker_data *) read_pointer)->index; - float bsf, dist; + float bsf; + float dist; pqueue_bsf *pq_bsf = ((ParIS_read_worker_data *) read_pointer)->pq_bsf; ts_type *ts_buffer; ts_type *ts = ((ParIS_read_worker_data *) read_pointer)->ts; - unsigned long t = 0, p; + unsigned long t = 0; + unsigned long p; unsigned long sum_of_lab = ((ParIS_read_worker_data *) read_pointer)->sum_of_lab; float *minidisvector = ((ParIS_read_worker_data *) read_pointer)->minidisvector; bsf = *(((ParIS_read_worker_data *) read_pointer)->bsf2); @@ -1182,16 +1208,18 @@ void *topk_readworker_inmemory(void *read_pointer) { bsf = pq_bsf->knn[pq_bsf->k - 1]; pthread_rwlock_unlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); t = __sync_fetch_and_add(((ParIS_read_worker_data *) read_pointer)->counter, 1); + if (t >= sum_of_lab) { break; } + p = ((ParIS_read_worker_data *) read_pointer)->load_point[t]; + if (minidisvector[t] < bsf) { ts_buffer = &((ParIS_read_worker_data *) read_pointer)->rawfile[p * index->settings->ts_byte_size / sizeof(ts_type)]; - // dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf); dist = ts_ed(ts, ts_buffer, index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->SIMD_flag, index->settings->is_norm); if (dist <= bsf) { pthread_rwlock_wrlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); @@ -1204,12 +1232,14 @@ void *topk_readworker_inmemory(void *read_pointer) { void *readworker2_inmemory(void *read_pointer) { isax_index *index = ((ParIS_read_worker_data *) read_pointer)->index; - float bsf, dist; + float bsf; + float dist; ts_type *ts_buffer; ts_type *ts = ((ParIS_read_worker_data *) read_pointer)->ts; unsigned long sum_of_lab = ((ParIS_read_worker_data *) read_pointer)->sum_of_lab; - long int t, p; + long int t; + long int p; float *minidisvector = ((ParIS_read_worker_data *) read_pointer)->minidisvector; bsf = *(((ParIS_read_worker_data *) read_pointer)->bsf2); @@ -1217,26 +1247,28 @@ void *readworker2_inmemory(void *read_pointer) { pthread_rwlock_rdlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); bsf = *(((ParIS_read_worker_data *) read_pointer)->bsf2); pthread_rwlock_unlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); - t = __sync_sub_and_fetch(((ParIS_read_worker_data *) read_pointer)->counter, 1); + if (t <= 0) { break; } - p = ((ParIS_read_worker_data *) read_pointer)->load_point[t]; + if (minidisvector[t] < bsf) { ts_buffer = &((ParIS_read_worker_data *) read_pointer)->rawfile[p * index->settings->ts_byte_size / sizeof(ts_type)]; // dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf); dist = ts_ed(ts, ts_buffer, index->settings->timeseries_size, bsf, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->SIMD_flag, index->settings->is_norm); if (dist < bsf) { pthread_rwlock_wrlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); + if (dist < *(((ParIS_read_worker_data *) read_pointer)->bsf2)) { *(((ParIS_read_worker_data *) read_pointer)->bsf2) = dist; } + pthread_rwlock_unlock(((ParIS_read_worker_data *) read_pointer)->lock_bsf); } } @@ -1245,17 +1277,14 @@ void *readworker2_inmemory(void *read_pointer) { query_result -exact_search_serial_ParIS_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves) { - +exact_search_serial_ParIS_openmp_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED - //LBDcalculationnumber=0; - //RDcalculationnumber=0; pthread_t threadid[maxquerythread]; COUNT_INPUT_TIME_START query_result approximate_result = approximate_search_inmemory_messi(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; int sum_of_lab = 0; @@ -1264,71 +1293,67 @@ exact_search_serial_ParIS_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index float bsf_distance; unsigned long j; omp_lock_t bsflock; - //omp_init_lock(&bsflock); + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); + approximate_result = refine_answer_inmemory(ts, paa, index, + approximate_result, minimum_distance, min_checked_leaves); } COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); - #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); #endif SET_APPROXIMATE(approximate_result.distance); bsf_distance = approximate_result.distance; COUNT_CAL_TIME_START - //LBDcalculationnumber=index->sax_cache_size; + #pragma omp parallel for num_threads(maxquerythread) reduction(min : bsf_distance) for (unsigned long j = 0; j < index->sax_cache_size; j++) { sax_type *sax = &index->sax_cache[j * index->settings->paa_segments]; + +#if defined(__x86_64__) if (minidist_paa_to_isax_rawa_SIMD(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt) <= bsf_distance) { + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= bsf_distance) { +#else + if (minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= bsf_distance) { +#endif ts_buffer = &rawfile[j * index->settings->timeseries_size]; - // float dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf_distance); + float dist = ts_ed(ts, ts_buffer, index->settings->timeseries_size, bsf_distance, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->SIMD_flag, index->settings->is_norm); - //__sync_fetch_and_add(&RDcalculationnumber,1); if (dist < bsf_distance) { - //omp_set_lock(&bsflock); bsf_distance = dist; - //omp_unset_lock(&bsflock); } } } + approximate_result.distance = bsf_distance; COUNT_CAL_TIME_END - // printf("the number of LB distance calculation is %ld\t\t and the Real distance calculation is %ld\n ",LBDcalculationnumber,RDcalculationnumber); - return approximate_result; } -query_result -exact_search_serial_ParGISG_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves) { - +query_result exact_search_serial_ParGISG_openmp_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED - //LBDcalculationnumber=0; - //RDcalculationnumber=0; - pthread_t threadid[maxquerythread]; COUNT_INPUT_TIME_START query_result approximate_result = approximate_search_inmemory_messi(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; int sum_of_lab = 0; @@ -1338,22 +1363,18 @@ exact_search_serial_ParGISG_openmp_inmemory(ts_type *ts, ts_type *paa, isax_inde unsigned long j; omp_lock_t bsflock; omp_init_lock(&bsflock); + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); + approximate_result = refine_answer_inmemory(ts, paa, index, + approximate_result, minimum_distance, min_checked_leaves); } COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); - - - SET_APPROXIMATE(approximate_result.distance); bsf_distance = approximate_result.distance; int numberofbuffer = pow(2, index->settings->paa_segments); @@ -1364,21 +1385,18 @@ exact_search_serial_ParGISG_openmp_inmemory(ts_type *ts, ts_type *paa, isax_inde #pragma omp parallel for num_threads(maxquerythread) for (int i = 0; i < numberofbuffer; i++) { fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 *) (index->fbl))->soft_buffers[i]; + if (current_buffer->initialized == 1) { isax_node *node = (((first_buffer_layer2 *) (index->fbl))->soft_buffers[i]).node; float distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - //COUNT_CAL_TIME_END - if (distance <= bsf_distance) { - //query_result * mindist_result = malloc(sizeof(query_result)); - ///mindist_result->node = node; - //mindist_result->distance=distance; + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + if (distance <= bsf_distance) { kkkk++; omp_set_lock(&bsflock); pqueue_bsfre_insert(pq, distance, (long int) i, NULL); @@ -1386,23 +1404,34 @@ exact_search_serial_ParGISG_openmp_inmemory(ts_type *ts, ts_type *paa, isax_inde } } } + COUNT_CAL_TIME_START + for (int i = 0; i < pq->nowk; i++) { if (pq->knn[i] < bsf_distance) { fbl_soft_buffer2 *current_buffer = &((first_buffer_layer2 *) (index->fbl))->soft_buffers[pq->position[i]]; + #pragma omp parallel for num_threads(maxquerythread) reduction(min : bsf_distance) for (unsigned long j = 0; j < current_buffer->max_buffer_size; j++) { sax_type *sax = ¤t_buffer->sax_records[j * index->settings->paa_segments]; + +#if defined(__x86_64__) if (minidist_paa_to_isax_rawa_SIMD(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt) <= bsf_distance) { + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= bsf_distance) { +#else + if (minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= bsf_distance) { +#endif ts_buffer = &rawfile[current_buffer->pos_records[j]]; - //float dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, - // bsf_distance); float dist = ts_ed(ts, ts_buffer, index->settings->timeseries_size, bsf_distance, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->SIMD_flag, index->settings->is_norm); + if (dist < bsf_distance) { bsf_distance = dist; } @@ -1413,25 +1442,18 @@ exact_search_serial_ParGISG_openmp_inmemory(ts_type *ts, ts_type *paa, isax_inde approximate_result.distance = bsf_distance; COUNT_CAL_TIME_END + return approximate_result; } -query_result -exact_search_serial_ParGIS_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, - int min_checked_leaves) { - +query_result exact_search_serial_ParGIS_openmp_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED - //LBDcalculationnumber=0; - //RDcalculationnumber=0; - - - - pthread_t threadid[maxquerythread]; COUNT_INPUT_TIME_START - bool *rdcbitmap = malloc(sizeof(bool) * index->sax_cache_size); + bool *rdcbitmap = (bool*)malloc(sizeof(bool) * index->sax_cache_size); query_result approximate_result = approximate_search_inmemory_pRecBuf(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; @@ -1439,73 +1461,73 @@ exact_search_serial_ParGIS_openmp_inmemory(ts_type *ts, ts_type *paa, isax_index float bsf_distance; unsigned long j; omp_lock_t bsflock; - //omp_init_lock(&bsflock); // Early termination... + if (approximate_result.distance == 0) { return approximate_result; } if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); + approximate_result = refine_answer_inmemory(ts, paa, index, + approximate_result, minimum_distance, min_checked_leaves); } COUNT_INPUT_TIME_END - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); - #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); #endif SET_APPROXIMATE(approximate_result.distance); bsf_distance = approximate_result.distance; COUNT_CAL_TIME_START - //LBDcalculationnumber=index->sax_cache_size; #pragma omp parallel for num_threads(maxquerythread) for (j = 0; j < index->sax_cache_size; j++) { rdcbitmap[j] = FALSE; sax_type *sax = &index->sax_cache[j * index->settings->paa_segments]; + +#if defined(__x86_64__) if (minidist_paa_to_isax_rawa_SIMD(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt) <= bsf_distance) { + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= bsf_distance) { +#else + if (minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt) <= bsf_distance) { +#endif rdcbitmap[j] = TRUE; - } } - COUNT_CAL_TIME_END + COUNT_CAL_TIME_END COUNT_QUEUE_TIME_START + #pragma omp parallel for num_threads(maxquerythread) reduction(min : bsf_distance) for (j = 0; j < index->sax_cache_size; j++) { if (rdcbitmap[j]) { ts_buffer = &rawfile[j * index->settings->timeseries_size]; - // float dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf_distance); float dist = ts_ed(ts, ts_buffer, index->settings->timeseries_size, bsf_distance, - index->settings->SIMD_flag, index->settings->is_norm); + index->settings->SIMD_flag, index->settings->is_norm); + if (dist < bsf_distance) { - //omp_set_lock(&bsflock); bsf_distance = dist; - //omp_unset_lock(&bsflock); } } } + free(rdcbitmap); approximate_result.distance = bsf_distance; COUNT_QUEUE_TIME_END - // printf("the number of LB distance calculation is %ld\t\t and the Real distance calculation is %ld\n ",LBDcalculationnumber,RDcalculationnumber); - return approximate_result; } - query_result exact_search_inmemory_openmp(ts_type *ts, ts_type *paa, isax_index *index, - float minimum_distance, int min_checked_leaves) { + float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_inmemory_m(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; @@ -1516,16 +1538,17 @@ query_result exact_search_inmemory_openmp(ts_type *ts, ts_type *paa, isax_index if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer_inmemory_m(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + min_checked_leaves); } + COUNT_QUEUE_TIME_START pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); COUNT_QUEUE_TIME_END - query_result *do_not_remove = &approximate_result; SET_APPROXIMATE(approximate_result.distance); @@ -1537,126 +1560,138 @@ query_result exact_search_inmemory_openmp(ts_type *ts, ts_type *paa, isax_index COUNT_QUEUE_TIME_START pqueue_insert(pq, &approximate_result); COUNT_QUEUE_TIME_END - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; + while (current_root_node != NULL) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = current_root_node; COUNT_QUEUE_TIME_START + if (mindist_result->distance < approximate_result.distance) { pqueue_insert(pq, mindist_result); } - COUNT_QUEUE_TIME_END current_root_node = current_root_node->next; } + query_result *n; int checks = 0; - while ((n = pqueue_pop(pq))) { + + while ((n = (query_result*)pqueue_pop(pq))) { // The best node has a worse mindist, so search is finished! - //printf("this is the check point of e s !!!\n"); if (n->distance >= bsf_result.distance || n->distance > minimum_distance) { COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) { + (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue - split_node(index, n->node); COUNT_QUEUE_TIME_START pqueue_insert(pq, n); COUNT_QUEUE_TIME_END + continue; } + // *** EXTRA BOUNDING *** if (tight_bound) { COUNT_OUTPUT_TIME_START float mindistance = calculate_minimum_distance_inmemory(index, n->node, ts, paa); COUNT_OUTPUT_TIME_END + if (mindistance >= bsf_result.distance) { - if (n != do_not_remove)//add + if (n != do_not_remove) { // add free(n); + } + continue; } } + // *** REAL DISTANCE *** checks++; COUNT_CAL_TIME_START float distance = calculate_node_distance_inmemory_m(index, n->node, ts, bsf_result.distance); COUNT_CAL_TIME_END + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node; } - //no check limit juge + // no check limit juge } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { - if (n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + if (n->node->left_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { COUNT_CAL_TIME_START float distance = calculate_node_distance_inmemory_m(index, n->node->left_child, ts, - bsf_result.distance); + bsf_result.distance); COUNT_CAL_TIME_END + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->left_child; } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = n->node->left_child; COUNT_QUEUE_TIME_START pqueue_insert(pq, mindist_result); COUNT_QUEUE_TIME_END } } + if (n->node->right_child->isax_cardinalities != NULL) { - if (n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && - aggressive_check) { + if (n->node->right_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { COUNT_CAL_TIME_START float distance = calculate_node_distance_inmemory_m(index, n->node->right_child, ts, - bsf_result.distance); + bsf_result.distance); COUNT_CAL_TIME_END + if (distance < bsf_result.distance) { bsf_result.distance = distance; bsf_result.node = n->node->right_child; } } else { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = n->node->right_child; COUNT_QUEUE_TIME_START pqueue_insert(pq, mindist_result); @@ -1666,45 +1701,47 @@ query_result exact_search_inmemory_openmp(ts_type *ts, ts_type *paa, isax_index } // Free the node currently popped. - if (n != do_not_remove)//add + if (n != do_not_remove) { // add free(n); + } } } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { - if (n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. COUNT_QUEUE_TIME_START pqueue_free(pq); COUNT_QUEUE_TIME_END - //PRINT_BYTES_ACCESSED + return bsf_result; } -query_result exact_search_ParISnew_inmemory(ts_type *ts, ts_type *paa, isax_index *index, node_list *nodelist, - float minimum_distance, int min_checked_leaves) { - //RDcalculationnumber=0; - //LBDcalculationnumber=0; +query_result exact_search_ParISnew_inmemory(ts_type *ts, ts_type *paa, + isax_index *index, node_list *nodelist, float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_inmemory_pRecBuf(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; int i; + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory_m(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + approximate_result = refine_answer_inmemory_m(ts, paa, index, + approximate_result, minimum_distance, min_checked_leaves); } pqueue_t *pq = pqueue_init(index->settings->root_nodes_size / 1000, - cmp_pri, get_pri, set_pri, get_pos, set_pos); - + cmp_pri, get_pri, set_pri, get_pos, set_pos); query_result *do_not_remove = &approximate_result; @@ -1714,10 +1751,11 @@ query_result exact_search_ParISnew_inmemory(ts_type *ts, ts_type *paa, isax_inde if (approximate_result.node != NULL) { // Insert approximate result in heap. - //pqueue_insert(pq, &approximate_result); - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // pqueue_insert(pq, &approximate_result); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } + // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; time_t t; @@ -1725,7 +1763,8 @@ query_result exact_search_ParISnew_inmemory(ts_type *ts, ts_type *paa, isax_inde pthread_t threadid[maxquerythread]; refind_answer_fonction_data rfdata; - pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER, lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, maxquerythread); @@ -1739,7 +1778,6 @@ query_result exact_search_ParISnew_inmemory(ts_type *ts, ts_type *paa, isax_inde rfdata.amountnode = nodelist->node_amount; rfdata.index = index; rfdata.minimum_distance = minimum_distance; - //rfdata.limit=limit/4; rfdata.node_counter = 0; rfdata.pq = pq; // Insert all root nodes in heap. @@ -1749,53 +1787,52 @@ query_result exact_search_ParISnew_inmemory(ts_type *ts, ts_type *paa, isax_inde query_result *n; rfdata.lock_barrier = &lock_barrier; + for (i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, exact_search_worker_inmemory, (void *) &(rfdata)); } + for (i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } - // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { - if (n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. pthread_barrier_destroy(&lock_barrier); pqueue_free(pq); bsf_result = *(rfdata.bsf_result); - //free(rfdata); - // printf("the number of LB distance calculation is %ld\t\t and the Real distance calculation is %ld\n ",LBDcalculationnumber,RDcalculationnumber); return *(rfdata.bsf_result); - // Free the nodes that where not popped. - } -query_result -exact_search_ParISnew_inmemory_workstealing(ts_type *ts, ts_type *paa, isax_index *index, node_list *nodelist, - float minimum_distance, int min_checked_leaves) { +query_result exact_search_ParISnew_inmemory_workstealing(ts_type *ts, ts_type *paa, + isax_index *index, node_list *nodelist, float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_inmemory_pRecBuf(ts, paa, index); - //query_result approximate_result = approximate_search_inmemory(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; int node_counter = 0; + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory_m(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + approximate_result = refine_answer_inmemory_m(ts, paa, index, + approximate_result, minimum_distance, min_checked_leaves); } - pqueue_t **allpq = malloc(sizeof(pqueue_t *) * maxquerythread); + pqueue_t **allpq = (pqueue_t**)malloc(sizeof(pqueue_t *) * maxquerythread); pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); pthread_mutex_t ququelock[maxquerythread]; int queuelabel[maxquerythread]; @@ -1806,16 +1843,13 @@ exact_search_ParISnew_inmemory_workstealing(ts_type *ts, ts_type *paa, isax_inde RESET_BYTES_ACCESSED - if (approximate_result.node != NULL) { - - } // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; - pthread_t threadid[maxquerythread]; MESSI_workerdata workerdata[maxquerythread]; - pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER, lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, maxquerythread); @@ -1825,10 +1859,10 @@ exact_search_ParISnew_inmemory_workstealing(ts_type *ts, ts_type *paa, isax_inde workerdata[i].paa = paa; workerdata[i].ts = ts; allpq[i] = pqueue_init(index->settings->root_nodes_size / maxquerythread, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); pthread_mutex_init(&ququelock[i], NULL); queuelabel[i] = 1; - localstk[i].val = malloc(sizeof(isax_node *) * 100); + localstk[i].val = (isax_node**)malloc(sizeof(isax_node *) * 100); localstk[i].top = 0; localstk[i].bottom = 0; workerdata[i].lock_queue = &lock_queue; @@ -1851,55 +1885,55 @@ exact_search_ParISnew_inmemory_workstealing(ts_type *ts, ts_type *paa, isax_inde workerdata[i].allpq = allpq; } - query_result *n; - for (int i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, exact_search_worker_inmemory_workstealing, (void *) &(workerdata[i])); } + for (int i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { - if (n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. pthread_barrier_destroy(&lock_barrier); - while (n = pqueue_pop(pq)) { + + while (n = (query_result*)pqueue_pop(pq)) { free(n); } + pqueue_free(pq); free(allpq); - bsf_result = bsf_result; - //free(rfdata); return bsf_result; - - // Free the nodes that where not popped. - } -query_result exact_search_MESSI(ts_type *ts, ts_type *paa, isax_index *index, node_list *nodelist, - float minimum_distance, int min_checked_leaves) { +query_result exact_search_MESSI(ts_type *ts, ts_type *paa, + isax_index *index, node_list *nodelist, float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_inmemory_pRecBuf(ts, paa, index); - query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; int node_counter = 0; + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer_inmemory_m( - ts, paa, index, approximate_result, minimum_distance,min_checked_leaves); + ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); } - pqueue_t **allpq = malloc(sizeof(pqueue_t *) * N_PQUEUE); + + pqueue_t **allpq = (pqueue_t**)malloc(sizeof(pqueue_t *) * N_PQUEUE); pthread_mutex_t ququelock[N_PQUEUE]; int queuelabel[N_PQUEUE]; @@ -1912,14 +1946,15 @@ query_result exact_search_MESSI(ts_type *ts, ts_type *paa, isax_index *index, no pthread_t threadid[maxquerythread]; MESSI_workerdata workerdata[maxquerythread]; - pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER, lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, maxquerythread); for (int i = 0; i < N_PQUEUE; i++) { allpq[i] = pqueue_init(index->settings->root_nodes_size / N_PQUEUE, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); pthread_mutex_init(&ququelock[i], NULL); queuelabel[i] = 1; } @@ -1947,6 +1982,7 @@ query_result exact_search_MESSI(ts_type *ts, ts_type *paa, isax_index *index, no for (int i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, exact_search_worker_inmemory_hybridpqueue, (void *) &(workerdata[i])); } + for (int i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } @@ -1958,35 +1994,34 @@ query_result exact_search_MESSI(ts_type *ts, ts_type *paa, isax_index *index, no for (int i = 0; i < N_PQUEUE; i++) { pqueue_free(allpq[i]); } + free(allpq); - bsf_result = bsf_result; return bsf_result; - } - -query_result -exact_search_ParISnew_inmemory_hybrid_workstealing(ts_type *ts, ts_type *paa, isax_index *index, node_list *nodelist, - float minimum_distance, int min_checked_leaves) { +query_result exact_search_ParISnew_inmemory_hybrid_workstealing(ts_type *ts, ts_type *paa, + isax_index *index, node_list *nodelist, float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_inmemory_pRecBuf(ts, paa, index); - //query_result approximate_result = approximate_search_inmemory(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; int node_counter = 0; + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { - approximate_result = refine_answer_inmemory_m(ts, paa, index, approximate_result, minimum_distance, - min_checked_leaves); + approximate_result = refine_answer_inmemory_m(ts, paa, index, + approximate_result, minimum_distance, min_checked_leaves); } - pqueue_t **allpq = malloc(sizeof(pqueue_t *) * N_PQUEUE); + + pqueue_t **allpq = (pqueue_t**)malloc(sizeof(pqueue_t *) * N_PQUEUE); pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); pthread_mutex_t ququelock[N_PQUEUE]; int queuelabel[N_PQUEUE]; @@ -1999,16 +2034,18 @@ exact_search_ParISnew_inmemory_hybrid_workstealing(ts_type *ts, ts_type *paa, is if (approximate_result.node != NULL) { // Insert approximate result in heap. - //pqueue_insert(pq, &approximate_result); - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // pqueue_insert(pq, &approximate_result); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } + // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; pthread_t threadid[maxquerythread]; MESSI_workerdata workerdata[maxquerythread]; - pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER, lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, maxquerythread); @@ -2016,7 +2053,7 @@ exact_search_ParISnew_inmemory_hybrid_workstealing(ts_type *ts, ts_type *paa, is for (int i = 0; i < N_PQUEUE; i++) { allpq[i] = pqueue_init(index->settings->root_nodes_size / N_PQUEUE, - cmp_pri, get_pri, set_pri, get_pos, set_pos); + cmp_pri, get_pri, set_pri, get_pos, set_pos); pthread_mutex_init(&ququelock[i], NULL); queuelabel[i] = 1; } @@ -2024,7 +2061,7 @@ exact_search_ParISnew_inmemory_hybrid_workstealing(ts_type *ts, ts_type *paa, is for (int i = 0; i < maxquerythread; i++) { workerdata[i].paa = paa; workerdata[i].ts = ts; - localstk[i].val = malloc(sizeof(isax_node *) * 100); + localstk[i].val = (isax_node**)malloc(sizeof(isax_node *) * 100); localstk[i].top = 0; localstk[i].bottom = 0; workerdata[i].lock_queue = &lock_queue; @@ -2044,40 +2081,37 @@ exact_search_ParISnew_inmemory_hybrid_workstealing(ts_type *ts, ts_type *paa, is workerdata[i].allqueuelabel = queuelabel; workerdata[i].allpq = allpq; workerdata[i].startqueuenumber = i % N_PQUEUE; - //printf("the workerdata[i].startqueuenumber is %d\n",workerdata[i].startqueuenumber ); } - query_result *n; - for (int i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, exact_search_worker_inmemory_hybridpqueue_workstealing, - (void *) &(workerdata[i])); + (void *) &(workerdata[i])); } + for (int i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) { - if (n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. pthread_barrier_destroy(&lock_barrier); - while (n = pqueue_pop(pq)) { + + while (n = (query_result*)pqueue_pop(pq)) { free(n); } + pqueue_free(pq); free(allpq); - bsf_result = bsf_result; - //free(rfdata); return bsf_result; - - // Free the nodes that where not popped. - } void *exact_search_worker_inmemory(void *rfdata) { @@ -2096,74 +2130,60 @@ void *exact_search_worker_inmemory(void *rfdata) { int aggressive_check = index->settings->aggressive_check; query_result *bsf_result = (((refind_answer_fonction_data *) rfdata)->bsf_result); float bsfdisntance = bsf_result->distance; - int calculate_node = 0, calculate_node_quque = 0; - //COUNT_QUEUE_TIME_START - - //gettimeofday(&workertimestart, NULL); + int calculate_node = 0; + int calculate_node_quque = 0; while (1) { current_root_node_number = __sync_fetch_and_add(&((refind_answer_fonction_data *) rfdata)->node_counter, 1); - //printf("the number is %d\n",current_root_node_number ); - if (current_root_node_number >= ((refind_answer_fonction_data *) rfdata)->amountnode) + + if (current_root_node_number >= ((refind_answer_fonction_data *) rfdata)->amountnode) { break; + } current_root_node = ((refind_answer_fonction_data *) rfdata)->nodelist[current_root_node_number]; insert_tree_node_m(paa, current_root_node, index, bsfdisntance, pq, - ((refind_answer_fonction_data *) rfdata)->lock_queue); - + ((refind_answer_fonction_data *) rfdata)->lock_queue); } - //COUNT_QUEUE_TIME_END - //gettimeofday(&workercurenttime, NULL); + pthread_barrier_wait(((refind_answer_fonction_data *) rfdata)->lock_barrier); - //printf("the size of quque is %d \n",pq->size); + while (1) { while (!__sync_bool_compare_and_swap(&(((refind_answer_fonction_data *) rfdata)->lockvalueq), false, true)) { } - //pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lockvalue); - n = pqueue_pop(pq); - //pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + + n = (query_result*)pqueue_pop(pq); __sync_lock_release(&(((refind_answer_fonction_data *) rfdata)->lockvalueq)); - if (n == NULL) + + if (n == NULL) { break; - //pthread_rwlock_rdlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); + } + bsfdisntance = bsf_result->distance; - //pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - // The best node has a worse mindist, so search is finished! if (n->distance > bsfdisntance || n->distance > minimum_distance) { break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { - checks++; float distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdisntance); + if (distance < bsfdisntance) { - //while( !__sync_bool_compare_and_swap((bsf_result->distance), bsfdisntance, distance)) - //{ - //bsfdisntance=bsf_result->distance; - // if(distance>=bsfdisntance) - // break; - // } pthread_rwlock_wrlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((refind_answer_fonction_data *) rfdata)->lock_bsf); } - } - } - //if(n != do_not_remove)//add + free(n); } - - //worker_total_time += workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec)-workertimestart.tv_sec*1000000 - (workertimestart.tv_usec); - //printf("create pq time is %f \n",worker_total_time ); - //printf("the check's node is \t%d\n",checks); } void *exact_search_worker_inmemory_workstealing(void *rfdata) { @@ -2184,98 +2204,98 @@ void *exact_search_worker_inmemory_workstealing(void *rfdata) { int aggressive_check = index->settings->aggressive_check; query_result *bsf_result = (((MESSI_workerdata *) rfdata)->bsf_result); float bsfdisntance = bsf_result->distance; - int calculate_node = 0, calculate_node_quque = 0; - - //COUNT_QUEUE_TIME_START - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,write_total_time; - //gettimeofday(&workertimestart, NULL); + int calculate_node = 0; + int calculate_node_quque = 0; while (1) { current_root_node_number = __sync_fetch_and_add(((MESSI_workerdata *) rfdata)->node_counter, 1); - //printf("the number is %d\n",current_root_node_number ); - if (current_root_node_number >= ((MESSI_workerdata *) rfdata)->amountnode) + + if (current_root_node_number >= ((MESSI_workerdata *) rfdata)->amountnode) { break; + } current_root_node = ((MESSI_workerdata *) rfdata)->nodelist[current_root_node_number]; insert_tree_node_m_workstealing(paa, current_root_node, index, bsfdisntance, pq, - ((MESSI_workerdata *) rfdata)->lock_queue, localstk); - //insert_tree_node_mW(paa,current_root_node,index,bsfdisntance,pq,((MESSI_workerdata*)rfdata)->lock_queue); - - + ((MESSI_workerdata *) rfdata)->lock_queue, localstk); } + while (1) { int offset = rand() % maxquerythread; finished = true; + for (int i = 0; i < maxquerythread; i++) { if (((MESSI_workerdata *) rfdata)->allstk[(i + offset) % maxquerythread].bottom != 0) { finished = false; isax_node *newnode = poptop2(&(((MESSI_workerdata *) rfdata)->allstk[(i + offset) % maxquerythread])); - if (newnode != NULL) + if (newnode != NULL) { insert_tree_node_m_workstealing(paa, newnode, index, bsfdisntance, pq, - ((MESSI_workerdata *) rfdata)->lock_queue, localstk); + ((MESSI_workerdata *) rfdata)->lock_queue, localstk); + } } } + if (finished) { break; } } - //COUNT_QUEUE_TIME_END calculate_node_quque = pq->size; - //gettimeofday(&workercurenttime, NULL); pthread_barrier_wait(((MESSI_workerdata *) rfdata)->lock_barrier); - //printf("the size of quque is %d \n",pq->size); + while (1) { pthread_mutex_lock(((MESSI_workerdata *) rfdata)->locallock); - n = pqueue_pop(pq); + n = (query_result*)pqueue_pop(pq); pthread_mutex_unlock(((MESSI_workerdata *) rfdata)->locallock); - if (n == NULL) + + if (n == NULL) { break; - //pthread_rwlock_rdlock(((MESSI_workerdata*)rfdata)->lock_bsf); + } + bsfdisntance = bsf_result->distance; - //pthread_rwlock_unlock(((MESSI_workerdata*)rfdata)->lock_bsf); - // The best node has a worse mindist, so search is finished! if (n->distance > bsfdisntance || n->distance > minimum_distance) { break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { - checks++; float distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdisntance); + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((MESSI_workerdata *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((MESSI_workerdata *) rfdata)->lock_bsf); } - } - } + free(n); } *(((MESSI_workerdata *) rfdata)->queuelabel) = 0; + while (1) { int offset = rand() % maxquerythread; finished = true; + for (int i = 0; i < maxquerythread; i++) { if ((((MESSI_workerdata *) rfdata)->allqueuelabel[i]) == 1) { finished = false; + while (1) { pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[i])); - n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[i]); + n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[i]); pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[i])); - if (n == NULL) + + if (n == NULL) { break; + } + if (n->distance > bsfdisntance || n->distance > minimum_distance) { break; } else { @@ -2283,38 +2303,39 @@ void *exact_search_worker_inmemory_workstealing(void *rfdata) { if (n->node->is_leaf) { checks++; float distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdisntance); + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((MESSI_workerdata *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((MESSI_workerdata *) rfdata)->lock_bsf); } - } - } - //add + + // add free(n); } } } + if (finished) { break; } } - free(localstk->val); + free(localstk->val); pthread_barrier_wait(((MESSI_workerdata *) rfdata)->lock_barrier); - while (n = pqueue_pop(pq)) { + + while (n = (query_result*)pqueue_pop(pq)) { free(n); } + pqueue_free(pq); - //worker_total_time += workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec)-workertimestart.tv_sec*1000000 - (workertimestart.tv_usec); - //printf("create pq time is %f \n",worker_total_time ); - //printf("the worker's write time is %f \n",write_total_time ); - //printf("the check's node is\t %d\tthe local queue's node is\t%d\n",checks,calculate_node_quque); } void *exact_search_worker_inmemory_hybridpqueue(void *rfdata) { @@ -2333,131 +2354,106 @@ void *exact_search_worker_inmemory_hybridpqueue(void *rfdata) { int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; query_result *bsf_result = (((MESSI_workerdata *) rfdata)->bsf_result); - float bsfdisntance = bsf_result->distance; - int calculate_node = 0, calculate_node_quque = 0; + float bsfdistance = bsf_result->distance; + int calculate_node = 0; + int calculate_node_quque = 0; int tnumber = rand() % N_PQUEUE; int startqueuenumber = ((MESSI_workerdata *) rfdata)->startqueuenumber; - /* - struct timeval current_time; - struct timeval pq_insert_time_start; - struct timeval pq_remove_time_start; - struct timeval lb_dist_calc_time_start; - struct timeval real_dist_calc_time_start; - - unsigned long int total_pq_insert_time=0; - unsigned long int total_pq_remove_time=0; - unsigned long int total_lb_dist_calc_time=0; - unsigned long int total_real_dist_calc_time=0; - - - gettimeofday(&pq_insert_time_start, NULL); - */ - while (1) { current_root_node_number = __sync_fetch_and_add(((MESSI_workerdata *) rfdata)->node_counter, 1); - if (current_root_node_number >= ((MESSI_workerdata *) rfdata)->amountnode) + + if (current_root_node_number >= ((MESSI_workerdata *) rfdata)->amountnode) { break; - current_root_node = ((MESSI_workerdata *) rfdata)->nodelist[current_root_node_number]; + } - insert_tree_node_m_hybridpqueue(paa, current_root_node, index, bsfdisntance, - ((MESSI_workerdata *) rfdata)->allpq, ((MESSI_workerdata *) rfdata)->alllock, - &tnumber); - //insert_tree_node_m_hybridpqueue_time(paa,current_root_node,index,bsfdisntance,((MESSI_workerdata*)rfdata)->allpq,((MESSI_workerdata*)rfdata)->alllock,&tnumber, &total_lb_dist_calc_time); + current_root_node = ((MESSI_workerdata *) rfdata)->nodelist[current_root_node_number]; + insert_tree_node_m_hybridpqueue(paa, current_root_node, index, bsfdistance, + ((MESSI_workerdata *) rfdata)->allpq, ((MESSI_workerdata *) rfdata)->alllock, + &tnumber); } pthread_barrier_wait(((MESSI_workerdata *) rfdata)->lock_barrier); - //calculate time for pq-insertion - /* - gettimeofday(¤t_time, NULL); - total_pq_insert_time += ((current_time.tv_sec*1000000 + (current_time.tv_usec)) - (pq_insert_time_start.tv_sec*1000000 + (pq_insert_time_start.tv_usec))); - */ - while (1) { - //gettimeofday(&pq_remove_time_start, NULL); pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber]); + n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber]); pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - //calculate time for pq remove - /* - gettimeofday(¤t_time, NULL); - total_pq_remove_time += ((current_time.tv_sec*1000000 + (current_time.tv_usec)) - (pq_remove_time_start.tv_sec*1000000 + (pq_remove_time_start.tv_usec))); - */ - - if (n == NULL) + if (n == NULL) { break; - bsfdisntance = bsf_result->distance; + } - if (n->distance > bsfdisntance || n->distance > minimum_distance) { + bsfdistance = bsf_result->distance; + + if (n->distance > bsfdistance || n->distance > minimum_distance) { break; } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { - checks++; float distance; - //SFA + + // SFA if (index->settings->function_type == 4) { - distance = calculate_node_distance2_inmemory_SFA(index, n->node, ts, paa, bsfdisntance); +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + distance = calculate_node_distance2_inmemory_SFA_SIMD(index, n->node, ts, paa, bsfdistance); + } else { +#endif + distance = calculate_node_distance2_inmemory_SFA(index, n->node, ts, paa, bsfdistance); +#if defined(__x86_64__) + } +#endif } else { - distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdisntance); + distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdistance); } - if (distance < bsfdisntance) { + if (distance < bsfdistance) { pthread_rwlock_wrlock(((MESSI_workerdata *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((MESSI_workerdata *) rfdata)->lock_bsf); } } - } + free(n); } if ((((MESSI_workerdata *) rfdata)->allqueuelabel[startqueuenumber]) == 1) { - //gettimeofday(&pq_remove_time_start, NULL); - (((MESSI_workerdata *) rfdata)->allqueuelabel[startqueuenumber]) = 0; pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - while (n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber])) { + + while (n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber])) { free(n); } - pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - //calculate time for pq remove - /* - gettimeofday(¤t_time, NULL); - total_pq_remove_time += ((current_time.tv_sec*1000000 + (current_time.tv_usec)) - (pq_remove_time_start.tv_sec*1000000 + (pq_remove_time_start.tv_usec))); - */ + pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); } while (1) { int offset = rand() % N_PQUEUE; finished = true; + for (int i = 0; i < N_PQUEUE; i++) { if ((((MESSI_workerdata *) rfdata)->allqueuelabel[i]) == 1) { finished = false; - while (1) { - //gettimeofday(&pq_remove_time_start, NULL); + while (1) { pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[i])); - n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[i]); + n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[i]); pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[i])); - //calculate time for pq remove - /* - gettimeofday(¤t_time, NULL); - total_pq_remove_time += ((current_time.tv_sec*1000000 + (current_time.tv_usec)) - (pq_remove_time_start.tv_sec*1000000 + (pq_remove_time_start.tv_usec))); - */ - - if (n == NULL) + if (n == NULL) { break; - if (n->distance > bsfdisntance || n->distance > minimum_distance) { + } + + if (n->distance > bsfdistance || n->distance > minimum_distance) { break; } else { // If it is a leaf, check its real distance. @@ -2465,38 +2461,45 @@ void *exact_search_worker_inmemory_hybridpqueue(void *rfdata) { checks++; float distance; - //SFA + + // SFA if (index->settings->function_type == 4) { - distance = calculate_node_distance2_inmemory_SFA(index, n->node, ts, paa, bsfdisntance); +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + distance = calculate_node_distance2_inmemory_SFA_SIMD(index, n->node, ts, paa, bsfdistance); + } else { +#endif + distance = calculate_node_distance2_inmemory_SFA(index, n->node, ts, paa, bsfdistance); +#if defined(__x86_64__) + } +#endif } else { - distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdisntance); + distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdistance); } - if (distance < bsfdisntance) { + if (distance < bsfdistance) { pthread_rwlock_wrlock(((MESSI_workerdata *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((MESSI_workerdata *) rfdata)->lock_bsf); } } } - //add + + // add free(n); } - } } + if (finished) { break; } } - /* - __sync_fetch_and_add(&TOTAL_PQ_INSERT_TIME,(int)total_pq_insert_time); - __sync_fetch_and_add(&TOTAL_PQ_REMOVE_TIME,(int)total_pq_remove_time); - __sync_fetch_and_add(&TOTAL_LB_DIST_CALC_TIME,(int)total_lb_dist_calc_time); - __sync_fetch_and_add(&TOTAL_REAL_DIST_CALC_TIME,(int)total_real_dist_calc_time);*/ } void *exact_search_worker_inmemory_hybridpqueue_workstealing(void *rfdata) { @@ -2518,64 +2521,60 @@ void *exact_search_worker_inmemory_hybridpqueue_workstealing(void *rfdata) { int aggressive_check = index->settings->aggressive_check; query_result *bsf_result = (((MESSI_workerdata *) rfdata)->bsf_result); float bsfdisntance = bsf_result->distance; - int calculate_node = 0, calculate_node_quque = 0; + int calculate_node = 0; + int calculate_node_quque = 0; int tnumber = rand() % N_PQUEUE; int startqueuenumber = ((MESSI_workerdata *) rfdata)->startqueuenumber; - //COUNT_QUEUE_TIME_START - //struct timeval workertimestart; - //struct timeval writetiemstart; - //struct timeval workercurenttime; - //struct timeval writecurenttime; - //double worker_total_time,write_total_time; - //gettimeofday(&workertimestart, NULL); while (1) { current_root_node_number = __sync_fetch_and_add(((MESSI_workerdata *) rfdata)->node_counter, 1); - //printf("the number is %d\n",current_root_node_number ); - if (current_root_node_number >= ((MESSI_workerdata *) rfdata)->amountnode) + + if (current_root_node_number >= ((MESSI_workerdata *) rfdata)->amountnode) { break; + } current_root_node = ((MESSI_workerdata *) rfdata)->nodelist[current_root_node_number]; insert_tree_node_m_hybridpqueue_workstealing(paa, current_root_node, index, bsfdisntance, - ((MESSI_workerdata *) rfdata)->allpq, - ((MESSI_workerdata *) rfdata)->alllock, localstk, &tnumber); - - //insert_tree_node_mW(paa,current_root_node,index,bsfdisntance,pq,((MESSI_workerdata*)rfdata)->lock_queue); - + ((MESSI_workerdata *) rfdata)->allpq, + ((MESSI_workerdata *) rfdata)->alllock, localstk, &tnumber); } + while (1) { int offset = rand() % maxquerythread; finished = true; + for (int i = 0; i < maxquerythread; i++) { if (((MESSI_workerdata *) rfdata)->allstk[(i + offset) % maxquerythread].bottom != 0) { finished = false; isax_node *newnode = poptop2(&(((MESSI_workerdata *) rfdata)->allstk[(i + offset) % maxquerythread])); - if (newnode != NULL) + + if (newnode != NULL) { insert_tree_node_m_hybridpqueue_workstealing(paa, newnode, index, bsfdisntance, - ((MESSI_workerdata *) rfdata)->allpq, - ((MESSI_workerdata *) rfdata)->alllock, localstk, - &tnumber); + ((MESSI_workerdata *) rfdata)->allpq, + ((MESSI_workerdata *) rfdata)->alllock, localstk, + &tnumber); + } } } + if (finished) { break; } } - //COUNT_QUEUE_TIME_END calculate_node_quque = pq->size; - //gettimeofday(&workercurenttime, NULL); pthread_barrier_wait(((MESSI_workerdata *) rfdata)->lock_barrier); - //printf("the size of quque is %d \n",pq->size); + while (1) { pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber]); + n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[startqueuenumber]); pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[startqueuenumber])); - if (n == NULL) + + if (n == NULL) { break; - //pthread_rwlock_rdlock(((MESSI_workerdata*)rfdata)->lock_bsf); + } + bsfdisntance = bsf_result->distance; - //pthread_rwlock_unlock(((MESSI_workerdata*)rfdata)->lock_bsf); // The best node has a worse mindist, so search is finished! if (n->distance > bsfdisntance || n->distance > minimum_distance) { @@ -2583,37 +2582,44 @@ void *exact_search_worker_inmemory_hybridpqueue_workstealing(void *rfdata) { } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { - checks++; float distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdisntance); + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((MESSI_workerdata *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((MESSI_workerdata *) rfdata)->lock_bsf); } - } - } + free(n); } (((MESSI_workerdata *) rfdata)->allqueuelabel[startqueuenumber]) = 0; + while (1) { int offset = rand() % N_PQUEUE; finished = true; + for (int i = 0; i < N_PQUEUE; i++) { if ((((MESSI_workerdata *) rfdata)->allqueuelabel[i]) == 1) { finished = false; + while (1) { pthread_mutex_lock(&(((MESSI_workerdata *) rfdata)->alllock[i])); - n = pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[i]); + n = (query_result*)pqueue_pop(((MESSI_workerdata *) rfdata)->allpq[i]); pthread_mutex_unlock(&(((MESSI_workerdata *) rfdata)->alllock[i])); - if (n == NULL) + + if (n == NULL) { break; + } + if (n->distance > bsfdisntance || n->distance > minimum_distance) { break; } else { @@ -2621,56 +2627,47 @@ void *exact_search_worker_inmemory_hybridpqueue_workstealing(void *rfdata) { if (n->node->is_leaf) { checks++; float distance = calculate_node_distance2_inmemory(index, n->node, ts, paa, bsfdisntance); + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((MESSI_workerdata *) rfdata)->lock_bsf); + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } + pthread_rwlock_unlock(((MESSI_workerdata *) rfdata)->lock_bsf); } - } - } - //add + + // add free(n); } } } + if (finished) { break; } } - free(localstk->val); - //pthread_barrier_wait(((MESSI_workerdata*)rfdata)->lock_barrier); - //while(n=pqueue_pop(pq)) - //{ - //free(n); - //} - //pqueue_free(pq); - //worker_total_time += workercurenttime.tv_sec*1000000 + (workercurenttime.tv_usec)-workertimestart.tv_sec*1000000 - (workertimestart.tv_usec); - //printf("create pq time is %f \n",worker_total_time ); - //printf("the worker's write time is %f \n",worker_total_time ); - //printf("the check's node is\t %d\tthe local queue's node is\t%d\n",checks,calculate_node_quque); + free(localstk->val); } -void insert_tree_node_m(float *paa, isax_node *node, isax_index *index, float bsf, pqueue_t *pq, - pthread_mutex_t *lock_queue) { - //COUNT_CAL_TIME_START +void insert_tree_node_m(float *paa, isax_node *node, + isax_index *index, float bsf, pqueue_t *pq, pthread_mutex_t *lock_queue) { float distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - //COUNT_CAL_TIME_END + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); if (distance < bsf) { if (node->is_leaf) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->node = node; mindist_result->distance = distance; pthread_mutex_lock(lock_queue); @@ -2681,6 +2678,7 @@ void insert_tree_node_m(float *paa, isax_node *node, isax_index *index, float bs if (node->left_child->isax_cardinalities != NULL) { insert_tree_node_m(paa, node->left_child, index, bsf, pq, lock_queue); } + if (node->right_child->isax_cardinalities != NULL) { insert_tree_node_m(paa, node->right_child, index, bsf, pq, lock_queue); } @@ -2688,18 +2686,15 @@ void insert_tree_node_m(float *paa, isax_node *node, isax_index *index, float bs } } - -void insert_tree_node_mgpu(float *paa, isax_node *node, isax_index *index, float bsf, pqueue_bsf *pq, - pthread_mutex_t *lock_queue) { - //COUNT_CAL_TIME_START +void insert_tree_node_mgpu(float *paa, isax_node *node, + isax_index *index, float bsf, pqueue_bsf *pq, pthread_mutex_t *lock_queue) { float distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - //COUNT_CAL_TIME_END + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); if (distance < bsf) { if (node->is_leaf) { @@ -2711,6 +2706,7 @@ void insert_tree_node_mgpu(float *paa, isax_node *node, isax_index *index, float if (node->left_child->isax_cardinalities != NULL) { insert_tree_node_mgpu(paa, node->left_child, index, bsf, pq, lock_queue); } + if (node->right_child->isax_cardinalities != NULL) { insert_tree_node_mgpu(paa, node->right_child, index, bsf, pq, lock_queue); } @@ -2718,98 +2714,54 @@ void insert_tree_node_mgpu(float *paa, isax_node *node, isax_index *index, float } } -/*void insert_tree_node_m_parallelqueue(float *paa,isax_node *node,isax_index *index,float bsf,FGHPQueue *pq,FGHPQueueThreadState *th_state) -{ - //COUNT_CAL_TIME_START - float distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - //COUNT_CAL_TIME_END - - if(distance < bsf) - { - if (node->is_leaf) - { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->node = node; - mindist_result->distance=distance; - //pthread_mutex_lock(lock_queue); - //pqueue_insert(pq, mindist_result); - //pthread_mutex_unlock(lock_queue); - FGHPQueueAdd(pq, th_state, node, distance); - added_tree_node++; - } - else - { - if (node->left_child->isax_cardinalities != NULL) - { - insert_tree_node_m_parallelqueue(paa,node->left_child,index, bsf,pq,th_state); - } - if (node->right_child->isax_cardinalities != NULL) - { - insert_tree_node_m_parallelqueue(paa,node->right_child,index,bsf,pq,th_state); - } - } - } -}*/ - - -void insert_tree_node_m_workstealing(float *paa, isax_node *node, isax_index *index, float bsf, pqueue_t *pq, - pthread_mutex_t *lock_queue, localStack *workstack) { - //COUNT_CAL_TIME_START +void insert_tree_node_m_workstealing(float *paa, isax_node *node, + isax_index *index, float bsf, pqueue_t *pq, pthread_mutex_t *lock_queue, localStack *workstack) { float distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - //COUNT_CAL_TIME_END + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); if (distance < bsf) { if (node->is_leaf) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->node = node; mindist_result->distance = distance; - //pthread_mutex_lock(lock_queue); pqueue_insert(pq, mindist_result); - //pthread_mutex_unlock(lock_queue); added_tree_node++; } else { if (node->right_child->isax_cardinalities != NULL) { pushbottom(workstack, node->right_child); } + if (node->left_child->isax_cardinalities != NULL) { insert_tree_node_m_workstealing(paa, node->left_child, index, bsf, pq, lock_queue, workstack); } } } + isax_node *newnode = popbottom2(workstack); + if (newnode != NULL) { insert_tree_node_m_workstealing(paa, newnode, index, bsf, pq, lock_queue, workstack); } } -void -insert_tree_node_m_hybridpqueue_workstealing(float *paa, isax_node *node, isax_index *index, float bsf, pqueue_t **pq, - pthread_mutex_t *lock_queue, localStack *workstack, int *tnumber) { - //COUNT_CAL_TIME_START +void insert_tree_node_m_hybridpqueue_workstealing(float *paa, isax_node *node, + isax_index *index, float bsf, pqueue_t **pq, pthread_mutex_t *lock_queue, localStack *workstack, int *tnumber) { float distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - //COUNT_CAL_TIME_END + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); if (distance < bsf) { if (node->is_leaf) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->node = node; mindist_result->distance = distance; pthread_mutex_lock(&lock_queue[*tnumber]); @@ -2821,39 +2773,72 @@ insert_tree_node_m_hybridpqueue_workstealing(float *paa, isax_node *node, isax_i if (node->right_child->isax_cardinalities != NULL) { pushbottom(workstack, node->right_child); } + if (node->left_child->isax_cardinalities != NULL) { insert_tree_node_m_hybridpqueue_workstealing(paa, node->left_child, index, bsf, pq, lock_queue, - workstack, tnumber); + workstack, tnumber); } } } + isax_node *newnode = popbottom2(workstack); + if (newnode != NULL) { insert_tree_node_m_hybridpqueue_workstealing(paa, newnode, index, bsf, pq, lock_queue, workstack, tnumber); } } - -void insert_tree_node_m_hybridpqueue(float *paa, isax_node *node, isax_index *index, float bsf, pqueue_t **pq, - pthread_mutex_t *lock_queue, int *tnumber) { +void insert_tree_node_m_hybridpqueue(float *paa, isax_node *node, + isax_index *index, float bsf, pqueue_t **pq, pthread_mutex_t *lock_queue, int *tnumber) { float distance; if (index->settings->function_type == 4) { - distance = minidist_fft_to_sfa(index, paa, node->isax_values, node->isax_cardinalities, bsf); +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + distance = __builtin_cpu_supports("avx512vl") ? + minidist_fft_to_sfa_rawe_SIMD512(index, paa, node->isax_values, node->isax_cardinalities, bsf) : + minidist_fft_to_sfa_rawe_SIMD(index, paa, node->isax_values, node->isax_cardinalities, bsf); + } else { +#endif + distance = minidist_fft_to_sfa(index, paa, node->isax_values, node->isax_cardinalities, bsf); +#if defined(__x86_64__) + } +#endif } else { - distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - } - //__sync_fetch_and_add(&LBDcalculationnumber,1); - //COUNT_CAL_TIME_END +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + distance = __builtin_cpu_supports("avx512dq") ? + minidist_paa_to_isax_rawa_SIMD512(paa, node->isax_values, + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt) : + minidist_paa_to_isax_rawa_SIMD(paa, node->isax_values, + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + } else { +#endif + distance = minidist_paa_to_isax(paa, node->isax_values, + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#if defined(__x86_64__) + } +#endif + } + if (distance < bsf) { if (node->is_leaf) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->node = node; mindist_result->distance = distance; pthread_mutex_lock(&lock_queue[*tnumber]); @@ -2865,6 +2850,7 @@ void insert_tree_node_m_hybridpqueue(float *paa, isax_node *node, isax_index *in if (node->left_child->isax_cardinalities != NULL) { insert_tree_node_m_hybridpqueue(paa, node->left_child, index, bsf, pq, lock_queue, tnumber); } + if (node->right_child->isax_cardinalities != NULL) { insert_tree_node_m_hybridpqueue(paa, node->right_child, index, bsf, pq, lock_queue, tnumber); } @@ -2873,33 +2859,34 @@ void insert_tree_node_m_hybridpqueue(float *paa, isax_node *node, isax_index *in } void insert_tree_node_m_hybridpqueue_time(float *paa, isax_node *node, isax_index *index, float bsf, pqueue_t **pq, - pthread_mutex_t *lock_queue, int *tnumber, unsigned long int *time_lb) { + pthread_mutex_t *lock_queue, int *tnumber, unsigned long int *time_lb) { float distance; struct timeval current_time; struct timeval lb_dist_time_start; gettimeofday(&lb_dist_time_start, NULL); + if (index->settings->function_type == 4) { distance = minidist_fft_to_sfa(index, paa, node->isax_values, node->isax_cardinalities, bsf); } else { distance = minidist_paa_to_isax(paa, node->isax_values, - node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); + node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); } + __sync_fetch_and_add(&LBDcalculationnumber, 1); gettimeofday(¤t_time, NULL); *time_lb += ((int) (current_time.tv_sec * 1000000 + (current_time.tv_usec)) - - (int) (lb_dist_time_start.tv_sec * 1000000 + (lb_dist_time_start.tv_usec))); + (int) (lb_dist_time_start.tv_sec * 1000000 + (lb_dist_time_start.tv_usec))); - //COUNT_CAL_TIME_END if (distance < bsf) { if (node->is_leaf) { - query_result *mindist_result = malloc(sizeof(query_result)); + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->node = node; mindist_result->distance = distance; pthread_mutex_lock(&lock_queue[*tnumber]); @@ -2910,11 +2897,12 @@ void insert_tree_node_m_hybridpqueue_time(float *paa, isax_node *node, isax_inde } else { if (node->left_child->isax_cardinalities != NULL) { insert_tree_node_m_hybridpqueue_time(paa, node->left_child, index, bsf, pq, lock_queue, tnumber, - time_lb); + time_lb); } + if (node->right_child->isax_cardinalities != NULL) { insert_tree_node_m_hybridpqueue_time(paa, node->right_child, index, bsf, pq, lock_queue, tnumber, - time_lb); + time_lb); } } } @@ -2926,28 +2914,32 @@ void pushbottom(localStack *stk, isax_node *node) { } bool isemptyqueue(localStack *stk) { - if (stk->top < stk->bottom) + if (stk->top < stk->bottom) { return true; - else + } else { return false; + } } isax_node *poptop2(localStack *stk) { int localtop = stk->top; int localbottom = stk->bottom; + if (localtop >= localbottom) { return NULL; } else { isax_node *localnode = stk->val[localtop]; int localnewtop = localtop; localnewtop++; + if (__sync_bool_compare_and_swap(&(stk->bottom), localnewtop, stk->bottom)) { return NULL; } else { - if (__sync_bool_compare_and_swap(&(stk->top), stk->top, localnewtop)) + if (__sync_bool_compare_and_swap(&(stk->top), stk->top, localnewtop)) { return localnode; - else + } else { return NULL; + } } } } @@ -2955,12 +2947,14 @@ isax_node *poptop2(localStack *stk) { isax_node *poptop(localStack *stk) { int localtop = stk->top; int localbottom = stk->bottom; + if (localtop >= localbottom) { return NULL; } else { isax_node *localnode = stk->val[localtop]; int localnewtop = localtop; localnewtop++; + if (__sync_bool_compare_and_swap(&(stk->top), localtop, localnewtop)) { return localnode; } else { @@ -2971,52 +2965,50 @@ isax_node *poptop(localStack *stk) { isax_node *popbottom(localStack *stk) { int localbottom = stk->bottom; - { - /* code */ - } + if (localbottom == 0) { - //this is the end of the stack + // this is the end of the stack return NULL; } + localbottom--; stk->bottom = localbottom; isax_node *localnode = stk->val[localbottom]; int localtop = stk->top; - if (localbottom > localtop) + + if (localbottom > localtop) { return localnode; + } stk->bottom = 0; + if (localbottom = localtop) { __sync_bool_compare_and_swap(&(stk->top), localtop, 0); + if (localtop == 0) { return localnode; } } + localtop = 0; - return NULL; + return NULL; } - isax_node *popbottom2(localStack *stk) { if (stk->bottom == 0) { return NULL; } + int localbottom = __sync_fetch_and_sub(&(stk->bottom), 1); localbottom--; isax_node *localnode = stk->val[localbottom]; + if (__sync_bool_compare_and_swap(&(stk->bottom), stk->top, 0)) { stk->top = 0; + return localnode; } else { return localnode; } } - - - - - - - - diff --git a/src/ads/parallel_query_engine.c b/src/ads/parallel_query_engine.c index f8a0cef5..1ea0a6d0 100644 --- a/src/ads/parallel_query_engine.c +++ b/src/ads/parallel_query_engine.c @@ -20,824 +20,674 @@ #define NTHREADS 4 void isax_query_binary_file_para(const char *ifilename, int q_num, isax_index *index, - float minimum_distance, int min_checked_leaves, - query_result (*search_function)(ts_type*, ts_type*, isax_index*, float, int)) { + float minimum_distance, int min_checked_leaves, + query_result (*search_function)(ts_type*, ts_type*, isax_index*, float, int)) { fprintf(stderr, ">>> Performing queries in file: %s\n", ifilename); FILE * ifile; - ifile = fopen (ifilename,"rb"); + ifile = fopen(ifilename, "rb"); + if (ifile == NULL) { fprintf(stderr, "File %s not found!\n", ifilename); + exit(-1); } + pthread_t threadid[q_num]; fseek(ifile, 0L, SEEK_END); file_position_type sz = (file_position_type) ftell(ifile); - file_position_type total_records = sz/index->settings->ts_byte_size; + file_position_type total_records = sz / index->settings->ts_byte_size; fseek(ifile, 0L, SEEK_SET); + if (total_records < q_num) { fprintf(stderr, "File %s has only %llu records!\n", ifilename, total_records); + exit(-1); } int q_loaded = 0; - //sax_type * sax = malloc(sizeof(sax_type) * index->settings->paa_segments); paraquery paraqueries[q_num]; - pthread_mutex_t lock_index=PTHREAD_MUTEX_INITIALIZER; - COUNT_TOTAL_TIME_START - COUNT_OUTPUT2_TIME_START - while (q_loaded < q_num) - { - //printf("Querying for: %d\n", index->settings->ts_byte_size * q_loaded); + pthread_mutex_t lock_index = PTHREAD_MUTEX_INITIALIZER; + COUNT_TOTAL_TIME_START + COUNT_OUTPUT2_TIME_START + + while (q_loaded < q_num) { // Parse ts and make PAA representation - paraqueries[q_loaded].ts= malloc(sizeof(ts_type) * index->settings->timeseries_size); - paraqueries[q_loaded].paa= malloc(sizeof(ts_type) * index->settings->paa_segments); - paraqueries[q_loaded].index=index; - paraqueries[q_loaded].minimum_distance=minimum_distance; - paraqueries[q_loaded].min_checked_leaves=min_checked_leaves; - paraqueries[q_loaded].lock_index=&lock_index; + paraqueries[q_loaded].ts = (ts_type*)malloc(sizeof(ts_type) * index->settings->timeseries_size); + paraqueries[q_loaded].paa = (ts_type*)malloc(sizeof(ts_type) * index->settings->paa_segments); + paraqueries[q_loaded].index = index; + paraqueries[q_loaded].minimum_distance = minimum_distance; + paraqueries[q_loaded].min_checked_leaves = min_checked_leaves; + paraqueries[q_loaded].lock_index = &lock_index; COUNT_INPUT_TIME_START - fread(paraqueries[q_loaded].ts, sizeof(ts_type),index->settings->timeseries_size,ifile); + fread(paraqueries[q_loaded].ts, sizeof(ts_type), index->settings->timeseries_size, ifile); COUNT_INPUT_TIME_END paa_from_ts(paraqueries[q_loaded].ts, paraqueries[q_loaded].paa, index->settings->paa_segments, - index->settings->ts_values_per_paa_segment, - index->settings->timeseries_size); - - - pthread_create(&(threadid[q_loaded]),NULL,para_queries_worker,(void*)&(paraqueries[q_loaded])); - //query_result result = search_function(ts, paa, index, minimum_distance, min_checked_leaves); - - //PRINT_STATS(result.distance) - + index->settings->ts_values_per_paa_segment, index->settings->timeseries_size); + pthread_create(&(threadid[q_loaded]), NULL, para_queries_worker, (void*)&(paraqueries[q_loaded])); fflush(stdout); + #if VERBOSE_LEVEL >= 1 printf("[%p]: Distance: %lf\n", result.node, result.distance); #endif - //sax_from_paa(paa, sax, index->settings->paa_segments, index->settings->sax_alphabet_cardinality, index->settings->sax_bit_cardinality); - //if (index->settings->timeseries_size * sizeof(ts_type) * q_loaded == 1024) { - // sax_print(sax, index->settings->paa_segments, index->settings->sax_bit_cardinality); - //} q_loaded++; } + q_loaded = 0; - while (q_loaded < q_num) - { - pthread_join(threadid[q_loaded],NULL); + + while (q_loaded < q_num) { + pthread_join(threadid[q_loaded], NULL); q_loaded++; } - COUNT_OUTPUT2_TIME_END - COUNT_TOTAL_TIME_END - //free(paa); - //free(ts); + + COUNT_OUTPUT2_TIME_END + COUNT_TOTAL_TIME_END fclose(ifile); fprintf(stderr, ">>> Finished querying.\n"); - } -void* para_queries_worker(void *transvector) -{ - - query_result result = exact_search_serial_para(((paraquery*)transvector)->ts, ((paraquery*)transvector)->paa, ((paraquery*)transvector)->index, ((paraquery*)transvector)->minimum_distance, ((paraquery*)transvector)->min_checked_leaves,((paraquery*)transvector)->lock_index); - PRINT_STATS(result.distance); +void* para_queries_worker(void *transvector) { + query_result result = exact_search_serial_para(((paraquery*)transvector)->ts, ((paraquery*)transvector)->paa, + ((paraquery*)transvector)->index, ((paraquery*)transvector)->minimum_distance, + ((paraquery*)transvector)->min_checked_leaves, ((paraquery*)transvector)->lock_index); + PRINT_STATS(result.distance); } -query_result exact_search_serial_para(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, pthread_mutex_t *lock_index) { - + +query_result exact_search_serial_para(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, + int min_checked_leaves, pthread_mutex_t *lock_index) { RESET_BYTES_ACCESSED - + // FOR THREAD USE - float *MINDISTS=malloc(sizeof(float) * index->sax_cache_size); - unsigned long j; - for (j = 0; j < index->sax_cache_size; j++) + float *MINDISTS = (float*)malloc(sizeof(float) * index->sax_cache_size); + + for (unsigned long j = 0; j < index->sax_cache_size; j++) { MINDISTS[j] = FLT_MAX; + } // END - pthread_mutex_lock(lock_index); + + pthread_mutex_lock(lock_index); query_result approximate_result = approximate_search(ts, paa, index); query_result bsf_result = approximate_result; - - + int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; - + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) - { + + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); } - pthread_mutex_unlock(lock_index); - + + pthread_mutex_unlock(lock_index); + unsigned long i; COUNT_INPUT_TIME_START FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); COUNT_INPUT_TIME_END - - //SET_APPROXIMATE(approximate_result.distance); - - // THREADED - //for ( i = 0; i < 100; i++) - //{ - // printf("the sax [%d ]%d\n",i,(int)(index->sax_cache[i * index->settings->paa_segments] )); - //} - for(i=0; isax_cache_size; i++) - { + + for (i = 0; i < index->sax_cache_size; i++) { sax_type *sax = &(index->sax_cache[i * index->settings->paa_segments]); MINDISTS[i] = minidist_paa_to_isax_raw(paa, sax, - index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); + index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); } // END - - //printf("the mindist 95008 is %f\n",MINDISTS[95008] ); - //printf("the mindist 280671 is %f\n",MINDISTS[280671] ); - //printf("the mindist 692396 is %f\n",MINDISTS[692396] ); - - - - for(i=0; isax_cache_size; i++) - { + for (i = 0; i < index->sax_cache_size; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - if(MINDISTS[i] <= approximate_result.distance) - { + + if (MINDISTS[i] <= approximate_result.distance) { COUNT_INPUT_TIME_START fseek(raw_file, i * index->settings->ts_byte_size, SEEK_SET); fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); COUNT_INPUT_TIME_END - //printf(" the %d sax is : %d !!!\n",i,index->sax_cache[i* index->settings->paa_segments] ); float dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, approximate_result.distance); - if(dist < approximate_result.distance) - { + + if (dist < approximate_result.distance) { approximate_result.distance = dist; #ifdef STORE_ANSWER memcpy(index->answer, ts_buffer, index->settings->timeseries_size * sizeof(ts_type)); #endif } - //INCREASE_BYTES_ACCESSED(index->settings->ts_byte_size) } } + free(ts_buffer); fclose(raw_file); free(MINDISTS); - + return approximate_result; } -query_result exact_search_serial_ParIS(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves) -{ +query_result exact_search_serial_ParIS(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED - - pthread_t threadid[maxquerythread]; query_result approximate_result = approximate_search(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); - - - int sum_of_lab=0; + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); + int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; float bsf_distance; unsigned long j; - //printf("check point 1 \n"); + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) - { + + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); } + query_result bsf_result = approximate_result; FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); - //printf("check point 2 \n"); - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); unsigned long i; - #ifdef AUTO_TUNE +#ifdef AUTO_TUNE float *mindists = malloc(sizeof(float) * index->sax_cache_size); - #endif +#endif + COUNT_CAL_TIME_START SET_APPROXIMATE(approximate_result.distance); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - ParIS_LDCW_data *essdata=malloc(sizeof(ParIS_LDCW_data)*(maxquerythread)); - pthread_rwlock_t lock_bsf=PTHREAD_RWLOCK_INITIALIZER; - //pthread_mutex_t lock_bsf2=PTHREAD_MUTEX_INITIALIZER; - //printf("check point 3 \n"); - for (i = 0; i < (maxquerythread-1); i++) - { - essdata[i].index=index; - essdata[i].lock_bsf=&lock_bsf; - essdata[i].start_number=i*(index->sax_cache_size/maxquerythread); - essdata[i].stop_number=(i+1)*(index->sax_cache_size/maxquerythread); - essdata[i].paa=paa; - essdata[i].ts=ts; - essdata[i].bsfdistance=approximate_result.distance; - essdata[i].sum_of_lab=0; + ParIS_LDCW_data *essdata = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); + pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; + + for (i = 0; i < (maxquerythread - 1); i++) { + essdata[i].index = index; + essdata[i].lock_bsf = &lock_bsf; + essdata[i].start_number = i * (index->sax_cache_size / maxquerythread); + essdata[i].stop_number = (i + 1) * (index->sax_cache_size / maxquerythread); + essdata[i].paa = paa; + essdata[i].ts = ts; + essdata[i].bsfdistance = approximate_result.distance; + essdata[i].sum_of_lab = 0; } - essdata[maxquerythread-1].index=index; - essdata[maxquerythread-1].lock_bsf=&lock_bsf; - essdata[maxquerythread-1].start_number=(maxquerythread-1)*(index->sax_cache_size/maxquerythread); - essdata[maxquerythread-1].stop_number=index->sax_cache_size; - essdata[maxquerythread-1].paa=paa; - essdata[maxquerythread-1].ts=ts; - essdata[maxquerythread-1].bsfdistance=approximate_result.distance; - essdata[maxquerythread-1].sum_of_lab=0; - - for(i=0; isax_cache_size is %ld\n", index->sax_cache_size); - //printf("essdata[i].start_number is %ld\n", essdata[i].start_number); - //printf("essdata[i].stop_number is %ld\n", essdata[i].stop_number); + + essdata[maxquerythread - 1].index = index; + essdata[maxquerythread - 1].lock_bsf = &lock_bsf; + essdata[maxquerythread - 1].start_number = (maxquerythread - 1) * (index->sax_cache_size / maxquerythread); + essdata[maxquerythread - 1].stop_number = index->sax_cache_size; + essdata[maxquerythread - 1].paa = paa; + essdata[maxquerythread - 1].ts = ts; + essdata[maxquerythread - 1].bsfdistance = approximate_result.distance; + essdata[maxquerythread - 1].sum_of_lab = 0; + + for (i = 0; i < maxquerythread; i++) { + pthread_create(&(threadid[i]), NULL, mindistance_worker, (void*)&(essdata[i])); } - for (i = 0; i < maxquerythread; i++) - { - pthread_join(threadid[i],NULL); - sum_of_lab+=essdata[i].sum_of_lab; + + for (i = 0; i < maxquerythread; i++) { + pthread_join(threadid[i], NULL); + sum_of_lab += essdata[i].sum_of_lab; } - //printf("check point 4 \n"); - unsigned long* label_number=malloc(sizeof(unsigned long)*(sum_of_lab)); - float* minidisvector=malloc(sizeof(float)*(sum_of_lab)); - - sum_of_lab=0; + unsigned long* label_number = (unsigned long*)malloc(sizeof(unsigned long) * (sum_of_lab)); + float* minidisvector = (float*)malloc(sizeof(float) * (sum_of_lab)); - for (i = 0; i < maxquerythread; i++) - { - memcpy(&(label_number[sum_of_lab]),essdata[i].label_number,sizeof(unsigned long)*essdata[i].sum_of_lab); - memcpy(&(minidisvector[sum_of_lab]),essdata[i].minidisvector,sizeof(float)*essdata[i].sum_of_lab); + sum_of_lab = 0; + + for (i = 0; i < maxquerythread; i++) { + memcpy(&(label_number[sum_of_lab]), essdata[i].label_number, sizeof(unsigned long) * essdata[i].sum_of_lab); + memcpy(&(minidisvector[sum_of_lab]), essdata[i].minidisvector, sizeof(float) * essdata[i].sum_of_lab); free(essdata[i].label_number); free(essdata[i].minidisvector); - sum_of_lab+=essdata[i].sum_of_lab; + sum_of_lab += essdata[i].sum_of_lab; } - - - pthread_t readthread[maxquerythread*maxreadthread]; + pthread_t readthread[maxquerythread * maxreadthread]; ParIS_read_worker_data readpointer; - unsigned long readcounter=0; - float bsfdistance=(approximate_result.distance); - - - readpointer.ts=ts; - readpointer.index=index; - readpointer.counter=&readcounter; - readpointer.bsf=approximate_result.distance; - readpointer.load_point=label_number; - - readpointer.lock_bsf=&lock_bsf; - readpointer.bsf2=&bsfdistance; - readpointer.minidisvector=minidisvector; - readpointer.sum_of_lab=sum_of_lab; - COUNT_CAL_TIME_END + unsigned long readcounter = 0; + float bsfdistance = (approximate_result.distance); + readpointer.ts = ts; + readpointer.index = index; + readpointer.counter = &readcounter; + readpointer.bsf = approximate_result.distance; + readpointer.load_point = label_number; + readpointer.lock_bsf = &lock_bsf; + readpointer.bsf2 = &bsfdistance; + readpointer.minidisvector = minidisvector; + readpointer.sum_of_lab = sum_of_lab; + COUNT_CAL_TIME_END COUNT_INPUT_TIME_START - for (i = 0; i < maxquerythread*maxreadthread; i++) - { - pthread_create(&(readthread[i]),NULL,read_worker,(void*)&(readpointer)); + + for (i = 0; i < maxquerythread * maxreadthread; i++) { + pthread_create(&(readthread[i]), NULL, read_worker, (void*)&(readpointer)); } - //printf("check point 7 \n"); - //wait the read worker finish - for (i = 0; i < maxquerythread*maxreadthread; i++) - { - pthread_join(readthread[i],NULL); - //read_time_all=read_time_all+read_time_conter[i]; - //if(readpointer[i].bsfsax_cache_size); - /*bit_array_free(bitarray);*/ - //printf("the new distance is: %f \n",approximate_result.distance); - //.sax_type *sax = &index->sax_cache[1 * index->settings->paa_segments]; + return approximate_result; } -query_result exact_search_serial_ParISnonsort(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves) -{ - +query_result exact_search_serial_ParISnonsort(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED - - pthread_t threadid[maxquerythread]; query_result approximate_result = approximate_search(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); - - - unsigned long sum_of_lab=0; + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); + unsigned long sum_of_lab = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; float bsf_distance; unsigned long j; - //printf("check point 1 \n"); + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) - { + + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); } + query_result bsf_result = approximate_result; FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); - //printf("check point 2 \n"); - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); unsigned long i; - #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); - #endif +#ifdef AUTO_TUNE + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); +#endif + COUNT_CAL_TIME_START SET_APPROXIMATE(approximate_result.distance); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - ParIS_LDCW_data *essdata=malloc(sizeof(ParIS_LDCW_data)*(maxquerythread)); - pthread_rwlock_t lock_bsf=PTHREAD_RWLOCK_INITIALIZER; - //pthread_mutex_t lock_bsf2=PTHREAD_MUTEX_INITIALIZER; - //printf("check point 3 \n"); - for (i = 0; i < (maxquerythread-1); i++) - { - essdata[i].index=index; - essdata[i].lock_bsf=&lock_bsf; - essdata[i].start_number=i*(index->sax_cache_size/maxquerythread); - essdata[i].stop_number=(i+1)*(index->sax_cache_size/maxquerythread); - essdata[i].paa=paa; - essdata[i].ts=ts; - essdata[i].bsfdistance=approximate_result.distance; - essdata[i].sum_of_lab=0; - } - essdata[maxquerythread-1].index=index; - essdata[maxquerythread-1].lock_bsf=&lock_bsf; - essdata[maxquerythread-1].start_number=(maxquerythread-1)*(index->sax_cache_size/maxquerythread); - essdata[maxquerythread-1].stop_number=index->sax_cache_size; - essdata[maxquerythread-1].paa=paa; - essdata[maxquerythread-1].ts=ts; - essdata[maxquerythread-1].bsfdistance=approximate_result.distance; - essdata[maxquerythread-1].sum_of_lab=0; - - for(i=0; isax_cache_size is %ld\n", index->sax_cache_size); - //printf("essdata[i].start_number is %ld\n", essdata[i].start_number); - //printf("essdata[i].stop_number is %ld\n", essdata[i].stop_number); + ParIS_LDCW_data *essdata = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data)*(maxquerythread)); + pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; + + for (i = 0; i < (maxquerythread - 1); i++) { + essdata[i].index = index; + essdata[i].lock_bsf = &lock_bsf; + essdata[i].start_number = i * (index->sax_cache_size / maxquerythread); + essdata[i].stop_number = (i + 1) * (index->sax_cache_size / maxquerythread); + essdata[i].paa = paa; + essdata[i].ts = ts; + essdata[i].bsfdistance = approximate_result.distance; + essdata[i].sum_of_lab = 0; } - for (i = 0; i < maxquerythread; i++) - { - pthread_join(threadid[i],NULL); - sum_of_lab+=essdata[i].sum_of_lab; - } - - //printf("check point 4 \n"); - unsigned long* label_number=malloc(sizeof(unsigned long)*(sum_of_lab)); - float* minidisvector=malloc(sizeof(float)*(sum_of_lab)); - - sum_of_lab=0; + essdata[maxquerythread - 1].index = index; + essdata[maxquerythread - 1].lock_bsf = &lock_bsf; + essdata[maxquerythread - 1].start_number = (maxquerythread - 1) * (index->sax_cache_size / maxquerythread); + essdata[maxquerythread - 1].stop_number = index->sax_cache_size; + essdata[maxquerythread - 1].paa = paa; + essdata[maxquerythread - 1].ts = ts; + essdata[maxquerythread - 1].bsfdistance = approximate_result.distance; + essdata[maxquerythread - 1].sum_of_lab = 0; + + for (i = 0; i < maxquerythread; i++) { + pthread_create(&(threadid[i]), NULL, mindistance_worker, (void*)&(essdata[i])); + } + for (i = 0; i < maxquerythread; i++) { + pthread_join(threadid[i], NULL); + sum_of_lab += essdata[i].sum_of_lab; + } - for (i = 0; i < maxquerythread; i++) - { - //free(essdata[i].label_number); - //free(essdata[i].minidisvector); - essdata[i].currentpositioncounter=&sum_of_lab; - essdata[i].label_number=label_number; - essdata[i].minidisvector=minidisvector; - //m//emcpy(&(label_number[sum_of_lab]),essdata[i].label_number,sizeof(unsigned long)*essdata[i].sum_of_lab); - // memcpy(&(minidisvector[sum_of_lab]),essdata[i].minidisvector,sizeof(float)*essdata[i].sum_of_lab); + unsigned long* label_number = (unsigned long*)malloc(sizeof(unsigned long) * (sum_of_lab)); + float* minidisvector = (float*)malloc(sizeof(float) * (sum_of_lab)); + sum_of_lab = 0; - //sum_of_lab+=essdata[i].sum_of_lab; - } - for(i=0; isax_cache_size); - /*bit_array_free(bitarray);*/ - //printf("the new distance is: %f \n",approximate_result.distance); - //.sax_type *sax = &index->sax_cache[1 * index->settings->paa_segments]; + return approximate_result; } - - -pqueue_bsf exact_topk_serial_ParIS(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves, int k) -{ - +pqueue_bsf exact_topk_serial_ParIS(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves, int k) { RESET_BYTES_ACCESSED - FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); pthread_t threadid[maxquerythread]; - pqueue_bsf *pq_bsf= pqueue_bsf_init(k); - approximate_topk(ts, paa, index,pq_bsf); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); - - int sum_of_lab=0; + pqueue_bsf *pq_bsf = pqueue_bsf_init(k); + approximate_topk(ts, paa, index, pq_bsf); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); + int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; float bsf_distance; unsigned long j; - //printf("check point 1 \n"); - // Early termination... - if (pq_bsf->knn[k-1] == 0) { + + if (pq_bsf->knn[k - 1] == 0) { return *pq_bsf; } - - if(pq_bsf->knn[k-1] == FLT_MAX || min_checked_leaves > 1) { + + if (pq_bsf->knn[k - 1] == FLT_MAX || min_checked_leaves > 1) { refine_topk_answer(ts, paa, index, pq_bsf, minimum_distance, min_checked_leaves); } - - //printf("check point 2 \n"); - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); + unsigned long i; - #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); - #endif - - SET_APPROXIMATE(pq_bsf->knn[k-1]); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - ParIS_LDCW_data *essdata=malloc(sizeof(ParIS_LDCW_data)*(maxquerythread)); - pthread_rwlock_t lock_bsf=PTHREAD_RWLOCK_INITIALIZER; - //pthread_mutex_t lock_bsf2=PTHREAD_MUTEX_INITIALIZER; - //printf("check point 3 \n"); - for (i = 0; i < (maxquerythread-1); i++) - { - essdata[i].index=index; - essdata[i].lock_bsf=&lock_bsf; - essdata[i].start_number=i*(index->sax_cache_size/maxquerythread); - essdata[i].stop_number=(i+1)*(index->sax_cache_size/maxquerythread); - essdata[i].paa=paa; - essdata[i].ts=ts; - essdata[i].bsfdistance=pq_bsf->knn[k-1]; - essdata[i].sum_of_lab=0; +#ifdef AUTO_TUNE + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); +#endif + + SET_APPROXIMATE(pq_bsf->knn[k - 1]); + ParIS_LDCW_data *essdata = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); + pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; + + for (i = 0; i < (maxquerythread - 1); i++) { + essdata[i].index = index; + essdata[i].lock_bsf = &lock_bsf; + essdata[i].start_number = i * (index->sax_cache_size / maxquerythread); + essdata[i].stop_number = (i + 1) * (index->sax_cache_size / maxquerythread); + essdata[i].paa = paa; + essdata[i].ts = ts; + essdata[i].bsfdistance = pq_bsf->knn[k - 1]; + essdata[i].sum_of_lab = 0; } - essdata[maxquerythread-1].index=index; - essdata[maxquerythread-1].lock_bsf=&lock_bsf; - essdata[maxquerythread-1].start_number=(maxquerythread-1)*(index->sax_cache_size/maxquerythread); - essdata[maxquerythread-1].stop_number=index->sax_cache_size; - essdata[maxquerythread-1].paa=paa; - essdata[maxquerythread-1].ts=ts; - essdata[maxquerythread-1].bsfdistance=pq_bsf->knn[k-1]; - essdata[maxquerythread-1].sum_of_lab=0; - - for(i=0; isax_cache_size is %ld\n", index->sax_cache_size); - //printf("essdata[i].start_number is %ld\n", essdata[i].start_number); - //printf("essdata[i].stop_number is %ld\n", essdata[i].stop_number); + + essdata[maxquerythread - 1].index = index; + essdata[maxquerythread - 1].lock_bsf = &lock_bsf; + essdata[maxquerythread - 1].start_number = (maxquerythread - 1) * (index->sax_cache_size / maxquerythread); + essdata[maxquerythread - 1].stop_number = index->sax_cache_size; + essdata[maxquerythread - 1].paa = paa; + essdata[maxquerythread - 1].ts = ts; + essdata[maxquerythread - 1].bsfdistance = pq_bsf->knn[k - 1]; + essdata[maxquerythread - 1].sum_of_lab = 0; + + for (i = 0; i < maxquerythread; i++) { + pthread_create(&(threadid[i]), NULL, mindistance_worker, (void*)&(essdata[i])); } - for (i = 0; i < maxquerythread; i++) - { - pthread_join(threadid[i],NULL); - sum_of_lab+=essdata[i].sum_of_lab; + + for (i = 0; i < maxquerythread; i++) { + pthread_join(threadid[i], NULL); + sum_of_lab += essdata[i].sum_of_lab; } - //printf("check point 4 \n"); - unsigned long* label_number=malloc(sizeof(unsigned long)*(sum_of_lab)); - float* minidisvector=malloc(sizeof(float)*(sum_of_lab)); - - sum_of_lab=0; - - for (i = 0; i < maxquerythread; i++) - { - memcpy(&(label_number[sum_of_lab]),essdata[i].label_number,sizeof(unsigned long)*essdata[i].sum_of_lab); - memcpy(&(minidisvector[sum_of_lab]),essdata[i].minidisvector,sizeof(float)*essdata[i].sum_of_lab); + + unsigned long* label_number = (unsigned long*)malloc(sizeof(unsigned long) * (sum_of_lab)); + float* minidisvector = (float*)malloc(sizeof(float) * (sum_of_lab)); + sum_of_lab = 0; + + for (i = 0; i < maxquerythread; i++) { + memcpy(&(label_number[sum_of_lab]), essdata[i].label_number, sizeof(unsigned long) * essdata[i].sum_of_lab); + memcpy(&(minidisvector[sum_of_lab]), essdata[i].minidisvector, sizeof(float) * essdata[i].sum_of_lab); free(essdata[i].label_number); free(essdata[i].minidisvector); - sum_of_lab+=essdata[i].sum_of_lab; + sum_of_lab += essdata[i].sum_of_lab; } - - - pthread_t readthread[maxquerythread*maxreadthread]; + pthread_t readthread[maxquerythread * maxreadthread]; ParIS_read_worker_data readpointer; - unsigned long readcounter=0; - - - readpointer.ts=ts; - readpointer.index=index; - readpointer.counter=&readcounter; - readpointer.load_point=label_number; - - readpointer.lock_bsf=&lock_bsf; - readpointer.minidisvector=minidisvector; - readpointer.sum_of_lab=sum_of_lab; - readpointer.pq_bsf=pq_bsf; - //printf("check point 6 \n"); - unsigned long read_time_conter[maxquerythread*maxreadthread], read_time_all=0; - - for (i = 0; i < maxquerythread*maxreadthread; i++) - { - pthread_create(&(readthread[i]),NULL,topk_read_worker,(void*)&(readpointer)); + unsigned long readcounter = 0; + readpointer.ts = ts; + readpointer.index = index; + readpointer.counter = &readcounter; + readpointer.load_point = label_number; + readpointer.lock_bsf = &lock_bsf; + readpointer.minidisvector = minidisvector; + readpointer.sum_of_lab = sum_of_lab; + readpointer.pq_bsf = pq_bsf; + unsigned long read_time_conter[maxquerythread * maxreadthread]; + unsigned long read_time_all = 0; + + for (i = 0; i < maxquerythread * maxreadthread; i++) { + pthread_create(&(readthread[i]), NULL, topk_read_worker, (void*)&(readpointer)); } - //printf("check point 7 \n"); - //wait the read worker finish - for (i = 0; i < maxquerythread*maxreadthread; i++) - { - pthread_join(readthread[i],NULL); - //read_time_all=read_time_all+read_time_conter[i]; - //if(readpointer[i].bsfsax_cache_size); - /*bit_array_free(bitarray);*/ - //printf("the new distance is: %f \n",approximate_result.distance); - //.sax_type *sax = &index->sax_cache[1 * index->settings->paa_segments]; + return *pq_bsf; } -void* mindistanceinsert_worker(void *essdata) -{ - unsigned long* localposition=((ParIS_LDCW_data*)essdata)->label_number; - float* localmindist=((ParIS_LDCW_data*)essdata)->minidisvector; - isax_index *index=((ParIS_LDCW_data*)essdata)->index; - unsigned long start_number=((ParIS_LDCW_data*)essdata)->start_number; - unsigned long stop_number=((ParIS_LDCW_data*)essdata)->stop_number; - unsigned long i,t; - float bsfdistance,mindist; - ts_type *paa=((ParIS_LDCW_data*)essdata)->paa; - ts_type *ts=((ParIS_LDCW_data*)essdata)->ts; - for(i=start_number;ilabel_number; + float* localmindist = ((ParIS_LDCW_data*)essdata)->minidisvector; + isax_index *index = ((ParIS_LDCW_data*)essdata)->index; + unsigned long start_number = ((ParIS_LDCW_data*)essdata)->start_number; + unsigned long stop_number = ((ParIS_LDCW_data*)essdata)->stop_number; + unsigned long t; + float bsfdistance; + float mindist; + ts_type *paa = ((ParIS_LDCW_data*)essdata)->paa; + ts_type *ts = ((ParIS_LDCW_data*)essdata)->ts; + + for (unsigned long i = start_number; i < stop_number; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - +#if defined(__x86_64__) mindist = minidist_paa_to_isax_rawa_SIMD(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - if(mindist <= ((ParIS_LDCW_data*)essdata)->bsfdistance) { - /*bit_array_set_bit(bitarray, i);*/ - //COUNT_INPUT_TIME_START - //fseek(raw_file, i * index->settings->ts_byte_size, SEEK_SET); - //fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); - //COUNT_INPUT_TIME_END - t=__sync_fetch_and_add(((ParIS_LDCW_data*)essdata)->currentpositioncounter,1); - - memcpy(&(((ParIS_LDCW_data*)essdata)->label_number[t]),&i,sizeof(unsigned int)); - memcpy(&( ((ParIS_LDCW_data*)essdata)->minidisvector[t]),&mindist,sizeof(float)); + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + mindist = minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + if (mindist <= ((ParIS_LDCW_data*)essdata)->bsfdistance) { + t = __sync_fetch_and_add(((ParIS_LDCW_data*)essdata)->currentpositioncounter, 1); + memcpy(&(((ParIS_LDCW_data*)essdata)->label_number[t]), &i, sizeof(unsigned int)); + memcpy(&(((ParIS_LDCW_data*)essdata)->minidisvector[t]), &mindist, sizeof(float)); } } - - - } -void* mindistance_worker(void *essdata) -{ - - unsigned long i; - float bsfdistance,mindist; - isax_index *index=((ParIS_LDCW_data*)essdata)->index; - unsigned long start_number=((ParIS_LDCW_data*)essdata)->start_number; - unsigned long stop_number=((ParIS_LDCW_data*)essdata)->stop_number; - ts_type *paa=((ParIS_LDCW_data*)essdata)->paa; - ts_type *ts=((ParIS_LDCW_data*)essdata)->ts; - ((ParIS_LDCW_data*)essdata)->label_number=malloc(sizeof(unsigned long)*10000); - ((ParIS_LDCW_data*)essdata)->minidisvector=malloc(sizeof(float)*10000); - - unsigned long max_number=10000; - - for(i=start_number;iindex; + unsigned long start_number = ((ParIS_LDCW_data*)essdata)->start_number; + unsigned long stop_number = ((ParIS_LDCW_data*)essdata)->stop_number; + ts_type *paa = ((ParIS_LDCW_data*)essdata)->paa; + ts_type *ts = ((ParIS_LDCW_data*)essdata)->ts; + ((ParIS_LDCW_data*)essdata)->label_number = (unsigned long*)malloc(sizeof(unsigned long) * 10000); + ((ParIS_LDCW_data*)essdata)->minidisvector = (float*)malloc(sizeof(float) * 10000); + unsigned long max_number = 10000; + + for (unsigned long i = start_number; i < stop_number; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - +#if defined(__x86_64__) mindist = minidist_paa_to_isax_rawa_SIMD(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - if(mindist <= ((ParIS_LDCW_data*)essdata)->bsfdistance) { - /*bit_array_set_bit(bitarray, i);*/ - //COUNT_INPUT_TIME_START - //fseek(raw_file, i * index->settings->ts_byte_size, SEEK_SET); - //fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); - //COUNT_INPUT_TIME_END - if ( ((ParIS_LDCW_data*)essdata)->sum_of_lab>=max_number) - { - max_number=(max_number+10000); - unsigned long* change_lab=((ParIS_LDCW_data*)essdata)->label_number; - float* change_minivec=((ParIS_LDCW_data*)essdata)->minidisvector; - ((ParIS_LDCW_data*)essdata)->label_number=malloc(sizeof(unsigned long)*(max_number+10000)); - ((ParIS_LDCW_data*)essdata)->minidisvector=malloc(sizeof(float)*(max_number+10000)); - memcpy(((ParIS_LDCW_data*)essdata)->label_number,change_lab,sizeof(unsigned long)*max_number); - memcpy(((ParIS_LDCW_data*)essdata)->minidisvector,change_minivec,sizeof(float)*max_number); - - //((ParIS_LDCW_data*)essdata)->label_number = (unsigned long*) realloc(((ParIS_LDCW_data*)essdata)->label_number, max_number); - //((ParIS_LDCW_data*)essdata)->minidisvector = (float*) realloc(((ParIS_LDCW_data*)essdata)->minidisvector, max_number); + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + mindist = minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + + if (mindist <= ((ParIS_LDCW_data*)essdata)->bsfdistance) { + if (((ParIS_LDCW_data*)essdata)->sum_of_lab >= max_number) { + max_number = (max_number + 10000); + unsigned long* change_lab = ((ParIS_LDCW_data*)essdata)->label_number; + float* change_minivec = ((ParIS_LDCW_data*)essdata)->minidisvector; + ((ParIS_LDCW_data*)essdata)->label_number = (unsigned long*)malloc(sizeof(unsigned long) * (max_number + 10000)); + ((ParIS_LDCW_data*)essdata)->minidisvector = (float*)malloc(sizeof(float) * (max_number + 10000)); + memcpy(((ParIS_LDCW_data*)essdata)->label_number, change_lab, sizeof(unsigned long) * max_number); + memcpy(((ParIS_LDCW_data*)essdata)->minidisvector, change_minivec, sizeof(float) * max_number); free(change_lab); free(change_minivec); - } - ((ParIS_LDCW_data*)essdata)->label_number[((ParIS_LDCW_data*)essdata)->sum_of_lab]=i; - ((ParIS_LDCW_data*)essdata)->minidisvector[((ParIS_LDCW_data*)essdata)->sum_of_lab]=mindist; + + ((ParIS_LDCW_data*)essdata)->label_number[((ParIS_LDCW_data*)essdata)->sum_of_lab] = i; + ((ParIS_LDCW_data*)essdata)->minidisvector[((ParIS_LDCW_data*)essdata)->sum_of_lab] = mindist; ((ParIS_LDCW_data*)essdata)->sum_of_lab++; } } } - -void* read_worker(void *read_pointer) -{ - isax_index *index=((ParIS_read_worker_data*)read_pointer)->index; +void* read_worker(void *read_pointer) { + isax_index *index = ((ParIS_read_worker_data*)read_pointer)->index; FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); ts_type *ts =((ParIS_read_worker_data*)read_pointer)->ts; - unsigned long t=0,p; - unsigned long sum_of_lab=((ParIS_read_worker_data*)read_pointer)->sum_of_lab; - float *minidisvector=((ParIS_read_worker_data*)read_pointer)->minidisvector; - //printf(" t is %ld\n",*((ParIS_read_worker_data*)read_pointer)->counter); - //unsigned long read_time_conter=0; - - float bsf,dist; - while(1) - { - - pthread_rwlock_rdlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - bsf= *(((ParIS_read_worker_data*)read_pointer)->bsf2); - //printf(" t is %ld\n",*(((ParIS_read_worker_data*)read_pointer)->counter)); - - pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - //t=*(((ParIS_read_worker_data*)read_pointer)->counter); - //*(((ParIS_read_worker_data*)read_pointer)->counter)=*(((ParIS_read_worker_data*)read_pointer)->counter)+1; - t=__sync_fetch_and_add(((ParIS_read_worker_data*)read_pointer)->counter,1); - //printf("%ld\n", ((ParIS_read_worker_data*)read_pointer)->sum_of_lab); - if (t>=sum_of_lab) - { - break; - } - - p=((ParIS_read_worker_data*)read_pointer)->load_point[t]; - //printf("t is %ld!!!\n",p ); - if (minidisvector[t]settings->ts_byte_size, SEEK_SET); + unsigned long t = 0; + unsigned long p; + unsigned long sum_of_lab = ((ParIS_read_worker_data*)read_pointer)->sum_of_lab; + float *minidisvector = ((ParIS_read_worker_data*)read_pointer)->minidisvector; + float bsf; + float dist; + + while (1) { + pthread_rwlock_rdlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + bsf = *(((ParIS_read_worker_data*)read_pointer)->bsf2); + pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + t = __sync_fetch_and_add(((ParIS_read_worker_data*)read_pointer)->counter, 1); + + if (t >= sum_of_lab) { + break; + } + + p = ((ParIS_read_worker_data*)read_pointer)->load_point[t]; + + if (minidisvector[t] < bsf) { + fseek(raw_file, p * index->settings->ts_byte_size, SEEK_SET); fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); - //read_time_conter++; - dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf); - //printf("the distance is %f!!\n", dist); - if(dist < bsf) - { - pthread_rwlock_wrlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - if (dist<*(((ParIS_read_worker_data*)read_pointer)->bsf2)) - { - *(((ParIS_read_worker_data*)read_pointer)->bsf2)= dist; - } - pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - } - } - //printf("the t is :%ld !!!!!\n",t); +#if defined(__x86_64__) + dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf); +#else + dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, bsf); +#endif + + if (dist < bsf) { + pthread_rwlock_wrlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + + if (dist < *(((ParIS_read_worker_data*)read_pointer)->bsf2)) { + *(((ParIS_read_worker_data*)read_pointer)->bsf2) = dist; + } + + pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + } + } } free(ts_buffer); fclose(raw_file); +} -} -void* topk_read_worker(void *read_pointer) -{ - isax_index *index=((ParIS_read_worker_data*)read_pointer)->index; - pqueue_bsf *pq_bsf=((ParIS_read_worker_data*)read_pointer)->pq_bsf; +void* topk_read_worker(void *read_pointer) { + isax_index *index = ((ParIS_read_worker_data*)read_pointer)->index; + pqueue_bsf *pq_bsf = ((ParIS_read_worker_data*)read_pointer)->pq_bsf; FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); - ts_type *ts =((ParIS_read_worker_data*)read_pointer)->ts; - unsigned long t=0,p; - unsigned long sum_of_lab=((ParIS_read_worker_data*)read_pointer)->sum_of_lab; - float *minidisvector=((ParIS_read_worker_data*)read_pointer)->minidisvector; - //printf(" t is %ld\n",*((ParIS_read_worker_data*)read_pointer)->counter); - //unsigned long read_time_conter=0; - - float bsf,dist; - while(1) - { - - //pthread_rwlock_rdlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - bsf= pq_bsf->knn[pq_bsf->k-1]; - //printf(" t is %ld\n",*(((ParIS_read_worker_data*)read_pointer)->counter)); - - //pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - //t=*(((ParIS_read_worker_data*)read_pointer)->counter); - //*(((ParIS_read_worker_data*)read_pointer)->counter)=*(((ParIS_read_worker_data*)read_pointer)->counter)+1; - t=__sync_fetch_and_add(((ParIS_read_worker_data*)read_pointer)->counter,1); - //printf("%ld\n", ((ParIS_read_worker_data*)read_pointer)->sum_of_lab); - if (t>=sum_of_lab) - { - break; - } - - p=((ParIS_read_worker_data*)read_pointer)->load_point[t]; - //printf("t is %ld!!!\n",p ); - if (minidisvector[t]settings->ts_byte_size, SEEK_SET); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); + ts_type *ts = ((ParIS_read_worker_data*)read_pointer)->ts; + unsigned long t = 0; + unsigned long p; + unsigned long sum_of_lab = ((ParIS_read_worker_data*)read_pointer)->sum_of_lab; + float *minidisvector = ((ParIS_read_worker_data*)read_pointer)->minidisvector; + float bsf; + float dist; + + while (1) { + bsf = pq_bsf->knn[pq_bsf->k - 1]; + t = __sync_fetch_and_add(((ParIS_read_worker_data*)read_pointer)->counter, 1); + + if (t >= sum_of_lab) { + break; + } + + p = ((ParIS_read_worker_data*)read_pointer)->load_point[t]; + + if (minidisvector[t] < bsf) { + fseek(raw_file, p * index->settings->ts_byte_size, SEEK_SET); fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); - //read_time_conter++; - dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf); - //printf("the distance is %f!!\n", dist); - if(dist <= bsf) - { - pthread_rwlock_wrlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - pqueue_bsf_insert(pq_bsf,dist,p,NULL); - pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); - } - } - //printf("the t is :%ld !!!!!\n",t); +#if defined(__x86_64__) + dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, bsf); +#else + dist = ts_euclidean_distance(ts, ts_buffer, index->settings->timeseries_size, bsf); +#endif + + if (dist <= bsf) { + pthread_rwlock_wrlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + pqueue_bsf_insert(pq_bsf, dist, p, NULL); + pthread_rwlock_unlock(((ParIS_read_worker_data*)read_pointer)->lock_bsf); + } + } } free(ts_buffer); fclose(raw_file); - //return read_time_conter; } -query_result exact_search_serial_ParIS_nb(ts_type *ts, ts_type *paa, isax_index *index, float minimum_distance, int min_checked_leaves) -{ - +query_result exact_search_serial_ParIS_nb(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves) { RESET_BYTES_ACCESSED pthread_t threadid[maxquerythread]; query_result approximate_result = approximate_search(ts, paa, index); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); + ts_type *ts_buffer = (ts_type*)malloc(index->settings->ts_byte_size); query_result bsf_result = approximate_result; - int sum_of_lab=0; + int sum_of_lab = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; float bsf_distance; @@ -847,481 +697,464 @@ query_result exact_search_serial_ParIS_nb(ts_type *ts, ts_type *paa, isax_index if (approximate_result.distance == 0) { return approximate_result; } - //printf("approximate_result.distance is %f\n",approximate_result.distance); - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) - { + + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); - //approximate_result = refine_answer_m(ts, paa, index, approximate_result2, minimum_distance, min_checked_leaves); } - //printf("approximate_result.distance is %f\n",approximate_result.distance); - - /*BIT_ARRAY* bitarray = bit_array_create(index->sax_cache_size);*/ - //printf("the old distance is: %f \n",approximate_result.distance); + unsigned long i; - #ifdef AUTO_TUNE - float *mindists = malloc(sizeof(float) * index->sax_cache_size); - #endif - +#ifdef AUTO_TUNE + float *mindists = (float*)malloc(sizeof(float) * index->sax_cache_size); +#endif + SET_APPROXIMATE(approximate_result.distance); - //printf("the index->sax_cache_size is %ld\n",index->sax_cache_size); - ParIS_LDCW_data *essdata=malloc(sizeof(ParIS_LDCW_data)*(maxquerythread)); - pthread_rwlock_t lock_bsf=PTHREAD_RWLOCK_INITIALIZER; - float bsfdistance=approximate_result.distance; - unsigned long read_time_conter=0; - for (i = 0; i < (maxquerythread-1); i++) - { - essdata[i].index=index; - essdata[i].lock_bsf=&lock_bsf; - essdata[i].start_number=i*(index->sax_cache_size/maxquerythread); - essdata[i].stop_number=(i+1)*(index->sax_cache_size/maxquerythread); - essdata[i].paa=paa; - essdata[i].ts=ts; - essdata[i].bsfdistance=approximate_result.distance; - essdata[i].sum_of_lab=0; - essdata[i].minidisvector=&bsfdistance; - essdata[i].read_time_conter=0; + ParIS_LDCW_data *essdata = (ParIS_LDCW_data*)malloc(sizeof(ParIS_LDCW_data) * (maxquerythread)); + pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; + float bsfdistance = approximate_result.distance; + unsigned long read_time_conter = 0; + + for (i = 0; i < (maxquerythread - 1); i++) { + essdata[i].index = index; + essdata[i].lock_bsf = &lock_bsf; + essdata[i].start_number = i * (index->sax_cache_size / maxquerythread); + essdata[i].stop_number = (i + 1) * (index->sax_cache_size / maxquerythread); + essdata[i].paa = paa; + essdata[i].ts = ts; + essdata[i].bsfdistance = approximate_result.distance; + essdata[i].sum_of_lab = 0; + essdata[i].minidisvector = &bsfdistance; + essdata[i].read_time_conter = 0; } - essdata[maxquerythread-1].index=index; - essdata[maxquerythread-1].lock_bsf=&lock_bsf; - essdata[maxquerythread-1].start_number=(maxquerythread-1)*(index->sax_cache_size/maxquerythread); - essdata[maxquerythread-1].stop_number=index->sax_cache_size; - essdata[maxquerythread-1].paa=paa; - essdata[maxquerythread-1].ts=ts; - essdata[maxquerythread-1].bsfdistance=approximate_result.distance; - essdata[maxquerythread-1].sum_of_lab=0; - essdata[maxquerythread-1].minidisvector=&bsfdistance; - - for(i=0; isax_cache_size / maxquerythread); + essdata[maxquerythread - 1].stop_number = index->sax_cache_size; + essdata[maxquerythread - 1].paa = paa; + essdata[maxquerythread - 1].ts = ts; + essdata[maxquerythread - 1].bsfdistance = approximate_result.distance; + essdata[maxquerythread - 1].sum_of_lab = 0; + essdata[maxquerythread - 1].minidisvector = &bsfdistance; + + for (i = 0; i < maxquerythread; i++) { + pthread_create(&(threadid[i]), NULL, ParIS_nb_worker, (void*)&(essdata[i])); } - for (i = 0; i < maxquerythread; i++) - { - pthread_join(threadid[i],NULL); - if(essdata[i].bsfdistanceindex; - FILE *raw_file = fopen(index->settings->raw_filename, "rb"); + float bsfdistance; + float mindist; + isax_index *index = ((ParIS_LDCW_data*)essdata)->index; + FILE *raw_file = fopen(index->settings->raw_filename, "rb"); fseek(raw_file, 0, SEEK_SET); - ts_type *ts_buffer = malloc(index->settings->ts_byte_size); - unsigned long start_number=((ParIS_LDCW_data*)essdata)->start_number; - unsigned long stop_number=((ParIS_LDCW_data*)essdata)->stop_number; - ts_type *paa=((ParIS_LDCW_data*)essdata)->paa; - ts_type *ts=((ParIS_LDCW_data*)essdata)->ts; - - for(i=start_number;isettings->ts_byte_size); + unsigned long start_number = ((ParIS_LDCW_data*)essdata)->start_number; + unsigned long stop_number = ((ParIS_LDCW_data*)essdata)->stop_number; + ts_type *paa = ((ParIS_LDCW_data*)essdata)->paa; + ts_type *ts = ((ParIS_LDCW_data*)essdata)->ts; + for (i = start_number; i < stop_number; i++) { sax_type *sax = &index->sax_cache[i * index->settings->paa_segments]; - +#if defined(__x86_64__) mindist = minidist_paa_to_isax_raw_SIMD(paa, sax, index->settings->max_sax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, MINVAL, MAXVAL, - index->settings->mindist_sqrt); - - if(mindist <= ((ParIS_LDCW_data*)essdata)->bsfdistance) { + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#else + mindist = minidist_paa_to_isax_raw(paa, sax, index->settings->max_sax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, MINVAL, MAXVAL, + index->settings->mindist_sqrt); +#endif + if (mindist <= ((ParIS_LDCW_data*)essdata)->bsfdistance) { fseek(raw_file, i * index->settings->ts_byte_size, SEEK_SET); fread(ts_buffer, index->settings->ts_byte_size, 1, raw_file); - - float dist = ts_euclidean_distance_SIMD(ts, ts_buffer, index->settings->timeseries_size, ((ParIS_LDCW_data*)essdata)->bsfdistance); - if(dist<(((ParIS_LDCW_data*)essdata)->bsfdistance)) - { - (((ParIS_LDCW_data*)essdata)->bsfdistance)=dist; - } - +#if defined(__x86_64__) + float dist = ts_euclidean_distance_SIMD(ts, ts_buffer, + index->settings->timeseries_size, ((ParIS_LDCW_data*)essdata)->bsfdistance); +#else + float dist = ts_euclidean_distance(ts, ts_buffer, + index->settings->timeseries_size, ((ParIS_LDCW_data*)essdata)->bsfdistance); +#endif + if (dist < (((ParIS_LDCW_data*)essdata)->bsfdistance)) { + (((ParIS_LDCW_data*)essdata)->bsfdistance) = dist; + } } } + fclose(raw_file); free(ts_buffer); - - } - query_result refin_answer_m(ts_type *ts, ts_type *paa, isax_index *index, - query_result *approximate_bsf_result, - float minimum_distance, int limit) -{ - pthread_t threadid[8]; - + query_result *approximate_bsf_result, float minimum_distance, int limit) { + int maxid = 8; + pthread_t threadid[maxid]; refind_answer_fonction_data rfdata; - pthread_mutex_t lock_queue=PTHREAD_MUTEX_INITIALIZER,lock_current_root_node=PTHREAD_MUTEX_INITIALIZER; - pthread_rwlock_t lock_bsf=PTHREAD_RWLOCK_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, 4); - rfdata.paa=paa; - rfdata.ts=ts; - - rfdata.lock_queue=&lock_queue; - rfdata.lock_current_root_node=&lock_current_root_node; - rfdata.lock_bsf=&lock_bsf; - - rfdata.index=index; - rfdata.minimum_distance=minimum_distance; - rfdata.limit=limit/4; + rfdata.paa = paa; + rfdata.ts = ts; + rfdata.lock_queue = &lock_queue; + rfdata.lock_current_root_node = &lock_current_root_node; + rfdata.lock_bsf = &lock_bsf; + rfdata.index = index; + rfdata.minimum_distance = minimum_distance; + rfdata.limit = limit / 4; pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); - rfdata.pq=pq; + cmp_pri, get_pri, set_pri, get_pos, set_pos); + rfdata.pq = pq; + // Insert all root nodes in heap. rfdata.current_root_node = index->first_node; rfdata.bsf_result = approximate_bsf_result; query_result bsf_result; - query_result * n; - - rfdata.lock_barrier=&lock_barrier; + query_result *n; - for (int i = 0; i < 8; i++) - { - pthread_create(&(threadid[i]),NULL,refind_answer_fonction,(void*)&(rfdata)); - } - for (int i = 0; i < 8; i++) - { - pthread_join(threadid[i],NULL); + rfdata.lock_barrier = &lock_barrier; + + for (int i = 0; i < maxid; i++) { + pthread_create(&(threadid[i]), NULL, refind_answer_fonction, (void*)&(rfdata)); } + for (int i = 0; i < maxid; i++) { + pthread_join(threadid[i], NULL); + } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) - { + while ((n = (query_result*)pqueue_pop(pq))) { free(n); } + // Free the priority queue. pthread_barrier_destroy(&lock_barrier); pqueue_free(pq); - - bsf_result=*(rfdata.bsf_result); - //free(rfdata); + bsf_result = *(rfdata.bsf_result); + return *(rfdata.bsf_result); } -void* refind_answer_fonction(void *rfdata) -{ + +void* refind_answer_fonction(void *rfdata) { isax_node *current_root_node; query_result *n; - isax_index *index=((refind_answer_fonction_data*)rfdata)->index; - ts_type *paa=((refind_answer_fonction_data*)rfdata)->paa; - ts_type *ts=((refind_answer_fonction_data*)rfdata)->ts; - pqueue_t *pq=((refind_answer_fonction_data*)rfdata)->pq; - float minimum_distance=((refind_answer_fonction_data*)rfdata)->minimum_distance; + isax_index *index = ((refind_answer_fonction_data*)rfdata)->index; + ts_type *paa = ((refind_answer_fonction_data*)rfdata)->paa; + ts_type *ts = ((refind_answer_fonction_data*)rfdata)->ts; + pqueue_t *pq = ((refind_answer_fonction_data*)rfdata)->pq; + float minimum_distance = ((refind_answer_fonction_data*)rfdata)->minimum_distance; float bsfdisntance; - int limit=((refind_answer_fonction_data*)rfdata)->limit; + int limit = ((refind_answer_fonction_data*)rfdata)->limit; int checks = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; - query_result *bsf_result=(((refind_answer_fonction_data*)rfdata)->bsf_result); - while (1) - { + query_result *bsf_result = (((refind_answer_fonction_data*)rfdata)->bsf_result); + + while (1) { pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_current_root_node); - current_root_node= ((refind_answer_fonction_data*)rfdata)->current_root_node; - if (current_root_node != NULL) - { - ((refind_answer_fonction_data*)rfdata)->current_root_node=((refind_answer_fonction_data*)rfdata)->current_root_node->next; + current_root_node = ((refind_answer_fonction_data*)rfdata)->current_root_node; + + if (current_root_node != NULL) { + ((refind_answer_fonction_data*)rfdata)->current_root_node = + ((refind_answer_fonction_data*)rfdata)->current_root_node->next; pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_current_root_node); - } - else - { + } else { pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_current_root_node); + break; } - - - query_result * mindist_result = malloc(sizeof(query_result)); + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = current_root_node; pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); pqueue_insert(pq, mindist_result); - pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); } - //printf("this is the check point 1 !!!!!!!!!!!!!!!!!!!\n"); + pthread_barrier_wait(((refind_answer_fonction_data*)rfdata)->lock_barrier); - //printf("this is the check point 2 !!!!!!!!!!!!!!!!!!!\n"); - while (1) - { + + while (1) { pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); - n = pqueue_pop(pq); + n = (query_result*)pqueue_pop(pq); pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); pthread_rwlock_rdlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - bsfdisntance=bsf_result->distance; + bsfdisntance = bsf_result->distance; pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); + // The best node has a worse mindist, so search is finished! if (n->distance >= bsfdisntance || n->distance > minimum_distance) { pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); pqueue_insert(pq, n); pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + break; - } - else - { + } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** - if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) - { + if (!n->node->has_full_data_file && (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue split_node(index, n->node); pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); pqueue_insert(pq, n); pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + continue; } + // *** EXTRA BOUNDING *** - if(tight_bound) { + if (tight_bound) { float mindistance = calculate_minimum_distance(index, n->node, ts, paa); - if(mindistance >= bsfdisntance) - { + + if (mindistance >= bsfdisntance) { free(n); + continue; } } + // *** REAL DISTANCE *** checks++; float distance = calculate_node_distance(index, n->node, ts, bsfdisntance); - if (distance < bsfdisntance) - { + + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - if(distance < bsf_result->distance) - { + + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); } - if(checks > limit) { + + if (checks > limit) { pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); pqueue_insert(pq, n); pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + break; } - } - else { + } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { - if(n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ + if (n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check) { float distance = calculate_node_distance(index, n->node->left_child, ts, bsfdisntance); - if (distance < bsfdisntance) - { + + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - if(distance distance) - { + + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node->left_child; } + pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); } - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->left_child; - pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); - pqueue_insert(pq, mindist_result); - pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + } else { + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->left_child; + pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); + pqueue_insert(pq, mindist_result); + pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); } } + if (n->node->right_child->isax_cardinalities != NULL) { - if(n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ + if (n->node->right_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { float distance = calculate_node_distance(index, n->node->right_child, ts, bsfdisntance); - if (distance < bsfdisntance) - { + + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - if(distance distance) - { + + if (distance distance) { bsf_result->distance = distance; bsf_result->node = n->node->right_child; } + pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); } - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->right_child; - pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); - pqueue_insert(pq, mindist_result); - pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + } else { + query_result *mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->right_child; + pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); + pqueue_insert(pq, mindist_result); + pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); } } } // Free the node currently popped. - free(n); + free(n); } } } -query_result exact_search_m (ts_type *ts, ts_type *paa, isax_index *index, - float minimum_distance, int min_checked_leaves) -{ +query_result exact_search_m(ts_type *ts, ts_type *paa, isax_index *index, + float minimum_distance, int min_checked_leaves) { query_result approximate_result = approximate_search_SIMD(ts, paa, index); query_result bsf_result = approximate_result; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; int i; + // Early termination... if (approximate_result.distance == 0) { return approximate_result; } - if(approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { + + if (approximate_result.distance == FLT_MAX || min_checked_leaves > 1) { approximate_result = refine_answer(ts, paa, index, approximate_result, minimum_distance, min_checked_leaves); } pqueue_t *pq = pqueue_init(index->settings->root_nodes_size, - cmp_pri, get_pri, set_pri, get_pos, set_pos); - - - + cmp_pri, get_pri, set_pri, get_pos, set_pos); query_result *do_not_remove = &approximate_result; - SET_APPROXIMATE(approximate_result.distance); RESET_BYTES_ACCESSED - if(approximate_result.node != NULL) { + if (approximate_result.node != NULL) { // Insert approximate result in heap. pqueue_insert(pq, &approximate_result); - //GOOD: if(approximate_result.node->filename != NULL) - //GOOD: printf("POPS: %.5lf\t", approximate_result.distance); + // GOOD: if(approximate_result.node->filename != NULL) + // GOOD: printf("POPS: %.5lf\t", approximate_result.distance); } // Insert all root nodes in heap. isax_node *current_root_node = index->first_node; - - - - pthread_t threadid[maxquerythread]; + pthread_t threadid[maxquerythread]; refind_answer_fonction_data rfdata; - pthread_mutex_t lock_queue=PTHREAD_MUTEX_INITIALIZER,lock_current_root_node=PTHREAD_MUTEX_INITIALIZER; - pthread_rwlock_t lock_bsf=PTHREAD_RWLOCK_INITIALIZER; + pthread_mutex_t lock_queue = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t lock_current_root_node = PTHREAD_MUTEX_INITIALIZER; + pthread_rwlock_t lock_bsf = PTHREAD_RWLOCK_INITIALIZER; pthread_barrier_t lock_barrier; pthread_barrier_init(&lock_barrier, NULL, maxquerythread); - rfdata.paa=paa; - rfdata.ts=ts; - - rfdata.lock_queue=&lock_queue; - rfdata.lock_current_root_node=&lock_current_root_node; - rfdata.lock_bsf=&lock_bsf; - - rfdata.index=index; - rfdata.minimum_distance=minimum_distance; - //rfdata.limit=limit/4; - - rfdata.pq=pq; + rfdata.paa = paa; + rfdata.ts = ts; + rfdata.lock_queue = &lock_queue; + rfdata.lock_current_root_node = &lock_current_root_node; + rfdata.lock_bsf = &lock_bsf; + rfdata.index = index; + rfdata.minimum_distance = minimum_distance; + rfdata.pq = pq; + // Insert all root nodes in heap. rfdata.current_root_node = index->first_node; rfdata.bsf_result = &bsf_result; - + query_result * n; - - rfdata.lock_barrier=&lock_barrier; - for (i = 0; i < maxquerythread; i++) - { - pthread_create(&(threadid[i]),NULL,exact_search_fonction,(void*)&(rfdata)); - } - for (i = 0; i < maxquerythread; i++) - { - pthread_join(threadid[i],NULL); + + rfdata.lock_barrier = &lock_barrier; + + for (i = 0; i < maxquerythread; i++) { + pthread_create(&(threadid[i]), NULL, exact_search_fonction, (void*)&(rfdata)); } + for (i = 0; i < maxquerythread; i++) { + pthread_join(threadid[i], NULL); + } // Free the nodes that where not popped. - while ((n = pqueue_pop(pq))) - { - if(n != do_not_remove) + while ((n = (query_result*)pqueue_pop(pq))) { + if (n != do_not_remove) { free(n); + } } + // Free the priority queue. pthread_barrier_destroy(&lock_barrier); pqueue_free(pq); - - bsf_result=*(rfdata.bsf_result); - //free(rfdata); - return *(rfdata.bsf_result); - // Free the nodes that where not popped. + bsf_result = *(rfdata.bsf_result); + return *(rfdata.bsf_result); } -void* exact_search_fonction(void *rfdata) -{ + +void* exact_search_fonction(void *rfdata) { isax_node *current_root_node; query_result *n; - isax_index *index=((refind_answer_fonction_data*)rfdata)->index; - ts_type *paa=((refind_answer_fonction_data*)rfdata)->paa; - ts_type *ts=((refind_answer_fonction_data*)rfdata)->ts; - pqueue_t *pq=((refind_answer_fonction_data*)rfdata)->pq; + isax_index *index = ((refind_answer_fonction_data*)rfdata)->index; + ts_type *paa = ((refind_answer_fonction_data*)rfdata)->paa; + ts_type *ts = ((refind_answer_fonction_data*)rfdata)->ts; + pqueue_t *pq = ((refind_answer_fonction_data*)rfdata)->pq; query_result *do_not_remove = ((refind_answer_fonction_data*)rfdata)->bsf_result; - float minimum_distance=((refind_answer_fonction_data*)rfdata)->minimum_distance; + float minimum_distance = ((refind_answer_fonction_data*)rfdata)->minimum_distance; float bsfdisntance; - int limit=((refind_answer_fonction_data*)rfdata)->limit; + int limit = ((refind_answer_fonction_data*)rfdata)->limit; int checks = 0; int tight_bound = index->settings->tight_bound; int aggressive_check = index->settings->aggressive_check; - query_result *bsf_result=(((refind_answer_fonction_data*)rfdata)->bsf_result); - while (1) - { + query_result *bsf_result = (((refind_answer_fonction_data*)rfdata)->bsf_result); + + while (1) { pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_current_root_node); - current_root_node= ((refind_answer_fonction_data*)rfdata)->current_root_node; - if (current_root_node != NULL) - { - ((refind_answer_fonction_data*)rfdata)->current_root_node=((refind_answer_fonction_data*)rfdata)->current_root_node->next; + current_root_node = ((refind_answer_fonction_data*)rfdata)->current_root_node; + + if (current_root_node != NULL) { + ((refind_answer_fonction_data*)rfdata)->current_root_node = + ((refind_answer_fonction_data*)rfdata)->current_root_node->next; pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_current_root_node); - } - else - { + } else { pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_current_root_node); + break; } - - - query_result * mindist_result = malloc(sizeof(query_result)); + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); mindist_result->distance = minidist_paa_to_isax(paa, current_root_node->isax_values, - current_root_node->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - + current_root_node->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); mindist_result->node = current_root_node; pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); @@ -1329,141 +1162,140 @@ void* exact_search_fonction(void *rfdata) pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); } - //printf("this is the check point 1 !!!!!!!!!!!!!!!!!!!\n"); - pthread_barrier_wait(((refind_answer_fonction_data*)rfdata)->lock_barrier); - - while (1) - { + pthread_barrier_wait(((refind_answer_fonction_data*)rfdata)->lock_barrier); + while (1) { pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); - n = pqueue_pop(pq); + n = (query_result*)pqueue_pop(pq); pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); - if(n==NULL) + + if (n == NULL) { break; - //printf("this is the check point of e s !!!\n"); + } + pthread_rwlock_rdlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - bsfdisntance=bsf_result->distance; + bsfdisntance = bsf_result->distance; pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); + // The best node has a worse mindist, so search is finished! if (n->distance >= bsfdisntance || n->distance > minimum_distance) { pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); pqueue_insert(pq, n); pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + break; - } - else - { + } else { // If it is a leaf, check its real distance. if (n->node->is_leaf) { // *** ADAPTIVE SPLITTING *** - if (!n->node->has_full_data_file && - (n->node->leaf_size > index->settings->min_leaf_size)) - { + if (!n->node->has_full_data_file && (n->node->leaf_size > index->settings->min_leaf_size)) { // Split and push again in the queue split_node(index, n->node); pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); pqueue_insert(pq, n); pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + continue; } + // *** EXTRA BOUNDING *** - if(tight_bound) { + if (tight_bound) { float mindistance = calculate_minimum_distance_SIMD(index, n->node, ts, paa); - if(mindistance >= bsfdisntance) - { - if(n != do_not_remove) + + if (mindistance >= bsfdisntance) { + if (n != do_not_remove) { free(n); + } + continue; } } + // *** REAL DISTANCE *** checks++; float distance = calculate_node_distance_SIMD(index, n->node, ts, bsfdisntance); - if (distance < bsfdisntance) - { + + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - if(distance < bsf_result->distance) - { + + if (distance < bsf_result->distance) { bsf_result->distance = distance; bsf_result->node = n->node; } pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); } - //if(checks > limit) { - // pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); - // pqueue_insert(pq, n); - // pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); - // break; - // } - } - else { + } else { // If it is an intermediate node calculate mindist for children // and push them in the queue if (n->node->left_child->isax_cardinalities != NULL) { - if(n->node->left_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ + if (n->node->left_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { float distance = calculate_node_distance_SIMD(index, n->node->left_child, ts, bsfdisntance); - if (distance < bsfdisntance) - { + + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - if(distance distance) - { + + if (distance distance) { bsf_result->distance = distance; bsf_result->node = n->node->left_child; } + pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); } - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, - n->node->left_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->left_child; - pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); - pqueue_insert(pq, mindist_result); - pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->left_child->isax_values, + n->node->left_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->left_child; + pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); + pqueue_insert(pq, mindist_result); + pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); } } + if (n->node->right_child->isax_cardinalities != NULL) { - if(n->node->right_child->is_leaf && !n->node->left_child->has_partial_data_file && aggressive_check){ + if (n->node->right_child->is_leaf && + !n->node->left_child->has_partial_data_file && aggressive_check) { float distance = calculate_node_distance_SIMD(index, n->node->right_child, ts, bsfdisntance); - if (distance < bsfdisntance) - { + + if (distance < bsfdisntance) { pthread_rwlock_wrlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); - if(distance distance) - { + + if (distance distance) { bsf_result->distance = distance; bsf_result->node = n->node->right_child; } + pthread_rwlock_unlock(((refind_answer_fonction_data*)rfdata)->lock_bsf); } - } - else { - query_result * mindist_result = malloc(sizeof(query_result)); - mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, - n->node->right_child->isax_cardinalities, - index->settings->sax_bit_cardinality, - index->settings->sax_alphabet_cardinality, - index->settings->paa_segments, - MINVAL, MAXVAL, - index->settings->mindist_sqrt); - mindist_result->node = n->node->right_child; - pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); - pqueue_insert(pq, mindist_result); - pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); + } else { + query_result * mindist_result = (query_result*)malloc(sizeof(query_result)); + mindist_result->distance = minidist_paa_to_isax(paa, n->node->right_child->isax_values, + n->node->right_child->isax_cardinalities, + index->settings->sax_bit_cardinality, + index->settings->sax_alphabet_cardinality, + index->settings->paa_segments, + MINVAL, MAXVAL, + index->settings->mindist_sqrt); + mindist_result->node = n->node->right_child; + pthread_mutex_lock(((refind_answer_fonction_data*)rfdata)->lock_queue); + pqueue_insert(pq, mindist_result); + pthread_mutex_unlock(((refind_answer_fonction_data*)rfdata)->lock_queue); } } } // Free the node currently popped. - if(n != do_not_remove) + if (n != do_not_remove) { free(n); + } } } -} \ No newline at end of file +} diff --git a/src/ads/pqueue.c b/src/ads/pqueue.c index 363a825a..90dbc502 100644 --- a/src/ads/pqueue.c +++ b/src/ads/pqueue.c @@ -13,7 +13,7 @@ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. -*/ + */ #include "../../config.h" #include "../../globals.h" #include @@ -22,28 +22,26 @@ #include #include "ads/pqueue.h" - #define left(i) ((i) << 1) #define right(i) (((i) << 1) + 1) #define parent(i) ((i) >> 1) - -pqueue_t * -pqueue_init(size_t n, - pqueue_cmp_pri_f cmppri, - pqueue_get_pri_f getpri, - pqueue_set_pri_f setpri, - pqueue_get_pos_f getpos, - pqueue_set_pos_f setpos) -{ +pqueue_t * pqueue_init(size_t n, + pqueue_cmp_pri_f cmppri, + pqueue_get_pri_f getpri, + pqueue_set_pri_f setpri, + pqueue_get_pos_f getpos, + pqueue_set_pos_f setpos) { pqueue_t *q; - if (!(q = malloc(sizeof(pqueue_t)))) + if (!(q = (pqueue_t*)malloc(sizeof(pqueue_t)))) { return NULL; + } /* Need to allocate n+1 elements since element 0 isn't used. */ - if (!(q->d = malloc((n + 1) * sizeof(void *)))) { + if (!(q->d = (void**)malloc((n + 1) * sizeof(void *)))) { free(q); + return NULL; } @@ -58,34 +56,24 @@ pqueue_init(size_t n, return q; } - -void -pqueue_free(pqueue_t *q) -{ +void pqueue_free(pqueue_t *q) { free(q->d); free(q); } - -size_t -pqueue_size(pqueue_t *q) -{ +size_t pqueue_size(pqueue_t *q) { /* queue element 0 exists but doesn't count since it isn't used. */ return (q->size - 1); } - -static void -bubble_up(pqueue_t *q, size_t i) -{ +static void bubble_up(pqueue_t *q, size_t i) { size_t parent_node; void *moving_node = q->d[i]; pqueue_pri_t moving_pri = q->getpri(moving_node); for (parent_node = parent(i); - ((i > 1) && q->cmppri(q->getpri(q->d[parent_node]), moving_pri)); - i = parent_node, parent_node = parent(i)) - { + ((i > 1) && q->cmppri(q->getpri(q->d[parent_node]), moving_pri)); + i = parent_node, parent_node = parent(i)) { q->d[i] = q->d[parent_node]; q->setpos(q->d[i], i); } @@ -94,33 +82,28 @@ bubble_up(pqueue_t *q, size_t i) q->setpos(moving_node, i); } - -static size_t -maxchild(pqueue_t *q, size_t i) -{ +static size_t maxchild(pqueue_t *q, size_t i) { size_t child_node = left(i); - if (child_node >= q->size) + if (child_node >= q->size) { return 0; + } if ((child_node+1) < q->size && - q->cmppri(q->getpri(q->d[child_node]), q->getpri(q->d[child_node+1]))) + q->cmppri(q->getpri(q->d[child_node]), q->getpri(q->d[child_node+1]))) { child_node++; /* use right child instead of left */ + } return child_node; } - -static void -percolate_down(pqueue_t *q, size_t i) -{ +static void percolate_down(pqueue_t *q, size_t i) { size_t child_node; void *moving_node = q->d[i]; pqueue_pri_t moving_pri = q->getpri(moving_node); while ((child_node = maxchild(q, i)) && - q->cmppri(moving_pri, q->getpri(q->d[child_node]))) - { + q->cmppri(moving_pri, q->getpri(q->d[child_node]))) { q->d[i] = q->d[child_node]; q->setpos(q->d[i], i); i = child_node; @@ -130,21 +113,23 @@ percolate_down(pqueue_t *q, size_t i) q->setpos(moving_node, i); } - -int -pqueue_insert(pqueue_t *q, void *d) -{ - void *tmp; +int pqueue_insert(pqueue_t *q, void *d) { + void **tmp; size_t i; size_t newsize; - if (!q) return 1; + if (!q) { + return 1; + } /* allocate more memory if necessary */ if (q->size >= q->avail) { newsize = q->size + q->step; - if (!(tmp = realloc(q->d, sizeof(void *) * newsize))) + + if (!(tmp = (void**)realloc(q->d, sizeof(void *) * newsize))) { return 1; + } + q->d = tmp; q->avail = newsize; } @@ -157,45 +142,39 @@ pqueue_insert(pqueue_t *q, void *d) return 0; } - -void -pqueue_change_priority(pqueue_t *q, - pqueue_pri_t new_pri, - void *d) -{ +void pqueue_change_priority(pqueue_t *q, pqueue_pri_t new_pri, void *d) { size_t posn; pqueue_pri_t old_pri = q->getpri(d); q->setpri(d, new_pri); posn = q->getpos(d); - if (q->cmppri(old_pri, new_pri)) + + if (q->cmppri(old_pri, new_pri)) { bubble_up(q, posn); - else + } else { percolate_down(q, posn); + } } - -int -pqueue_remove(pqueue_t *q, void *d) -{ +int pqueue_remove(pqueue_t *q, void *d) { size_t posn = q->getpos(d); q->d[posn] = q->d[--q->size]; - if (q->cmppri(q->getpri(d), q->getpri(q->d[posn]))) + + if (q->cmppri(q->getpri(d), q->getpri(q->d[posn]))) { bubble_up(q, posn); - else + } else { percolate_down(q, posn); + } return 0; } - -void * -pqueue_pop(pqueue_t *q) -{ +void * pqueue_pop(pqueue_t *q) { void *head; - if (!q || q->size == 1) + if (!q || q->size == 1) { return NULL; + } head = q->d[1]; q->d[1] = q->d[--q->size]; @@ -204,229 +183,162 @@ pqueue_pop(pqueue_t *q) return head; } - -void * -pqueue_peek(pqueue_t *q) -{ +void * pqueue_peek(pqueue_t *q) { void *d; - if (!q || q->size == 1) + + if (!q || q->size == 1) { return NULL; + } + d = q->d[1]; + return d; } +void pqueue_dump(pqueue_t *q, FILE *out, pqueue_print_entry_f print) { + fprintf(stdout, "posn\tleft\tright\tparent\tmaxchild\t...\n"); -void -pqueue_dump(pqueue_t *q, - FILE *out, - pqueue_print_entry_f print) -{ - int i; - - fprintf(stdout,"posn\tleft\tright\tparent\tmaxchild\t...\n"); - for (i = 1; i < q->size ;i++) { - fprintf(stdout, - "%d\t%d\t%d\t%d\t%ul\t", - i, - left(i), right(i), parent(i), + for (int i = 1; i < q->size; i++) { + fprintf(stdout, "%d\t%d\t%d\t%d\t%ul\t", i, left(i), right(i), parent(i), (unsigned int)maxchild(q, i)); print(out, q->d[i]); } } - -static void -set_pos(void *d, size_t val) -{ +static void set_pos(void *d, size_t val) { /* do nothing */ } - -static void -set_pri(void *d, pqueue_pri_t pri) -{ +static void set_pri(void *d, pqueue_pri_t pri) { /* do nothing */ } - -void -pqueue_print(pqueue_t *q, - FILE *out, - pqueue_print_entry_f print) -{ +void pqueue_print(pqueue_t *q, FILE *out, pqueue_print_entry_f print) { pqueue_t *dup; - void *e; + void *e; - dup = pqueue_init(q->size, - q->cmppri, q->getpri, set_pri, - q->getpos, set_pos); + dup = pqueue_init(q->size, q->cmppri, q->getpri, set_pri, q->getpos, set_pos); dup->size = q->size; dup->avail = q->avail; dup->step = q->step; memcpy(dup->d, q->d, (q->size * sizeof(void *))); - while ((e = pqueue_pop(dup))) - print(out, e); + while ((e = pqueue_pop(dup))) { + print(out, e); + } pqueue_free(dup); } - -static int -subtree_is_valid(pqueue_t *q, int pos) -{ +static int subtree_is_valid(pqueue_t *q, int pos) { if (left(pos) < q->size) { /* has a left child */ - if (q->cmppri(q->getpri(q->d[pos]), q->getpri(q->d[left(pos)]))) + if (q->cmppri(q->getpri(q->d[pos]), q->getpri(q->d[left(pos)]))) { return 0; - if (!subtree_is_valid(q, left(pos))) + } + + if (!subtree_is_valid(q, left(pos))) { return 0; + } } + if (right(pos) < q->size) { /* has a right child */ - if (q->cmppri(q->getpri(q->d[pos]), q->getpri(q->d[right(pos)]))) + if (q->cmppri(q->getpri(q->d[pos]), q->getpri(q->d[right(pos)]))) { return 0; - if (!subtree_is_valid(q, right(pos))) + } + + if (!subtree_is_valid(q, right(pos))) { return 0; + } } + return 1; } - -int -pqueue_is_valid(pqueue_t *q) -{ +int pqueue_is_valid(pqueue_t *q) { return subtree_is_valid(q, 1); } - - - - - - - - - - - - /* Function to create an empty priority queue */ -pqueue_bsf* pqueue_bsf_init(int k) -{ - - pqueue_bsf *q; +pqueue_bsf* pqueue_bsf_init(int k) { + pqueue_bsf *q; - if (!(q = malloc(sizeof(pqueue_bsf)))) + if (!(q = (pqueue_bsf*)malloc(sizeof(pqueue_bsf)))) { return NULL; - if (!(q->position = malloc(sizeof(long unsigned int)*k))) + } + + if (!(q->position = (long int*)malloc(sizeof(long unsigned int)*k))) { return NULL; - if (!(q->knn = malloc(sizeof(float)*k))) + } + + if (!(q->knn = (float*)malloc(sizeof(float)*k))) { return NULL; - if (!(q->node = malloc(sizeof(isax_node *)*k))) + } + + if (!(q->node = (isax_node**)malloc(sizeof(isax_node *)*k))) { return NULL; + } - for (int i = 0; i < k; ++i) - { - q->knn[i]=FLT_MAX; + for (int i = 0; i < k; ++i) { + q->knn[i] = FLT_MAX; } - q->k=k; - q->nowk=0; + + q->k = k; + q->nowk = 0; + return q; } - - /* Function to insert value into priority queue */ - - - - /* Function to check priority and place element */ - -void pqueue_bsf_insert(pqueue_bsf *q,float data,long int position, isax_node *node) -{ - - int i,j; - - for (i = 0; i < q->k; i++) - { - - if (data <= q->knn[i]) - { - //for (int w=0; wk; w++) { - //printf("[%d] %f\n", w, q->knn[w]); - //} - - for (j = q->k-1; j > i; j--) - { - - q->knn[j] =q->knn[j - 1]; - q->position[j]=q->position[j - 1]; +void pqueue_bsf_insert(pqueue_bsf *q, float data, long int position, isax_node *node) { + for (long int i = 0; i < q->k; i++) { + if (data <= q->knn[i]) { + for (int j = q->k-1; j > i; j--) { + q->knn[j] = q->knn[j - 1]; + q->position[j] = q->position[j - 1]; q->node[j] = q->node[j - 1]; } q->knn[i] = data; - q->position[i]=position; + q->position[i] = position; q->node[i] = node; - //for (int w=0; wk; w++) { - //printf("[%d] %f\n", w, q->knn[w]); - //} - return; - } - } } - -void pqueue_bsfre_insert(pqueue_bsf *q,float data,long int position, isax_node *node) -{ - - int i,j; - if(q->nowk==q->k) - { - q->k=q->k*2; - realloc(q->position,sizeof(long int)*(q->k)); - realloc(q->knn ,sizeof(float)*(q->k)); - - +void pqueue_bsfre_insert(pqueue_bsf *q, float data, long int position, isax_node *node) { + if (q->nowk == q->k) { + q->k = q->k*2; + realloc(q->position, sizeof(long int) * (q->k)); + realloc(q->knn, sizeof(float) * (q->k)); } - for (i = 0; i < q->nowk; i++) - { - if (data <= q->knn[i]) - { - for (j = q->nowk; j > i; j--) - { - - q->knn[j] =q->knn[j - 1]; - q->position[j]=q->position[j - 1]; + for (int i = 0; i < q->nowk; i++) { + if (data <= q->knn[i]) { + for (int j = q->nowk; j > i; j--) { + q->knn[j] = q->knn[j - 1]; + q->position[j] = q->position[j - 1]; } + q->knn[i] = data; - q->position[i]=position; - //for (int w=0; wk; w++) { - //printf("[%d] %f\n", w, q->knn[w]); - //} + q->position[i] = position; q->nowk++; + return; } } + q->knn[q->nowk] = data; - q->position[q->nowk]=position; + q->position[q->nowk] = position; q->nowk++; } - /* Function to delete an element from queue */ - - - - /* Function to display queue elements */ - diff --git a/src/ads/sax/sax.c b/src/ads/sax/sax.c index 8c7d12a5..c7fa3a27 100644 --- a/src/ads/sax/sax.c +++ b/src/ads/sax/sax.c @@ -4,13 +4,15 @@ // // Created by Kostas Zoumpatianos and Botao Peng, March 2020 // -//#define DEBUG; +// #define DEBUG; #include "../../../config.h" #include "../../../globals.h" #include #include #include +#if defined(__x86_64__) #include "immintrin.h" +#endif #ifdef VALUES @@ -27,8 +29,8 @@ */ int compare(const void *a, const void *b) { float *c = (float *) b - 1; + if (*(float *) a > *(float *) c && *(float *) a <= *(float *) b) { - //printf("Found %lf between %lf and %lf\n",*(float*)a,*(float*)c,*(float*)b); return 0; } else if (*(float *) a <= *(float *) c) { return -1; @@ -41,33 +43,29 @@ int compare(const void *a, const void *b) { Calculate paa. */ enum response paa_from_ts(ts_type *ts_in, ts_type *paa_out, int segments, - int ts_values_per_segment, int timeseries_size) { - //fprintf(stderr, "paa from ts\n"); + int ts_values_per_segment, int timeseries_size) { + int left_values = timeseries_size; // if timeseries size is not divisible by segments - int s, i; - int left_values = timeseries_size; // if timeseries size is not divisible by segments - for (s = 0; s < segments; s++) { + for (int s = 0; s < segments; s++) { paa_out[s] = 0; - for (i = 0; i < min(ts_values_per_segment, left_values); i++) { + + for (int i = 0; i < min(ts_values_per_segment, left_values); i++) { paa_out[s] += ts_in[(s * ts_values_per_segment) + i]; } + paa_out[s] /= ts_values_per_segment; left_values -= ts_values_per_segment; - // printf("%0.1f,", paa_out[s]); } + return SUCCESS; } enum response sax_from_paa(ts_type *paa, sax_type *sax, int segments, - int cardinality, int bit_cardinality) { - //fprintf(stderr, "sax from paa\n"); - + int cardinality, int bit_cardinality) { int offset = ((cardinality - 1) * (cardinality - 2)) / 2; - //printf("FROM %lf TO %lf\n", sax_breakpoints[offset], sax_breakpoints[offset + cardinality - 2]); - int si; - for (si = 0; si < segments; si++) { + for (int si = 0; si < segments; si++) { sax[si] = 0; // First object = sax_breakpoints[offset] @@ -75,11 +73,12 @@ enum response sax_from_paa(ts_type *paa, sax_type *sax, int segments, // Size of sub-array = cardinality - 1 float *res = (float *) bsearch(&paa[si], &sax_breakpoints[offset], cardinality - 1, - sizeof(ts_type), compare); - if (res != NULL) + sizeof(ts_type), compare); + if (res != NULL) { sax[si] = (int) (res - &sax_breakpoints[offset]); - else if (paa[si] > 0) + } else if (paa[si] > 0) { sax[si] = cardinality - 1; + } } return SUCCESS; @@ -90,38 +89,37 @@ enum response sax_from_paa(ts_type *paa, sax_type *sax, int segments, This function converts a ts record into its sax representation. */ enum response sax_from_ts(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, - int segments, int cardinality, int bit_cardinality, int timeseries_size) { + int segments, int cardinality, int bit_cardinality, int timeseries_size) { // Create PAA representation - float *paa = malloc(sizeof(float) * segments); + float *paa = (float*)malloc(sizeof(float) * segments); + if (paa == NULL) { fprintf(stderr, "error: could not allocate memory for PAA representation.\n"); + return FAILURE; } - int s, i; - int left_values = timeseries_size; // if timeseries size is not divisible by segments - for (s = 0; s < segments; s++) { + int left_values = timeseries_size; // if timeseries size is not divisible by segments + + for (int s = 0; s < segments; s++) { paa[s] = 0; - for (i = 0; i < min(ts_values_per_segment, left_values); i++) { + + for (int i = 0; i < min(ts_values_per_segment, left_values); i++) { paa[s] += ts_in[(s * ts_values_per_segment) + i]; } + paa[s] /= ts_values_per_segment; left_values -= ts_values_per_segment; - //#ifdef DEBUG - //printf("%d: %lf\n", s, paa[s]); - //#endif } // Convert PAA to SAX // Note: Each cardinality has cardinality - 1 break points if c is cardinality - // the breakpoints can be found in the following array positions: - // FROM (c - 1) * (c - 2) / 2 + // the breakpoints can be found in the following array positions: + // FROM (c - 1) * (c - 2) / 2 // TO (c - 1) * (c - 2) / 2 + c - 1 int offset = ((cardinality - 1) * (cardinality - 2)) / 2; - //printf("FROM %lf TO %lf\n", sax_breakpoints[offset], sax_breakpoints[offset + cardinality - 2]); - int si; - for (si = 0; si < segments; si++) { + for (int si = 0; si < segments; si++) { sax_out[si] = 0; // First object = sax_breakpoints[offset] @@ -129,51 +127,51 @@ enum response sax_from_ts(ts_type *ts_in, sax_type *sax_out, int ts_values_per_s // Size of sub-array = cardinality - 1 float *res = (float *) bsearch(&paa[si], &sax_breakpoints[offset], cardinality - 1, - sizeof(ts_type), compare); - if (res != NULL) + sizeof(ts_type), compare); + if (res != NULL) { sax_out[si] = (int) (res - &sax_breakpoints[offset]); - else if (paa[si] > 0) + } else if (paa[si] > 0) { sax_out[si] = cardinality - 1; + } } - //sax_print(sax_out, segments, cardinality); free(paa); + return SUCCESS; } enum response sax_from_ts_new(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, - int segments, int cardinality, int bit_cardinality, int timeseries_size) { + int segments, int cardinality, int bit_cardinality, int timeseries_size) { // Create PAA representation - float *paa = malloc(sizeof(float) * segments); + float *paa = (float*)malloc(sizeof(float) * segments); + if (paa == NULL) { fprintf(stderr, "error: could not allocate memory for PAA representation.\n"); + return FAILURE; } - int s, i; - int left_values = timeseries_size; // if timeseries size is not divisible by segments - for (s = 0; s < segments; s++) { + int left_values = timeseries_size; // if timeseries size is not divisible by segments + + for (int s = 0; s < segments; s++) { paa[s] = 0; - for (i = 0; i < min(ts_values_per_segment, left_values); i++) { + + for (int i = 0; i < min(ts_values_per_segment, left_values); i++) { paa[s] += ts_in[(s * ts_values_per_segment) + i]; } + paa[s] /= ts_values_per_segment; left_values -= ts_values_per_segment; - //#ifdef DEBUG - //printf("%d: %lf\n", s, paa[s]); - //#endif } // Convert PAA to SAX // Note: Each cardinality has cardinality - 1 break points if c is cardinality - // the breakpoints can be found in the following array positions: - // FROM (c - 1) * (c - 2) / 2 + // the breakpoints can be found in the following array positions: + // FROM (c - 1) * (c - 2) / 2 // TO (c - 1) * (c - 2) / 2 + c - 1 - //int offset = ((cardinality - 1) * (cardinality - 2)) / 2; - //printf("FROM %lf TO %lf\n", sax_breakpoints[offset], sax_breakpoints[offset + cardinality - 2]); + // int offset = ((cardinality - 1) * (cardinality - 2)) / 2; - int si; - for (si = 0; si < segments; si++) { + for (int si = 0; si < segments; si++) { sax_out[si] = 0; // First object = sax_breakpointsnew3[0] @@ -181,58 +179,56 @@ enum response sax_from_ts_new(ts_type *ts_in, sax_type *sax_out, int ts_values_p // Size of sub-array = cardinality - 1 float *res = (float *) bsearch(&paa[si], &sax_breakpointsnew3[0], cardinality - 1, - sizeof(ts_type), compare); - if (res != NULL) + sizeof(ts_type), compare); + if (res != NULL) { sax_out[si] = (int) (res - &sax_breakpointsnew3[0]); - else if (paa[si] > 0) + } else if (paa[si] > 0) { sax_out[si] = cardinality - 1; - - + } } - //sax_print(sax_out, segments, cardinality); free(paa); + return SUCCESS; } +#if defined(__x86_64__) enum response sax_from_ts_SIMD(ts_type *ts_in, sax_type *sax_out, int ts_values_per_segment, - int segments, int cardinality, int bit_cardinality) { + int segments, int cardinality, int bit_cardinality) { // Create PAA representation - float *paa = malloc(sizeof(float) * segments); + float *paa = (float*)malloc(sizeof(float) * segments); + if (paa == NULL) { fprintf(stderr, "error: could not allocate memory for PAA representation.\n"); + return FAILURE; } - int s, i; float paasss[8]; - for (s = 0; s < segments; s++) { + + for (int s = 0; s < segments; s++) { paa[s] = 0; __m256 a = _mm256_load_ps(&ts_in[(s * ts_values_per_segment)]); - for (i = 8; i < ts_values_per_segment; i += 8) { + + for (int i = 8; i < ts_values_per_segment; i += 8) { __m256 b = _mm256_load_ps(&ts_in[(s * ts_values_per_segment + i)]); a = _mm256_add_ps(a, b); - //paa[s] += ts_in[(s * ts_values_per_segment)+i]; } + a = _mm256_hadd_ps(a, a); a = _mm256_hadd_ps(a, a); _mm256_storeu_ps(paasss, a); paa[s] = (paasss[0] + paasss[4]) / ts_values_per_segment; - //#ifdef DEBUG - //printf("%d: %lf\n", s, paa[s]); - //#endif } // Convert PAA to SAX // Note: Each cardinality has cardinality - 1 break points if c is cardinality - // the breakpoints can be found in the following array positions: - // FROM (c - 1) * (c - 2) / 2 + // the breakpoints can be found in the following array positions: + // FROM (c - 1) * (c - 2) / 2 // TO (c - 1) * (c - 2) / 2 + c - 1 int offset = ((cardinality - 1) * (cardinality - 2)) / 2; - //printf("FROM %lf TO %lf\n", sax_breakpoints[offset], sax_breakpoints[offset + cardinality - 2]); - int si; - for (si = 0; si < segments; si++) { + for (int si = 0; si < segments; si++) { sax_out[si] = 0; // First object = sax_breakpoints[offset] @@ -240,28 +236,33 @@ enum response sax_from_ts_SIMD(ts_type *ts_in, sax_type *sax_out, int ts_values_ // Size of sub-array = cardinality - 1 float *res = (float *) bsearch(&paa[si], &sax_breakpoints[offset], cardinality - 1, - sizeof(ts_type), compare); - if (res != NULL) + sizeof(ts_type), compare); + if (res != NULL) { sax_out[si] = (int) (res - &sax_breakpoints[offset]); - else if (paa[si] > 0) + } else if (paa[si] > 0) { sax_out[si] = cardinality - 1; + } } - //sax_print(sax_out, segments, cardinality); free(paa); + return SUCCESS; } +#endif void printbin(unsigned long long n, int size) { - char *b = malloc(sizeof(char) * (size + 1)); + char *b = (char*)malloc(sizeof(char) * (size + 1)); int i; for (i = 0; i < size; i++) { b[i] = '0'; } - for (i = 0; i < size; i++, n = n / 2) - if (n % 2) b[size - 1 - i] = '1'; + for (i = 0; i < size; i++, n = n / 2) { + if (n % 2) { + b[size - 1 - i] = '1'; + } + } b[size] = '\0'; printf("%s\n", b); @@ -269,67 +270,63 @@ void printbin(unsigned long long n, int size) { } void serial_printbin(unsigned long long n, int size) { - char *b = malloc(sizeof(char) * (size + 1)); + char *b = (char*)malloc(sizeof(char) * (size + 1)); int i; for (i = 0; i < size; i++) { b[i] = '0'; } - for (i = 0; i < size; i++, n = n / 2) + for (i = 0; i < size; i++, n = n / 2) { if (n % 2) b[size - 1 - i] = '1'; + } b[size] = '\0'; printf(" %s ", b); } - /** This function prints a sax record. */ void sax_print(sax_type *sax, int segments, int cardinality) { - int i; - for (i = 0; i < segments; i++) { + for (int i = 0; i < segments; i++) { printf("%d:\t", i); printbin(sax[i], cardinality); } + printf("\n"); } float minidist_paa_to_isax(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt) { - //fprintf(stderr, "paa mindist\n"); - + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt) { float distance = 0.0; - // TODO: Store offset in index settings. and pass index settings as parameter. - + // TODO(someone): Store offset in index settings. and pass index settings as parameter. int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; // For each sax record find the break point - int i; - for (i = 0; i < number_of_segments; i++) { - + for (int i = 0; i < number_of_segments; i++) { sax_type c_c = sax_cardinalities[i]; sax_type c_m = max_bit_cardinality; sax_type v = sax[i]; sax_type region_lower = (v << (c_m - c_c)); - sax_type region_upper = (~((int) MAXFLOAT << (c_m - c_c)) | region_lower); - float breakpoint_lower; // <-- TODO: calculate breakpoints. - float breakpoint_upper; // <-- - || - + sax_type region_upper = (~((int) 0x7fffffff << (c_m - c_c)) | region_lower); + float breakpoint_lower; // <-- TODO(someone): calculate breakpoints. + float breakpoint_upper; // <-- - || - if (region_lower == 0) { breakpoint_lower = min_val; } else { breakpoint_lower = sax_breakpoints[offset + region_lower - 1]; } + if (region_upper == max_cardinality - 1) { breakpoint_upper = max_val; } else { @@ -343,21 +340,20 @@ float minidist_paa_to_isax(float *paa, sax_type *sax, } } - //distance = ratio_sqrt * sqrtf(distance); - distance = ratio_sqrt * distance; - return distance; + return ratio_sqrt * distance; } +#if defined(__x86_64__) float minidist_paa_to_isax_SIMD(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt) { - - int region_upper[16], region_lower[16]; + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt) { + int region_upper[16]; + int region_lower[16]; float distancef[16]; int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; @@ -365,39 +361,28 @@ float minidist_paa_to_isax_SIMD(float *paa, sax_type *sax, __m256i vloweroffset = _mm256_set1_epi32(offset - 1); __m256i vupperoffset = _mm256_set1_epi32(offset); - //__m256i c_cv_0 = _mm256_set_epi32 ( sax_cardinalities[7] , sax_cardinalities[6] ,sax_cardinalities[5] ,sax_cardinalities[4] , sax_cardinalities[3] ,sax_cardinalities[2] ,sax_cardinalities[1],sax_cardinalities[0]); - //__m256i c_cv_1 = _mm256_set_epi32 ( sax_cardinalities[15], sax_cardinalities[14],sax_cardinalities[13],sax_cardinalities[12], sax_cardinalities[11],sax_cardinalities[10],sax_cardinalities[9],sax_cardinalities[8]); - __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const void *) sax_cardinalities); + __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const __m128i*) sax_cardinalities); __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); - //__m256i v_0 = _mm256_set_epi32 (sax[7],sax[6],sax[5],sax[4],sax[3],sax[2],sax[1],sax[0]); - //__m256i v_1 = _mm256_set_epi32 (sax[15],sax[14],sax[13],sax[12],sax[11],sax[10],sax[9],sax[8]); - __m128i saxv8 = _mm_lddqu_si128((const void *) sax); + __m128i saxv8 = _mm_lddqu_si128((const __m128i*) sax); __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); __m128i saxv16_0 = _mm256_extractf128_si256(saxv16, 0); __m128i saxv16_1 = _mm256_extractf128_si256(saxv16, 1); __m256i v_0 = _mm256_cvtepu16_epi32(saxv16_0); __m256i v_1 = _mm256_cvtepu16_epi32(saxv16_1); - __m256i c_m = _mm256_set1_epi32(max_bit_cardinality); __m256i cm_ccv_0 = _mm256_sub_epi32(c_m, c_cv_0); __m256i cm_ccv_1 = _mm256_sub_epi32(c_m, c_cv_1); - //__m256i _mm256_set_epi32 (int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0) - // __m256i _mm256_set1_epi32 (int a) __m256i region_lowerv_0 = _mm256_sllv_epi32(v_0, cm_ccv_0); __m256i region_lowerv_1 = _mm256_sllv_epi32(v_1, cm_ccv_1); - //region_lowerv_0 = _mm256_sllv_epi32 (region_lowerv_0, cm_ccv_0); - //region_lowerv_1 = _mm256_sllv_epi32 (region_lowerv_1, cm_ccv_1); - __m256i v1 = _mm256_set1_epi32((int) 0x7f800000); - //__m256i v1= _mm256_andnot_si256 (_mm256_setzero_si256 (), vectorsignbit); __m256i region_upperv_0 = _mm256_sllv_epi32(v1, cm_ccv_0); __m256i region_upperv_1 = _mm256_sllv_epi32(v1, cm_ccv_1); @@ -412,14 +397,12 @@ float minidist_paa_to_isax_SIMD(float *paa, sax_type *sax, region_lowerv_1 = _mm256_add_epi32(region_lowerv_1, vloweroffset); region_upperv_0 = _mm256_add_epi32(region_upperv_0, vupperoffset); region_upperv_1 = _mm256_add_epi32(region_upperv_1, vupperoffset); - _mm256_storeu_si256((void *) &(region_lower[0]), region_lowerv_0); - _mm256_storeu_si256((void *) &(region_lower[8]), region_lowerv_1); - _mm256_storeu_si256((void *) &(region_upper[0]), region_upperv_0); - _mm256_storeu_si256((void *) &(region_upper[8]), region_upperv_1); - - - //lower + _mm256_storeu_si256((__m256i_u*) &(region_lower[0]), region_lowerv_0); + _mm256_storeu_si256((__m256i_u*) &(region_lower[8]), region_lowerv_1); + _mm256_storeu_si256((__m256i_u*) &(region_upper[0]), region_upperv_0); + _mm256_storeu_si256((__m256i_u*) &(region_upper[8]), region_upperv_1); + // lower __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32(region_lowerv_0, _mm256_setzero_si256()); __m256i lower_juge_zerov_1 = _mm256_cmpeq_epi32(region_lowerv_1, _mm256_setzero_si256()); @@ -428,54 +411,19 @@ float minidist_paa_to_isax_SIMD(float *paa, sax_type *sax, __m256 minvalv = _mm256_set1_ps(min_val); - __m256 lsax_breakpoints_shiftv_0 = _mm256_i32gather_ps(sax_breakpoints, region_lowerv_0, 4); - //__m256 lsax_breakpoints_shiftv_0= _mm256_set_ps (sax_breakpoints[region_lower[7]], - //sax_breakpoints[region_lower[6]], - //sax_breakpoints[region_lower[5]], - //sax_breakpoints[region_lower[4]], - //sax_breakpoints[region_lower[3]], - //sax_breakpoints[region_lower[2]], - //sax_breakpoints[region_lower[1]], - //sax_breakpoints[region_lower[0]]); __m256 lsax_breakpoints_shiftv_1 = _mm256_i32gather_ps(sax_breakpoints, region_lowerv_1, 4); - //__m256 lsax_breakpoints_shiftv_1= _mm256_set_ps (sax_breakpoints[region_lower[15]], - //sax_breakpoints[region_lower[14]], - //sax_breakpoints[region_lower[13]], - //sax_breakpoints[region_lower[12]], - //sax_breakpoints[region_lower[11]], - //sax_breakpoints[region_lower[10]], - //sax_breakpoints[region_lower[9]], - //sax_breakpoints[region_lower[8]]); - __m256 breakpoint_lowerv_0 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_0, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_0, - (__m256i) lsax_breakpoints_shiftv_0)); + _mm256_and_si256(lower_juge_nzerov_0, + (__m256i) lsax_breakpoints_shiftv_0)); __m256 breakpoint_lowerv_1 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_1, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_1, - (__m256i) lsax_breakpoints_shiftv_1)); + _mm256_and_si256(lower_juge_nzerov_1, + (__m256i) lsax_breakpoints_shiftv_1)); - //uper + // uper __m256 usax_breakpoints_shiftv_0 = _mm256_i32gather_ps(sax_breakpoints, region_upperv_0, 4); - //__m256 usax_breakpoints_shiftv_0= _mm256_set_ps (sax_breakpoints[region_upper[7]], - //sax_breakpoints[region_upper[6]], - //sax_breakpoints[region_upper[5]], - //sax_breakpoints[region_upper[4]], - //sax_breakpoints[region_upper[3]], - //sax_breakpoints[region_upper[2]], - //sax_breakpoints[region_upper[1]], - //sax_breakpoints[region_upper[0]]); __m256 usax_breakpoints_shiftv_1 = _mm256_i32gather_ps(sax_breakpoints, region_upperv_1, 4); - //__m256 usax_breakpoints_shiftv_1= _mm256_set_ps (sax_breakpoints[region_upper[15]], - //sax_breakpoints[region_upper[14]], - //sax_breakpoints[region_upper[13]], - //sax_breakpoints[region_upper[12]], - //sax_breakpoints[region_upper[11]], - //sax_breakpoints[region_upper[10]], - //sax_breakpoints[region_upper[9]], - //sax_breakpoints[region_upper[8]]); - __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(max_cardinality - 1)); __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32(region_upperv_1, _mm256_set1_epi32(max_cardinality - 1)); @@ -490,28 +438,20 @@ float minidist_paa_to_isax_SIMD(float *paa, sax_type *sax, _mm256_and_si256(upper_juge_maxv_1, (__m256i) _mm256_set1_ps(max_val)), _mm256_and_si256(upper_juge_nmaxv_1, (__m256i) usax_breakpoints_shiftv_1)); - - - - - - - //dis - __m256 paav_0, paav_1; - + // dis + __m256 paav_0; + __m256 paav_1; paav_0 = _mm256_loadu_ps(paa); paav_1 = _mm256_loadu_ps(&(paa[8])); - __m256 dis_juge_upv_0 = _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_GT_OS); __m256 dis_juge_upv_1 = _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_GT_OS); - __m256 dis_juge_lov_0 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); + (__m256i) _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); __m256 dis_juge_lov_1 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS)); + (__m256i) _mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS)); __m256 dis_juge_elv_0 = (__m256) _mm256_andnot_si256( _mm256_or_si256((__m256i) dis_juge_upv_0, (__m256i) dis_juge_lov_0), vectorsignbit); @@ -523,146 +463,109 @@ float minidist_paa_to_isax_SIMD(float *paa, sax_type *sax, __m256 dis_uppv_0 = _mm256_sub_ps(breakpoint_upperv_0, paav_0); __m256 dis_uppv_1 = _mm256_sub_ps(breakpoint_upperv_1, paav_1); - __m256 distancev_0 = (__m256) _mm256_or_si256( _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), - _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)), - _mm256_and_si256((__m256i) dis_juge_elv_0, (__m256i) _mm256_set1_ps(0.0))); + _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)), + _mm256_and_si256((__m256i) dis_juge_elv_0, (__m256i) _mm256_set1_ps(0.0))); __m256 distancev_1 = (__m256) _mm256_or_si256( _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_1, (__m256i) dis_lowv_1), - _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)), - _mm256_and_si256((__m256i) dis_juge_elv_1, (__m256i) _mm256_set1_ps(0.0))); - + _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)), + _mm256_and_si256((__m256i) dis_juge_elv_1, (__m256i) _mm256_set1_ps(0.0))); __m256 distancesum_0 = _mm256_dp_ps(distancev_0, distancev_0, 0xff); __m256 distancesum_1 = _mm256_dp_ps(distancev_1, distancev_1, 0xff); __m256 distancevf = _mm256_add_ps(distancesum_0, distancesum_1); - //__m256 distancev2 = _mm256_hadd_ps (distancev, distancev); - //__m256 distancevf = _mm256_hadd_ps (distancev2, distancev2); - //__m256 _mm256_dp_ps (__m256 a, __m256 b, const int imm8); _mm256_storeu_ps(distancef, distancevf); - //_mm256_storeu_ps (&checkvalue[8] ,distancev_1); - return (distancef[0] + distancef[4]) * ratio_sqrt; } +#endif float minidist_paa_to_isax_raw(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt) { - + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt) { float distance = 0; - // TODO: Store offset in index settings. and pass index settings as parameter. - + // TODO(someone): Store offset in index settings. and pass index settings as parameter. int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; // For each sax record find the break point - int i; - for (i = 0; i < number_of_segments; i++) { - + for (int i = 0; i < number_of_segments; i++) { sax_type c_c = sax_cardinalities[i]; sax_type c_m = max_bit_cardinality; sax_type v = sax[i]; - //sax_print(&v, 1, c_m); - - sax_type region_lower = (v >> (c_m - c_c)) << (c_m - c_c);//shift operation - sax_type region_upper = (~((int) MAXFLOAT << (c_m - c_c)) | region_lower); - //printf("[%d, %d] %d -- %d\n", sax[i], c_c, region_lower, region_upper); - - float breakpoint_lower = 0; // <-- TODO: calculate breakpoints. - float breakpoint_upper = 0; // <-- - || - + sax_type region_lower = (v >> (c_m - c_c)) << (c_m - c_c); // shift operation + sax_type region_upper = (~((int) 0x7fffffff << (c_m - c_c)) | region_lower); + float breakpoint_lower = 0; // <-- TODO(someone): calculate breakpoints. + float breakpoint_upper = 0; // <-- - || - if (region_lower == 0) { breakpoint_lower = min_val; } else { breakpoint_lower = sax_breakpoints[offset + region_lower - 1]; } + if (region_upper == max_cardinality - 1) { breakpoint_upper = max_val; } else { - breakpoint_upper = sax_breakpoints[offset + region_upper];//search in a list(why?) + breakpoint_upper = sax_breakpoints[offset + region_upper]; // search in a list(why?) } - //printf("\n%d.%d is from %d to %d, %lf - %lf\n", v, c_c, region_lower, region_upper, - // breakpoint_lower, breakpoint_upper); - - //printf("FROM: \n"); - //sax_print(®ion_lower, 1, c_m); - //printf("TO: \n"); - //sax_print(®ion_upper, 1, c_m); - - //printf ("\n---------\n"); - if (breakpoint_lower > paa[i]) { distance += pow(breakpoint_lower - paa[i], 2); } else if (breakpoint_upper < paa[i]) { distance += pow(breakpoint_upper - paa[i], 2); } - - -// else { -// printf("%lf is between: %lf and %lf\n", paa[i], breakpoint_lower, breakpoint_upper); -// } } - //distance = ratio_sqrt * sqrtf(distance); - distance = ratio_sqrt * distance; - return distance; + return ratio_sqrt * distance; } -float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt) { - - int region_upper[16], region_lower[16]; +#if defined(__x86_64__) +float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, sax_type *sax_cardinalities, sax_type max_bit_cardinality, + int max_cardinality, int number_of_segments, int min_val, int max_val, float ratio_sqrt) { + int region_upper[16]; + int region_lower[16]; float distancef[16]; int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; __m256i vectorsignbit = _mm256_set1_epi32(0xffffffff); - //__m256i c_cv_0 = _mm256_set_epi32 ( sax_cardinalities[7] , sax_cardinalities[6] ,sax_cardinalities[5] ,sax_cardinalities[4] , sax_cardinalities[3] ,sax_cardinalities[2] ,sax_cardinalities[1],sax_cardinalities[0]); - //__m256i c_cv_1 = _mm256_set_epi32 ( sax_cardinalities[15], sax_cardinalities[14],sax_cardinalities[13],sax_cardinalities[12], sax_cardinalities[11],sax_cardinalities[10],sax_cardinalities[9],sax_cardinalities[8]); - __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const void *) sax_cardinalities); - __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); - __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); - __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); - __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); - __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); +// __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const __m128i*) sax_cardinalities); +// __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); +// __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); +// __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); +// __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); +// __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); + __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const __m128i*) sax_cardinalities); + __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); + __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); + __m256i c_cv_0 = _mm256_cvtepu8_epi32(sax_cardinalitiesv8); + __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); - //__m256i v_0 = _mm256_set_epi32 (sax[7],sax[6],sax[5],sax[4],sax[3],sax[2],sax[1],sax[0]); - //__m256i v_1 = _mm256_set_epi32 (sax[15],sax[14],sax[13],sax[12],sax[11],sax[10],sax[9],sax[8]); - __m128i saxv8 = _mm_lddqu_si128((const void *) sax); + + __m128i saxv8 = _mm_lddqu_si128((const __m128i*) sax); __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); __m128i saxv16_0 = _mm256_extractf128_si256(saxv16, 0); __m128i saxv16_1 = _mm256_extractf128_si256(saxv16, 1); __m256i v_0 = _mm256_cvtepu16_epi32(saxv16_0); __m256i v_1 = _mm256_cvtepu16_epi32(saxv16_1); - __m256i c_m = _mm256_set1_epi32(max_bit_cardinality); __m256i cm_ccv_0 = _mm256_sub_epi32(c_m, c_cv_0); __m256i cm_ccv_1 = _mm256_sub_epi32(c_m, c_cv_1); - //__m256i _mm256_set_epi32 (int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0) - // __m256i _mm256_set1_epi32 (int a) __m256i region_lowerv_0 = _mm256_srlv_epi32(v_0, cm_ccv_0); __m256i region_lowerv_1 = _mm256_srlv_epi32(v_1, cm_ccv_1); region_lowerv_0 = _mm256_sllv_epi32(region_lowerv_0, cm_ccv_0); region_lowerv_1 = _mm256_sllv_epi32(region_lowerv_1, cm_ccv_1); - __m256i v1 = _mm256_andnot_si256(_mm256_setzero_si256(), vectorsignbit); __m256i region_upperv_0 = _mm256_sllv_epi32(v1, cm_ccv_0); @@ -673,13 +576,12 @@ float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, region_upperv_0 = _mm256_or_si256(region_upperv_0, region_lowerv_0); region_upperv_1 = _mm256_or_si256(region_upperv_1, region_lowerv_1); - _mm256_storeu_si256((void *) &(region_lower[0]), region_lowerv_0); - _mm256_storeu_si256((void *) &(region_lower[8]), region_lowerv_1); - _mm256_storeu_si256((void *) &(region_upper[0]), region_upperv_0); - _mm256_storeu_si256((void *) &(region_upper[8]), region_upperv_1); - + _mm256_storeu_si256((__m256i_u*) &(region_lower[0]), region_lowerv_0); + _mm256_storeu_si256((__m256i_u*) &(region_lower[8]), region_lowerv_1); + _mm256_storeu_si256((__m256i_u*) &(region_upper[0]), region_upperv_0); + _mm256_storeu_si256((__m256i_u*) &(region_upper[8]), region_upperv_1); - //lower + // lower __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32(region_lowerv_0, _mm256_setzero_si256()); __m256i lower_juge_zerov_1 = _mm256_cmpeq_epi32(region_lowerv_1, _mm256_setzero_si256()); @@ -688,50 +590,47 @@ float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, __m256 minvalv = _mm256_set1_ps(min_val); - //__m256 lsax_breakpoints_shiftv_0 _mm256_i32gather_ps (sax_breakpoints, __m256i vindex, const int scale) __m256 lsax_breakpoints_shiftv_0 = _mm256_set_ps(sax_breakpoints[offset + region_lower[7] - 1], - sax_breakpoints[offset + region_lower[6] - 1], - sax_breakpoints[offset + region_lower[5] - 1], - sax_breakpoints[offset + region_lower[4] - 1], - sax_breakpoints[offset + region_lower[3] - 1], - sax_breakpoints[offset + region_lower[2] - 1], - sax_breakpoints[offset + region_lower[1] - 1], - sax_breakpoints[offset + region_lower[0] - 1]); + sax_breakpoints[offset + region_lower[6] - 1], + sax_breakpoints[offset + region_lower[5] - 1], + sax_breakpoints[offset + region_lower[4] - 1], + sax_breakpoints[offset + region_lower[3] - 1], + sax_breakpoints[offset + region_lower[2] - 1], + sax_breakpoints[offset + region_lower[1] - 1], + sax_breakpoints[offset + region_lower[0] - 1]); __m256 lsax_breakpoints_shiftv_1 = _mm256_set_ps(sax_breakpoints[offset + region_lower[15] - 1], - sax_breakpoints[offset + region_lower[14] - 1], - sax_breakpoints[offset + region_lower[13] - 1], - sax_breakpoints[offset + region_lower[12] - 1], - sax_breakpoints[offset + region_lower[11] - 1], - sax_breakpoints[offset + region_lower[10] - 1], - sax_breakpoints[offset + region_lower[9] - 1], - sax_breakpoints[offset + region_lower[8] - 1]); - + sax_breakpoints[offset + region_lower[14] - 1], + sax_breakpoints[offset + region_lower[13] - 1], + sax_breakpoints[offset + region_lower[12] - 1], + sax_breakpoints[offset + region_lower[11] - 1], + sax_breakpoints[offset + region_lower[10] - 1], + sax_breakpoints[offset + region_lower[9] - 1], + sax_breakpoints[offset + region_lower[8] - 1]); __m256 breakpoint_lowerv_0 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_0, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_0, - (__m256i) lsax_breakpoints_shiftv_0)); + _mm256_and_si256(lower_juge_nzerov_0, + (__m256i) lsax_breakpoints_shiftv_0)); __m256 breakpoint_lowerv_1 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_1, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_1, - (__m256i) lsax_breakpoints_shiftv_1)); + _mm256_and_si256(lower_juge_nzerov_1, + (__m256i) lsax_breakpoints_shiftv_1)); - //upper + // upper __m256 usax_breakpoints_shiftv_0 = _mm256_set_ps(sax_breakpoints[offset + region_upper[7]], - sax_breakpoints[offset + region_upper[6]], - sax_breakpoints[offset + region_upper[5]], - sax_breakpoints[offset + region_upper[4]], - sax_breakpoints[offset + region_upper[3]], - sax_breakpoints[offset + region_upper[2]], - sax_breakpoints[offset + region_upper[1]], - sax_breakpoints[offset + region_upper[0]]); + sax_breakpoints[offset + region_upper[6]], + sax_breakpoints[offset + region_upper[5]], + sax_breakpoints[offset + region_upper[4]], + sax_breakpoints[offset + region_upper[3]], + sax_breakpoints[offset + region_upper[2]], + sax_breakpoints[offset + region_upper[1]], + sax_breakpoints[offset + region_upper[0]]); __m256 usax_breakpoints_shiftv_1 = _mm256_set_ps(sax_breakpoints[offset + region_upper[15]], - sax_breakpoints[offset + region_upper[14]], - sax_breakpoints[offset + region_upper[13]], - sax_breakpoints[offset + region_upper[12]], - sax_breakpoints[offset + region_upper[11]], - sax_breakpoints[offset + region_upper[10]], - sax_breakpoints[offset + region_upper[9]], - sax_breakpoints[offset + region_upper[8]]); - + sax_breakpoints[offset + region_upper[14]], + sax_breakpoints[offset + region_upper[13]], + sax_breakpoints[offset + region_upper[12]], + sax_breakpoints[offset + region_upper[11]], + sax_breakpoints[offset + region_upper[10]], + sax_breakpoints[offset + region_upper[9]], + sax_breakpoints[offset + region_upper[8]]); __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(max_cardinality - 1)); __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32(region_upperv_1, _mm256_set1_epi32(max_cardinality - 1)); @@ -746,8 +645,9 @@ float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, _mm256_and_si256(upper_juge_maxv_1, (__m256i) _mm256_set1_ps(max_val)), _mm256_and_si256(upper_juge_nmaxv_1, (__m256i) usax_breakpoints_shiftv_1)); - //dis - __m256 paav_0, paav_1; + // dis + __m256 paav_0; + __m256 paav_1; paav_0 = _mm256_loadu_ps(paa); paav_1 = _mm256_loadu_ps(&(paa[8])); @@ -756,9 +656,9 @@ float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, __m256 dis_juge_upv_1 = _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_GT_OS); __m256 dis_juge_lov_0 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); + (__m256i) _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); __m256 dis_juge_lov_1 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS)); + (__m256i) _mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS)); __m256 dis_juge_elv_0 = (__m256) _mm256_andnot_si256( _mm256_or_si256((__m256i) dis_juge_upv_0, (__m256i) dis_juge_lov_0), vectorsignbit); @@ -766,82 +666,68 @@ float minidist_paa_to_isax_raw_SIMD(float *paa, sax_type *sax, _mm256_or_si256((__m256i) dis_juge_upv_1, (__m256i) dis_juge_lov_1), vectorsignbit); __m256 dis_lowv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_0, paav_0), - _mm256_sub_ps(breakpoint_lowerv_0, paav_0)); + _mm256_sub_ps(breakpoint_lowerv_0, paav_0)); __m256 dis_lowv_1 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_1, paav_1), - _mm256_sub_ps(breakpoint_lowerv_1, paav_1)); + _mm256_sub_ps(breakpoint_lowerv_1, paav_1)); __m256 dis_uppv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_0, paav_0), - _mm256_sub_ps(breakpoint_upperv_0, paav_0)); + _mm256_sub_ps(breakpoint_upperv_0, paav_0)); __m256 dis_uppv_1 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_1, paav_1), - _mm256_sub_ps(breakpoint_upperv_1, paav_1)); + _mm256_sub_ps(breakpoint_upperv_1, paav_1)); - __m256 distancev_0 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), - _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)), - _mm256_and_si256((__m256i) dis_juge_elv_0, (__m256i) _mm256_set1_ps(0.0))); - __m256 distancev_1 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_1, (__m256i) dis_lowv_1), - _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)), - _mm256_and_si256((__m256i) dis_juge_elv_1, (__m256i) _mm256_set1_ps(0.0))); + __m256 distancev_0 = (__m256)_mm256_or_si256( + _mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), + _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)); + __m256 distancev_1 = (__m256)_mm256_or_si256( + _mm256_and_si256((__m256i) dis_juge_upv_1, (__m256i) dis_lowv_1), + _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)); __m256 distancev = _mm256_add_ps(distancev_0, distancev_1); __m256 distancev2 = _mm256_hadd_ps(distancev, distancev); __m256 distancevf = _mm256_hadd_ps(distancev2, distancev2); _mm256_storeu_ps(distancef, distancevf); - //_mm256_storeu_ps (&checkvalue[8] ,distancev_1); return (distancef[0] + distancef[4]) * ratio_sqrt; } +#endif - +#if defined(__x86_64__) float minidist_paa_to_isax_rawa_SIMD(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt) { - - int region_upper[16], region_lower[16]; + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt) { + int region_upper[16]; + int region_lower[16]; float distancef[16]; int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; __m256i vectorsignbit = _mm256_set1_epi32(0xffffffff); __m256i vloweroffset = _mm256_set1_epi32(offset - 1); __m256i vupperoffset = _mm256_set1_epi32(offset); + __m256 minvalv = _mm256_set1_ps(min_val); + __m256 maxvalv = _mm256_set1_ps(max_val); - //__m256i c_cv_0 = _mm256_set_epi32 ( sax_cardinalities[7] , sax_cardinalities[6] ,sax_cardinalities[5] ,sax_cardinalities[4] , sax_cardinalities[3] ,sax_cardinalities[2] ,sax_cardinalities[1],sax_cardinalities[0]); - //__m256i c_cv_1 = _mm256_set_epi32 ( sax_cardinalities[15], sax_cardinalities[14],sax_cardinalities[13],sax_cardinalities[12], sax_cardinalities[11],sax_cardinalities[10],sax_cardinalities[9],sax_cardinalities[8]); - __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const void *) sax_cardinalities); - __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); - __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); - __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); - __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); - __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); - - //__m256i v_0 = _mm256_set_epi32 (sax[7],sax[6],sax[5],sax[4],sax[3],sax[2],sax[1],sax[0]); - //__m256i v_1 = _mm256_set_epi32 (sax[15],sax[14],sax[13],sax[12],sax[11],sax[10],sax[9],sax[8]); - __m128i saxv8 = _mm_lddqu_si128((const void *) sax); - __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); - __m128i saxv16_0 = _mm256_extractf128_si256(saxv16, 0); - __m128i saxv16_1 = _mm256_extractf128_si256(saxv16, 1); - __m256i v_0 = _mm256_cvtepu16_epi32(saxv16_0); - __m256i v_1 = _mm256_cvtepu16_epi32(saxv16_1); + __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const __m128i*) sax_cardinalities); + __m256i c_cv_0 = _mm256_cvtepu8_epi32(sax_cardinalitiesv8); + __m256i c_cv_1 = _mm256_cvtepu8_epi32(_mm_shuffle_epi32(sax_cardinalitiesv8, 14)); + __m128i saxv8 = _mm_lddqu_si128((const __m128i*) sax); + __m256i v_0 = _mm256_cvtepu8_epi32(saxv8); + __m256i v_1 = _mm256_cvtepu8_epi32(_mm_shuffle_epi32(saxv8, 14)); __m256i c_m = _mm256_set1_epi32(max_bit_cardinality); __m256i cm_ccv_0 = _mm256_sub_epi32(c_m, c_cv_0); __m256i cm_ccv_1 = _mm256_sub_epi32(c_m, c_cv_1); - //__m256i _mm256_set_epi32 (int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0) - // __m256i _mm256_set1_epi32 (int a) __m256i region_lowerv_0 = _mm256_srlv_epi32(v_0, cm_ccv_0); __m256i region_lowerv_1 = _mm256_srlv_epi32(v_1, cm_ccv_1); region_lowerv_0 = _mm256_sllv_epi32(region_lowerv_0, cm_ccv_0); region_lowerv_1 = _mm256_sllv_epi32(region_lowerv_1, cm_ccv_1); - __m256i v1 = _mm256_andnot_si256(_mm256_setzero_si256(), vectorsignbit); __m256i region_upperv_0 = _mm256_sllv_epi32(v1, cm_ccv_0); @@ -850,77 +736,33 @@ float minidist_paa_to_isax_rawa_SIMD(float *paa, sax_type *sax, region_upperv_1 = _mm256_andnot_si256(region_upperv_1, vectorsignbit); region_upperv_0 = _mm256_or_si256(region_upperv_0, region_lowerv_0); - region_upperv_1 = _mm256_or_si256(region_upperv_1, region_lowerv_1); - __m256i region_lowerv_0_offset = _mm256_add_epi32 (region_lowerv_0, vloweroffset); - __m256i region_lowerv_1_offset = _mm256_add_epi32 (region_lowerv_1, vloweroffset); - __m256i region_upperv_0_offset = _mm256_add_epi32 (region_upperv_0, vupperoffset); - __m256i region_upperv_1_offset = _mm256_add_epi32 (region_upperv_1, vupperoffset); - _mm256_storeu_si256((void *) &(region_lower[0]), region_lowerv_0); - _mm256_storeu_si256((void *) &(region_lower[8]), region_lowerv_1); - _mm256_storeu_si256((void *) &(region_upper[0]), region_upperv_0); - _mm256_storeu_si256((void *) &(region_upper[8]), region_upperv_1); - - - //lower + __m256i region_lowerv_0_offset = _mm256_add_epi32(region_lowerv_0, vloweroffset); + __m256i region_lowerv_1_offset = _mm256_add_epi32(region_lowerv_1, vloweroffset); + __m256i region_upperv_0_offset = _mm256_add_epi32(region_upperv_0, vupperoffset); + __m256i region_upperv_1_offset = _mm256_add_epi32(region_upperv_1, vupperoffset); + // lower __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32(region_lowerv_0, _mm256_setzero_si256()); __m256i lower_juge_zerov_1 = _mm256_cmpeq_epi32(region_lowerv_1, _mm256_setzero_si256()); __m256i lower_juge_nzerov_0 = _mm256_andnot_si256(lower_juge_zerov_0, vectorsignbit); __m256i lower_juge_nzerov_1 = _mm256_andnot_si256(lower_juge_zerov_1, vectorsignbit); - __m256 minvalv = _mm256_set1_ps(min_val); - - __m256 lsax_breakpoints_shiftv_0 = _mm256_i32gather_ps(sax_breakpoints, region_lowerv_0_offset, 4); - //__m256 lsax_breakpoints_shiftv_0= _mm256_set_ps (sax_breakpoints[region_lower[7]], - //sax_breakpoints[region_lower[6]], - //sax_breakpoints[region_lower[5]], - //sax_breakpoints[region_lower[4]], - //sax_breakpoints[region_lower[3]], - //sax_breakpoints[region_lower[2]], - //sax_breakpoints[region_lower[1]], - //sax_breakpoints[region_lower[0]]); __m256 lsax_breakpoints_shiftv_1 = _mm256_i32gather_ps(sax_breakpoints, region_lowerv_1_offset, 4); - //__m256 lsax_breakpoints_shiftv_1= _mm256_set_ps (sax_breakpoints[region_lower[15]], - //sax_breakpoints[region_lower[14]], - //sax_breakpoints[region_lower[13]], - //sax_breakpoints[region_lower[12]], - //sax_breakpoints[region_lower[11]], - //sax_breakpoints[region_lower[10]], - //sax_breakpoints[region_lower[9]], - //sax_breakpoints[region_lower[8]]); + __m256 breakpoint_lowerv_0 = (__m256) _mm256_or_si256( + _mm256_and_si256(lower_juge_zerov_0, (__m256i)minvalv), + _mm256_and_si256(lower_juge_nzerov_0, (__m256i) lsax_breakpoints_shiftv_0)); + __m256 breakpoint_lowerv_1 = (__m256) _mm256_or_si256( + _mm256_and_si256(lower_juge_zerov_1, (__m256i)minvalv), + _mm256_and_si256(lower_juge_nzerov_1, (__m256i) lsax_breakpoints_shiftv_1)); - __m256 breakpoint_lowerv_0 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_0, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_0, - (__m256i) lsax_breakpoints_shiftv_0)); - __m256 breakpoint_lowerv_1 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_1, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_1, - (__m256i) lsax_breakpoints_shiftv_1)); - - //uper + // uper __m256 usax_breakpoints_shiftv_0 = _mm256_i32gather_ps(sax_breakpoints, region_upperv_0_offset, 4); - //__m256 usax_breakpoints_shiftv_0= _mm256_set_ps (sax_breakpoints[region_upper[7]], - //sax_breakpoints[region_upper[6]], - //sax_breakpoints[region_upper[5]], - //sax_breakpoints[region_upper[4]], - //sax_breakpoints[region_upper[3]], - //sax_breakpoints[region_upper[2]], - //sax_breakpoints[region_upper[1]], - //sax_breakpoints[region_upper[0]]); __m256 usax_breakpoints_shiftv_1 = _mm256_i32gather_ps(sax_breakpoints, region_upperv_1_offset, 4); - //__m256 usax_breakpoints_shiftv_1= _mm256_set_ps (sax_breakpoints[region_upper[15]], - //sax_breakpoints[region_upper[14]], - //sax_breakpoints[region_upper[13]], - //sax_breakpoints[region_upper[12]], - //sax_breakpoints[region_upper[11]], - //sax_breakpoints[region_upper[10]], - //sax_breakpoints[region_upper[9]], - //sax_breakpoints[region_upper[8]]); - __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(max_cardinality - 1)); __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32(region_upperv_1, _mm256_set1_epi32(max_cardinality - 1)); @@ -929,25 +771,15 @@ float minidist_paa_to_isax_rawa_SIMD(float *paa, sax_type *sax, __m256i upper_juge_nmaxv_1 = _mm256_andnot_si256(upper_juge_maxv_1, vectorsignbit); __m256 breakpoint_upperv_0 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_0, (__m256i) _mm256_set1_ps(max_val)), + _mm256_and_si256(upper_juge_maxv_0, (__m256i)maxvalv), _mm256_and_si256(upper_juge_nmaxv_0, (__m256i) usax_breakpoints_shiftv_0)); __m256 breakpoint_upperv_1 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_1, (__m256i) _mm256_set1_ps(max_val)), + _mm256_and_si256(upper_juge_maxv_1, (__m256i)maxvalv), _mm256_and_si256(upper_juge_nmaxv_1, (__m256i) usax_breakpoints_shiftv_1)); - - - - - - - //dis - __m256 paav_0, paav_1; - - - paav_0 = _mm256_loadu_ps(paa); - paav_1 = _mm256_loadu_ps(&(paa[8])); - + // dis + __m256 paav_0 = _mm256_loadu_ps(paa); + __m256 paav_1 = _mm256_loadu_ps(&(paa[8])); __m256 dis_juge_upv_0 = _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_GT_OS); __m256 dis_juge_upv_1 = _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_GT_OS); @@ -955,10 +787,6 @@ float minidist_paa_to_isax_rawa_SIMD(float *paa, sax_type *sax, __m256 dis_juge_lov_0 = _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS); __m256 dis_juge_lov_1 = _mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS); - - // __m256 dis_juge_lov_0=(__m256)_mm256_and_si256 ((__m256i)_mm256_cmp_ps (breakpoint_lowerv_0, paav_0, _CMP_NGT_US),(__m256i)_mm256_cmp_ps (breakpoint_upperv_0, paav_0, _CMP_LT_OS)) ; - // __m256 dis_juge_lov_1=(__m256)_mm256_and_si256 ((__m256i)_mm256_cmp_ps (breakpoint_lowerv_1, paav_1, _CMP_NGT_US),(__m256i)_mm256_cmp_ps (breakpoint_upperv_1, paav_1, _CMP_LT_OS)); - __m256 dis_juge_elv_0 = (__m256) _mm256_andnot_si256( _mm256_or_si256((__m256i) dis_juge_upv_0, (__m256i) dis_juge_lov_0), vectorsignbit); __m256 dis_juge_elv_1 = (__m256) _mm256_andnot_si256( @@ -969,248 +797,114 @@ float minidist_paa_to_isax_rawa_SIMD(float *paa, sax_type *sax, __m256 dis_uppv_0 = _mm256_sub_ps(breakpoint_upperv_0, paav_0); __m256 dis_uppv_1 = _mm256_sub_ps(breakpoint_upperv_1, paav_1); - - __m256 distancev_0 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), - _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)), - _mm256_and_si256((__m256i) dis_juge_elv_0, (__m256i) _mm256_set1_ps(0.0))); - __m256 distancev_1 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_1, (__m256i) dis_lowv_1), - _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)), - _mm256_and_si256((__m256i) dis_juge_elv_1, (__m256i) _mm256_set1_ps(0.0))); - + __m256 distancev_0 = (__m256)_mm256_or_si256( + _mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), + _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)); + __m256 distancev_1 = (__m256)_mm256_or_si256( + _mm256_and_si256((__m256i) dis_juge_upv_1, (__m256i) dis_lowv_1), + _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)); __m256 distancesum_0 = _mm256_dp_ps(distancev_0, distancev_0, 0xff); __m256 distancesum_1 = _mm256_dp_ps(distancev_1, distancev_1, 0xff); __m256 distancevf = _mm256_add_ps(distancesum_0, distancesum_1); - //__m256 distancev2 = _mm256_hadd_ps (distancev, distancev); - //__m256 distancevf = _mm256_hadd_ps (distancev2, distancev2); - //__m256 _mm256_dp_ps (__m256 a, __m256 b, const int imm8); _mm256_storeu_ps(distancef, distancevf); - //_mm256_storeu_ps (&checkvalue[8] ,distancev_1); - return (distancef[0] + distancef[4]) * ratio_sqrt; } +#endif -float minidist_paa_to_isax_raw_e_SIMD(float *paa, sax_type *sax, - sax_type *sax_cardinalities, - sax_type max_bit_cardinality, - int max_cardinality, - int number_of_segments, - int min_val, - int max_val, - float ratio_sqrt, - float bsf) { - - int region_upper[16], region_lower[16]; - float distancef_0[8], distancef_1[8]; +#if defined(__x86_64__) +__attribute__((target("avx512vl"))) +__attribute__((target("avx512dq"))) +float minidist_paa_to_isax_rawa_SIMD512(float *paa, sax_type *sax, + sax_type *sax_cardinalities, + sax_type max_bit_cardinality, + int max_cardinality, + int number_of_segments, + int min_val, + int max_val, + float ratio_sqrt) { + int region_upper[16]; + int region_lower[16]; + float distancef[16]; int offset = ((max_cardinality - 1) * (max_cardinality - 2)) / 2; __m256i vectorsignbit = _mm256_set1_epi32(0xffffffff); - - - - //__m256i c_cv_0 = _mm256_set_epi32 ( sax_cardinalities[7] , sax_cardinalities[6] ,sax_cardinalities[5] ,sax_cardinalities[4] , sax_cardinalities[3] ,sax_cardinalities[2] ,sax_cardinalities[1],sax_cardinalities[0]); - //__m256i c_cv_1 = _mm256_set_epi32 ( sax_cardinalities[15], sax_cardinalities[14],sax_cardinalities[13],sax_cardinalities[12], sax_cardinalities[11],sax_cardinalities[10],sax_cardinalities[9],sax_cardinalities[8]); - __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const void *) sax_cardinalities); - __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); - __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); - __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); - - - //__m256i v_0 = _mm256_set_epi32 (sax[7],sax[6],sax[5],sax[4],sax[3],sax[2],sax[1],sax[0]); - //__m256i v_1 = _mm256_set_epi32 (sax[15],sax[14],sax[13],sax[12],sax[11],sax[10],sax[9],sax[8]); - __m128i saxv8 = _mm_lddqu_si128((const void *) sax); - __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); - __m128i saxv16_0 = _mm256_extractf128_si256(saxv16, 0); - __m256i v_0 = _mm256_cvtepu16_epi32(saxv16_0); - - - __m256i c_m = _mm256_set1_epi32(max_bit_cardinality); - __m256i cm_ccv_0 = _mm256_sub_epi32(c_m, c_cv_0); - - //__m256i _mm256_set_epi32 (int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0) - // __m256i _mm256_set1_epi32 (int a) - __m256i region_lowerv_0 = _mm256_srlv_epi32(v_0, cm_ccv_0); - region_lowerv_0 = _mm256_sllv_epi32(region_lowerv_0, cm_ccv_0); - - - __m256i v1 = _mm256_andnot_si256(_mm256_setzero_si256(), vectorsignbit); - __m256i region_upperv_0 = _mm256_sllv_epi32(v1, cm_ccv_0); - - region_upperv_0 = _mm256_andnot_si256(region_upperv_0, vectorsignbit); - - - region_upperv_0 = _mm256_or_si256(region_upperv_0, region_lowerv_0); - - - _mm256_storeu_si256((void *) &(region_lower[0]), region_lowerv_0); - - _mm256_storeu_si256((void *) &(region_upper[0]), region_upperv_0); - - - //lower - - __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32(region_lowerv_0, _mm256_setzero_si256()); - - __m256i lower_juge_nzerov_0 = _mm256_andnot_si256(lower_juge_zerov_0, vectorsignbit); - + __m256i vloweroffset = _mm256_set1_epi32(offset - 1); + __m256i vupperoffset = _mm256_set1_epi32(offset); __m256 minvalv = _mm256_set1_ps(min_val); + __m256 maxvalv = _mm256_set1_ps(max_val); + __m512i vloweroffsetf = _mm512_set1_epi32(offset - 1); + __m512i vupperoffsetf = _mm512_set1_epi32(offset); + __m512 minvalvf = _mm512_set1_ps(min_val); + __m512 maxvalvf = _mm512_set1_ps(max_val); + __m512i vectorsignbitf = _mm512_set1_epi32(0xffffffff); + __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const __m128i*) sax_cardinalities); + __m512i c_cv = _mm512_cvtepu8_epi32(sax_cardinalitiesv8); + __m128i saxv8 = _mm_lddqu_si128((const __m128i*) sax); + __m512i saxv = _mm512_cvtepu8_epi32(saxv8); + __m512i c_mf = _mm512_set1_epi32(max_bit_cardinality); + __m512i cm_ccv = _mm512_sub_epi32(c_mf, c_cv); - //__m256 lsax_breakpoints_shiftv_0 _mm256_i32gather_ps (sax_breakpoints, region_lowerv_0, 1); - __m256 lsax_breakpoints_shiftv_0 = _mm256_set_ps(sax_breakpoints[offset + region_lower[7] - 1], - sax_breakpoints[offset + region_lower[6] - 1], - sax_breakpoints[offset + region_lower[5] - 1], - sax_breakpoints[offset + region_lower[4] - 1], - sax_breakpoints[offset + region_lower[3] - 1], - sax_breakpoints[offset + region_lower[2] - 1], - sax_breakpoints[offset + region_lower[1] - 1], - sax_breakpoints[offset + region_lower[0] - 1]); - - - __m256 breakpoint_lowerv_0 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_0, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_0, - (__m256i) lsax_breakpoints_shiftv_0)); - - //uper - __m256 usax_breakpoints_shiftv_0 = _mm256_set_ps(sax_breakpoints[offset + region_upper[7]], - sax_breakpoints[offset + region_upper[6]], - sax_breakpoints[offset + region_upper[5]], - sax_breakpoints[offset + region_upper[4]], - sax_breakpoints[offset + region_upper[3]], - sax_breakpoints[offset + region_upper[2]], - sax_breakpoints[offset + region_upper[1]], - sax_breakpoints[offset + region_upper[0]]); - - - __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(max_cardinality - 1)); - - - __m256i upper_juge_nmaxv_0 = _mm256_andnot_si256(upper_juge_maxv_0, vectorsignbit); - - __m256 breakpoint_upperv_0 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_0, (__m256i) _mm256_set1_ps(max_val)), - _mm256_and_si256(upper_juge_nmaxv_0, (__m256i) usax_breakpoints_shiftv_0)); - - - - + __m512i region_lowerv = _mm512_srlv_epi32(saxv, cm_ccv); + region_lowerv = _mm512_sllv_epi32(region_lowerv, cm_ccv); + __m512i region_upperv = _mm512_sllv_epi32(vectorsignbitf, cm_ccv); + region_upperv = _mm512_andnot_si512(region_upperv, vectorsignbitf); + region_upperv = _mm512_or_si512(region_upperv, region_lowerv); - //dis - __m256 paav_0, paav_1; - - - paav_0 = _mm256_loadu_ps(paa); - - - __m256 dis_juge_upv_0 = _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_GT_OS); - - - __m256 dis_juge_lov_0 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); - - __m256 dis_juge_elv_0 = (__m256) _mm256_andnot_si256( - _mm256_or_si256((__m256i) dis_juge_upv_0, (__m256i) dis_juge_lov_0), vectorsignbit); - - __m256 dis_lowv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_0, paav_0), - _mm256_sub_ps(breakpoint_lowerv_0, paav_0)); - __m256 dis_uppv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_0, paav_0), - _mm256_sub_ps(breakpoint_upperv_0, paav_0)); - - - __m256 distancev_0 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), - _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)), - _mm256_and_si256((__m256i) dis_juge_elv_0, (__m256i) _mm256_set1_ps(0.0))); - + __m512i region_lowerv_offset = _mm512_add_epi32(region_lowerv, vloweroffsetf); + __m512i region_upperv_offset = _mm512_add_epi32(region_upperv, vloweroffsetf); - __m256 distancev2_0 = _mm256_hadd_ps(distancev_0, distancev_0); - __m256 distancev3_0 = _mm256_hadd_ps(distancev2_0, distancev2_0); - __m256 distancevf_0 = _mm256_hadd_ps(distancev3_0, distancev3_0); + // lower + __mmask16 lower_juge_zero_mask = _mm512_cmpeq_epi32_mask(region_lowerv, _mm512_setzero_si512()); - _mm256_storeu_ps(distancef_0, distancevf_0); - //if(bsf #include #include +#if defined(__x86_64__) #include "immintrin.h" +#endif #include "ads/sax/ts.h" /** @@ -25,42 +27,44 @@ void ts_parse_str(char ts_str[], ts_type *ts_out, int ts_size, const char *delims) { int index = 0; char *result = strtok(ts_str, delims); + while (result != NULL) { ts_out[index] = atof(result); result = strtok(NULL, delims); + #ifdef SANITY_CHECK - if (index >= ts_size) - { + if (index >= ts_size) { fprintf(stderr, "sanity error: Time series bigger than limit of %d", ts_size); - exit(-1); + + exit(-1); } #endif index++; } + free(result); } float ts_euclidean_distance_dot_product(ts_type *X, ts_type *Y, int size) { float dot = 0; - for (int i = 0; i < size; i++) { - dot += X[i] * Y[i]; + + for (int count = 0; count < size; count++) { + dot += X[count] * Y[count]; } - float result = 2.0f * (float) size * (1.0f - (dot / (float) size)); - // result = sqrtf(result); - return result; + return 2.0f * (float)size * (1.0f - (dot / (float)size)); } +#if defined(__x86_64__) float ts_euclidean_distance_dot_product_SIMD(float *X, float *Y, int m) { - __m256 sum_vec = _mm256_setzero_ps(); // Initialize sum vector to zero + __m256 sum_vec = _mm256_setzero_ps(); // Initialize sum vector to zero + int count = 0; - int i = 0; // Process 8 elements at a time - for (; i < m-7; i += 8) { - __m256 x_vec = _mm256_loadu_ps(&X[i]); - __m256 y_vec = _mm256_loadu_ps(&Y[i]); - __m256 prod_vec = _mm256_mul_ps(x_vec, y_vec); - sum_vec = _mm256_add_ps(sum_vec, prod_vec); + for (; count < m - 7; count += 8) { + __m256 x_vec = _mm256_loadu_ps(&X[count]); + __m256 y_vec = _mm256_loadu_ps(&Y[count]); + sum_vec = _mm256_fmadd_ps(x_vec, y_vec, sum_vec); } // Sum the elements of the sum_vec @@ -69,94 +73,135 @@ float ts_euclidean_distance_dot_product_SIMD(float *X, float *Y, int m) { float dot = temp[0] + temp[1] + temp[2] + temp[3] + temp[4] + temp[5] + temp[6] + temp[7]; // Remaining values, if length is not divisible by 8! - for (; i < m; i++) { - dot += X[i] * Y[i]; + for (; count < m; count++) { + dot += X[count] * Y[count]; } - float size = (float) m; - float result = 2.0f * size * (1.0f - (dot / size)); - // result= sqrtf(result); - return result; -} + float size = (float)m; + return 2.0f * size * (1.0f - (dot / size)); +} +#endif float ts_euclidean_distance(ts_type *t, ts_type *s, int size, float bound) { float distance = 0; + while (size > 0 && distance < bound) { size--; distance += (t[size] - s[size]) * (t[size] - s[size]); } - // distance = sqrtf(distance); + return distance; } +#if defined(__x86_64__) float ts_euclidean_distance_SIMD(ts_type *t, ts_type *s, int size, float bound) { float distance = 0; - int i = 0; float distancef[8]; + int count = 0; int size2 = size; - __m256 v_t, v_s, v_d, distancev; - while (size >= 8 && distance < bound) { - v_t = _mm256_loadu_ps(&t[i]); - v_s = _mm256_loadu_ps(&s[i]); + __m256 v_t; + __m256 v_s; + __m256 v_d; + __m256 distancev = _mm256_setzero_ps(); + while (size >= 8 && distance < bound) { + v_t = _mm256_loadu_ps(&t[count]); + v_s = _mm256_loadu_ps(&s[count]); v_d = _mm256_sub_ps(v_t, v_s); - v_d = _mm256_mul_ps(v_d, v_d); + distancev = _mm256_fmadd_ps(v_d, v_d, distancev); size -= 8; + count += 8; + __m256 intermed_dist = _mm256_hadd_ps(distancev, distancev); + intermed_dist = _mm256_hadd_ps(intermed_dist, intermed_dist); + _mm256_storeu_ps(distancef, intermed_dist); + distance = distancef[0] + distancef[4]; + } + + // Remaining values, if length is not divisible by 8! + while (count < size2 && distance < bound) { + distance += (t[count] - s[count]) * (t[count] - s[count]); + count++; + } + + return distance; +} +#endif - i = i + 8; - distancev = _mm256_hadd_ps(v_d, v_d); +#if defined(__x86_64__) +__attribute__((target("avx512dq"))) +float ts_euclidean_distance_SIMD512DQ(ts_type *t, ts_type *s, int size, float bound) { + float distance = 0; + int count = 0; + float distancef[8]; + int size2 = size; + + __m512 vv_t; + __m512 vv_s; + __m512 vv_d; + __m512 sumv = _mm512_setzero_ps(); + + while (size >= 16 && distance < bound) { + vv_t = _mm512_loadu_ps(&t[count]); + vv_s = _mm512_loadu_ps(&s[count]); + vv_d = _mm512_sub_ps(vv_t, vv_s); + sumv = _mm512_fmadd_ps(vv_d, vv_d, sumv); + size -= 16; + count += 16; + distance = _mm512_reduce_add_ps(sumv); + } + + __m256 v_t; + __m256 v_s; + __m256 v_d; + __m256 distancev = _mm256_setzero_ps(); + + if (size >= 8 && distance < bound) { + v_t = _mm256_loadu_ps(&t[count]); + v_s = _mm256_loadu_ps(&s[count]); + v_d = _mm256_sub_ps(v_t, v_s); + distancev = _mm256_fmadd_ps(v_d, v_d, distancev); + count += 8; + distancev = _mm256_hadd_ps(distancev, distancev); distancev = _mm256_hadd_ps(distancev, distancev); _mm256_storeu_ps(distancef, distancev); distance += distancef[0] + distancef[4]; } - // Remaining values, if length is not divisible by 8! - while (i < size2 && distance < bound) { - distance += (t[i] - s[i]) * (t[i] - s[i]); - i++; + // Remaining values, if length is not divisible by 16! + while (count < size2 && distance < bound) { + distance += (t[count] - s[count]) * (t[count] - s[count]); + count++; } - // distance = sqrtf(distance); return distance; } - +#endif float ts_ed(ts_type * t, ts_type * s, int size, float bound, char is_simd, char is_norm) { - /*if (is_simd) { - if (is_norm) { - return ts_euclidean_distance_dot_product_SIMD(t, s, size); - } - else { - return ts_euclidean_distance_SIMD(t, s, size, bound); - } - } - else { - if (is_norm) { - return ts_euclidean_distance_dot_product(t, s, size); - } - else { - return ts_euclidean_distance(t, s, size, bound); - } - }*/ +#if defined(__x86_64__) if (is_simd) { - return ts_euclidean_distance_SIMD(t, s, size, bound); + return __builtin_cpu_supports("avx512dq") ? + ts_euclidean_distance_SIMD512DQ(t, s, size, bound) : + ts_euclidean_distance_SIMD(t, s, size, bound); } else { +#endif return ts_euclidean_distance(t, s, size, bound); +#if defined(__x86_64__) } +#endif } - /** This function prints a ts record of a size. @param ts *ts @param int size */ void ts_print(ts_type *ts, int size) { - int i; - for (i = 0; i < size; i++) { - printf("%lf", ts[i]); + for (int count = 0; count < size; count++) { + printf("%lf", ts[count]); } + printf("\n"); } diff --git a/src/ads/sfa/dft.c b/src/ads/sfa/dft.c old mode 100755 new mode 100644 index cc6d7c29..9d33e420 --- a/src/ads/sfa/dft.c +++ b/src/ads/sfa/dft.c @@ -4,20 +4,39 @@ // // Based on dft code by Karima Echihabi on 18/12/2016 // Copyright 2016 Paris Descartes University. All rights reserved. -// +// // #include #include +#include #include "config.h" #include "globals.h" #include "ads/isax_index.h" #include "math.h" - +#if defined(__x86_64__) +#include "x86intrin.h" +#include "immintrin.h" +#endif #include - #include "ads/sfa/dft.h" +#if defined(__x86_64__) +__attribute__((target("avx512f"))) +int transform_vec_SIMD512F(ts_type norm_factor, int i, int coeff_number, ts_type *transform) { + __m512 norm_factor_vec_h = _mm512_set1_ps(norm_factor); + __m512 transform_vec_h = _mm512_loadu_ps(&transform[i]); + + for (; i < coeff_number - (coeff_number % 16); i += 16) { + _mm512_storeu_ps(&transform[i], + _mm512_mul_ps(transform_vec_h, norm_factor_vec_h)); + transform_vec_h = _mm512_loadu_ps(&transform[i + 16]); + } + + return i; +} +#endif + /* This function calculates the FFT coefficients for a given time series */ @@ -26,25 +45,23 @@ void fft_from_ts( int coeff_number, int best_only, fftwf_complex *ts_out, ts_type *transform, fftwf_plan plan_forward) { unsigned long ts_length = index->settings->timeseries_size; - fftwf_execute(plan_forward); // Image part of first (DC) coefficient ts_out[0][1] = 0; - int j = 0; // if normalized, ignore first coeff and start with offset 1 int start_offset = index->settings->is_norm ? 1 : 0; if (best_only) { - for (int k = 0; k < coeff_number / 2; ++k, j+= 2) { + for (int k = 0; k < coeff_number / 2; ++k, j += 2) { int coeff = index->coefficients[k] + start_offset; transform[j] = ts_out[coeff][0]; transform[j + 1] = ts_out[coeff][1] * -1; } } else { - for (int k = start_offset; k < coeff_number / 2 + start_offset; ++k, j+= 2) { + for (int k = start_offset; k < coeff_number / 2 + start_offset; ++k, j += 2) { transform[j] = ts_out[k][0]; transform[j + 1] = ts_out[k][1] * -1; } @@ -52,9 +69,28 @@ void fft_from_ts( // normalizing fft result in frequency domain to allow for lower bounding ts_type norm_factor = index->norm_factor; - for (int i = 0; i < coeff_number; ++i) { + int i = 0; + +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { +// if (__builtin_cpu_supports("avx512f")) { // this actually is slower than scalar... +// i = transform_vec_SIMD512F(norm_factor, i, coeff_number, transform); +// } + + __m256 norm_factor_vec = _mm256_set1_ps(norm_factor); + __m256 transform_vec = _mm256_loadu_ps(&transform[i]); + + for (; i < coeff_number - (coeff_number % 8); i += 8) { + _mm256_storeu_ps(&transform[i], _mm256_mul_ps(transform_vec, norm_factor_vec)); + transform_vec = _mm256_loadu_ps(&transform[i + 8]); + } + } +#endif + + for (; i < coeff_number; ++i) { transform[i] *= norm_factor; } + return; } @@ -63,42 +99,142 @@ void fft_from_ts( The current transform is pointed to by dft_mem_array */ void sfa_from_fft(isax_index *index, ts_type *cur_transform, unsigned char *cur_sfa_word) { - unsigned long ts_length = index->settings->timeseries_size; int paa_segments = index->settings->paa_segments; - int cardinality = index->settings->sax_alphabet_cardinality; - int offset = ((cardinality - 1) * (cardinality - 2)) / 2; + int cardinality = index->settings->sax_alphabet_cardinality - 1; for (int k = 0; k < paa_segments; ++k) { unsigned int c; - for (c = 0; c < index->settings->sax_alphabet_cardinality - 1; c++) { + + for (c = 0; c < cardinality; c++) { if (cur_transform[k] < index->bins[k][c]) { break; } } + cur_sfa_word[k] = (unsigned char) (c); } } +/* + This function discretized FFT coefficients with the intervals from MCB + The current transform is pointed to by dft_mem_array + A sax-cardinality as a multiple of 8 is assumed +*/ +#if defined(__x86_64__) +void sfa_from_fft_SIMD(isax_index *index, ts_type *cur_transform, unsigned char *cur_sfa_word) { + int paa_segments = index->settings->paa_segments; + int cardinality = index->settings->sax_alphabet_cardinality; + + for (int k = 0; k < paa_segments; ++k) { + int idx = cardinality; + __m256 comparison; + + for (int count = 0; count < cardinality; count += 8) { + comparison = _mm256_cmp_ps( + _mm256_set1_ps(cur_transform[k]), + _mm256_loadu_ps(&index->bins[k][count]), + 17); + int compMask = _mm256_movemask_ps(comparison); + idx = count + _tzcnt_u32(compMask); + + if (_popcnt32(compMask)) { + break; + } + } + + cur_sfa_word[k] = (unsigned char)(idx > cardinality - 1 ? cardinality - 1 : idx); + } +} +#endif + +#if defined(__x86_64__) +__attribute__((target("avx512vl"))) +void sfa_from_fft_SIMD512_256b(isax_index *index, ts_type *cur_transform, unsigned char *cur_sfa_word) { + int paa_segments = index->settings->paa_segments; + int cardinality = index->settings->sax_alphabet_cardinality; + + for (int k = 0; k < paa_segments; ++k) { + int idx = cardinality; + __m256 comparison; + + for (int count = 0; count < cardinality; count += 8) { + int compMask = _mm256_cmp_ps_mask( + _mm256_set1_ps(cur_transform[k]), + _mm256_loadu_ps(&index->bins[k][count]), + 17); + idx = count + (_tzcnt_u32(compMask)); + + if (_popcnt32(compMask)) { + break; + } + } + + cur_sfa_word[k] = (unsigned char)(idx > cardinality - 1 ? cardinality - 1 : idx); + } +} +#endif + +#if defined(__x86_64__) +__attribute__((target("avx512vl"))) +void sfa_from_fft_SIMD512_512b(isax_index *index, ts_type *cur_transform, unsigned char *cur_sfa_word) { + int paa_segments = index->settings->paa_segments; + int cardinality = index->settings->sax_alphabet_cardinality; + + for (int k = 0; k < paa_segments; ++k) { + int idx = cardinality; + __m256 comparison; + + for (int count = 0; count < cardinality; count += 16) { + int compMask = _mm512_cmp_ps_mask( + _mm512_set1_ps(cur_transform[k]), + _mm512_loadu_ps(&index->bins[k][count]), + 17); + idx = count + (_tzcnt_u32(compMask)); + + if (_popcnt32(compMask)) { + break; + } + } + + cur_sfa_word[k] = (unsigned char)(idx > cardinality - 1 ? cardinality - 1 : idx); + } +} +#endif + /* This function creates an SFA representation of a time series */ enum response sfa_from_ts(isax_index *index, ts_type *ts_in, sax_type *sax_out, fftwf_complex *ts_out, ts_type *transform, fftwf_plan plan_forward) { - int use_best = index->settings->coeff_number != 0; fft_from_ts(index, ts_in, index->settings->paa_segments, use_best, ts_out, transform, plan_forward); + ts_type *cur_coeff_line = (ts_type*)calloc(index->settings->paa_segments, sizeof(ts_type)); - ts_type *cur_coeff_line = calloc(index->settings->paa_segments, sizeof(ts_type)); for (int i = 0; i < index->settings->paa_segments; ++i) { cur_coeff_line[i] = transform[i]; } - sfa_from_fft(index, cur_coeff_line, sax_out); +#if defined(__x86_64__) + if (index->settings->SIMD_flag && __builtin_cpu_supports("avx512vl")) { + if (index->settings->sax_alphabet_cardinality >= 16) { + sfa_from_fft_SIMD512_512b(index, cur_coeff_line, sax_out); + } else { + sfa_from_fft_SIMD512_256b(index, cur_coeff_line, sax_out); + } + } else if (index->settings->SIMD_flag) { + sfa_from_fft_SIMD(index, cur_coeff_line, sax_out); + } else { +#endif + sfa_from_fft(index, cur_coeff_line, sax_out); +#if defined(__x86_64__) + } +#endif free(cur_coeff_line); - if (sax_out != NULL) return SUCCESS; - else { + if (sax_out != NULL) { + return SUCCESS; + } else { fprintf(stderr, "SFA error"); } } diff --git a/src/ads/sfa/sfa.c b/src/ads/sfa/sfa.c index 9d87bdc2..b26401ce 100644 --- a/src/ads/sfa/sfa.c +++ b/src/ads/sfa/sfa.c @@ -1,10 +1,10 @@ -// +// // sfa.c // sfa C version for MESSI // // Based on sfa_trie code by Karima Echihabi on 18/11/2017 // Copyright 2017 Paris Descartes University. All rights reserved. -// +// // Based on isax code written by Zoumpatianos on 3/12/12. // Copyright 2012 University of Trento. All rights reserved. // @@ -15,20 +15,20 @@ #include #include #include +#if defined(__x86_64__) #include "immintrin.h" +#endif #ifdef VALUES - #include - #endif #include #include +#include #include #include #include -#include #include "ads/calc_utils.h" #include "ads/isax_index.h" @@ -50,30 +50,36 @@ enum response sfa_bins_init(isax_index *index) { index->bins = NULL; index->bins = (ts_type **) calloc(paa_segments, sizeof(ts_type * )); index->binsv = (ts_type *) calloc(paa_segments * (num_symbols - 1), sizeof(ts_type)); + if (index == NULL) { fprintf(stderr, "Error in sfa.c: Could not allocate memory for bins structure.\n"); + return FAILURE; } - //allocate num_symbols-1 memory slots for each word + // allocate num_symbols-1 memory slots for each word for (int i = 0; i < paa_segments; ++i) { - index->bins[i] = calloc(num_symbols - 1, sizeof(ts_type)); + index->bins[i] = (ts_type*)calloc(num_symbols - 1, sizeof(ts_type)); + if (index == NULL) { fprintf(stderr, "Error in sfa.c: Could not allocate memory for bins structure.\n"); + return FAILURE; } + for (int j = 0; j < num_symbols - 1; ++j) { index->bins[i][j] = FLT_MAX; } - } + for (int j = 0; j < paa_segments * (num_symbols - 1); ++j) { index->binsv[j] = FLT_MAX; } + fprintf(stderr, ">>> SFA: Initialized bins[%d][%d] \n", paa_segments, num_symbols - 1); if (index->settings->coeff_number != 0) { - index->coefficients = calloc(paa_segments / 2, sizeof(int)); + index->coefficients = (int*)calloc(paa_segments / 2, sizeof(int)); } return SUCCESS; @@ -86,6 +92,7 @@ void sfa_free_bins(isax_index *index) { for (int i = 0; i < index->settings->paa_segments; ++i) { free(index->bins[i]); } + free(index->bins); } @@ -99,7 +106,6 @@ void sfa_set_bins( isax_index *index, const char *ifilename, long int ts_num, int maxquerythread, int filetype_int, int apply_znorm) { - int paa_segments = index->settings->paa_segments; int coeff_number = 0; int ts_length = index->settings->timeseries_size; @@ -109,9 +115,7 @@ void sfa_set_bins( // a) select best coefficients based no variance if (use_variance) { coeff_number = index->settings->coeff_number; - } - // b) use the first coefficients - else { + } else { // b) use the first coefficients coeff_number = index->settings->paa_segments; } @@ -119,14 +123,15 @@ void sfa_set_bins( COUNT_BINNING_TIME_START ts_type **dft_mem_array = (ts_type **) calloc(coeff_number, sizeof(ts_type * )); + for (int k = 0; k < coeff_number; ++k) { dft_mem_array[k] = (ts_type *) calloc(sample_size, sizeof(ts_type)); } - //build the bins out of a sample of the data - //read whole sample in memory + // build the bins out of a sample of the data + // read whole sample in memory pthread_t threadid[maxquerythread]; - bins_data_inmemory *input_data = malloc(sizeof(bins_data_inmemory) * (maxquerythread)); + bins_data_inmemory *input_data = (bins_data_inmemory*)malloc(sizeof(bins_data_inmemory) * (maxquerythread)); ts_type *ts; fftwf_complex *ts_out; @@ -134,11 +139,11 @@ void sfa_set_bins( ts_type *transform; for (int i = 0; i < maxquerythread; i++) { - //create FFTW-objects for the threads - ts = fftwf_malloc(sizeof(ts_type) * ts_length); + // create FFTW-objects for the threads + ts = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); ts_out = (fftwf_complex *) fftwf_malloc(sizeof(fftwf_complex) * (ts_length / 2 + 1)); plan_forward = fftwf_plan_dft_r2c_1d(ts_length, ts, ts_out, FFTW_ESTIMATE); - transform = fftwf_malloc(sizeof(ts_type) * ts_length); + transform = (ts_type*)fftwf_malloc(sizeof(ts_type) * ts_length); input_data[i].index = index; input_data[i].dft_mem_array = dft_mem_array; @@ -151,14 +156,10 @@ void sfa_set_bins( if (index->settings->sample_type == 1) { input_data[i].start_number = i * (sample_size / maxquerythread); input_data[i].stop_number = (i + 1) * (sample_size / maxquerythread); - } - // uniform sampling - else if (index->settings->sample_type == 2) { + } else if (index->settings->sample_type == 2) { // uniform sampling input_data[i].start_number = i * (ts_num / maxquerythread); input_data[i].stop_number = (i + 1) * (ts_num / maxquerythread); - } - // random sampling - else if (index->settings->sample_type == 3) { + } else if (index->settings->sample_type == 3) { // random sampling input_data[i].start_number = 0; input_data[i].stop_number = ts_num; } @@ -192,9 +193,20 @@ void sfa_set_bins( } ts_type **dft_mem_array_coeff; + if (use_variance) { // calculate coefficient-wise variance - dft_mem_array_coeff = calculate_variance_coeff(index, dft_mem_array); +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + dft_mem_array_coeff = __builtin_cpu_supports("avx512f") ? + calculate_variance_coeff_SIMD512F(index, dft_mem_array) : + calculate_variance_coeff_SIMD(index, dft_mem_array); + } else { +#endif + dft_mem_array_coeff = calculate_variance_coeff(index, dft_mem_array); +#if defined(__x86_64__) + } +#endif free_dft_memory(index, coeff_number, dft_mem_array); } @@ -205,8 +217,8 @@ void sfa_set_bins( fftwf_free(input_data[i].ts_out); fftwf_free(input_data[i].transform); - input_data[i].start_number = i * (paa_segments / maxquerythread); - input_data[i].stop_number = (i + 1) * (paa_segments / maxquerythread); + input_data[i].start_number = (int)round(i * ((float)paa_segments / maxquerythread)); + input_data[i].stop_number = (int)round((i + 1) * ((float)paa_segments / maxquerythread)); if (use_variance) { // replace with new ordering @@ -214,14 +226,12 @@ void sfa_set_bins( } } - input_data[maxquerythread - 1].start_number = (maxquerythread - 1) * (paa_segments / maxquerythread); - input_data[maxquerythread - 1].stop_number = paa_segments; - - //initiate worker threads for splitting coefficients into intervals + // initiate worker threads for splitting coefficients into intervals for (int i = 0; i < maxquerythread; i++) { pthread_create(&(threadid[i]), NULL, order_divide_worker, (void *) &(input_data[i])); } - //wait for the finish of other threads + + // wait for the finish of other threads for (int i = 0; i < maxquerythread; i++) { pthread_join(threadid[i], NULL); } @@ -256,18 +266,174 @@ ts_type **calculate_variance_coeff(isax_index *index, ts_type **dft_mem_array) { double mean_imag = 0.0; double var_real = 0.0; double var_imag = 0.0; + double mean_real_a[4]; + double mean_imag_a[4]; + double var_real_a[4]; + double var_imag_a[4]; - for (int j = 0; j < sample_size; ++j) { + int j = 0; + +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + __m256d mean_real_v = _mm256_setzero_pd(); + __m256d mean_imag_v = _mm256_setzero_pd(); + + for (; j < sample_size - (sample_size % 4); j += 4) { + mean_real_v = _mm256_add_pd(mean_real_v, _mm256_cvtps_pd(_mm_loadu_ps(&dft_mem_array[i * 2][j]))); + mean_imag_v = _mm256_add_pd(mean_imag_v, _mm256_cvtps_pd(_mm_loadu_ps(&dft_mem_array[i * 2 + 1][j]))); + } + + _mm256_store_pd(mean_real_a, mean_real_v); + _mm256_store_pd(mean_imag_a, mean_imag_v); + mean_real = mean_real_a[0] + mean_real_a[1] + mean_real_a[2] + mean_real_a[3]; + mean_imag = mean_imag_a[0] + mean_imag_a[1] + mean_imag_a[2] + mean_imag_a[3]; + } +#endif + + for (; j < sample_size; ++j) { mean_real += dft_mem_array[i * 2][j]; mean_imag += dft_mem_array[i * 2 + 1][j]; } + mean_real = mean_real / (double) sample_size; mean_imag = mean_imag / (double) sample_size; + j = 0; + +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + __m256d mean_real_v = _mm256_set1_pd(mean_real); + __m256d mean_imag_v = _mm256_set1_pd(mean_imag); + __m256d var_real_v = _mm256_setzero_pd(); + __m256d var_imag_v = _mm256_setzero_pd(); + + for (; j < sample_size - (sample_size % 4); j += 4) { + __m256d intermed_vec1 = _mm256_sub_pd(_mm256_cvtps_pd(_mm_loadu_ps(&dft_mem_array[i * 2][j])), mean_real_v); + __m256d intermed_vec2 = _mm256_sub_pd(_mm256_cvtps_pd(_mm_loadu_ps(&dft_mem_array[i * 2 + 1][j])), mean_imag_v); + var_real_v = _mm256_fmadd_pd(intermed_vec1, intermed_vec1, var_real_v); + var_imag_v = _mm256_fmadd_pd(intermed_vec2, intermed_vec2, var_imag_v); + } + + _mm256_store_pd(var_real_a, var_real_v); + _mm256_store_pd(var_imag_a, var_imag_v); + var_real = var_real_a[0] + var_real_a[1] + var_real_a[2] + var_real_a[3]; + var_imag = var_imag_a[0] + var_imag_a[1] + var_imag_a[2] + var_imag_a[3]; + } +#endif + + for (; j < sample_size; ++j) { + var_real += (dft_mem_array[i * 2][j] - mean_real) * (dft_mem_array[i * 2][j] - mean_real); + var_imag += (dft_mem_array[i * 2 + 1][j] - mean_imag) * (dft_mem_array[i * 2 + 1][j] - mean_imag); + } + + var_real = var_real / (double) sample_size; + var_imag = var_imag / (double) sample_size; + + double total_var = var_real + var_imag; + + var_coeff_index[i].variance = total_var; + var_coeff_index[i].coeff_index = i; + } + + qsort(var_coeff_index, coeff_number / 2, sizeof(var_coeff_index[0]), compare_var); + + fprintf(stderr, ">>> SFA: Best Indices Sorted:\n"); + + for (int i = 0; i < coeff_number / 2; ++i) { + fprintf(stderr, "%d, (%.4f) ", var_coeff_index[i].coeff_index, var_coeff_index[i].variance); + } + + fprintf(stderr, "\n"); + + for (int i = 0; i < paa_segments / 2; ++i) { + index->coefficients[i] = var_coeff_index[i].coeff_index; + } + + // sorting needed? + qsort(index->coefficients, paa_segments / 2, sizeof(int), compare_int); + fprintf(stderr, ">>> SFA: Hightest Variance Coeffs Sorted: "); + + for (int i = 0; i < paa_segments / 2; ++i) { + fprintf(stderr, "%d, ", index->coefficients[i]); + } + + fprintf(stderr, "\n"); + + ts_type **dft_mem_array_coeff = (ts_type **) calloc(paa_segments, sizeof(ts_type * )); + + for (int k = 0; k < paa_segments; ++k) { + dft_mem_array_coeff[k] = (ts_type *) calloc(sample_size, sizeof(ts_type)); + } + + for (int i = 0; i < paa_segments / 2; ++i) { + int coeff = index->coefficients[i]; + for (int j = 0; j < sample_size; ++j) { + dft_mem_array_coeff[i * 2][j] = dft_mem_array[coeff * 2][j]; + dft_mem_array_coeff[i * 2 + 1][j] = dft_mem_array[coeff * 2 + 1][j]; + } + } + + return dft_mem_array_coeff; +} + +#if defined(__x86_64__) +ts_type **calculate_variance_coeff_SIMD(isax_index *index, ts_type **dft_mem_array) { + int coeff_number = index->settings->coeff_number; + int paa_segments = index->settings->paa_segments; + unsigned int sample_size = index->settings->sample_size; + + struct variance_coeff_index var_coeff_index[coeff_number / 2]; + + for (int i = 0; i < coeff_number / 2; ++i) { + double mean_real = 0.0; + double mean_imag = 0.0; + double var_real = 0.0; + double var_imag = 0.0; + + int j = 0; + + __m256d mean_real_v = _mm256_setzero_pd(); + __m256d mean_imag_v = _mm256_setzero_pd(); + + for (; j < sample_size - (sample_size % 4); j += 4) { + mean_real_v = _mm256_add_pd(mean_real_v, _mm256_cvtps_pd(_mm_loadu_ps(&dft_mem_array[i * 2][j]))); + mean_imag_v = _mm256_add_pd(mean_imag_v, _mm256_cvtps_pd(_mm_loadu_ps(&dft_mem_array[i * 2 + 1][j]))); + } + + mean_real = mean_real_v[0] + mean_real_v[1] + mean_real_v[2] + mean_real_v[3]; + mean_imag = mean_imag_v[0] + mean_imag_v[1] + mean_imag_v[2] + mean_imag_v[3]; + + for (; j < sample_size; ++j) { + mean_real += dft_mem_array[i * 2][j]; + mean_imag += dft_mem_array[i * 2 + 1][j]; + } + + mean_real = mean_real / (double) sample_size; + mean_imag = mean_imag / (double) sample_size; + + j = 0; + + mean_real_v = _mm256_set1_pd(mean_real); + mean_imag_v = _mm256_set1_pd(mean_imag); + __m256d var_real_v = _mm256_setzero_pd(); + __m256d var_imag_v = _mm256_setzero_pd(); + + for (; j < sample_size - (sample_size % 4); j += 4) { + __m256d intermed_vec1 = _mm256_sub_pd(_mm256_cvtps_pd(_mm_loadu_ps(&dft_mem_array[i * 2][j])), mean_real_v); + __m256d intermed_vec2 = _mm256_sub_pd(_mm256_cvtps_pd(_mm_loadu_ps(&dft_mem_array[i * 2 + 1][j])), mean_imag_v); + var_real_v = _mm256_fmadd_pd(intermed_vec1, intermed_vec1, var_real_v); + var_imag_v = _mm256_fmadd_pd(intermed_vec2, intermed_vec2, var_imag_v); + } + + var_real = var_real_v[0] + var_real_v[1] + var_real_v[2] + var_real_v[3]; + var_imag = var_imag_v[0] + var_imag_v[1] + var_imag_v[2] + var_imag_v[3]; + + for (; j < sample_size; ++j) { var_real += (dft_mem_array[i * 2][j] - mean_real) * (dft_mem_array[i * 2][j] - mean_real); var_imag += (dft_mem_array[i * 2 + 1][j] - mean_imag) * (dft_mem_array[i * 2 + 1][j] - mean_imag); } + var_real = var_real / (double) sample_size; var_imag = var_imag / (double) sample_size; @@ -277,21 +443,124 @@ ts_type **calculate_variance_coeff(isax_index *index, ts_type **dft_mem_array) { var_coeff_index[i].coeff_index = i; } - /* - fprintf(stderr, "Variance: "); - for (int i = 0; i < coeff_number; ++i) { - // fprintf(stderr, "%.3f\tposition %d\n", var_coeff_index[i].variance, var_coeff_index[i].coeff_index); - fprintf(stderr, "%.4f, ", var_coeff_index[i].variance); + qsort(var_coeff_index, coeff_number / 2, sizeof(var_coeff_index[0]), compare_var); + + fprintf(stderr, ">>> SFA: Best Indices Sorted:\n"); + + for (int i = 0; i < coeff_number / 2; ++i) { + fprintf(stderr, "%d, (%.4f) ", var_coeff_index[i].coeff_index, var_coeff_index[i].variance); + } + + fprintf(stderr, "\n"); + + for (int i = 0; i < paa_segments / 2; ++i) { + index->coefficients[i] = var_coeff_index[i].coeff_index; + } + + // sorting needed? + qsort(index->coefficients, paa_segments / 2, sizeof(int), compare_int); + fprintf(stderr, ">>> SFA: Hightest Variance Coeffs Sorted: "); + + for (int i = 0; i < paa_segments / 2; ++i) { + fprintf(stderr, "%d, ", index->coefficients[i]); } + fprintf(stderr, "\n"); - */ + + ts_type **dft_mem_array_coeff = (ts_type **) calloc(paa_segments, sizeof(ts_type * )); + + for (int k = 0; k < paa_segments; ++k) { + dft_mem_array_coeff[k] = (ts_type *) calloc(sample_size, sizeof(ts_type)); + } + + for (int i = 0; i < paa_segments / 2; ++i) { + int coeff = index->coefficients[i]; + + for (int j = 0; j < sample_size; ++j) { + dft_mem_array_coeff[i * 2][j] = dft_mem_array[coeff * 2][j]; + dft_mem_array_coeff[i * 2 + 1][j] = dft_mem_array[coeff * 2 + 1][j]; + } + } + + return dft_mem_array_coeff; +} +#endif + +#if defined(__x86_64__) +__attribute__((target("avx512f"))) +ts_type **calculate_variance_coeff_SIMD512F(isax_index *index, ts_type **dft_mem_array) { + int coeff_number = index->settings->coeff_number; + int paa_segments = index->settings->paa_segments; + unsigned int sample_size = index->settings->sample_size; + + struct variance_coeff_index var_coeff_index[coeff_number / 2]; + + for (int i = 0; i < coeff_number / 2; ++i) { + double mean_real = 0.0; + double mean_imag = 0.0; + double var_real = 0.0; + double var_imag = 0.0; + + int j = 0; + + __m512d mean_real_v = _mm512_setzero_pd(); + __m512d mean_imag_v = _mm512_setzero_pd(); + + for (; j < sample_size - (sample_size % 8); j += 8) { + mean_real_v = _mm512_add_pd(mean_real_v, _mm512_cvtps_pd(_mm256_loadu_ps(&dft_mem_array[i * 2][j]))); + mean_imag_v = _mm512_add_pd(mean_imag_v, _mm512_cvtps_pd(_mm256_loadu_ps(&dft_mem_array[i * 2 + 1][j]))); + } + + mean_real = _mm512_reduce_add_pd(mean_real_v); + mean_imag = _mm512_reduce_add_pd(mean_imag_v); + + for (; j < sample_size; ++j) { + mean_real += dft_mem_array[i * 2][j]; + mean_imag += dft_mem_array[i * 2 + 1][j]; + } + + mean_real = mean_real / (double) sample_size; + mean_imag = mean_imag / (double) sample_size; + + j = 0; + + mean_real_v = _mm512_set1_pd(mean_real); + mean_imag_v = _mm512_set1_pd(mean_imag); + __m512d var_real_v = _mm512_setzero_pd(); + __m512d var_imag_v = _mm512_setzero_pd(); + + for (; j < sample_size - (sample_size % 8); j += 8) { + __m512d intermed_vec1 = _mm512_sub_pd(_mm512_cvtps_pd(_mm256_loadu_ps(&dft_mem_array[i * 2][j])), mean_real_v); + __m512d intermed_vec2 = _mm512_sub_pd(_mm512_cvtps_pd(_mm256_loadu_ps(&dft_mem_array[i * 2 + 1][j])), mean_imag_v); + var_real_v = _mm512_fmadd_pd(intermed_vec1, intermed_vec1, var_real_v); + var_imag_v = _mm512_fmadd_pd(intermed_vec2, intermed_vec2, var_imag_v); + } + + var_real = _mm512_reduce_add_pd(var_real_v); + var_imag = _mm512_reduce_add_pd(var_imag_v); + + for (; j < sample_size; ++j) { + var_real += (dft_mem_array[i * 2][j] - mean_real) * (dft_mem_array[i * 2][j] - mean_real); + var_imag += (dft_mem_array[i * 2 + 1][j] - mean_imag) * (dft_mem_array[i * 2 + 1][j] - mean_imag); + } + + var_real = var_real / (double) sample_size; + var_imag = var_imag / (double) sample_size; + + double total_var = var_real + var_imag; + + var_coeff_index[i].variance = total_var; + var_coeff_index[i].coeff_index = i; + } qsort(var_coeff_index, coeff_number / 2, sizeof(var_coeff_index[0]), compare_var); fprintf(stderr, ">>> SFA: Best Indices Sorted:\n"); + for (int i = 0; i < coeff_number / 2; ++i) { fprintf(stderr, "%d, (%.4f) ", var_coeff_index[i].coeff_index, var_coeff_index[i].variance); } + fprintf(stderr, "\n"); for (int i = 0; i < paa_segments / 2; ++i) { @@ -301,12 +570,15 @@ ts_type **calculate_variance_coeff(isax_index *index, ts_type **dft_mem_array) { // sorting needed? qsort(index->coefficients, paa_segments / 2, sizeof(int), compare_int); fprintf(stderr, ">>> SFA: Hightest Variance Coeffs Sorted: "); + for (int i = 0; i < paa_segments / 2; ++i) { fprintf(stderr, "%d, ", index->coefficients[i]); } + fprintf(stderr, "\n"); ts_type **dft_mem_array_coeff = (ts_type **) calloc(paa_segments, sizeof(ts_type * )); + for (int k = 0; k < paa_segments; ++k) { dft_mem_array_coeff[k] = (ts_type *) calloc(sample_size, sizeof(ts_type)); } @@ -322,6 +594,7 @@ ts_type **calculate_variance_coeff(isax_index *index, ts_type **dft_mem_array) { return dft_mem_array_coeff; } +#endif /* Worker method for sampling values, calculating FFT coefficients (the first coeff_number coefficients) and saving them to dft_mem_array @@ -329,25 +602,24 @@ ts_type **calculate_variance_coeff(isax_index *index, ts_type **dft_mem_array) { void *set_bins_worker_dft(void *transferdata) { struct bins_data_inmemory *bins_data = (bins_data_inmemory *) transferdata; - ts_type **dft_mem_array = bins_data->dft_mem_array; + _Alignas(32) ts_type **dft_mem_array = bins_data->dft_mem_array; isax_index *index = ((bins_data_inmemory *) transferdata)->index; - unsigned long start_number = bins_data->start_number; - unsigned long stop_number = bins_data->stop_number; + uint64_t start_number = bins_data->start_number; + uint64_t stop_number = bins_data->stop_number; - unsigned long ts_length = index->settings->timeseries_size; + uint64_t ts_length = index->settings->timeseries_size; int coeff_number = 0; // Variance based coefficients + if (index->settings->coeff_number > 0) { coeff_number = index->settings->coeff_number; - } - // first coefficients - else { + } else { // first coefficients coeff_number = index->settings->paa_segments; } - unsigned long start_index = start_number * ts_length * sizeof(ts_type); + uint64_t start_index = start_number * ts_length * sizeof(ts_type); int filetype_int = bins_data->filetype_int; int apply_znorm = bins_data->apply_znorm; @@ -355,16 +627,16 @@ void *set_bins_worker_dft(void *transferdata) { ifile = fopen(bins_data->filename, "rb"); fseek(ifile, start_index, SEEK_SET); - unsigned long skip_elements; - long records = bins_data->records; + uint64_t skip_elements; + int64_t records = bins_data->records; - unsigned long position_count = start_number; + uint64_t position_count = start_number; - //set number of elements to skip for uniform sampling + // set number of elements to skip for uniform sampling if (index->settings->sample_type == 2) { skip_elements = (((stop_number - start_number) / records) - 1); - // TODO skip_elements = (((stop_number - start_number) / records) - 1) * ts_length * sizeof(ts_type); + // TODO(someone) skip_elements = (((stop_number - start_number) / records) - 1) * ts_length * sizeof(ts_type); } ts_type *ts = bins_data->ts; @@ -372,8 +644,8 @@ void *set_bins_worker_dft(void *transferdata) { fftwf_plan plan_forward = bins_data->plan_forward; ts_type *transform = bins_data->transform; - file_type *ts_orig1; - ts_type *ts_orig2; + _Alignas(32) file_type *ts_orig1; + _Alignas(32) ts_type *ts_orig2; if (filetype_int) { ts_orig1 = (file_type *) calloc(index->settings->timeseries_size, sizeof(file_type)); @@ -382,7 +654,7 @@ void *set_bins_worker_dft(void *transferdata) { } for (int i = 0; i < records; ++i) { - //choose random position for random sampling + // choose random position for random sampling if (index->settings->sample_type == 3) { long int position = start_number + random_at_most(records); fseek(ifile, (position * ts_length * sizeof(ts_type)), SEEK_SET); @@ -390,21 +662,33 @@ void *set_bins_worker_dft(void *transferdata) { if (filetype_int) { fread(ts_orig1, sizeof(file_type), ts_length, ifile); + for (int j = 0; j < ts_length; ++j) { ts[j] = (ts_type) ts_orig1[j]; } } else { fread(ts_orig2, sizeof(ts_type), ts_length, ifile); + for (int j = 0; j < ts_length; ++j) { ts[j] = ts_orig2[j]; } } + // apply z-normalization if (apply_znorm) { - znorm(ts, ts_length); +#if defined(__x86_64__) + if (index->settings->SIMD_flag) { + znorm_SIMD(ts, ts_length); + } else { +#endif + znorm(ts, ts_length); +#if defined(__x86_64__) + } +#endif } int use_best = index->settings->coeff_number != 0; + if (use_best) { fft_from_ts(index, ts, index->settings->coeff_number, 0, ts_out, transform, plan_forward); } else { @@ -412,7 +696,7 @@ void *set_bins_worker_dft(void *transferdata) { } for (int j = 0; j < coeff_number; ++j) { - ts_type value = transform[j]; + _Alignas(32) ts_type value = transform[j]; dft_mem_array[j][i + (bins_data->workernumber * bins_data->records_offset)] = value; } @@ -420,6 +704,7 @@ void *set_bins_worker_dft(void *transferdata) { if (index->settings->sample_type == 2) { fseek(ifile, skip_elements * ts_length * sizeof(ts_type), SEEK_CUR); position_count += (1 + skip_elements); + if (position_count >= stop_number) { fprintf(stderr, "pos %lu; stop_number %lu\n", position_count, stop_number); } @@ -439,6 +724,7 @@ void *set_bins_worker_dft(void *transferdata) { } else { free(ts_orig2); } + fclose(ifile); } @@ -451,8 +737,8 @@ void *order_divide_worker(void *transferdata) { ts_type **dft_mem_array = bins_data->dft_mem_array; isax_index *index = ((bins_data_inmemory *) transferdata)->index; - unsigned long start_number = bins_data->start_number; - unsigned long stop_number = bins_data->stop_number; + uint64_t start_number = bins_data->start_number; + uint64_t stop_number = bins_data->stop_number; unsigned int sample_size = index->settings->sample_size; int paa_segments = index->settings->paa_segments; @@ -463,6 +749,7 @@ void *order_divide_worker(void *transferdata) { qsort(cur_coeff_line, sample_size, sizeof(ts_type), &compare_ts_type); } // equi-depth splitting + if (index->settings->histogram_type == 1) { int num_symbols = index->settings->sax_alphabet_cardinality; ts_type depth = (ts_type) sample_size / num_symbols; @@ -470,14 +757,13 @@ void *order_divide_worker(void *transferdata) { for (int i = start_number; i < stop_number; ++i) { float bin_index = 0.0; cur_coeff_line = dft_mem_array[i]; + for (int j = 0; j < num_symbols - 1; ++j) { bin_index += depth; index->bins[i][j] = cur_coeff_line[(int) bin_index]; } } - } - // equi-width splitting - else if (index->settings->histogram_type == 2) { + } else if (index->settings->histogram_type == 2) { // equi-width splitting int num_symbols = index->settings->sax_alphabet_cardinality; for (int i = start_number; i < stop_number; ++i) { @@ -485,6 +771,7 @@ void *order_divide_worker(void *transferdata) { ts_type first = cur_coeff_line[0]; ts_type last = cur_coeff_line[sample_size - 1]; ts_type interval_width = (last - first) / (ts_type) num_symbols; + for (int j = 0; j < num_symbols - 1; ++j) { index->bins[i][j] = interval_width * (j + 1) + first; } @@ -498,74 +785,58 @@ void *order_divide_worker(void *transferdata) { */ void sfa_print_bins(isax_index *index) { fprintf(stderr, ">>> SFA: Sample size %u\n", index->settings->sample_size); + if (index->settings->histogram_type == 1) { fprintf(stderr, ">>> SFA: Using Equi-depth histograms\n"); } else if (index->settings->histogram_type == 2) { fprintf(stderr, ">>> SFA: Using Equi-width histograms\n"); } - - - /* - int paa_segments = index->settings->paa_segments; - fprintf(stderr,"[\n"); - for (int i = 0; i < paa_segments; ++i) - { - fprintf(stderr,"-Inf\t"); - for (int j=0; j < index->settings->sax_alphabet_cardinality-1; ++j) - { - ts_type value = roundf(index->bins[i][j]*100.0)/100.0; - if (value == FLT_MAX) - fprintf(stderr,",Inf\n"); - else - fprintf(stderr,",%g",value); - } - fprintf(stderr,";\n"); - } - fprintf(stderr,"]\n"); - */ - } void free_dft_memory(isax_index *index, int coeff_number, ts_type **dft_mem_array) { - // int paa_segments = index->settings->paa_segments; for (int k = 0; k < coeff_number; ++k) { free(dft_mem_array[k]); } + free(dft_mem_array); } -//compare-functions for qsort +// compare-functions for qsort int compare_ts_type(const void *a, const void *b) { ts_type ts_a = *((ts_type *) a); ts_type ts_b = *((ts_type *) b); - if (ts_a < ts_b) + if (ts_a < ts_b) { return -1; - else return ts_a > ts_b; + } else { + return ts_a > ts_b; + } } int compare_var(const void *a, const void *b) { struct variance_coeff_index *a1 = (struct variance_coeff_index *) a; struct variance_coeff_index *a2 = (struct variance_coeff_index *) b; - if ((*a1).variance > (*a2).variance) + + if ((*a1).variance > (*a2).variance) { return -1; - else if ((*a1).variance < (*a2).variance) + } else if ((*a1).variance < (*a2).variance) { return 1; - else + } else { return 0; + } } int compare_int(const void *a, const void *b) { const int *ia = (const int *) a; const int *ib = (const int *) b; + return *ia - *ib; } -ts_type -get_lb_distance(const ts_type *bins, const float fft, const sax_type v, const sax_type c_c, +ts_type get_lb_distance(const ts_type *bins, const float fft, const sax_type v, const sax_type c_c, sax_type c_m, int max_cardinality, float factor) { sax_type region_lower = (v << (c_m - c_c)); - sax_type region_upper = (~((int) MAXFLOAT << (c_m - c_c)) | region_lower); + sax_type region_upper = (~((int) 0x7fffffff << (c_m - c_c)) | region_lower); ts_type distance = 0.0; float breakpoint_lower = 0.0; @@ -576,19 +847,33 @@ get_lb_distance(const ts_type *bins, const float fft, const sax_type v, const sa } else { breakpoint_lower = bins[region_lower - 1]; } + + if (breakpoint_lower > fft) { + ts_type value = breakpoint_lower - fft; + + return factor * value * value; + } + if (region_upper == max_cardinality - 1) { breakpoint_upper = MAXVAL; } else { breakpoint_upper = bins[region_upper]; } - if (breakpoint_lower > fft) { - ts_type value = breakpoint_lower - fft; - distance += factor * value * value; - } else if (breakpoint_upper < fft) { + if (breakpoint_upper < fft) { ts_type value = (fft - breakpoint_upper); - distance += factor * value * value; + + return factor * value * value; } + +// if (breakpoint_lower > fft) { +// ts_type value = breakpoint_lower - fft; +// distance += factor * value * value; +// } else if (breakpoint_upper < fft) { +// ts_type value = (fft - breakpoint_upper); +// distance += factor * value * value; +// } + return distance; } @@ -603,8 +888,8 @@ ts_type minidist_fft_to_sfa(isax_index *index, float *fft, sax_type *sax, sax_ty ts_type distance = 0.0; int i = 0; - //special case: for not normalized time series, the first coefficient has to be treated spacially - //for normalized data, this part is skipped + // special case: for not normalized time series, the first coefficient has to be treated spacially + // for normalized data, this part is skipped if (!index->settings->is_norm && (index->settings->coeff_number == 0 || index->coefficients[0] == 0)) { distance += get_lb_distance( @@ -648,8 +933,8 @@ ts_type minidist_fft_to_sfa_raw(isax_index *index, float *fft, sax_type *sax, sa ts_type distance = 0.0; int i = 0; - //special case: for not normalized time series, the first coefficient has to be treated specially - //for normalized data, this part is skipped + // special case: for not normalized time series, the first coefficient has to be treated specially + // for normalized data, this part is skipped if (!index->settings->is_norm && (index->settings->coeff_number == 0 || index->coefficients[0] == 0)) { distance += get_lb_distance( @@ -683,15 +968,18 @@ ts_type minidist_fft_to_sfa_raw(isax_index *index, float *fft, sax_type *sax, sa } void sfa_printbin(unsigned long long n, int size) { - char *b = malloc(sizeof(char) * (size + 1)); + char *b = (char*)malloc(sizeof(char) * (size + 1)); int i; for (i = 0; i < size; i++) { b[i] = '0'; } - for (i = 0; i < size; i++, n = n / 2) - if (n % 2) b[size - 1 - i] = '1'; + for (i = 0; i < size; i++, n = n / 2) { + if (n % 2) { + b[size - 1 - i] = '1'; + } + } b[size] = '\0'; printf("%s\n", b); @@ -700,18 +988,22 @@ void sfa_printbin(unsigned long long n, int size) { void sfa_print(sax_type *sax, int segments, int cardinality) { int i; + for (i = 0; i < segments; i++) { printf("%d:\t\n", i); sfa_printbin(sax[i], cardinality); } + printf("\n"); } void fft_print(ts_type *fft, int segments) { int i; + for (i = 0; i < segments; i++) { printf("%d:\t%.3f\n", i, fft[i]); } + printf("\n"); } @@ -719,538 +1011,269 @@ void fft_print(ts_type *fft, int segments) { This function calculates random numbers between 0 and max */ long random_at_most(long max) { - unsigned long - num_bins = (unsigned long) max + 1, - num_rand = (unsigned long) RAND_MAX + 1, - bin_size = num_rand / num_bins, - defect = num_rand % num_bins; + uint64_t num_bins = (uint64_t) max + 1; + uint64_t num_rand = (uint64_t) RAND_MAX + 1; + uint64_t bin_size = num_rand / num_bins; + uint64_t defect = num_rand % num_bins; + + int64_t x; - long x; do { x = random(); - } while (num_rand - defect <= (unsigned long) x); + } while (num_rand - defect <= (uint64_t) x); return x / bin_size; } - -ts_type -minidist_fft_to_sfa_raw_SIMD(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf) { - - int region_upper[16], region_lower[16]; - float distancef[16]; +#if defined(__x86_64__) +ts_type minidist_fft_to_sfa_rawe_SIMD(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf) { + int region_upper[16]; + int region_lower[16]; + float distancef[8]; + float distancef2[8]; int offset = 0; sax_type max_bit_cardinality = index->settings->sax_bit_cardinality; + int sax_alphabet_cardinality = index->settings->sax_alphabet_cardinality - 1; __m256i vectorsignbit = _mm256_set1_epi32(0xffffffff); - //__m256i c_cv_0 = _mm256_set_epi32 ( sax_cardinalities[7] , sax_cardinalities[6] ,sax_cardinalities[5] ,sax_cardinalities[4] , sax_cardinalities[3] ,sax_cardinalities[2] ,sax_cardinalities[1],sax_cardinalities[0]); - //__m256i c_cv_1 = _mm256_set_epi32 ( sax_cardinalities[15], sax_cardinalities[14],sax_cardinalities[13],sax_cardinalities[12], sax_cardinalities[11],sax_cardinalities[10],sax_cardinalities[9],sax_cardinalities[8]); - __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const void *) sax_cardinalities); - __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); - __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); - __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); - __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); - __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); - - //__m256i v_0 = _mm256_set_epi32 (sax[7],sax[6],sax[5],sax[4],sax[3],sax[2],sax[1],sax[0]); - //__m256i v_1 = _mm256_set_epi32 (sax[15],sax[14],sax[13],sax[12],sax[11],sax[10],sax[9],sax[8]); - __m128i saxv8 = _mm_lddqu_si128((const void *) sax); - __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); - __m128i saxv16_0 = _mm256_extractf128_si256(saxv16, 0); - __m128i saxv16_1 = _mm256_extractf128_si256(saxv16, 1); - __m256i v_0 = _mm256_cvtepu16_epi32(saxv16_0); - __m256i v_1 = _mm256_cvtepu16_epi32(saxv16_1); + __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const __m128i*)sax_cardinalities); + __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); + __m256i c_cv_0 = _mm256_cvtepu8_epi32(sax_cardinalitiesv8); + __m128i saxv8 = _mm_lddqu_si128((const __m128i*)sax); + __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); + __m256i v_0 = _mm256_cvtepu8_epi32(saxv8); __m256i c_m = _mm256_set1_epi32(max_bit_cardinality); __m256i cm_ccv_0 = _mm256_sub_epi32(c_m, c_cv_0); - __m256i cm_ccv_1 = _mm256_sub_epi32(c_m, c_cv_1); - //__m256i _mm256_set_epi32 (int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0) - // __m256i _mm256_set1_epi32 (int a) __m256i region_lowerv_0 = _mm256_srlv_epi32(v_0, cm_ccv_0); - __m256i region_lowerv_1 = _mm256_srlv_epi32(v_1, cm_ccv_1); region_lowerv_0 = _mm256_sllv_epi32(region_lowerv_0, cm_ccv_0); - region_lowerv_1 = _mm256_sllv_epi32(region_lowerv_1, cm_ccv_1); - - __m256i v1 = _mm256_andnot_si256(_mm256_setzero_si256(), vectorsignbit); + __m256i region_upperv_0 = _mm256_sllv_epi32(vectorsignbit, cm_ccv_0); - __m256i region_upperv_0 = _mm256_sllv_epi32(v1, cm_ccv_0); - __m256i region_upperv_1 = _mm256_sllv_epi32(v1, cm_ccv_1); region_upperv_0 = _mm256_andnot_si256(region_upperv_0, vectorsignbit); - region_upperv_1 = _mm256_andnot_si256(region_upperv_1, vectorsignbit); - region_upperv_0 = _mm256_or_si256(region_upperv_0, region_lowerv_0); - region_upperv_1 = _mm256_or_si256(region_upperv_1, region_lowerv_1); - - _mm256_storeu_si256((void *) &(region_lower[0]), region_lowerv_0); - _mm256_storeu_si256((void *) &(region_lower[8]), region_lowerv_1); - _mm256_storeu_si256((void *) &(region_upper[0]), region_upperv_0); - _mm256_storeu_si256((void *) &(region_upper[8]), region_upperv_1); - - //lower + // lower __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32(region_lowerv_0, _mm256_setzero_si256()); - __m256i lower_juge_zerov_1 = _mm256_cmpeq_epi32(region_lowerv_1, _mm256_setzero_si256()); - __m256i lower_juge_nzerov_0 = _mm256_andnot_si256(lower_juge_zerov_0, vectorsignbit); - __m256i lower_juge_nzerov_1 = _mm256_andnot_si256(lower_juge_zerov_1, vectorsignbit); __m256 minvalv = _mm256_set1_ps(MINVAL); + __m256i bitsizev = _mm256_set1_epi16((int16_t)sax_alphabet_cardinality); + __m256i bit1v = _mm256_set1_epi32(1); + __m256i offsetvs = _mm256_set_epi16(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + + __m256i vsssssoffsetvs2 = _mm256_mullo_epi16(bitsizev, offsetvs); + __m128i offsetv0s = _mm256_extractf128_si256(vsssssoffsetvs2, 0); + __m128i offsetv1s = _mm256_extractf128_si256(vsssssoffsetvs2, 1); + __m256i offsetv0 = _mm256_cvtepu16_epi32(offsetv0s); + + __m256i region_lowerbinv0 = _mm256_add_epi32(offsetv0, region_lowerv_0); + + region_lowerbinv0 = _mm256_sub_epi32(region_lowerbinv0, bit1v); - //__m256 lsax_breakpoints_shiftv_0 _mm256_i32gather_ps (sax_breakpoints, __m256i vindex, const int scale) - __m256 lsax_breakpoints_shiftv_0 = _mm256_set_ps(index->bins[7][region_lower[7] - 1], - index->bins[6][region_lower[6] - 1], - index->bins[5][region_lower[5] - 1], - index->bins[4][region_lower[4] - 1], - index->bins[3][region_lower[3] - 1], - index->bins[2][region_lower[2] - 1], - index->bins[1][region_lower[1] - 1], - index->bins[0][region_lower[0] - 1]); - __m256 lsax_breakpoints_shiftv_1 = _mm256_set_ps(index->bins[15][region_lower[15] - 1], - index->bins[14][region_lower[14] - 1], - index->bins[13][region_lower[13] - 1], - index->bins[12][region_lower[12] - 1], - index->bins[11][region_lower[11] - 1], - index->bins[10][region_lower[10] - 1], - index->bins[9][region_lower[9] - 1], - index->bins[8][region_lower[8] - 1]); - - - __m256 breakpoint_lowerv_0 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_0, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_0, - (__m256i) lsax_breakpoints_shiftv_0)); - __m256 breakpoint_lowerv_1 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_1, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_1, - (__m256i) lsax_breakpoints_shiftv_1)); + __m256 lsax_breakpoints_shiftv_0 = _mm256_i32gather_ps(index->binsv, region_lowerbinv0, 4); + + __m256 breakpoint_lowerv_0 = (__m256)_mm256_or_si256( + _mm256_and_si256(lower_juge_zerov_0, (__m256i)minvalv), + _mm256_and_si256(lower_juge_nzerov_0, (__m256i)lsax_breakpoints_shiftv_0)); // upper - __m256 usax_breakpoints_shiftv_0 = _mm256_set_ps(index->bins[7][region_upper[7]], - index->bins[6][region_upper[6]], - index->bins[5][region_upper[5]], - index->bins[4][region_upper[4]], - index->bins[3][region_upper[3]], - index->bins[2][region_upper[2]], - index->bins[1][region_upper[1]], - index->bins[0][region_upper[0]]); - __m256 usax_breakpoints_shiftv_1 = _mm256_set_ps(index->bins[15][region_upper[15]], - index->bins[14][region_upper[14]], - index->bins[13][region_upper[13]], - index->bins[12][region_upper[12]], - index->bins[11][region_upper[11]], - index->bins[10][region_upper[10]], - index->bins[9][region_upper[9]], - index->bins[8][region_upper[8]]); - - - __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(index->settings->sax_alphabet_cardinality - 1)); - __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32(region_upperv_1, _mm256_set1_epi32(index->settings->sax_alphabet_cardinality - 1)); + __m256i region_upperbinv0 = _mm256_add_epi32(offsetv0, region_upperv_0); + + __m256 usax_breakpoints_shiftv_0 = _mm256_i32gather_ps(index->binsv, region_upperbinv0, 4); + + __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(sax_alphabet_cardinality)); + __m256i upper_juge_nmaxv_0 = _mm256_andnot_si256(upper_juge_maxv_0, vectorsignbit); - __m256i upper_juge_nmaxv_1 = _mm256_andnot_si256(upper_juge_maxv_1, vectorsignbit); __m256 breakpoint_upperv_0 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_0, (__m256i) _mm256_set1_ps(MAXVAL)), - _mm256_and_si256(upper_juge_nmaxv_0, (__m256i) usax_breakpoints_shiftv_0)); - __m256 breakpoint_upperv_1 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_1, (__m256i) _mm256_set1_ps(MAXVAL)), - _mm256_and_si256(upper_juge_nmaxv_1, (__m256i) usax_breakpoints_shiftv_1)); + _mm256_and_si256(upper_juge_maxv_0, (__m256i)_mm256_set1_ps(MAXVAL)), + _mm256_and_si256(upper_juge_nmaxv_0, (__m256i)usax_breakpoints_shiftv_0)); - //dis - __m256 paav_0, paav_1; - - paav_0 = _mm256_loadu_ps(fft); - paav_1 = _mm256_loadu_ps(&(fft[8])); + // dis + __m256 paav_0 = _mm256_loadu_ps(fft); + __m256 paav_1 = _mm256_loadu_ps(&(fft[8])); __m256 dis_juge_upv_0 = _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_GT_OS); - __m256 dis_juge_upv_1 = _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_GT_OS); - __m256 dis_juge_lov_0 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); - __m256 dis_juge_lov_1 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS)); + __m256 dis_juge_lov_0 = (__m256)_mm256_and_si256( + (__m256i)_mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_NGT_US), + (__m256i)_mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); - __m256 dis_juge_elv_0 = (__m256) _mm256_andnot_si256( - _mm256_or_si256((__m256i) dis_juge_upv_0, (__m256i) dis_juge_lov_0), vectorsignbit); - __m256 dis_juge_elv_1 = (__m256) _mm256_andnot_si256( - _mm256_or_si256((__m256i) dis_juge_upv_1, (__m256i) dis_juge_lov_1), vectorsignbit); + __m256 dis_juge_elv_0 = (__m256)_mm256_andnot_si256( + _mm256_or_si256((__m256i)dis_juge_upv_0, (__m256i)dis_juge_lov_0), + vectorsignbit); __m256 dis_lowv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_0, paav_0), _mm256_sub_ps(breakpoint_lowerv_0, paav_0)); - __m256 dis_lowv_1 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_1, paav_1), - _mm256_sub_ps(breakpoint_lowerv_1, paav_1)); __m256 dis_uppv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_0, paav_0), _mm256_sub_ps(breakpoint_upperv_0, paav_0)); - __m256 dis_uppv_1 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_1, paav_1), - _mm256_sub_ps(breakpoint_upperv_1, paav_1)); - __m256 distancev_0 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), - _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)), - _mm256_and_si256((__m256i) dis_juge_elv_0, (__m256i) _mm256_set1_ps(0.0))); - __m256 distancev_1 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_1, (__m256i) dis_lowv_1), - _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)), - _mm256_and_si256((__m256i) dis_juge_elv_1, (__m256i) _mm256_set1_ps(0.0))); + __m256 distancev_0 = (__m256)_mm256_or_si256( + _mm256_and_si256((__m256i)dis_juge_upv_0, (__m256i)dis_lowv_0), + _mm256_and_si256((__m256i)dis_juge_lov_0, (__m256i)dis_uppv_0)); - __m256 distancev = _mm256_add_ps(distancev_0, distancev_1); - __m256 distancev2 = _mm256_hadd_ps(distancev, distancev); + __m256 distancev2 = _mm256_hadd_ps(distancev_0, distancev_0); __m256 distancevf = _mm256_hadd_ps(distancev2, distancev2); + _mm256_store_ps(distancef, distancevf); - _mm256_storeu_ps(distancef, distancevf); - //_mm256_storeu_ps (&checkvalue[8] ,distancev_1); - - return (distancef[0] + distancef[4]) * 2; - -} - -ts_type -minidist_fft_to_sfa_rawa_SIMD(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf) { - - int region_upper[16], region_lower[16]; - float distancef[8]; - int offset = 0; - sax_type max_bit_cardinality = index->settings->sax_bit_cardinality; - - __m256i vectorsignbit = _mm256_set1_epi32(0xffffffff); - - - - //__m256i c_cv_0 = _mm256_set_epi32 ( sax_cardinalities[7] , sax_cardinalities[6] ,sax_cardinalities[5] ,sax_cardinalities[4] , sax_cardinalities[3] ,sax_cardinalities[2] ,sax_cardinalities[1],sax_cardinalities[0]); - //__m256i c_cv_1 = _mm256_set_epi32 ( sax_cardinalities[15], sax_cardinalities[14],sax_cardinalities[13],sax_cardinalities[12], sax_cardinalities[11],sax_cardinalities[10],sax_cardinalities[9],sax_cardinalities[8]); - __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const void *) sax_cardinalities); - __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); - __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); - __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); - __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); - __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); - - //__m256i v_0 = _mm256_set_epi32 (sax[7],sax[6],sax[5],sax[4],sax[3],sax[2],sax[1],sax[0]); - //__m256i v_1 = _mm256_set_epi32 (sax[15],sax[14],sax[13],sax[12],sax[11],sax[10],sax[9],sax[8]); - __m128i saxv8 = _mm_lddqu_si128((const void *) sax); - __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); - __m128i saxv16_0 = _mm256_extractf128_si256(saxv16, 0); - __m128i saxv16_1 = _mm256_extractf128_si256(saxv16, 1); - __m256i v_0 = _mm256_cvtepu16_epi32(saxv16_0); - __m256i v_1 = _mm256_cvtepu16_epi32(saxv16_1); - + if ((distancef[0] + distancef[4]) * 2 > bsf) { + return (distancef[0] + distancef[4]) * 2; + } - __m256i c_m = _mm256_set1_epi32(max_bit_cardinality); - __m256i cm_ccv_0 = _mm256_sub_epi32(c_m, c_cv_0); + __m256i c_cv_1 = _mm256_cvtepu8_epi32(_mm_shuffle_epi32(sax_cardinalitiesv8, 14)); + __m256i v_1 = _mm256_cvtepu8_epi32(_mm_shuffle_epi32(saxv8, 14)); __m256i cm_ccv_1 = _mm256_sub_epi32(c_m, c_cv_1); - - //__m256i _mm256_set_epi32 (int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0) - // __m256i _mm256_set1_epi32 (int a) - __m256i region_lowerv_0 = _mm256_srlv_epi32(v_0, cm_ccv_0); __m256i region_lowerv_1 = _mm256_srlv_epi32(v_1, cm_ccv_1); - region_lowerv_0 = _mm256_sllv_epi32(region_lowerv_0, cm_ccv_0); region_lowerv_1 = _mm256_sllv_epi32(region_lowerv_1, cm_ccv_1); - - - __m256i v1 = _mm256_andnot_si256(_mm256_setzero_si256(), vectorsignbit); - - __m256i region_upperv_0 = _mm256_sllv_epi32(v1, cm_ccv_0); - __m256i region_upperv_1 = _mm256_sllv_epi32(v1, cm_ccv_1); - region_upperv_0 = _mm256_andnot_si256(region_upperv_0, vectorsignbit); + __m256i region_upperv_1 = _mm256_sllv_epi32(vectorsignbit, cm_ccv_1); region_upperv_1 = _mm256_andnot_si256(region_upperv_1, vectorsignbit); - - region_upperv_0 = _mm256_or_si256(region_upperv_0, region_lowerv_0); region_upperv_1 = _mm256_or_si256(region_upperv_1, region_lowerv_1); - - //_mm256_storeu_si256 ((void*)&(region_lower[0]),region_lowerv_0); - //_mm256_storeu_si256 ((void*)&(region_lower[8]),region_lowerv_1); - //_mm256_storeu_si256 ((void*)&(region_upper[0]),region_upperv_0); - //_mm256_storeu_si256 ((void*)&(region_upper[8]),region_upperv_1); - - - //lower - - __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32(region_lowerv_0, _mm256_setzero_si256()); __m256i lower_juge_zerov_1 = _mm256_cmpeq_epi32(region_lowerv_1, _mm256_setzero_si256()); - - __m256i lower_juge_nzerov_0 = _mm256_andnot_si256(lower_juge_zerov_0, vectorsignbit); __m256i lower_juge_nzerov_1 = _mm256_andnot_si256(lower_juge_zerov_1, vectorsignbit); - - __m256 minvalv = _mm256_set1_ps(MINVAL); - __m256i bitsizev = _mm256_set1_epi16((short) index->settings->sax_alphabet_cardinality - 1); - __m256i bit1v = _mm256_set1_epi32(1); - //__m256i bit8v = _mm256_set1_epi32(8); - __m256i offsetvs = _mm256_set_epi16(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); - //__m256i offsetv1=_mm256_set_epi32(); - //__m256i offsetv1=_mm256_add_epi32(offsetv0,bit8v); - - __m256i vsssssoffsetvs2 = _mm256_mullo_epi16(bitsizev, offsetvs); - __m128i offsetv0s = _mm256_extractf128_si256(vsssssoffsetvs2, 0); - __m128i offsetv1s = _mm256_extractf128_si256(vsssssoffsetvs2, 1); - __m256i offsetv0 = _mm256_cvtepu16_epi32(offsetv0s); __m256i offsetv1 = _mm256_cvtepu16_epi32(offsetv1s); - //__m256i offsetvv0=_mm256_mul_epi32 (offsetv0, bitsizev); - //__m256i offsetvv1=_mm256_mul_epi32 (offsetv1, bitsizev); - - - __m256i region_lowerbinv0 = _mm256_add_epi32(offsetv0, region_lowerv_0); __m256i region_lowerbinv1 = _mm256_add_epi32(offsetv1, region_lowerv_1); - region_lowerbinv0 = _mm256_sub_epi32(region_lowerbinv0, bit1v); region_lowerbinv1 = _mm256_sub_epi32(region_lowerbinv1, bit1v); - //__m256 lsax_breakpoints_shiftv_0 _mm256_i32gather_ps (sax_breakpoints, __m256i vindex, const int scale) - __m256 lsax_breakpoints_shiftv_0 = _mm256_i32gather_ps(index->binsv, region_lowerbinv0, 4); - __m256 lsax_breakpoints_shiftv_1 = _mm256_i32gather_ps(index->binsv, region_lowerbinv1, 4); + __m256 breakpoint_lowerv_1 = (__m256)_mm256_or_si256( + _mm256_and_si256(lower_juge_zerov_1, (__m256i)minvalv), + _mm256_and_si256(lower_juge_nzerov_1, (__m256i)lsax_breakpoints_shiftv_1)); - __m256 breakpoint_lowerv_0 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_0, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_0, - (__m256i) lsax_breakpoints_shiftv_0)); - __m256 breakpoint_lowerv_1 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_1, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_1, - (__m256i) lsax_breakpoints_shiftv_1)); - - //uper - __m256i region_upperbinv0 = _mm256_add_epi32(offsetv0, region_upperv_0); __m256i region_upperbinv1 = _mm256_add_epi32(offsetv1, region_upperv_1); - __m256 usax_breakpoints_shiftv_0 = _mm256_i32gather_ps(index->binsv, region_upperbinv0, 4); __m256 usax_breakpoints_shiftv_1 = _mm256_i32gather_ps(index->binsv, region_upperbinv1, 4); - - __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(index->settings->sax_alphabet_cardinality - 1)); - __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32(region_upperv_1, _mm256_set1_epi32(index->settings->sax_alphabet_cardinality - 1)); - __m256i upper_juge_nmaxv_0 = _mm256_andnot_si256(upper_juge_maxv_0, vectorsignbit); + __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32(region_upperv_1, _mm256_set1_epi32(sax_alphabet_cardinality)); __m256i upper_juge_nmaxv_1 = _mm256_andnot_si256(upper_juge_maxv_1, vectorsignbit); - - __m256 breakpoint_upperv_0 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_0, (__m256i) _mm256_set1_ps(MAXVAL)), - _mm256_and_si256(upper_juge_nmaxv_0, (__m256i) usax_breakpoints_shiftv_0)); - __m256 breakpoint_upperv_1 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_1, (__m256i) _mm256_set1_ps(MAXVAL)), - _mm256_and_si256(upper_juge_nmaxv_1, (__m256i) usax_breakpoints_shiftv_1)); - - //dis - __m256 paav_0, paav_1; - - - paav_0 = _mm256_loadu_ps(fft); - paav_1 = _mm256_loadu_ps(&(fft[8])); - - - __m256 dis_juge_upv_0 = _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_GT_OS); + __m256 breakpoint_upperv_1 = (__m256)_mm256_or_si256( + _mm256_and_si256(upper_juge_maxv_1, (__m256i)_mm256_set1_ps(MAXVAL)), + _mm256_and_si256(upper_juge_nmaxv_1, (__m256i)usax_breakpoints_shiftv_1)); __m256 dis_juge_upv_1 = _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_GT_OS); - __m256 dis_juge_lov_0 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); - __m256 dis_juge_lov_1 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS)); + __m256 dis_juge_lov_1 = (__m256)_mm256_and_si256( + (__m256i)_mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_NGT_US), + (__m256i)_mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS)); - __m256 dis_juge_elv_0 = (__m256) _mm256_andnot_si256( - _mm256_or_si256((__m256i) dis_juge_upv_0, (__m256i) dis_juge_lov_0), vectorsignbit); - __m256 dis_juge_elv_1 = (__m256) _mm256_andnot_si256( - _mm256_or_si256((__m256i) dis_juge_upv_1, (__m256i) dis_juge_lov_1), vectorsignbit); + __m256 dis_juge_elv_1 = (__m256)_mm256_andnot_si256( + _mm256_or_si256((__m256i)dis_juge_upv_1, (__m256i)dis_juge_lov_1), + vectorsignbit); - __m256 dis_lowv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_0, paav_0), - _mm256_sub_ps(breakpoint_lowerv_0, paav_0)); __m256 dis_lowv_1 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_1, paav_1), _mm256_sub_ps(breakpoint_lowerv_1, paav_1)); - __m256 dis_uppv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_0, paav_0), - _mm256_sub_ps(breakpoint_upperv_0, paav_0)); + __m256 dis_uppv_1 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_1, paav_1), _mm256_sub_ps(breakpoint_upperv_1, paav_1)); - - __m256 distancev_0 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), - _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)), - _mm256_and_si256((__m256i) dis_juge_elv_0, (__m256i) _mm256_set1_ps(0.0))); __m256 distancev_1 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_1, (__m256i) dis_lowv_1), - _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)), - _mm256_and_si256((__m256i) dis_juge_elv_1, (__m256i) _mm256_set1_ps(0.0))); - - __m256 distancev = _mm256_add_ps(distancev_0, distancev_1); - __m256 distancev2 = _mm256_hadd_ps(distancev, distancev); - __m256 distancevf = _mm256_hadd_ps(distancev2, distancev2); - - - _mm256_storeu_ps(distancef, distancevf); - //_mm256_storeu_ps (&checkvalue[8] ,distancev_1); - //_mm256_storeu_si256 ((void*)&(offsetvvvv[0]),offsetv0); - // _mm256_storeu_si256 ((void*)&(offsetvvvv[8]),offsetv1); - //for (int i = 0; i < 16; i++) - //{ - // printf("the number is victor [%d] %d\n",i,offsetvvvv[i]); - // printf("the number is [%d] %d\n",i,i*(index->settings->sax_alphabet_cardinality-1)); - - // } - //printf("distance is %f!!!!!!!\n",(distancef[0]+distancef[4])*2); - //sleep(5); + _mm256_and_si256((__m256i)dis_juge_upv_1, (__m256i)dis_lowv_1), + _mm256_and_si256((__m256i)dis_juge_lov_1, (__m256i)dis_uppv_1)); - return (distancef[0] + distancef[4]) * 2; + distancev2 = _mm256_hadd_ps(distancev_1, distancev_1); + distancevf = _mm256_hadd_ps(distancev2, distancev2); + _mm256_store_ps(distancef2, distancevf); + return (distancef[0] + distancef[4] + distancef2[0] + distancef2[4]) * 2; } +#endif - -ts_type -minidist_fft_to_sfa_rawe_SIMD(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf) { - - int region_upper[16], region_lower[16]; - float distancef[8], distancef2[8]; +// completely implemented in AVX-512, do all work and decide return value for early abandonment afterwards. +#if defined(__x86_64__) +__attribute__((target("avx512vl"))) +__attribute__((target("avx512dq"))) +ts_type minidist_fft_to_sfa_rawe_SIMD512(isax_index *index, float *fft, sax_type *sax, sax_type *sax_cardinalities, float bsf) { + int region_upper[16]; + int region_lower[16]; + float distancef[8]; + float distancef2[8]; int offset = 0; sax_type max_bit_cardinality = index->settings->sax_bit_cardinality; + int sax_alphabet_cardinality = index->settings->sax_alphabet_cardinality - 1; - __m256i vectorsignbit = _mm256_set1_epi32(0xffffffff); + __m512i vectorsignbit = _mm512_set1_epi32(0xffffffff); - __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const void *) sax_cardinalities); - __m256i sax_cardinalitiesv16 = _mm256_cvtepu8_epi16(sax_cardinalitiesv8); - __m128i sax_cardinalitiesv16_0 = _mm256_extractf128_si256(sax_cardinalitiesv16, 0); - __m256i c_cv_0 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_0); + __m128i sax_cardinalitiesv8 = _mm_lddqu_si128((const __m128i*)sax_cardinalities); + __m512i c_cv = _mm512_cvtepu8_epi32(sax_cardinalitiesv8); - __m128i saxv8 = _mm_lddqu_si128((const void *) sax); - __m256i saxv16 = _mm256_cvtepu8_epi16(saxv8); - __m128i saxv16_0 = _mm256_extractf128_si256(saxv16, 0); + __m128i saxv8 = _mm_lddqu_si128((const __m128i*)sax); + __m512i v_0 = _mm512_cvtepu8_epi32(saxv8); - __m256i v_0 = _mm256_cvtepu16_epi32(saxv16_0); + __m512i c_m = _mm512_set1_epi32(max_bit_cardinality); + __m512i cm_ccv = _mm512_sub_epi32(c_m, c_cv); + __m512i region_lowerv = _mm512_srlv_epi32(v_0, cm_ccv); + region_lowerv = _mm512_sllv_epi32(region_lowerv, cm_ccv); - __m256i c_m = _mm256_set1_epi32(max_bit_cardinality); - __m256i cm_ccv_0 = _mm256_sub_epi32(c_m, c_cv_0); + __m512i region_upperv = _mm512_sllv_epi32(vectorsignbit, cm_ccv); - __m256i region_lowerv_0 = _mm256_srlv_epi32(v_0, cm_ccv_0); + region_upperv = _mm512_andnot_si512(region_upperv, vectorsignbit); + region_upperv = _mm512_or_si512(region_upperv, region_lowerv); - region_lowerv_0 = _mm256_sllv_epi32(region_lowerv_0, cm_ccv_0); - - - __m256i v1 = _mm256_andnot_si256(_mm256_setzero_si256(), vectorsignbit); - - __m256i region_upperv_0 = _mm256_sllv_epi32(v1, cm_ccv_0); - - region_upperv_0 = _mm256_andnot_si256(region_upperv_0, vectorsignbit); - region_upperv_0 = _mm256_or_si256(region_upperv_0, region_lowerv_0); + // lower + __mmask16 lower_juge_zero_mask = _mm512_cmpeq_epi32_mask(region_lowerv, _mm512_setzero_si512()); + __mmask16 lower_juge_nzero_mask = _mm512_kandn(lower_juge_zero_mask, 0xffff); - //lower - __m256i lower_juge_zerov_0 = _mm256_cmpeq_epi32(region_lowerv_0, _mm256_setzero_si256()); - - - __m256i lower_juge_nzerov_0 = _mm256_andnot_si256(lower_juge_zerov_0, vectorsignbit); - - __m256 minvalv = _mm256_set1_ps(MINVAL); - __m256i bitsizev = _mm256_set1_epi16((short) index->settings->sax_alphabet_cardinality - 1); - __m256i bit1v = _mm256_set1_epi32(1); + __m512 minvalv = _mm512_set1_ps(MINVAL); + __m256i bitsizev = _mm256_set1_epi16((int16_t)sax_alphabet_cardinality); + __m512i bit1v = _mm512_set1_epi32(1); __m256i offsetvs = _mm256_set_epi16(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); __m256i vsssssoffsetvs2 = _mm256_mullo_epi16(bitsizev, offsetvs); - __m128i offsetv0s = _mm256_extractf128_si256(vsssssoffsetvs2, 0); - - __m128i offsetv1s = _mm256_extractf128_si256(vsssssoffsetvs2, 1); - __m256i offsetv0 = _mm256_cvtepu16_epi32(offsetv0s); + __m512i offsetv = _mm512_cvtepu16_epi32(vsssssoffsetvs2); - __m256i region_lowerbinv0 = _mm256_add_epi32(offsetv0, region_lowerv_0); - - region_lowerbinv0 = _mm256_sub_epi32(region_lowerbinv0, bit1v); + __m512i region_lowerbinv = _mm512_add_epi32(offsetv, region_lowerv); - __m256 lsax_breakpoints_shiftv_0 = _mm256_i32gather_ps(index->binsv, region_lowerbinv0, 4); + region_lowerbinv = _mm512_sub_epi32(region_lowerbinv, bit1v); - __m256 breakpoint_lowerv_0 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_0, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_0, - (__m256i) lsax_breakpoints_shiftv_0)); + __m512 lsax_breakpoints_shiftv = _mm512_i32gather_ps(region_lowerbinv, index->binsv, 4); + __m512 breakpoint_lowerv = (__m512)_mm512_or_si512( + _mm512_maskz_mov_epi32(lower_juge_zero_mask, (__m512i)minvalv), + _mm512_maskz_mov_epi32(lower_juge_nzero_mask, (__m512i)lsax_breakpoints_shiftv)); - //upper - __m256i region_upperbinv0 = _mm256_add_epi32(offsetv0, region_upperv_0); + // upper + __m512i region_upperbinv = _mm512_add_epi32(offsetv, region_upperv); - __m256 usax_breakpoints_shiftv_0 = _mm256_i32gather_ps(index->binsv, region_upperbinv0, 4); + __m512 usax_breakpoints_shiftv = _mm512_i32gather_ps(region_upperbinv, index->binsv, 4); - __m256i upper_juge_maxv_0 = _mm256_cmpeq_epi32(region_upperv_0, _mm256_set1_epi32(index->settings->sax_alphabet_cardinality - 1)); + __mmask16 upper_juge_max_mask = _mm512_cmpeq_epi32_mask(region_upperv, _mm512_set1_epi32(sax_alphabet_cardinality)); - __m256i upper_juge_nmaxv_0 = _mm256_andnot_si256(upper_juge_maxv_0, vectorsignbit); + __mmask16 upper_juge_nmax_mask = _mm512_kandn(upper_juge_max_mask, 0xffff); - __m256 breakpoint_upperv_0 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_0, (__m256i) _mm256_set1_ps(MAXVAL)), - _mm256_and_si256(upper_juge_nmaxv_0, (__m256i) usax_breakpoints_shiftv_0)); + __m512 breakpoint_upperv = (__m512)_mm512_or_si512( + _mm512_maskz_mov_epi32(upper_juge_max_mask, (__m512i)_mm512_set1_ps(MAXVAL)), + _mm512_maskz_mov_epi32(upper_juge_nmax_mask, (__m512i)usax_breakpoints_shiftv)); + // dis + __m512 paav = _mm512_loadu_ps(fft); - //dis - __m256 paav_0, paav_1; + __mmask16 dis_juge_upv = _mm512_cmp_ps_mask(breakpoint_lowerv, paav, _CMP_GT_OS); - paav_0 = _mm256_loadu_ps(fft); + __mmask16 dis_juge_lov = _mm512_kand( + _mm512_cmp_ps_mask(breakpoint_lowerv, paav, _CMP_NGT_US), + _mm512_cmp_ps_mask(breakpoint_upperv, paav, _CMP_LT_OS)); - __m256 dis_juge_upv_0 = _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_GT_OS); + __m512 dis_lowv = _mm512_mul_ps(_mm512_sub_ps(breakpoint_lowerv, paav), + _mm512_sub_ps(breakpoint_lowerv, paav)); + __m512 dis_uppv = _mm512_mul_ps(_mm512_sub_ps(breakpoint_upperv, paav), + _mm512_sub_ps(breakpoint_upperv, paav)); - __m256 dis_juge_lov_0 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_0, paav_0, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_0, paav_0, _CMP_LT_OS)); + __m512 distancev = _mm512_or_ps( + _mm512_maskz_mov_ps(dis_juge_upv, dis_lowv), + _mm512_maskz_mov_ps(dis_juge_lov, dis_uppv)); - __m256 dis_juge_elv_0 = (__m256) _mm256_andnot_si256( - _mm256_or_si256((__m256i) dis_juge_upv_0, (__m256i) dis_juge_lov_0), vectorsignbit); + ts_type distance = _mm512_reduce_add_ps(distancev); - __m256 dis_lowv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_0, paav_0), - _mm256_sub_ps(breakpoint_lowerv_0, paav_0)); - __m256 dis_uppv_0 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_0, paav_0), - _mm256_sub_ps(breakpoint_upperv_0, paav_0)); - - - __m256 distancev_0 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_0, (__m256i) dis_lowv_0), - _mm256_and_si256((__m256i) dis_juge_lov_0, (__m256i) dis_uppv_0)), - _mm256_and_si256((__m256i) dis_juge_elv_0, (__m256i) _mm256_set1_ps(0.0))); - - __m256 distancev2 = _mm256_hadd_ps(distancev_0, distancev_0); + __m256 distancev1 = _mm512_extractf32x8_ps(distancev, 0); + __m256 distancev2 = _mm256_hadd_ps(distancev1, distancev1); __m256 distancevf = _mm256_hadd_ps(distancev2, distancev2); + _mm256_store_ps(distancef, distancevf); - _mm256_storeu_ps(distancef, distancevf); if ((distancef[0] + distancef[4]) * 2 > bsf) { return (distancef[0] + distancef[4]) * 2; } - __m128i sax_cardinalitiesv16_1 = _mm256_extractf128_si256(sax_cardinalitiesv16, 1); - __m256i c_cv_1 = _mm256_cvtepu16_epi32(sax_cardinalitiesv16_1); - __m128i saxv16_1 = _mm256_extractf128_si256(saxv16, 1); - __m256i v_1 = _mm256_cvtepu16_epi32(saxv16_1); - __m256i cm_ccv_1 = _mm256_sub_epi32(c_m, c_cv_1); - __m256i region_lowerv_1 = _mm256_srlv_epi32(v_1, cm_ccv_1); - region_lowerv_1 = _mm256_sllv_epi32(region_lowerv_1, cm_ccv_1); - __m256i region_upperv_1 = _mm256_sllv_epi32(v1, cm_ccv_1); - region_upperv_1 = _mm256_andnot_si256(region_upperv_1, vectorsignbit); - region_upperv_1 = _mm256_or_si256(region_upperv_1, region_lowerv_1); - __m256i lower_juge_zerov_1 = _mm256_cmpeq_epi32(region_lowerv_1, _mm256_setzero_si256()); - __m256i lower_juge_nzerov_1 = _mm256_andnot_si256(lower_juge_zerov_1, vectorsignbit); - __m256i offsetv1 = _mm256_cvtepu16_epi32(offsetv1s); - __m256i region_lowerbinv1 = _mm256_add_epi32(offsetv1, region_lowerv_1); - region_lowerbinv1 = _mm256_sub_epi32(region_lowerbinv1, bit1v); - __m256 lsax_breakpoints_shiftv_1 = _mm256_i32gather_ps(index->binsv, region_lowerbinv1, 4); - __m256 breakpoint_lowerv_1 = (__m256) _mm256_or_si256(_mm256_and_si256(lower_juge_zerov_1, (__m256i) minvalv), - _mm256_and_si256(lower_juge_nzerov_1, - (__m256i) lsax_breakpoints_shiftv_1)); - - __m256i region_upperbinv1 = _mm256_add_epi32(offsetv1, region_upperv_1); - __m256 usax_breakpoints_shiftv_1 = _mm256_i32gather_ps(index->binsv, region_upperbinv1, 4); - __m256i upper_juge_maxv_1 = _mm256_cmpeq_epi32(region_upperv_1, _mm256_set1_epi32(index->settings->sax_alphabet_cardinality - 1)); - __m256i upper_juge_nmaxv_1 = _mm256_andnot_si256(upper_juge_maxv_1, vectorsignbit); - __m256 breakpoint_upperv_1 = (__m256) _mm256_or_si256( - _mm256_and_si256(upper_juge_maxv_1, (__m256i) _mm256_set1_ps(MAXVAL)), - _mm256_and_si256(upper_juge_nmaxv_1, (__m256i) usax_breakpoints_shiftv_1)); - paav_1 = _mm256_loadu_ps(&(fft[8])); - __m256 dis_juge_upv_1 = _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_GT_OS); - - - __m256 dis_juge_lov_1 = (__m256) _mm256_and_si256((__m256i) _mm256_cmp_ps(breakpoint_lowerv_1, paav_1, _CMP_NGT_US), - (__m256i) _mm256_cmp_ps(breakpoint_upperv_1, paav_1, _CMP_LT_OS)); - - __m256 dis_juge_elv_1 = (__m256) _mm256_andnot_si256( - _mm256_or_si256((__m256i) dis_juge_upv_1, (__m256i) dis_juge_lov_1), vectorsignbit); - - __m256 dis_lowv_1 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_lowerv_1, paav_1), - _mm256_sub_ps(breakpoint_lowerv_1, paav_1)); - - __m256 dis_uppv_1 = _mm256_mul_ps(_mm256_sub_ps(breakpoint_upperv_1, paav_1), - _mm256_sub_ps(breakpoint_upperv_1, paav_1)); - - __m256 distancev_1 = (__m256) _mm256_or_si256( - _mm256_or_si256(_mm256_and_si256((__m256i) dis_juge_upv_1, (__m256i) dis_lowv_1), - _mm256_and_si256((__m256i) dis_juge_lov_1, (__m256i) dis_uppv_1)), - _mm256_and_si256((__m256i) dis_juge_elv_1, (__m256i) _mm256_set1_ps(0.0))); - - - distancev2 = _mm256_hadd_ps(distancev_1, distancev_1); - distancevf = _mm256_hadd_ps(distancev2, distancev2); - _mm256_storeu_ps(distancef2, distancevf); - - return (distancef[0] + distancef[4] + distancef2[0] + distancef2[4]) * 2; - + return distance * 2; } +#endif diff --git a/src/utils/MESSI.c b/src/utils/MESSI.c index 5a6ac206..8f61ab97 100644 --- a/src/utils/MESSI.c +++ b/src/utils/MESSI.c @@ -1,9 +1,9 @@ // -// main.c +// MESSI.c // isaxlib // -// Created by Botao Peng, March 2020. -// +// created: Jakob Brand 2022 +// changes: Gerrit Slomma 2025 // #define _GNU_SOURCE @@ -14,11 +14,10 @@ #include #endif -#include "../../config.h" -#include "../../globals.h" #include #include #include +#include #include #include #include @@ -26,6 +25,12 @@ #include #include #include +#if defined(__linux__) +#include +#endif +#if defined(__APPLE_CC__) +#include +#endif #include #include @@ -33,7 +38,6 @@ #include "ads/sax/ts.h" #include "ads/isax_visualize_index.h" #include "ads/isax_file_loaders.h" -#include "ads/isax_visualize_index.h" #include "ads/isax_first_buffer_layer.h" #include "ads/isax_query_engine.h" #include "ads/inmemory_query_engine.h" @@ -46,46 +50,49 @@ #include "ads/sfa/dft.h" #include "ads/sfa/sfa.h" #include "include/ads/isax_file_loaders.h" -//#define PROGRESS_CALCULATE_THREAD_NUMBER 4 -//#define PROGRESS_FLUSH_THREAD_NUMBER 4 -//#define QUERIES_THREAD_NUMBER 4 -//#define DISK_BUFFER_SIZE 32 -#define FILENAME_LENGTH 256 + +#include "../../config.h" +#include "../../globals.h" isax_index *idx; void INThandler(int); - int main(int argc, char **argv) { signal(SIGINT, INThandler); +#if defined(__x86_64__) + if (!__builtin_cpu_supports("fma")) { + printf("CPU does not support FMA, exiting.\n"); + + return -1; + } +#endif + #ifndef BENCHMARK - printf(PRODUCT); + printf("%s", PRODUCT); #if VERBOSE_LEVEL == 0 printf("Executing in silent mode. Please wait.\n"); #endif #endif - static char index_directory[FILENAME_LENGTH]; - strcpy(index_directory, getenv("HOME")); - strcat(index_directory, "/index/"); + static char index_directory[FILENAME_MAX]; + int pathlen = snprintf(index_directory, strlen(getenv("HOME")) + 1, getenv("HOME")); + snprintf(index_directory + pathlen, strlen("/index/") + 1, "/index/"); - static char data_directory[FILENAME_LENGTH]; - strcpy(data_directory, getenv("HOME")); - strcat(data_directory, "/data/data"); + static char data_directory[FILENAME_MAX]; + pathlen = snprintf(data_directory, strlen(getenv("HOME")) + 1, getenv("HOME")); + snprintf(data_directory + pathlen, strlen("/data/data") + 1, "/data/data"); - static char query_directory[FILENAME_LENGTH]; - strcpy(query_directory, getenv("HOME")); - strcat(query_directory, "/data/query"); + static char query_directory[FILENAME_MAX]; + pathlen = snprintf(query_directory, strlen(getenv("HOME")) + 1, getenv("HOME")); + snprintf(query_directory + pathlen, strlen("/data/query") + 1, "data/query"); static char *dataset = data_directory; static char *queries = query_directory; static char *index_path = index_directory; static char *labelset = index_directory; - //static int dataset_size = 20100;//1000000; - //static int dataset_size = 1000000;//simple2 - static long int dataset_size = 6000000;//testbench + static int64_t dataset_size = 6000000; // testbench static int queries_size = 10; static int time_series_size = 256; static int paa_segments = 16; @@ -105,6 +112,8 @@ int main(int argc, char **argv) { static char knnlabel = 0; static int min_checked_leaves = -1; static int cpu_control_type = 81; + static int threads_to_run = 8; + static int node_to_run = -1; static char inmemory_flag = 0; static char SIMD_flag = 0; static char is_norm = 0; @@ -120,7 +129,7 @@ int main(int argc, char **argv) { maxreadthread = 5; read_block_length = 20000; int k_size = 0; - long int labelsize = 1; + int64_t labelsize = 1; int topk = 0; int dtwwindowsize = 0; int sample_size = 1; @@ -176,142 +185,168 @@ int main(int argc, char **argv) { /* getopt_long stores the option index here. */ int option_index = 0; - int c = getopt_long(argc, argv, "", - long_options, &option_index); - if (c == -1) + int c = getopt_long(argc, argv, "", long_options, &option_index); + + if (c == -1) { break; + } + switch (c) { case 'j': serial_scan = 1; + break; case 'g': aggressive_check = 1; - break; + break; case 's': minimum_distance = atof(optarg); - break; + break; case 'n': tight_bound = 1; - break; + break; case 'e': total_loaded_leaves = atoi(optarg); - break; + break; case 'c': complete_type = atoi(optarg); - break; + break; case 'q': queries = optarg; - break; + break; case 'k': queries_size = atoi(optarg); - break; + break; case 'd': dataset = optarg; - break; + break; case 'p': index_path = optarg; - break; + break; case 'z': dataset_size = atoi(optarg); - break; + break; case 't': time_series_size = atoi(optarg); - break; + break; case 'x': sax_cardinality = atoi(optarg); - break; + break; case 'B': paa_segments = atoi(optarg); + break; case 'l': leaf_size = atoi(optarg); - break; + break; case 'm': min_leaf_size = atoi(optarg); - break; + break; case 'b': initial_lbl_size = atoi(optarg); - break; + break; case 'f': flush_limit = atoi(optarg); - break; + break; case 'u': min_checked_leaves = atoi(optarg); + break; case 'w': - cpu_control_type = atoi(optarg); - break; + if (strchr(optarg, '-')) { + node_to_run = atoi(strchr(optarg, '-') + 1); + } + + threads_to_run = atoi(optarg); + break; case 'y': function_type = atoi(optarg); + break; case 'i': initial_fbl_size = atoi(optarg); + break; case 'o': maxreadthread = atoi(optarg); + break; case 'r': read_block_length = atoi(optarg); + break; case '0': k_size = atoi(optarg); + break; case '1': labelset = optarg; + break; case '2': labelsize = atoi(optarg); + + break; case '3': knnlabel = 1; + break; case '4': topk = 1; + break; case '5': dtwwindowsize = atoi(optarg); + break; case '6': N_PQUEUE = atoi(optarg); + break; case '8': sample_size = atoi(optarg); + break; case 'A': histogram_type = atoi(optarg); + break; case 'C': sample_type = atoi(optarg); + break; case 'D': coeff_number = atoi(optarg); + break; case 'E': filetype_int = 1; + break; case 'F': apply_znorm = 1; - break; + break; case 'h': #ifdef BENCHMARK - printf(PRODUCT); + printf("%s", PRODUCT); #endif printf("Usage:\n\ \t--dataset XX \t\t\tThe path to the dataset file\n\ @@ -346,7 +381,8 @@ int main(int argc, char **argv) { \t\t\tin memory only index creation: 0\n\ \t\t\tParIS-TS: 1\n\ \t\t\tParIS: 2\n\ - \t\t\t\\MESSI-mq: 3\n\ + \t\t\tMESSI-mq: 3\n\ + \t\t\tMESSI-SFA: 4\n\ \t--SIMD\t\t\tSet for search with SIMD intrinsics\n\ \t--sample-size\t\t\tSet sample size for MCB\n\ \t--sample-type\t\t\tSet for sampling strategy\n\ @@ -360,279 +396,66 @@ int main(int argc, char **argv) { \t--histogram-type\t\t\tSet for binning strategy\n\ \t\t\tequi-depth splitting (default): 1\n\ \t\t\tequi-width splitting: 2\n\ - \t--cpu-type\t\t\tSet for how many cores you want to used and in 1 or 2 cpu\n\ + \t--cpu-type\t\t\tSet for how many cores you want to used on what cpu numa-node\n\ \t--help\n\n\ - \tCPU type code:\t\t\t21 : 2 core in 1 CPU\n\ - \t\t\t\t\t22 : 2 core in 2 CPUs\n\ - \t\t\t\t\t41 : 4 core in 1 CPU\n\ - \t\t\t\t\t42 : 4 core in 2 CPUs\n\ - \t\t\t\t\t61 : 6 core in 1 CPU\n\ - \t\t\t\t\t62 : 6 core in 2 CPUs\n\ - \t\t\t\t\t81 : 8 core in 1 CPU\n\ - \t\t\t\t\t82 : 8 core in 2 CPUs\n\ - \t\t\t\t\t101: 10 core in 1 CPU\n\ - \t\t\t\t\t102: 10 core in 2 CPUs\n\ - \t\t\t\t\t121: 12 core in 1 CPU\n\ - \t\t\t\t\t122: 12 core in 2 CPUs\n\ - \t\t\t\t\t181: 18 core in 1 CPU\n\ - \t\t\t\t\t182: 18 core in 2 CPUs\n\ - \t\t\t\t\t242: 24 core in 2 CPUs\n\ - \t\t\t\t\t362: 36 core in 2 CPUs\n\ - \t\t\t\t\tOther: 1 core in 1 CPU\n\ - "); + \tCPU type code:\t\t\t2-1 : 2 core on node 1\n\ + \t\t\t\t\t2 : 2 cores in all nodes\n\ + \t\t\t\t\t40-0 : 40 cores on node 0\n"); + return 0; + break; case 'a': use_index = 1; + break; case 'v': inmemory_flag = 1; + break; case '7': SIMD_flag = 1; + break; case '9': is_norm = 1; + break; default: exit(-1); + break; } } INIT_STATS(); - cpu_set_t mask, get; - CPU_ZERO(&mask); - CPU_ZERO(&get); - if (cpu_control_type == 21) { - CPU_SET(0, &mask); - CPU_SET(2, &mask); - calculate_thread = 2; - maxquerythread = 2; - } else if (cpu_control_type == 22) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - calculate_thread = 2; - maxquerythread = 2; - } else if (cpu_control_type == 41) { - CPU_SET(0, &mask); - CPU_SET(2, &mask); - CPU_SET(4, &mask); - CPU_SET(6, &mask); - calculate_thread = 4; - maxquerythread = 4; - } else if (cpu_control_type == 42) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - CPU_SET(2, &mask); - CPU_SET(3, &mask); - calculate_thread = 4; - maxquerythread = 4; - } else if (cpu_control_type == 61) { - CPU_SET(0, &mask); - CPU_SET(2, &mask); - CPU_SET(4, &mask); - CPU_SET(6, &mask); - CPU_SET(8, &mask); - CPU_SET(10, &mask); - calculate_thread = 6; - maxquerythread = 6; - } else if (cpu_control_type == 62) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - CPU_SET(2, &mask); - CPU_SET(3, &mask); - CPU_SET(4, &mask); - CPU_SET(5, &mask); - calculate_thread = 6; - maxquerythread = 6; - } else if (cpu_control_type == 81) { - CPU_SET(0, &mask); - CPU_SET(2, &mask); - CPU_SET(4, &mask); - CPU_SET(6, &mask); - CPU_SET(8, &mask); - CPU_SET(10, &mask); - CPU_SET(12, &mask); - CPU_SET(14, &mask); - calculate_thread = 8; - maxquerythread = 8; - } else if (cpu_control_type == 82) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - CPU_SET(2, &mask); - CPU_SET(3, &mask); - CPU_SET(4, &mask); - CPU_SET(5, &mask); - CPU_SET(6, &mask); - CPU_SET(7, &mask); - calculate_thread = 8; - maxquerythread = 8; - } else if (cpu_control_type == 101) { - CPU_SET(0, &mask); - CPU_SET(2, &mask); - CPU_SET(4, &mask); - CPU_SET(6, &mask); - CPU_SET(8, &mask); - CPU_SET(10, &mask); - CPU_SET(12, &mask); - CPU_SET(14, &mask); - CPU_SET(16, &mask); - CPU_SET(18, &mask); - calculate_thread = 10; - maxquerythread = 10; - } else if (cpu_control_type == 102) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - CPU_SET(2, &mask); - CPU_SET(3, &mask); - CPU_SET(4, &mask); - CPU_SET(5, &mask); - CPU_SET(6, &mask); - CPU_SET(7, &mask); - CPU_SET(8, &mask); - CPU_SET(9, &mask); - calculate_thread = 10; - maxquerythread = 10; - } else if (cpu_control_type == 121) { - CPU_SET(0, &mask); - CPU_SET(2, &mask); - CPU_SET(4, &mask); - CPU_SET(6, &mask); - CPU_SET(8, &mask); - CPU_SET(10, &mask); - CPU_SET(12, &mask); - CPU_SET(14, &mask); - CPU_SET(16, &mask); - CPU_SET(18, &mask); - CPU_SET(20, &mask); - CPU_SET(22, &mask); - calculate_thread = 12; - maxquerythread = 12; - } else if (cpu_control_type == 122) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - CPU_SET(2, &mask); - CPU_SET(3, &mask); - CPU_SET(4, &mask); - CPU_SET(5, &mask); - CPU_SET(6, &mask); - CPU_SET(7, &mask); - CPU_SET(8, &mask); - CPU_SET(9, &mask); - CPU_SET(10, &mask); - CPU_SET(11, &mask); - calculate_thread = 12; - maxquerythread = 12; - } else if (cpu_control_type == 182) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - CPU_SET(2, &mask); - CPU_SET(3, &mask); - CPU_SET(4, &mask); - CPU_SET(5, &mask); - CPU_SET(6, &mask); - CPU_SET(7, &mask); - CPU_SET(8, &mask); - CPU_SET(9, &mask); - CPU_SET(10, &mask); - CPU_SET(11, &mask); - CPU_SET(12, &mask); - CPU_SET(13, &mask); - CPU_SET(14, &mask); - CPU_SET(15, &mask); - CPU_SET(16, &mask); - CPU_SET(17, &mask); - calculate_thread = 18; - maxquerythread = 18; - } else if (cpu_control_type == 242) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - CPU_SET(2, &mask); - CPU_SET(3, &mask); - CPU_SET(4, &mask); - CPU_SET(5, &mask); - CPU_SET(6, &mask); - CPU_SET(7, &mask); - CPU_SET(8, &mask); - CPU_SET(9, &mask); - CPU_SET(10, &mask); - CPU_SET(11, &mask); - CPU_SET(12, &mask); - CPU_SET(13, &mask); - CPU_SET(14, &mask); - CPU_SET(15, &mask); - CPU_SET(16, &mask); - CPU_SET(17, &mask); - CPU_SET(18, &mask); - CPU_SET(19, &mask); - CPU_SET(20, &mask); - CPU_SET(21, &mask); - CPU_SET(22, &mask); - CPU_SET(23, &mask); - calculate_thread = 24; - maxquerythread = 24; - } - //new control type for gruenau1-server with 36 cores on 2 CPUs - else if (cpu_control_type == 362) { - CPU_SET(0, &mask); - CPU_SET(1, &mask); - CPU_SET(2, &mask); - CPU_SET(3, &mask); - CPU_SET(4, &mask); - CPU_SET(5, &mask); - CPU_SET(6, &mask); - CPU_SET(7, &mask); - CPU_SET(8, &mask); - CPU_SET(9, &mask); - CPU_SET(10, &mask); - CPU_SET(11, &mask); - CPU_SET(12, &mask); - CPU_SET(13, &mask); - CPU_SET(14, &mask); - CPU_SET(15, &mask); - CPU_SET(16, &mask); - CPU_SET(17, &mask); - CPU_SET(18, &mask); - CPU_SET(19, &mask); - CPU_SET(20, &mask); - CPU_SET(21, &mask); - CPU_SET(22, &mask); - CPU_SET(23, &mask); - CPU_SET(24, &mask); - CPU_SET(25, &mask); - CPU_SET(26, &mask); - CPU_SET(27, &mask); - CPU_SET(28, &mask); - CPU_SET(29, &mask); - CPU_SET(30, &mask); - CPU_SET(31, &mask); - CPU_SET(32, &mask); - CPU_SET(33, &mask); - CPU_SET(34, &mask); - CPU_SET(35, &mask); - calculate_thread = 36; - maxquerythread = 36; - } else if (cpu_control_type == 1) { - calculate_thread = 1; - maxquerythread = 1; - } else { - calculate_thread = cpu_control_type; - maxquerythread = cpu_control_type; +#if defined(__linux__) + if (numa_available() >= 0) { + struct bitmask *bm = numa_bitmask_alloc(numa_num_task_cpus()); + numa_set_localalloc(); - for (int i = 0; i < cpu_control_type; i++) { - //CPU_SET(i, &mask); + if (node_to_run >= 0) { + if (node_to_run > numa_max_node()) { + node_to_run = numa_max_node(); + } + + numa_run_on_node(node_to_run); + printf("run %d threads on node %d\n", threads_to_run, node_to_run); + } else { + printf("run %d threads on all nodes\n", threads_to_run); + numa_run_on_node(-1); } + } else { +#endif + printf("run %d threads on all nodes\n", threads_to_run); +#if defined(__linux__) } +#endif - if (pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) < 0) { - fprintf(stderr, "set thread affinity failed\n"); - } + calculate_thread = threads_to_run; + maxquerythread = threads_to_run; - if (pthread_getaffinity_np(pthread_self(), sizeof(get), &get) < 0) { - fprintf(stderr, "get thread affinity failed\n"); - } if (use_index) { isax_index *idx = index_read(index_path); idx->settings->tight_bound = tight_bound; @@ -640,49 +463,45 @@ int main(int argc, char **argv) { idx->settings->total_loaded_leaves = total_loaded_leaves; idx->settings->min_leaf_size = min_leaf_size; print_settings(idx->settings); - //fprintf(stderr,"total_records: %ld\n", idx->total_records); - //fprintf(stderr,"loaded_records: %ld\n", idx->loaded_records); - //create_wedges(idx, NULL); char sanity_test = 0; + if (sanity_test) { cache_sax_file(idx); - isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - &sanity_check_query); + isax_query_binary_file(queries, queries_size, idx, + minimum_distance, min_checked_leaves, &sanity_check_query); } else { if (serial_scan) { cache_sax_file(idx); if (knnlabel) { if (function_type == 0) { isax_knn_query_binary_file(queries, labelset, queries_size, idx, minimum_distance, - min_checked_leaves, k_size, labelsize, - &exact_topk_serial); //ADS+ knn + min_checked_leaves, k_size, labelsize, &exact_topk_serial); // ADS+ knn } else if (function_type == 1) { isax_knn_query_binary_file(queries, labelset, queries_size, idx, minimum_distance, - min_checked_leaves, k_size, labelsize, - &exact_topk_serial_ParIS); //ParIS knn + min_checked_leaves, k_size, labelsize, &exact_topk_serial_ParIS); // ParIS knn } - } else if (topk) { if (function_type == 0) { - isax_topk_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - k_size, &exact_topk_serial);//ADS+ topk + isax_topk_query_binary_file(queries, queries_size, idx, minimum_distance, + min_checked_leaves, k_size, &exact_topk_serial); // ADS+ topk } else if (function_type == 1) { - isax_topk_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - k_size, &exact_topk_serial_ParIS);//ParIS topk + isax_topk_query_binary_file(queries, queries_size, idx, minimum_distance, + min_checked_leaves, k_size, &exact_topk_serial_ParIS); // ParIS topk } } else { if (function_type == 0) { - isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - &exact_search_serial);//ADS+ similarity search + isax_query_binary_file(queries, queries_size, idx, minimum_distance, + min_checked_leaves, &exact_search_serial); // ADS+ similarity search } else if (function_type == 1) { - isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - &exact_search_serial_ParIS);//ParIS similarity search + isax_query_binary_file(queries, queries_size, idx, minimum_distance, + min_checked_leaves, &exact_search_serial_ParIS); // ParIS similarity search } else if (function_type == 2) { - isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - &exact_search_serial_ParIS_nb);//ParIS-nb similarity search + isax_query_binary_file(queries, queries_size, idx, minimum_distance, + min_checked_leaves, &exact_search_serial_ParIS_nb); // ParIS-nb similarity search } else if (function_type == 3) { - //isax_query_binary_file_para(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_serial); + // TODO(someon): implement serial scan + // isax_query_binary_file_para(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_serial); } } @@ -690,69 +509,123 @@ int main(int argc, char **argv) { if (knnlabel) { if (function_type == 0) { isax_knn_query_binary_file(queries, labelset, queries_size, idx, minimum_distance, - min_checked_leaves, k_size, labelsize, &exact_topk); + min_checked_leaves, k_size, labelsize, &exact_topk); } - } else if (topk) { if (function_type == 0) { - isax_topk_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - k_size, &exact_topk); + isax_topk_query_binary_file(queries, queries_size, idx, minimum_distance, + min_checked_leaves, k_size, &exact_topk); } } else { if (function_type == 0) { - isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - &exact_search); + isax_query_binary_file(queries, queries_size, idx, minimum_distance, + min_checked_leaves, &exact_search); } else { - isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - &exact_search_m); + isax_query_binary_file(queries, queries_size, idx, minimum_distance, + min_checked_leaves, &exact_search_m); } } } } + PRINT_STATS(0.00f) flush_all_leaf_buffers(idx, TMP_ONLY_CLEAN); index_write(idx); - //clear_wedges(idx, NULL); - //printf("this is the total search time is %f\n", total_time); isax_index_destroy(idx, NULL); } else { - char rm_command[256]; + char rm_command[FILENAME_MAX]; if (!inmemory_flag) { - sprintf(rm_command, "rm -rf %s", index_path); + snprintf(rm_command, FILENAME_MAX, "rm -rf %s", index_path); system(rm_command); } - //check if paa_segments size is at most timeseries_size + + // check if paa_segments size is at most timeseries_size if (paa_segments > time_series_size) { fprintf(stderr, "ERROR: PAA segments may not be larger than timeseries-size!\n"); + return -1; } - //check is coeff_number is between paa_segments/2 and timeseries_size/2 + + // check is coeff_number is between paa_segments/2 and timeseries_size/2 if (coeff_number != 0 && (coeff_number < paa_segments / 2 || coeff_number > time_series_size / 2)) { if (coeff_number < paa_segments || coeff_number > time_series_size) { - fprintf(stderr, "ERROR: coeff number must be between %d and %d!\n", paa_segments, time_series_size); + fprintf(stderr, "ERROR: coeff number must be between %d and %d!\n", + paa_segments, time_series_size); + return -1; } else if (coeff_number % 2 != 0) { fprintf(stderr, "ERROR: coeff number must be divisible by 2!\n"); + return -1; } } - //get current time for logfiles + char cpu_model[100]; + char cpu_cores[8]; +#if defined(__linux__) + FILE *fp = fopen("/proc/cpuinfo", "r"); + char buf[BUFSIZ]; + bool found_model = false; + bool found_cores = false; + + while (fgets(buf, sizeof(buf), fp) != NULL) { + if (strncmp(buf, "model name", strlen("model name")) == 0 && found_model == false) { + char *pos = strstr(buf, ": "); + + if (pos != NULL) { + memcpy(cpu_model, pos + 2, strlen(pos) - 3); + found_model = true; + } + } + + if (strncmp(buf, "cpu cores", strlen("cpu cores")) == 0 && found_cores == false) { + char *pos = strstr(buf, ": "); + + if (pos != NULL) { + memcpy(cpu_cores, pos + 2, strlen(pos) - 3); + found_cores = true; + } + } + } + + printf("model: %s\n", cpu_model); + printf("cores: %s\n", cpu_cores); + fclose(fp); +#elif defined(__APPLE_CC__) + int mib[2]; + size_t len; + int cpu_cores_i; + + mib[0] = CTL_HW; + mib[1] = HW_MODEL; + + sysctl(mib, 2, NULL, &len, NULL, 0); + sysctl(mib, 2, cpu_model, &len, NULL, 0); + + mib[1] = HW_NCPU; + + sysctl(mib, 2, NULL, &len, NULL, 0); + + sysctl(mib, 2, &cpu_cores_i, &len, NULL, 0); + sprintf(cpu_cores, "%d", cpu_cores_i); +#endif + + // get current time for logfiles time(&time_now); char time_str[20]; time_now = time(NULL); strftime(time_str, 20, "%Y_%m_%d_%H:%M:%S", localtime(&time_now)); - //concatenate names for logfile directories - char log_file_directory[FILENAME_LENGTH]; - char log_filename[FILENAME_LENGTH]; - char log_filename_tree[FILENAME_LENGTH]; - char log_filename_index[FILENAME_LENGTH]; - char log_filename_query[FILENAME_LENGTH]; + // concatenate names for logfile directories + char log_file_directory[FILENAME_MAX]; + char log_filename[FILENAME_MAX]; + char log_filename_tree[FILENAME_MAX]; + char log_filename_index[FILENAME_MAX]; + char log_filename_query[FILENAME_MAX]; strcat(strcpy(log_file_directory, getenv("HOME")), "/MESSI_logs"); strcat(strcpy(log_filename, getenv("HOME")), "/MESSI_logs/settings"); @@ -760,31 +633,30 @@ int main(int argc, char **argv) { strcat(strcpy(log_filename_index, getenv("HOME")), "/MESSI_logs/index"); strcat(strcpy(log_filename_query, getenv("HOME")), "/MESSI_logs/query"); - //check if logfile directories exist, create them if neccessary + // check if logfile directories exist, create them if neccessary struct stat st = {0}; if (stat(log_file_directory, &st) == -1) { mkdir(log_file_directory, 0777); } + if (stat(log_filename, &st) == -1) { mkdir(log_filename, 0777); } + if (stat(log_filename_tree, &st) == -1) { mkdir(log_filename_tree, 0777); } + if (stat(log_filename_index, &st) == -1) { mkdir(log_filename_index, 0777); } + if (stat(log_filename_query, &st) == -1) { mkdir(log_filename_query, 0777); } -/* - mkdir(log_filename, 0777); - mkdir(log_filename_tree, 0777); - mkdir(log_filename_index, 0777); - mkdir(log_filename_query, 0777); -*/ - //concatenate actual file names + + // concatenate actual file names strcat(log_filename, "/MESSI_SETTINGS_"); strcat(log_filename, time_str); strcat(log_filename, ".csv"); @@ -803,7 +675,7 @@ int main(int argc, char **argv) { strcat(index_directory, time_str); - //create logfiles + // create logfiles FILE *logfile; logfile = fopen(log_filename, "w"); @@ -819,33 +691,32 @@ int main(int argc, char **argv) { SET_LOGFILE(logfile_query); fprintf(logfile, - "MESSI SETTINGS\nFunction type,%d\nSIMD,%u\ntimeseries length,%d\npaa segments,%d\nisax-cardinality,%d\nleaf size,%d\nsample-size,%d\nsample type,%d\n", - function_type, SIMD_flag, time_series_size, paa_segments, sax_cardinality, leaf_size, sample_size, - sample_type); - - isax_index_settings *index_settings = isax_index_settings_init(index_path, // INDEX DIRECTORY - time_series_size, // TIME SERIES SIZE - paa_segments, // PAA SEGMENTS - sax_cardinality, // SAX CARDINALITY IN BITS - leaf_size, // LEAF SIZE - min_leaf_size, // MIN LEAF SIZE - initial_lbl_size, // INITIAL LEAF BUFFER SIZE - flush_limit, // FLUSH LIMIT - initial_fbl_size, // INITIAL FBL BUFFER SIZE - total_loaded_leaves,// Leaves to load at each fetch - tight_bound, // Tightness of leaf bounds - aggressive_check, // aggressive check - 1, // new index - function_type, //function_type - inmemory_flag, //inmemory_flag - SIMD_flag, //SIMD_flag - sample_size, //sample_size for MCB - is_norm, //input normalized for fft - histogram_type, //histogram type for binning - sample_type, //sampling type - coeff_number //coeff number - ); - + "MESSI SETTINGS\nFunction type,%d\nSIMD,%u\ntimeseries length,%d\npaa segments,%d\nisax-cardinality,%d\nleaf size,%d\nsample-size,%d\nsample type,%d\nthreads run,%d\ncpu model,%s\ncpu cores,%s\n", + function_type, SIMD_flag, time_series_size, paa_segments, sax_cardinality, + leaf_size, sample_size, sample_type, threads_to_run, cpu_model, cpu_cores); + + isax_index_settings *index_settings = isax_index_settings_init( + index_path, // INDEX DIRECTORY + time_series_size, // TIME SERIES SIZE + paa_segments, // PAA SEGMENTS + sax_cardinality, // SAX CARDINALITY IN BITS + leaf_size, // LEAF SIZE + min_leaf_size, // MIN LEAF SIZE + initial_lbl_size, // INITIAL LEAF BUFFER SIZE + flush_limit, // FLUSH LIMIT + initial_fbl_size, // INITIAL FBL BUFFER SIZE + total_loaded_leaves, // Leaves to load at each fetch + tight_bound, // Tightness of leaf bounds + aggressive_check, // aggressive check + 1, // new index + function_type, // function_type + inmemory_flag, // inmemory_flag + SIMD_flag, // SIMD_flag + sample_size, // sample_size for MCB + is_norm, // input normalized for fft + histogram_type, // histogram type for binning + sample_type, // sampling type + coeff_number); // coeff number if (!inmemory_flag) { idx = isax_index_init(index_settings); @@ -857,57 +728,66 @@ int main(int argc, char **argv) { #ifdef CLUSTERED char s[255]; - sprintf(s, "rm -rf %s.*", dataset); + snprintf(s, sizeof(s) + 1, "rm -rf %s.*", dataset); system(s); #endif - COUNT_TOTAL_TIME_START +#if defined(__x86_64__) + if (__builtin_cpu_supports("fma")) { + printf("FMA"); + } - //// #### COMMENTED OUT: BUGGY CODE!!! #### - /*int sorted = 0; - if(sorted == 1) { - isax_sorted_index_binary_file(dataset, dataset_size, idx); + if (__builtin_cpu_supports("avx512f")) { + printf("; AVX512F"); } - else if(sorted == 2) { - isax_merge_sorted_index_binary_file(dataset, dataset_size, idx); + + if (__builtin_cpu_supports("avx512vl")) { + printf("; AVX512VL"); } - else {*/ - /// ######################################## - //MESSI-SFA: in-memory flag set with function-type 4 + if (__builtin_cpu_supports("avx512dq")) { + printf("; AVX512DQ"); + } + + printf(" detected\n"); +#endif + + COUNT_TOTAL_TIME_START + + // MESSI-SFA: in-memory flag set with function-type 4 if (inmemory_flag && function_type == 4) { - //initialize bins + // initialize bins sfa_bins_init(idx); - //set bins + // set bins sfa_set_bins(idx, dataset, dataset_size, maxquerythread, filetype_int, apply_znorm); - //build index + // build index index_creation_pRecBuf(dataset, dataset_size, filetype_int, apply_znorm, idx); - //calculate depth (for analysis logfile only) + // calculate depth (for analysis logfile only) calculate_average_depth(logfile_tree, idx); - //save index building stats + // save index building stats INIT_INDEX_STATS_FILE(logfile_index); INIT_SAVE_FILE(logfile_query); + for (int i = 0; i < paa_segments; i++) { memcpy(&idx->binsv[i * (idx->settings->sax_alphabet_cardinality - 1)], idx->bins[i], sizeof(ts_type) * (idx->settings->sax_alphabet_cardinality - 1)); } - //perform queries + // perform queries if (topk && k_size > 1) { isax_topk_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, - min_checked_leaves, k_size, filetype_int, apply_znorm, - &exact_topk_MESSImq_inmemory);//MESSI topk + min_checked_leaves, k_size, filetype_int, apply_znorm, + &exact_topk_MESSImq_inmemory); // MESSI topk } else { - isax_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, min_checked_leaves, - filetype_int, apply_znorm, &exact_search_MESSI); + isax_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, + min_checked_leaves, filetype_int, apply_znorm, &exact_search_MESSI); } - } else if (inmemory_flag) { - // MESSI: parallel in memory index creation + // MESSI: parallel in memory index creation index_creation_pRecBuf(dataset, dataset_size, filetype_int, apply_znorm, idx); calculate_average_depth(logfile_tree, idx); @@ -915,71 +795,38 @@ int main(int argc, char **argv) { INIT_INDEX_STATS_FILE(logfile_index); INIT_SAVE_FILE(logfile_query); - //INIT_STATS() + // INIT_STATS() if (knnlabel) { if (function_type == 1) { isax_knn_query_binary_file(queries, labelset, queries_size, idx, minimum_distance, - min_checked_leaves, k_size, 2000, &exact_search_serial_topk_inmemory); + min_checked_leaves, k_size, 2000, &exact_search_serial_topk_inmemory); } else if (function_type == 2) { isax_knn_query_binary_file(queries, labelset, queries_size, idx, minimum_distance, - min_checked_leaves, k_size, 2000, &exact_topk_serial_ParIS_inmemory); + min_checked_leaves, k_size, 2000, &exact_topk_serial_ParIS_inmemory); } else if (function_type == 3) { isax_knn_query_binary_file_traditional(queries, labelset, queries_size, idx, minimum_distance, - min_checked_leaves, k_size, 2000, - &exact_topk_MESSImq_inmemory); + min_checked_leaves, k_size, 2000, + &exact_topk_MESSImq_inmemory); } } else if (topk && k_size > 1) { - if (function_type == 3) + if (function_type == 3) { isax_topk_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, - min_checked_leaves, k_size, filetype_int, apply_znorm, - &exact_topk_MESSImq_inmemory);//MESSI topk - + min_checked_leaves, k_size, filetype_int, apply_znorm, + &exact_topk_MESSImq_inmemory); // MESSI topk + } } else { - if (function_type == 0) { - //isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_inmemory); - //isax_DTWquery_binary_file_traditional(queries, queries_size, idx, minimum_distance, min_checked_leaves,dtwwindowsize); - } else if (function_type == 1) { + if (function_type == 1) { isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - &exact_search_parads_inmemory); - } else if (function_type == 4) { - //isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_inmemory_openmp); - } else if (function_type == 7) { - //isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_serial_ParIS_nb_inmemory); + &exact_search_parads_inmemory); } else if (function_type == 2) { isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, - &exact_search_serial_ParIS_inmemory); - } else if (function_type == 5) { - //bf=1; - //isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_serial_ParIS2_inmemory); - //isax_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, min_checked_leaves, filetype_int, filetype_int, apply_znorm, &exact_search_ParISnew_inmemory_hybrid_workstealing); - } else if (function_type == 6) { - //isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_serial_ParGISG_openmp_inmemory); - } - //MESSI-mq: in-memory flag set with function-type 3 - else if (function_type == 3) { + &exact_search_serial_ParIS_inmemory); + } else if (function_type == 3) { + // MESSI-mq: in-memory flag set with function-type 3 isax_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, min_checked_leaves, - filetype_int, apply_znorm, &exact_search_MESSI); - - //isax_query_binary_file_batch(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_serial_ParIS_nb_batch_inmemory); - } else if (function_type == 8) { - //isax_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, min_checked_leaves, filetype_int, filetype_int, znorm, &exact_search_ParISnew_inmemory); - //isax_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, min_checked_leaves, filetype_int, znorm, &exact_search_ParISnew_inmemory_workstealing); - } else if (function_type == 9) { - // isax_query_binary_file_traditional(queries, queries_size, idx, minimum_distance, min_checked_leaves, filetype_int, znorm, &exact_search_serial_ParGIS_openmp_inmemory); - } else if (function_type == 10) { - - //index_generate_inmemory_pRecBuf(dataset, dataset_size, idx); - //COUNT_QUEUE_TIME_START - //flush_pRecBuf_inmemory((parallel_first_buffer_layer*) idx->fbl, idx); - //COUNT_QUEUE_TIME_END - //PRINT_STATS(0.0f) - - //printf("this is the queue time: %f\n", total_queue_time); - //INIT_STATS() - //isax_query_binary_file(queries, queries_size, idx, minimum_distance, min_checked_leaves, &exact_search_serial_inmemory); + filetype_int, apply_znorm, &exact_search_MESSI); } } - } else { // ParIS/ParIS+ on disk index creation if (function_type == 0) { @@ -989,30 +836,17 @@ int main(int argc, char **argv) { flush_fbl(idx->fbl, idx); } else if (function_type == 1) { isax_index_binary_file_m(dataset, dataset_size, idx, - calculate_thread);// ParIS indexing program in parallel + calculate_thread); // ParIS indexing program in parallel } else if (function_type == 2) { isax_index_binary_file_m_new(dataset, dataset_size, idx, - calculate_thread);//ParIS+ indexing program in parallel + calculate_thread); // ParIS+ indexing program in parallel } } - //save querying stats + // save querying stats SAVE_STATS_TOTAL(logfile_query, queries_size) PRINT_STATS(0.00f) - /* Do not store index for now - //save index and get size for analysis - index_mRecBuf_write(idx); - - struct stat stat_index; - struct stat stat_adaptive; - - get_index_size(idx, &stat_index, &stat_adaptive); - - fprintf(stderr, "\nindex size: %ld\n", (long int) stat_index.st_size); - fprintf(logfile_index, "%ld\n", (long int) stat_index.st_size); - */ - fclose(logfile); fclose(logfile_tree); fclose(logfile_query); @@ -1022,9 +856,9 @@ int main(int argc, char **argv) { FLUSHES++; COUNT_TOTAL_TIME_END - //PRINT_STATS(distance) COUNT_TOTAL_TIME_START + if (complete_type == 1) { fprintf(stderr, ">>> Completing index.\n"); complete_index(idx, dataset_size); @@ -1032,13 +866,25 @@ int main(int argc, char **argv) { fprintf(stderr, ">>> Completing index.\n"); complete_index_leafs(idx); } + COUNT_TOTAL_TIME_END +// index_mRecBuf_write(idx); + +// for (int i = 0; i < paa_segments; i++) { +// printf("[%2d] ", i); +// +// for (int j = 0; j < idx->settings->sax_alphabet_cardinality - 1; j++) { +// printf("%f ", idx->bins[i][j]); +// } +// +// printf("\n"); +// } + if (!inmemory_flag) { index_write(idx); isax_index_destroy(idx, NULL); PRINT_STATS(distance) - } else { free(rawfile); @@ -1048,13 +894,11 @@ int main(int argc, char **argv) { } else if (function_type == 3) { isax_index_pRecBuf_destroy(idx, NULL, maxquerythread); } else { - //isax_index_destroy(idx, NULL); MESSI2_index_destroy(idx, NULL); } } printf("\n"); - } return 0; @@ -1066,16 +910,21 @@ void INThandler(int sig) { signal(sig, SIG_IGN); fprintf(stderr, "Do you really want to quit? [y/n] "); c = getchar(); + if (c == 'y' || c == 'Y') { c = getchar(); fprintf(stderr, "Do you want to save the index? [y/n] "); c = getchar(); + if (c == 'y' || c == 'Y') { flush_fbl(idx->fbl, idx); index_write(idx); } + exit(0); - } else + } else { signal(SIGINT, INThandler); - getchar(); // Get new line character + } + + getchar(); // Get new line character }