| … | … | @@ -2,12 +2,12 @@ bin_PROGRAMS = neigh2d # neigh2d_memopts |
| 2 | 2 | |
| 3 | 3 | ACLOCAL_AMFLAGS = -I m4 |
| 4 | 4 | |
| 5 | SUBDIRS = kdtree hash oldHash timer | |
| 5 | SUBDIRS = kdtree hash simplehash timer | |
| 6 | 6 | |
| 7 | 7 | neigh2d_C_SRCS = neigh2d.c gpu.c |
| 8 | 8 | neigh2d_H_SRCS = gpu.h |
| 9 | 9 | neigh2d_SOURCES = ${neigh2d_C_SRCS} ${neigh2d_H_SRCS} |
| 10 | neigh2d_LDADD = kdtree/libkdtree.la hash/libhash.la oldHash/libhashold.la timer/libtimer.la | |
| 10 | neigh2d_LDADD = kdtree/libkdtree.la hash/libhash.la simplehash/libsimplehash.la timer/libtimer.la | |
| 11 | 11 | |
| 12 | 12 | LDADD = -lm |
| 13 | 13 | |
| … | … | @@ -26,8 +26,8 @@ hash/libhash.la: |
| 26 | 26 | cd hash |
| 27 | 27 | make |
| 28 | 28 | |
| 29 | oldHash/libhashold.la: | |
| 30 | cd oldHash | |
| 29 | simplehash/libsimplehash.la: | |
| 30 | cd simplehash | |
| 31 | 31 | make |
| 32 | 32 | |
| 33 | 33 | clean-local: |
| … | … | @@ -110,7 +110,7 @@ am__objects_2 = |
| 110 | 110 | am_neigh2d_OBJECTS = $(am__objects_1) $(am__objects_2) |
| 111 | 111 | neigh2d_OBJECTS = $(am_neigh2d_OBJECTS) |
| 112 | 112 | neigh2d_DEPENDENCIES = kdtree/libkdtree.la hash/libhash.la \ |
| 113 | oldHash/libhashold.la timer/libtimer.la | |
| 113 | simplehash/libsimplehash.la timer/libtimer.la | |
| 114 | 114 | AM_V_lt = $(am__v_lt_@AM_V@) |
| 115 | 115 | am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) |
| 116 | 116 | am__v_lt_0 = --silent |
| … | … | @@ -360,11 +360,11 @@ top_build_prefix = @top_build_prefix@ |
| 360 | 360 | top_builddir = @top_builddir@ |
| 361 | 361 | top_srcdir = @top_srcdir@ |
| 362 | 362 | ACLOCAL_AMFLAGS = -I m4 |
| 363 | SUBDIRS = kdtree hash oldHash timer | |
| 363 | SUBDIRS = kdtree hash simplehash timer | |
| 364 | 364 | neigh2d_C_SRCS = neigh2d.c gpu.c |
| 365 | 365 | neigh2d_H_SRCS = gpu.h |
| 366 | 366 | neigh2d_SOURCES = ${neigh2d_C_SRCS} ${neigh2d_H_SRCS} |
| 367 | neigh2d_LDADD = kdtree/libkdtree.la hash/libhash.la oldHash/libhashold.la timer/libtimer.la | |
| 367 | neigh2d_LDADD = kdtree/libkdtree.la hash/libhash.la simplehash/libsimplehash.la timer/libtimer.la | |
| 368 | 368 | LDADD = -lm |
| 369 | 369 | EXTRA_DIST = neigh2d_kern.cl APACHE_LICENSE-2_0 AUTHORS README LICENSE \ |
| 370 | 370 | Papers.bib NOTICE README.md ReleaseAuthorization.pdf Todo libtool |
| … | … | @@ -933,8 +933,8 @@ hash/libhash.la: |
| 933 | 933 | cd hash |
| 934 | 934 | make |
| 935 | 935 | |
| 936 | oldHash/libhashold.la: | |
| 937 | cd oldHash | |
| 936 | simplehash/libsimplehash.la: | |
| 937 | cd simplehash | |
| 938 | 938 | make |
| 939 | 939 | |
| 940 | 940 | clean-local: |
| … | … | @@ -16311,7 +16311,7 @@ ac_config_files="$ac_config_files kdtree/Makefile" |
| 16311 | 16311 | |
| 16312 | 16312 | ac_config_files="$ac_config_files hash/Makefile" |
| 16313 | 16313 | |
| 16314 | ac_config_files="$ac_config_files oldHash/Makefile" | |
| 16314 | ac_config_files="$ac_config_files simplehash/Makefile" | |
| 16315 | 16315 | |
| 16316 | 16316 | ac_config_files="$ac_config_files timer/Makefile" |
| 16317 | 16317 | |
| … | … | @@ -17357,7 +17357,7 @@ do |
| 17357 | 17357 | "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; |
| 17358 | 17358 | "kdtree/Makefile") CONFIG_FILES="$CONFIG_FILES kdtree/Makefile" ;; |
| 17359 | 17359 | "hash/Makefile") CONFIG_FILES="$CONFIG_FILES hash/Makefile" ;; |
| 17360 | "oldHash/Makefile") CONFIG_FILES="$CONFIG_FILES oldHash/Makefile" ;; | |
| 17360 | "simplehash/Makefile") CONFIG_FILES="$CONFIG_FILES simplehash/Makefile" ;; | |
| 17361 | 17361 | "timer/Makefile") CONFIG_FILES="$CONFIG_FILES timer/Makefile" ;; |
| 17362 | 17362 | |
| 17363 | 17363 | *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; |
| … | … | @@ -376,7 +376,7 @@ AC_SUBST(CPREPROCESSOR) |
| 376 | 376 | AC_CONFIG_FILES([Makefile]) |
| 377 | 377 | AC_CONFIG_FILES([kdtree/Makefile]) |
| 378 | 378 | AC_CONFIG_FILES([hash/Makefile]) |
| 379 | AC_CONFIG_FILES([oldHash/Makefile]) | |
| 379 | AC_CONFIG_FILES([simplehash/Makefile]) | |
| 380 | 380 | AC_CONFIG_FILES([timer/Makefile]) |
| 381 | 381 | |
| 382 | 382 | AC_OUTPUT |
| … | … | @@ -50,8 +50,8 @@ |
| 50 | 50 | #include "kdtree/KDTree2d.h" |
| 51 | 51 | #include "gpu.h" |
| 52 | 52 | #include "hash/hash.h" |
| 53 | #include "oldHash/hashit.h" | |
| 54 | #include "oldHash/hasholdlib.h" | |
| 53 | #include "simplehash/simplehash.h" | |
| 54 | #include "simplehash/simplehashlib.h" | |
| 55 | 55 | #include "timer/timer.h" |
| 56 | 56 | |
| 57 | 57 | #ifdef HAVE_OPENCL |
| … | … | @@ -1,28 +0,0 @@ |
| 1 | default: hashit.c hasholdlib.c libhashold.la | |
| 2 | all: hashit.c hasholdlib.c libhashold.la | |
| 3 | ||
| 4 | AM_MAKEFLAGS = -j 4 | |
| 5 | ||
| 6 | DEFAULT_INCLUDES=-I. -I.. | |
| 7 | ||
| 8 | lib_LTLIBRARIES = libhashold.la | |
| 9 | include_HEADERS = hashit.h hasholdlib.h | |
| 10 | ||
| 11 | H_SRCS = hashit.h hasholdlib.h | |
| 12 | ||
| 13 | C_SRCS = hashit.c hasholdlib.c | |
| 14 | ||
| 15 | libhashold_la_SOURCES = ${C_SRCS} ${H_SRCS} | |
| 16 | ||
| 17 | hasholdlib.c: hasholdlib_kern.inc hashold_kern.inc | |
| 18 | ||
| 19 | hasholdlib_kern.inc: | |
| 20 | ./embed_source.pl hasholdlib_kern.cl > hasholdlib_kern.inc | |
| 21 | ||
| 22 | hashold_kern.inc: | |
| 23 | ./embed_source.pl hashold_kern.cl > hashold_kern.inc | |
| 24 | ||
| 25 | EXTRA_DIST = hashold_kern.cl hasholdlib_kern.cl embed_source.pl | |
| 26 | ||
| 27 | clean-local: | |
| 28 | rm -f *.inc |
| … | … | @@ -1,680 +0,0 @@ |
| 1 | # Makefile.in generated by automake 1.13.4 from Makefile.am. | |
| 2 | # @configure_input@ | |
| 3 | ||
| 4 | # Copyright (C) 1994-2013 Free Software Foundation, Inc. | |
| 5 | ||
| 6 | # This Makefile.in is free software; the Free Software Foundation | |
| 7 | # gives unlimited permission to copy and/or distribute it, | |
| 8 | # with or without modifications, as long as this notice is preserved. | |
| 9 | ||
| 10 | # This program is distributed in the hope that it will be useful, | |
| 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
| 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
| 13 | # PARTICULAR PURPOSE. | |
| 14 | ||
| 15 | @SET_MAKE@ | |
| 16 | ||
| 17 | ||
| 18 | VPATH = @srcdir@ | |
| 19 | am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' | |
| 20 | am__make_running_with_option = \ | |
| 21 | case $${target_option-} in \ | |
| 22 | ?) ;; \ | |
| 23 | *) echo "am__make_running_with_option: internal error: invalid" \ | |
| 24 | "target option '$${target_option-}' specified" >&2; \ | |
| 25 | exit 1;; \ | |
| 26 | esac; \ | |
| 27 | has_opt=no; \ | |
| 28 | sane_makeflags=$$MAKEFLAGS; \ | |
| 29 | if $(am__is_gnu_make); then \ | |
| 30 | sane_makeflags=$$MFLAGS; \ | |
| 31 | else \ | |
| 32 | case $$MAKEFLAGS in \ | |
| 33 | *\\[\ \ ]*) \ | |
| 34 | bs=\\; \ | |
| 35 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | |
| 36 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ | |
| 37 | esac; \ | |
| 38 | fi; \ | |
| 39 | skip_next=no; \ | |
| 40 | strip_trailopt () \ | |
| 41 | { \ | |
| 42 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ | |
| 43 | }; \ | |
| 44 | for flg in $$sane_makeflags; do \ | |
| 45 | test $$skip_next = yes && { skip_next=no; continue; }; \ | |
| 46 | case $$flg in \ | |
| 47 | *=*|--*) continue;; \ | |
| 48 | -*I) strip_trailopt 'I'; skip_next=yes;; \ | |
| 49 | -*I?*) strip_trailopt 'I';; \ | |
| 50 | -*O) strip_trailopt 'O'; skip_next=yes;; \ | |
| 51 | -*O?*) strip_trailopt 'O';; \ | |
| 52 | -*l) strip_trailopt 'l'; skip_next=yes;; \ | |
| 53 | -*l?*) strip_trailopt 'l';; \ | |
| 54 | -[dEDm]) skip_next=yes;; \ | |
| 55 | -[JT]) skip_next=yes;; \ | |
| 56 | esac; \ | |
| 57 | case $$flg in \ | |
| 58 | *$$target_option*) has_opt=yes; break;; \ | |
| 59 | esac; \ | |
| 60 | done; \ | |
| 61 | test $$has_opt = yes | |
| 62 | am__make_dryrun = (target_option=n; $(am__make_running_with_option)) | |
| 63 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) | |
| 64 | pkgdatadir = $(datadir)/@PACKAGE@ | |
| 65 | pkgincludedir = $(includedir)/@PACKAGE@ | |
| 66 | pkglibdir = $(libdir)/@PACKAGE@ | |
| 67 | pkglibexecdir = $(libexecdir)/@PACKAGE@ | |
| 68 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | |
| 69 | install_sh_DATA = $(install_sh) -c -m 644 | |
| 70 | install_sh_PROGRAM = $(install_sh) -c | |
| 71 | install_sh_SCRIPT = $(install_sh) -c | |
| 72 | INSTALL_HEADER = $(INSTALL_DATA) | |
| 73 | transform = $(program_transform_name) | |
| 74 | NORMAL_INSTALL = : | |
| 75 | PRE_INSTALL = : | |
| 76 | POST_INSTALL = : | |
| 77 | NORMAL_UNINSTALL = : | |
| 78 | PRE_UNINSTALL = : | |
| 79 | POST_UNINSTALL = : | |
| 80 | build_triplet = @build@ | |
| 81 | host_triplet = @host@ | |
| 82 | subdir = oldHash | |
| 83 | DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ | |
| 84 | $(top_srcdir)/./config/depcomp $(include_HEADERS) | |
| 85 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | |
| 86 | am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ | |
| 87 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ | |
| 88 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ | |
| 89 | $(top_srcdir)/configure.ac | |
| 90 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | |
| 91 | $(ACLOCAL_M4) | |
| 92 | mkinstalldirs = $(install_sh) -d | |
| 93 | CONFIG_CLEAN_FILES = | |
| 94 | CONFIG_CLEAN_VPATH_FILES = | |
| 95 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | |
| 96 | am__vpath_adj = case $$p in \ | |
| 97 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | |
| 98 | *) f=$$p;; \ | |
| 99 | esac; | |
| 100 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; | |
| 101 | am__install_max = 40 | |
| 102 | am__nobase_strip_setup = \ | |
| 103 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` | |
| 104 | am__nobase_strip = \ | |
| 105 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" | |
| 106 | am__nobase_list = $(am__nobase_strip_setup); \ | |
| 107 | for p in $$list; do echo "$$p $$p"; done | \ | |
| 108 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ | |
| 109 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ | |
| 110 | if (++n[$$2] == $(am__install_max)) \ | |
| 111 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ | |
| 112 | END { for (dir in files) print dir, files[dir] }' | |
| 113 | am__base_list = \ | |
| 114 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ | |
| 115 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | |
| 116 | am__uninstall_files_from_dir = { \ | |
| 117 | test -z "$$files" \ | |
| 118 | || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ | |
| 119 | || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ | |
| 120 | $(am__cd) "$$dir" && rm -f $$files; }; \ | |
| 121 | } | |
| 122 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" | |
| 123 | LTLIBRARIES = $(lib_LTLIBRARIES) | |
| 124 | libhashold_la_LIBADD = | |
| 125 | am__objects_1 = hashit.lo hasholdlib.lo | |
| 126 | am__objects_2 = | |
| 127 | am_libhashold_la_OBJECTS = $(am__objects_1) $(am__objects_2) | |
| 128 | libhashold_la_OBJECTS = $(am_libhashold_la_OBJECTS) | |
| 129 | AM_V_lt = $(am__v_lt_@AM_V@) | |
| 130 | am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) | |
| 131 | am__v_lt_0 = --silent | |
| 132 | am__v_lt_1 = | |
| 133 | AM_V_P = $(am__v_P_@AM_V@) | |
| 134 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) | |
| 135 | am__v_P_0 = false | |
| 136 | am__v_P_1 = : | |
| 137 | AM_V_GEN = $(am__v_GEN_@AM_V@) | |
| 138 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) | |
| 139 | am__v_GEN_0 = @echo " GEN " $@; | |
| 140 | am__v_GEN_1 = | |
| 141 | AM_V_at = $(am__v_at_@AM_V@) | |
| 142 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |
| 143 | am__v_at_0 = @ | |
| 144 | am__v_at_1 = | |
| 145 | depcomp = $(SHELL) $(top_srcdir)/./config/depcomp | |
| 146 | am__depfiles_maybe = depfiles | |
| 147 | am__mv = mv -f | |
| 148 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | |
| 149 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | |
| 150 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | |
| 151 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ | |
| 152 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | |
| 153 | $(AM_CFLAGS) $(CFLAGS) | |
| 154 | AM_V_CC = $(am__v_CC_@AM_V@) | |
| 155 | am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) | |
| 156 | am__v_CC_0 = @echo " CC " $@; | |
| 157 | am__v_CC_1 = | |
| 158 | CCLD = $(CC) | |
| 159 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | |
| 160 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | |
| 161 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | |
| 162 | AM_V_CCLD = $(am__v_CCLD_@AM_V@) | |
| 163 | am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) | |
| 164 | am__v_CCLD_0 = @echo " CCLD " $@; | |
| 165 | am__v_CCLD_1 = | |
| 166 | SOURCES = $(libhashold_la_SOURCES) | |
| 167 | DIST_SOURCES = $(libhashold_la_SOURCES) | |
| 168 | am__can_run_installinfo = \ | |
| 169 | case $$AM_UPDATE_INFO_DIR in \ | |
| 170 | n|no|NO) false;; \ | |
| 171 | *) (install-info --version) >/dev/null 2>&1;; \ | |
| 172 | esac | |
| 173 | HEADERS = $(include_HEADERS) | |
| 174 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) | |
| 175 | # Read a list of newline-separated strings from the standard input, | |
| 176 | # and print each of them once, without duplicates. Input order is | |
| 177 | # *not* preserved. | |
| 178 | am__uniquify_input = $(AWK) '\ | |
| 179 | BEGIN { nonempty = 0; } \ | |
| 180 | { items[$$0] = 1; nonempty = 1; } \ | |
| 181 | END { if (nonempty) { for (i in items) print i; }; } \ | |
| 182 | ' | |
| 183 | # Make sure the list of sources is unique. This is necessary because, | |
| 184 | # e.g., the same source file might be shared among _SOURCES variables | |
| 185 | # for different programs/libraries. | |
| 186 | am__define_uniq_tagged_files = \ | |
| 187 | list='$(am__tagged_files)'; \ | |
| 188 | unique=`for i in $$list; do \ | |
| 189 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | |
| 190 | done | $(am__uniquify_input)` | |
| 191 | ETAGS = etags | |
| 192 | CTAGS = ctags | |
| 193 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | |
| 194 | ACLOCAL = @ACLOCAL@ | |
| 195 | AMTAR = @AMTAR@ | |
| 196 | AM_CPPFLAGS = @AM_CPPFLAGS@ | |
| 197 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | |
| 198 | AR = @AR@ | |
| 199 | AUTOCONF = @AUTOCONF@ | |
| 200 | AUTOHEADER = @AUTOHEADER@ | |
| 201 | AUTOMAKE = @AUTOMAKE@ | |
| 202 | AWK = @AWK@ | |
| 203 | CC = @CC@ | |
| 204 | CCDEPMODE = @CCDEPMODE@ | |
| 205 | CFLAGS = @CFLAGS@ | |
| 206 | CPP = @CPP@ | |
| 207 | CPPFLAGS = @CPPFLAGS@ | |
| 208 | CPREPROCESSOR = @CPREPROCESSOR@ | |
| 209 | CXX = @CXX@ | |
| 210 | CXXCPP = @CXXCPP@ | |
| 211 | CXXDEPMODE = @CXXDEPMODE@ | |
| 212 | CXXFLAGS = @CXXFLAGS@ | |
| 213 | CYGPATH_W = @CYGPATH_W@ | |
| 214 | DEFS = @DEFS@ | |
| 215 | DEPDIR = @DEPDIR@ | |
| 216 | DLLTOOL = @DLLTOOL@ | |
| 217 | DSYMUTIL = @DSYMUTIL@ | |
| 218 | DUMPBIN = @DUMPBIN@ | |
| 219 | ECHO_C = @ECHO_C@ | |
| 220 | ECHO_N = @ECHO_N@ | |
| 221 | ECHO_T = @ECHO_T@ | |
| 222 | EGREP = @EGREP@ | |
| 223 | EXEEXT = @EXEEXT@ | |
| 224 | FGREP = @FGREP@ | |
| 225 | GREP = @GREP@ | |
| 226 | HAVE_ADDR2LINE = @HAVE_ADDR2LINE@ | |
| 227 | INDENT = @INDENT@ | |
| 228 | INSTALL = @INSTALL@ | |
| 229 | INSTALL_DATA = @INSTALL_DATA@ | |
| 230 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
| 231 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | |
| 232 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | |
| 233 | LD = @LD@ | |
| 234 | LDFLAGS = @LDFLAGS@ | |
| 235 | LIBOBJS = @LIBOBJS@ | |
| 236 | LIBS = @LIBS@ | |
| 237 | LIBTOOL = @LIBTOOL@ | |
| 238 | LIPO = @LIPO@ | |
| 239 | LN_S = @LN_S@ | |
| 240 | LTLIBOBJS = @LTLIBOBJS@ | |
| 241 | MAKEINFO = @MAKEINFO@ | |
| 242 | MANIFEST_TOOL = @MANIFEST_TOOL@ | |
| 243 | MKDIR_P = @MKDIR_P@ | |
| 244 | NM = @NM@ | |
| 245 | NMEDIT = @NMEDIT@ | |
| 246 | OBJDUMP = @OBJDUMP@ | |
| 247 | OBJEXT = @OBJEXT@ | |
| 248 | OTOOL = @OTOOL@ | |
| 249 | OTOOL64 = @OTOOL64@ | |
| 250 | PACKAGE = @PACKAGE@ | |
| 251 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | |
| 252 | PACKAGE_NAME = @PACKAGE_NAME@ | |
| 253 | PACKAGE_STRING = @PACKAGE_STRING@ | |
| 254 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | |
| 255 | PACKAGE_URL = @PACKAGE_URL@ | |
| 256 | PACKAGE_VERSION = @PACKAGE_VERSION@ | |
| 257 | PATH_SEPARATOR = @PATH_SEPARATOR@ | |
| 258 | RANLIB = @RANLIB@ | |
| 259 | SED = @SED@ | |
| 260 | SET_MAKE = @SET_MAKE@ | |
| 261 | SHELL = @SHELL@ | |
| 262 | STRIP = @STRIP@ | |
| 263 | VERSION = @VERSION@ | |
| 264 | abs_builddir = @abs_builddir@ | |
| 265 | abs_srcdir = @abs_srcdir@ | |
| 266 | abs_top_builddir = @abs_top_builddir@ | |
| 267 | abs_top_srcdir = @abs_top_srcdir@ | |
| 268 | ac_ct_AR = @ac_ct_AR@ | |
| 269 | ac_ct_CC = @ac_ct_CC@ | |
| 270 | ac_ct_CXX = @ac_ct_CXX@ | |
| 271 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | |
| 272 | am__include = @am__include@ | |
| 273 | am__leading_dot = @am__leading_dot@ | |
| 274 | am__quote = @am__quote@ | |
| 275 | am__tar = @am__tar@ | |
| 276 | am__untar = @am__untar@ | |
| 277 | bindir = @bindir@ | |
| 278 | build = @build@ | |
| 279 | build_alias = @build_alias@ | |
| 280 | build_cpu = @build_cpu@ | |
| 281 | build_os = @build_os@ | |
| 282 | build_vendor = @build_vendor@ | |
| 283 | builddir = @builddir@ | |
| 284 | datadir = @datadir@ | |
| 285 | datarootdir = @datarootdir@ | |
| 286 | docdir = @docdir@ | |
| 287 | dvidir = @dvidir@ | |
| 288 | exec_prefix = @exec_prefix@ | |
| 289 | host = @host@ | |
| 290 | host_alias = @host_alias@ | |
| 291 | host_cpu = @host_cpu@ | |
| 292 | host_os = @host_os@ | |
| 293 | host_vendor = @host_vendor@ | |
| 294 | htmldir = @htmldir@ | |
| 295 | includedir = @includedir@ | |
| 296 | infodir = @infodir@ | |
| 297 | install_sh = @install_sh@ | |
| 298 | libdir = @libdir@ | |
| 299 | libexecdir = @libexecdir@ | |
| 300 | localedir = @localedir@ | |
| 301 | localstatedir = @localstatedir@ | |
| 302 | lspci_found = @lspci_found@ | |
| 303 | mandir = @mandir@ | |
| 304 | mkdir_p = @mkdir_p@ | |
| 305 | oldincludedir = @oldincludedir@ | |
| 306 | pdfdir = @pdfdir@ | |
| 307 | prefix = @prefix@ | |
| 308 | program_transform_name = @program_transform_name@ | |
| 309 | psdir = @psdir@ | |
| 310 | sbindir = @sbindir@ | |
| 311 | sharedstatedir = @sharedstatedir@ | |
| 312 | srcdir = @srcdir@ | |
| 313 | sysconfdir = @sysconfdir@ | |
| 314 | target_alias = @target_alias@ | |
| 315 | top_build_prefix = @top_build_prefix@ | |
| 316 | top_builddir = @top_builddir@ | |
| 317 | top_srcdir = @top_srcdir@ | |
| 318 | AM_MAKEFLAGS = -j 4 | |
| 319 | DEFAULT_INCLUDES = -I. -I.. | |
| 320 | lib_LTLIBRARIES = libhashold.la | |
| 321 | include_HEADERS = hashit.h hasholdlib.h | |
| 322 | H_SRCS = hashit.h hasholdlib.h | |
| 323 | C_SRCS = hashit.c hasholdlib.c | |
| 324 | libhashold_la_SOURCES = ${C_SRCS} ${H_SRCS} | |
| 325 | EXTRA_DIST = hashold_kern.cl hasholdlib_kern.cl embed_source.pl | |
| 326 | all: all-am | |
| 327 | ||
| 328 | .SUFFIXES: | |
| 329 | .SUFFIXES: .c .lo .o .obj | |
| 330 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | |
| 331 | @for dep in $?; do \ | |
| 332 | case '$(am__configure_deps)' in \ | |
| 333 | *$$dep*) \ | |
| 334 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | |
| 335 | && { if test -f $@; then exit 0; else break; fi; }; \ | |
| 336 | exit 1;; \ | |
| 337 | esac; \ | |
| 338 | done; \ | |
| 339 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign oldHash/Makefile'; \ | |
| 340 | $(am__cd) $(top_srcdir) && \ | |
| 341 | $(AUTOMAKE) --foreign oldHash/Makefile | |
| 342 | .PRECIOUS: Makefile | |
| 343 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | |
| 344 | @case '$?' in \ | |
| 345 | *config.status*) \ | |
| 346 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | |
| 347 | *) \ | |
| 348 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | |
| 349 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | |
| 350 | esac; | |
| 351 | ||
| 352 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | |
| 353 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | |
| 354 | ||
| 355 | $(top_srcdir)/configure: $(am__configure_deps) | |
| 356 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | |
| 357 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | |
| 358 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | |
| 359 | $(am__aclocal_m4_deps): | |
| 360 | ||
| 361 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) | |
| 362 | @$(NORMAL_INSTALL) | |
| 363 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | |
| 364 | list2=; for p in $$list; do \ | |
| 365 | if test -f $$p; then \ | |
| 366 | list2="$$list2 $$p"; \ | |
| 367 | else :; fi; \ | |
| 368 | done; \ | |
| 369 | test -z "$$list2" || { \ | |
| 370 | echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ | |
| 371 | $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ | |
| 372 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ | |
| 373 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ | |
| 374 | } | |
| 375 | ||
| 376 | uninstall-libLTLIBRARIES: | |
| 377 | @$(NORMAL_UNINSTALL) | |
| 378 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | |
| 379 | for p in $$list; do \ | |
| 380 | $(am__strip_dir) \ | |
| 381 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ | |
| 382 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ | |
| 383 | done | |
| 384 | ||
| 385 | clean-libLTLIBRARIES: | |
| 386 | -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) | |
| 387 | @list='$(lib_LTLIBRARIES)'; \ | |
| 388 | locs=`for p in $$list; do echo $$p; done | \ | |
| 389 | sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ | |
| 390 | sort -u`; \ | |
| 391 | test -z "$$locs" || { \ | |
| 392 | echo rm -f $${locs}; \ | |
| 393 | rm -f $${locs}; \ | |
| 394 | } | |
| 395 | ||
| 396 | libhashold.la: $(libhashold_la_OBJECTS) $(libhashold_la_DEPENDENCIES) $(EXTRA_libhashold_la_DEPENDENCIES) | |
| 397 | $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libhashold_la_OBJECTS) $(libhashold_la_LIBADD) $(LIBS) | |
| 398 | ||
| 399 | mostlyclean-compile: | |
| 400 | -rm -f *.$(OBJEXT) | |
| 401 | ||
| 402 | distclean-compile: | |
| 403 | -rm -f *.tab.c | |
| 404 | ||
| 405 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashit.Plo@am__quote@ | |
| 406 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hasholdlib.Plo@am__quote@ | |
| 407 | ||
| 408 | .c.o: | |
| 409 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | |
| 410 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | |
| 411 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | |
| 412 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
| 413 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< | |
| 414 | ||
| 415 | .c.obj: | |
| 416 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | |
| 417 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | |
| 418 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | |
| 419 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
| 420 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` | |
| 421 | ||
| 422 | .c.lo: | |
| 423 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | |
| 424 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | |
| 425 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | |
| 426 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
| 427 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< | |
| 428 | ||
| 429 | mostlyclean-libtool: | |
| 430 | -rm -f *.lo | |
| 431 | ||
| 432 | clean-libtool: | |
| 433 | -rm -rf .libs _libs | |
| 434 | install-includeHEADERS: $(include_HEADERS) | |
| 435 | @$(NORMAL_INSTALL) | |
| 436 | @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ | |
| 437 | if test -n "$$list"; then \ | |
| 438 | echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ | |
| 439 | $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ | |
| 440 | fi; \ | |
| 441 | for p in $$list; do \ | |
| 442 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | |
| 443 | echo "$$d$$p"; \ | |
| 444 | done | $(am__base_list) | \ | |
| 445 | while read files; do \ | |
| 446 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ | |
| 447 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ | |
| 448 | done | |
| 449 | ||
| 450 | uninstall-includeHEADERS: | |
| 451 | @$(NORMAL_UNINSTALL) | |
| 452 | @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ | |
| 453 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ | |
| 454 | dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) | |
| 455 | ||
| 456 | ID: $(am__tagged_files) | |
| 457 | $(am__define_uniq_tagged_files); mkid -fID $$unique | |
| 458 | tags: tags-am | |
| 459 | TAGS: tags | |
| 460 | ||
| 461 | tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) | |
| 462 | set x; \ | |
| 463 | here=`pwd`; \ | |
| 464 | $(am__define_uniq_tagged_files); \ | |
| 465 | shift; \ | |
| 466 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | |
| 467 | test -n "$$unique" || unique=$$empty_fix; \ | |
| 468 | if test $$# -gt 0; then \ | |
| 469 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | |
| 470 | "$$@" $$unique; \ | |
| 471 | else \ | |
| 472 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | |
| 473 | $$unique; \ | |
| 474 | fi; \ | |
| 475 | fi | |
| 476 | ctags: ctags-am | |
| 477 | ||
| 478 | CTAGS: ctags | |
| 479 | ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) | |
| 480 | $(am__define_uniq_tagged_files); \ | |
| 481 | test -z "$(CTAGS_ARGS)$$unique" \ | |
| 482 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | |
| 483 | $$unique | |
| 484 | ||
| 485 | GTAGS: | |
| 486 | here=`$(am__cd) $(top_builddir) && pwd` \ | |
| 487 | && $(am__cd) $(top_srcdir) \ | |
| 488 | && gtags -i $(GTAGS_ARGS) "$$here" | |
| 489 | cscopelist: cscopelist-am | |
| 490 | ||
| 491 | cscopelist-am: $(am__tagged_files) | |
| 492 | list='$(am__tagged_files)'; \ | |
| 493 | case "$(srcdir)" in \ | |
| 494 | [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ | |
| 495 | *) sdir=$(subdir)/$(srcdir) ;; \ | |
| 496 | esac; \ | |
| 497 | for i in $$list; do \ | |
| 498 | if test -f "$$i"; then \ | |
| 499 | echo "$(subdir)/$$i"; \ | |
| 500 | else \ | |
| 501 | echo "$$sdir/$$i"; \ | |
| 502 | fi; \ | |
| 503 | done >> $(top_builddir)/cscope.files | |
| 504 | ||
| 505 | distclean-tags: | |
| 506 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | |
| 507 | ||
| 508 | distdir: $(DISTFILES) | |
| 509 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | |
| 510 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | |
| 511 | list='$(DISTFILES)'; \ | |
| 512 | dist_files=`for file in $$list; do echo $$file; done | \ | |
| 513 | sed -e "s|^$$srcdirstrip/||;t" \ | |
| 514 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | |
| 515 | case $$dist_files in \ | |
| 516 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | |
| 517 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | |
| 518 | sort -u` ;; \ | |
| 519 | esac; \ | |
| 520 | for file in $$dist_files; do \ | |
| 521 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | |
| 522 | if test -d $$d/$$file; then \ | |
| 523 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | |
| 524 | if test -d "$(distdir)/$$file"; then \ | |
| 525 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | |
| 526 | fi; \ | |
| 527 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | |
| 528 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | |
| 529 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | |
| 530 | fi; \ | |
| 531 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | |
| 532 | else \ | |
| 533 | test -f "$(distdir)/$$file" \ | |
| 534 | || cp -p $$d/$$file "$(distdir)/$$file" \ | |
| 535 | || exit 1; \ | |
| 536 | fi; \ | |
| 537 | done | |
| 538 | check-am: all-am | |
| 539 | check: check-am | |
| 540 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) | |
| 541 | installdirs: | |
| 542 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ | |
| 543 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | |
| 544 | done | |
| 545 | install: install-am | |
| 546 | install-exec: install-exec-am | |
| 547 | install-data: install-data-am | |
| 548 | uninstall: uninstall-am | |
| 549 | ||
| 550 | install-am: all-am | |
| 551 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | |
| 552 | ||
| 553 | installcheck: installcheck-am | |
| 554 | install-strip: | |
| 555 | if test -z '$(STRIP)'; then \ | |
| 556 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | |
| 557 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | |
| 558 | install; \ | |
| 559 | else \ | |
| 560 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | |
| 561 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | |
| 562 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ | |
| 563 | fi | |
| 564 | mostlyclean-generic: | |
| 565 | ||
| 566 | clean-generic: | |
| 567 | ||
| 568 | distclean-generic: | |
| 569 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | |
| 570 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | |
| 571 | ||
| 572 | maintainer-clean-generic: | |
| 573 | @echo "This command is intended for maintainers to use" | |
| 574 | @echo "it deletes files that may require special tools to rebuild." | |
| 575 | clean: clean-am | |
| 576 | ||
| 577 | clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ | |
| 578 | mostlyclean-am | |
| 579 | ||
| 580 | distclean: distclean-am | |
| 581 | -rm -rf ./$(DEPDIR) | |
| 582 | -rm -f Makefile | |
| 583 | distclean-am: clean-am distclean-compile distclean-generic \ | |
| 584 | distclean-tags | |
| 585 | ||
| 586 | dvi: dvi-am | |
| 587 | ||
| 588 | dvi-am: | |
| 589 | ||
| 590 | html: html-am | |
| 591 | ||
| 592 | html-am: | |
| 593 | ||
| 594 | info: info-am | |
| 595 | ||
| 596 | info-am: | |
| 597 | ||
| 598 | install-data-am: install-includeHEADERS | |
| 599 | ||
| 600 | install-dvi: install-dvi-am | |
| 601 | ||
| 602 | install-dvi-am: | |
| 603 | ||
| 604 | install-exec-am: install-libLTLIBRARIES | |
| 605 | ||
| 606 | install-html: install-html-am | |
| 607 | ||
| 608 | install-html-am: | |
| 609 | ||
| 610 | install-info: install-info-am | |
| 611 | ||
| 612 | install-info-am: | |
| 613 | ||
| 614 | install-man: | |
| 615 | ||
| 616 | install-pdf: install-pdf-am | |
| 617 | ||
| 618 | install-pdf-am: | |
| 619 | ||
| 620 | install-ps: install-ps-am | |
| 621 | ||
| 622 | install-ps-am: | |
| 623 | ||
| 624 | installcheck-am: | |
| 625 | ||
| 626 | maintainer-clean: maintainer-clean-am | |
| 627 | -rm -rf ./$(DEPDIR) | |
| 628 | -rm -f Makefile | |
| 629 | maintainer-clean-am: distclean-am maintainer-clean-generic | |
| 630 | ||
| 631 | mostlyclean: mostlyclean-am | |
| 632 | ||
| 633 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ | |
| 634 | mostlyclean-libtool | |
| 635 | ||
| 636 | pdf: pdf-am | |
| 637 | ||
| 638 | pdf-am: | |
| 639 | ||
| 640 | ps: ps-am | |
| 641 | ||
| 642 | ps-am: | |
| 643 | ||
| 644 | uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES | |
| 645 | ||
| 646 | .MAKE: install-am install-strip | |
| 647 | ||
| 648 | .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ | |
| 649 | clean-libLTLIBRARIES clean-libtool clean-local cscopelist-am \ | |
| 650 | ctags ctags-am distclean distclean-compile distclean-generic \ | |
| 651 | distclean-libtool distclean-tags distdir dvi dvi-am html \ | |
| 652 | html-am info info-am install install-am install-data \ | |
| 653 | install-data-am install-dvi install-dvi-am install-exec \ | |
| 654 | install-exec-am install-html install-html-am \ | |
| 655 | install-includeHEADERS install-info install-info-am \ | |
| 656 | install-libLTLIBRARIES install-man install-pdf install-pdf-am \ | |
| 657 | install-ps install-ps-am install-strip installcheck \ | |
| 658 | installcheck-am installdirs maintainer-clean \ | |
| 659 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | |
| 660 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | |
| 661 | tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ | |
| 662 | uninstall-libLTLIBRARIES | |
| 663 | ||
| 664 | default: hashit.c hasholdlib.c libhashold.la | |
| 665 | all: hashit.c hasholdlib.c libhashold.la | |
| 666 | ||
| 667 | hasholdlib.c: hasholdlib_kern.inc hashold_kern.inc | |
| 668 | ||
| 669 | hasholdlib_kern.inc: | |
| 670 | ./embed_source.pl hasholdlib_kern.cl > hasholdlib_kern.inc | |
| 671 | ||
| 672 | hashold_kern.inc: | |
| 673 | ./embed_source.pl hashold_kern.cl > hashold_kern.inc | |
| 674 | ||
| 675 | clean-local: | |
| 676 | rm -f *.inc | |
| 677 | ||
| 678 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | |
| 679 | # Otherwise a system limit (for SysV at least) may be exceeded. | |
| 680 | .NOEXPORT: |
| … | … | @@ -1,68 +0,0 @@ |
| 1 | eval 'exec perl -w $0 ${1+"$@"}' | |
| 2 | if 0; | |
| 3 | ||
| 4 | # Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 5 | # under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 6 | # Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 7 | # for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 8 | # reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 9 | # ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 10 | # ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 11 | # to produce derivative works, such modified software should be clearly marked, | |
| 12 | # so as not to confuse it with the version available from LANL. | |
| 13 | # | |
| 14 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 15 | # use this file except in compliance with the License. You may obtain a copy | |
| 16 | # of the License at | |
| 17 | # | |
| 18 | # http://www.apache.org/licenses/LICENSE-2.0 | |
| 19 | # | |
| 20 | # Unless required by applicable law or agreed to in writing, software distributed | |
| 21 | # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 22 | # CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 23 | # specific language governing permissions and limitations under the License. | |
| 24 | # | |
| 25 | # Under this license, it is required to include a reference to this work. We | |
| 26 | # request that each derivative work contain a reference to LANL Copyright | |
| 27 | # Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 28 | # measured. In addition, it is requested that a modifier is included as in | |
| 29 | # the following example: | |
| 30 | # | |
| 31 | # //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 32 | # | |
| 33 | # This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 34 | ||
| 35 | use File::Basename; | |
| 36 | ||
| 37 | $ARGV_LAST = ""; | |
| 38 | ||
| 39 | ($file,,) = fileparse($ARGV[0], qr/\..*/); | |
| 40 | print "const char *",$file,"_source =\n"; | |
| 41 | ||
| 42 | while(<>) { | |
| 43 | if ($ARGV ne $ARGV_LAST){ | |
| 44 | # $comment = 0; | |
| 45 | $ARGV_LAST=$ARGV; | |
| 46 | } | |
| 47 | chop $_; | |
| 48 | ||
| 49 | s/"/""/g; | |
| 50 | ||
| 51 | # if (/^\/\*/){ | |
| 52 | # #print "Setting comment to 1\n"; | |
| 53 | # $comment = 1; | |
| 54 | # } | |
| 55 | # if (/\*\/$/){ | |
| 56 | # #print "Setting comment to 0\n"; | |
| 57 | # $comment = 0; | |
| 58 | # next; | |
| 59 | # } | |
| 60 | # if ($comment eq 1) { | |
| 61 | # #print "Skip line and goto next\n"; | |
| 62 | ## next; | |
| 63 | # } | |
| 64 | ||
| 65 | print '"',$_,'\n','"',"\n"; | |
| 66 | } | |
| 67 | ||
| 68 | print ";\n" |
| … | … | @@ -1,1266 +0,0 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | #include "hashit.h" | |
| 34 | //#include "timer/timer.h" | |
| 35 | ||
| 36 | static ulong AA; | |
| 37 | static ulong BB; | |
| 38 | static ulong prime=4294967291; | |
| 39 | static uint hashtablesize; | |
| 40 | static uint hash_stride; | |
| 41 | static uint hash_ncells; | |
| 42 | static uint write_hash_collisions; | |
| 43 | static uint read_hash_collisions; | |
| 44 | static double write_hash_collisions_runsum = 0.0; | |
| 45 | static double read_hash_collisions_runsum = 0.0; | |
| 46 | static uint write_hash_collisions_count = 0; | |
| 47 | static uint read_hash_collisions_count = 0; | |
| 48 | static uint hash_report_level = 0; | |
| 49 | static uint hash_queries; | |
| 50 | static uint hash_method = 1; | |
| 51 | static uint hash_jump_prime = 41; | |
| 52 | static double hash_mult = 3.0; | |
| 53 | static int do_compact_hash = 0; | |
| 54 | ||
| 55 | float mem_opt_factor; | |
| 56 | ||
| 57 | void compact_hash_delete(int *hash){ | |
| 58 | free(hash); | |
| 59 | } | |
| 60 | ||
| 61 | int (*read_hash)(ulong, int *); | |
| 62 | void (*write_hash)(uint, ulong, int *); | |
| 63 | ||
| 64 | #ifdef _OPENMP | |
| 65 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 66 | void (*write_hash_openmp)(uint, ulong, int *); | |
| 67 | #else | |
| 68 | void (*write_hash_openmp)(uint, ulong, int *, omp_lock_t * lock); | |
| 69 | #endif | |
| 70 | #endif | |
| 71 | ||
| 72 | int get_hash_method(void) { | |
| 73 | return(hash_method); | |
| 74 | } | |
| 75 | ||
| 76 | long long get_hashtablesize(void) { | |
| 77 | return(hashtablesize); | |
| 78 | } | |
| 79 | ||
| 80 | int *compact_hash_init(int ncells, uint isize, uint jsize, uint report_level){ | |
| 81 | ||
| 82 | hash_ncells = 0; | |
| 83 | write_hash_collisions = 0; | |
| 84 | read_hash_collisions = 0; | |
| 85 | hash_queries = 0; | |
| 86 | hash_report_level = report_level; | |
| 87 | hash_stride = isize; | |
| 88 | int *hash = NULL; | |
| 89 | ||
| 90 | uint compact_hash_size = (uint)((double)ncells*hash_mult); | |
| 91 | compact_hash_size = ncells; | |
| 92 | uint perfect_hash_size = (uint)(isize*jsize); | |
| 93 | float hash_mem_factor = 20.0; | |
| 94 | float hash_mem_ratio = (double)perfect_hash_size/(double)compact_hash_size; | |
| 95 | if (mem_opt_factor != 1.0) hash_mem_factor /= (mem_opt_factor*0.2); | |
| 96 | do_compact_hash = (hash_mem_ratio < hash_mem_factor) ? 0 : 1; | |
| 97 | do_compact_hash = 1; | |
| 98 | if (hash_report_level >= 2) printf("DEBUG do_compact_hash %d hash_mem_ratio %f hash_mem_factor %f mem_opt_factor %f perfect_hash_size %u compact_hash_size %u\n",do_compact_hash,hash_mem_ratio,hash_mem_factor,mem_opt_factor,perfect_hash_size,compact_hash_size); | |
| 99 | ||
| 100 | if (do_compact_hash) { | |
| 101 | hashtablesize = compact_hash_size; | |
| 102 | AA = (ulong)(1.0+(double)(prime-1)*drand48()); | |
| 103 | BB = (ulong)(0.0+(double)(prime-1)*drand48()); | |
| 104 | if (AA > prime-1 || BB > prime-1) exit(0); | |
| 105 | if (hash_report_level > 1) printf("Factors AA %lu BB %lu\n",AA,BB); | |
| 106 | ||
| 107 | hash = (int *)malloc(2*hashtablesize*sizeof(int)); | |
| 108 | for (uint ii = 0; ii<2*hashtablesize; ii+=2){ | |
| 109 | hash[ii] = -1; | |
| 110 | } | |
| 111 | } else { | |
| 112 | hashtablesize = perfect_hash_size; | |
| 113 | ||
| 114 | hash = (int *)malloc(hashtablesize*sizeof(int)); | |
| 115 | for (uint ii = 0; ii<hashtablesize; ii++){ | |
| 116 | hash[ii] = -1; | |
| 117 | } | |
| 118 | } | |
| 119 | ||
| 120 | if (hash_report_level >= 2) { | |
| 121 | printf("Hash table size %u perfect hash table size %u memory savings %u by percentage %lf\n", | |
| 122 | hashtablesize,isize*jsize,isize*jsize-hashtablesize, | |
| 123 | (double)hashtablesize/(double)(isize*jsize)); | |
| 124 | } | |
| 125 | ||
| 126 | if (! do_compact_hash) { | |
| 127 | read_hash = read_hash_perfect; | |
| 128 | write_hash = write_hash_perfect; | |
| 129 | } else if (hash_method == 0){ | |
| 130 | if (hash_report_level == 0){ | |
| 131 | read_hash = read_hash_linear; | |
| 132 | write_hash = write_hash_linear; | |
| 133 | } else if (hash_report_level == 1){ | |
| 134 | read_hash = read_hash_linear_report_level_1; | |
| 135 | write_hash = write_hash_linear_report_level_1; | |
| 136 | } else if (hash_report_level == 2){ | |
| 137 | read_hash = read_hash_linear_report_level_2; | |
| 138 | write_hash = write_hash_linear_report_level_2; | |
| 139 | } else if (hash_report_level == 3){ | |
| 140 | read_hash = read_hash_linear_report_level_3; | |
| 141 | write_hash = write_hash_linear_report_level_3; | |
| 142 | } | |
| 143 | } else if (hash_method == 1){ | |
| 144 | if (hash_report_level == 0){ | |
| 145 | read_hash = read_hash_quadratic; | |
| 146 | write_hash = write_hash_quadratic; | |
| 147 | } else if (hash_report_level == 1){ | |
| 148 | read_hash = read_hash_quadratic_report_level_1; | |
| 149 | write_hash = write_hash_quadratic_report_level_1; | |
| 150 | } else if (hash_report_level == 2){ | |
| 151 | read_hash = read_hash_quadratic_report_level_2; | |
| 152 | write_hash = write_hash_quadratic_report_level_2; | |
| 153 | } else if (hash_report_level == 3){ | |
| 154 | read_hash = read_hash_quadratic_report_level_3; | |
| 155 | write_hash = write_hash_quadratic_report_level_3; | |
| 156 | } | |
| 157 | } else if (hash_method == 2){ | |
| 158 | if (hash_report_level == 0){ | |
| 159 | read_hash = read_hash_primejump; | |
| 160 | write_hash = write_hash_primejump; | |
| 161 | } else if (hash_report_level == 1){ | |
| 162 | read_hash = read_hash_primejump_report_level_1; | |
| 163 | write_hash = write_hash_primejump_report_level_1; | |
| 164 | } else if (hash_report_level == 2){ | |
| 165 | read_hash = read_hash_primejump_report_level_2; | |
| 166 | write_hash = write_hash_primejump_report_level_2; | |
| 167 | } else if (hash_report_level == 3){ | |
| 168 | read_hash = read_hash_primejump_report_level_3; | |
| 169 | write_hash = write_hash_primejump_report_level_3; | |
| 170 | } | |
| 171 | } | |
| 172 | ||
| 173 | return(hash); | |
| 174 | } | |
| 175 | ||
| 176 | void write_hash_perfect(uint ic, ulong hashkey, int *hash){ | |
| 177 | hash[hashkey] = ic; | |
| 178 | } | |
| 179 | ||
| 180 | void write_hash_linear(uint ic, ulong hashkey, int *hash){ | |
| 181 | uint hashloc; | |
| 182 | ||
| 183 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc++,hashloc = hashloc%hashtablesize); | |
| 184 | ||
| 185 | hash[2*hashloc] = hashkey; | |
| 186 | hash[2*hashloc+1] = ic; | |
| 187 | } | |
| 188 | ||
| 189 | void write_hash_linear_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 190 | int icount = 0; | |
| 191 | uint hashloc; | |
| 192 | ||
| 193 | hash_ncells++; | |
| 194 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 195 | write_hash_collisions++; | |
| 196 | } | |
| 197 | ||
| 198 | hash[2*hashloc] = hashkey; | |
| 199 | hash[2*hashloc+1] = ic; | |
| 200 | } | |
| 201 | ||
| 202 | void write_hash_linear_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 203 | int icount = 0; | |
| 204 | uint hashloc; | |
| 205 | ||
| 206 | hash_ncells++; | |
| 207 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 208 | write_hash_collisions++; | |
| 209 | } | |
| 210 | ||
| 211 | hash[2*hashloc] = hashkey; | |
| 212 | hash[2*hashloc+1] = ic; | |
| 213 | } | |
| 214 | ||
| 215 | void write_hash_linear_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 216 | int icount = 0; | |
| 217 | uint hashloc; | |
| 218 | ||
| 219 | hash_ncells++; | |
| 220 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 221 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 222 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 223 | int hashloctmp = hashloc+1; | |
| 224 | hashloctmp = hashloctmp%hashtablesize; | |
| 225 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 226 | icount++; | |
| 227 | } | |
| 228 | write_hash_collisions += icount; | |
| 229 | ||
| 230 | hash[2*hashloc] = hashkey; | |
| 231 | hash[2*hashloc+1] = ic; | |
| 232 | } | |
| 233 | ||
| 234 | void write_hash_quadratic(uint ic, ulong hashkey, int *hash){ | |
| 235 | int icount = 0; | |
| 236 | uint hashloc; | |
| 237 | ||
| 238 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize) { | |
| 239 | icount++; | |
| 240 | } | |
| 241 | ||
| 242 | hash[2*hashloc] = hashkey; | |
| 243 | hash[2*hashloc+1] = ic; | |
| 244 | } | |
| 245 | ||
| 246 | void write_hash_quadratic_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 247 | int icount = 0; | |
| 248 | uint hashloc; | |
| 249 | ||
| 250 | hash_ncells++; | |
| 251 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 252 | icount++; | |
| 253 | } | |
| 254 | write_hash_collisions += icount; | |
| 255 | ||
| 256 | hash[2*hashloc] = hashkey; | |
| 257 | hash[2*hashloc+1] = ic; | |
| 258 | } | |
| 259 | ||
| 260 | void write_hash_quadratic_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 261 | int icount = 0; | |
| 262 | uint hashloc; | |
| 263 | ||
| 264 | hash_ncells++; | |
| 265 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 266 | icount++; | |
| 267 | } | |
| 268 | write_hash_collisions += icount; | |
| 269 | ||
| 270 | hash[2*hashloc] = hashkey; | |
| 271 | hash[2*hashloc+1] = ic; | |
| 272 | } | |
| 273 | ||
| 274 | void write_hash_quadratic_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 275 | int icount = 0; | |
| 276 | uint hashloc; | |
| 277 | ||
| 278 | hash_ncells++; | |
| 279 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 280 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 281 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 282 | icount++; | |
| 283 | int hashloctmp = hashloc+icount*icount; | |
| 284 | hashloctmp = hashloctmp%hashtablesize; | |
| 285 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 286 | } | |
| 287 | write_hash_collisions += icount; | |
| 288 | ||
| 289 | hash[2*hashloc] = hashkey; | |
| 290 | hash[2*hashloc+1] = ic; | |
| 291 | } | |
| 292 | ||
| 293 | void write_hash_primejump(uint ic, ulong hashkey, int *hash){ | |
| 294 | int icount = 0; | |
| 295 | uint hashloc; | |
| 296 | ||
| 297 | uint jump = 1+hashkey%hash_jump_prime; | |
| 298 | ||
| 299 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize) { | |
| 300 | icount++; | |
| 301 | } | |
| 302 | ||
| 303 | hash[2*hashloc] = hashkey; | |
| 304 | hash[2*hashloc+1] = ic; | |
| 305 | } | |
| 306 | ||
| 307 | void write_hash_primejump_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 308 | int icount = 0; | |
| 309 | uint hashloc; | |
| 310 | ||
| 311 | uint jump = 1+hashkey%hash_jump_prime; | |
| 312 | ||
| 313 | hash_ncells++; | |
| 314 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 315 | icount++; | |
| 316 | } | |
| 317 | write_hash_collisions += icount; | |
| 318 | ||
| 319 | hash[2*hashloc] = hashkey; | |
| 320 | hash[2*hashloc+1] = ic; | |
| 321 | } | |
| 322 | ||
| 323 | void write_hash_primejump_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 324 | int icount = 0; | |
| 325 | uint hashloc; | |
| 326 | ||
| 327 | uint jump = 1+hashkey%hash_jump_prime; | |
| 328 | ||
| 329 | hash_ncells++; | |
| 330 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 331 | icount++; | |
| 332 | } | |
| 333 | write_hash_collisions += icount; | |
| 334 | ||
| 335 | hash[2*hashloc] = hashkey; | |
| 336 | hash[2*hashloc+1] = ic; | |
| 337 | } | |
| 338 | ||
| 339 | void write_hash_primejump_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 340 | int icount = 0; | |
| 341 | uint hashloc; | |
| 342 | ||
| 343 | uint jump = 1+hashkey%hash_jump_prime; | |
| 344 | ||
| 345 | hash_ncells++; | |
| 346 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 347 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 348 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 349 | icount++; | |
| 350 | int hashloctmp = hashloc+1; | |
| 351 | hashloctmp = hashloctmp%hashtablesize; | |
| 352 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 353 | } | |
| 354 | write_hash_collisions += icount; | |
| 355 | ||
| 356 | hash[2*hashloc] = hashkey; | |
| 357 | hash[2*hashloc+1] = ic; | |
| 358 | } | |
| 359 | ||
| 360 | #ifdef _OPENMP | |
| 361 | ||
| 362 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 363 | void write_hash_perfect_openmp(uint ic, ulong hashkey, int *hash){ | |
| 364 | #else | |
| 365 | void write_hash_perfect_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 366 | #endif | |
| 367 | hash[hashkey] = ic; | |
| 368 | } | |
| 369 | ||
| 370 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 371 | void write_hash_linear_openmp(uint ic, ulong hashkey, int *hash){ | |
| 372 | #else | |
| 373 | void write_hash_linear_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 374 | #endif | |
| 375 | int icount; | |
| 376 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize;; | |
| 377 | ||
| 378 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 379 | int MaxTries = 1000; | |
| 380 | ||
| 381 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 382 | //printf("old_key is %d\n",old_key); | |
| 383 | ||
| 384 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 385 | hashloc++; | |
| 386 | hashloc %= hashtablesize; | |
| 387 | ||
| 388 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 389 | } | |
| 390 | ||
| 391 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 392 | #else | |
| 393 | omp_set_lock(&(lock[hashloc])); | |
| 394 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 395 | omp_unset_lock(&(lock[hashloc])); | |
| 396 | hashloc++; | |
| 397 | hashloc = hashloc%hashtablesize; | |
| 398 | omp_set_lock(&(lock[hashloc])); | |
| 399 | } | |
| 400 | ||
| 401 | hash[2*hashloc] = hashkey; | |
| 402 | hash[2*hashloc+1] = ic; | |
| 403 | omp_unset_lock(&(lock[hashloc])); | |
| 404 | #endif | |
| 405 | } | |
| 406 | ||
| 407 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 408 | void write_hash_linear_openmp_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 409 | #else | |
| 410 | void write_hash_linear_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 411 | #endif | |
| 412 | int icount = 0; | |
| 413 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize;; | |
| 414 | ||
| 415 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 416 | int MaxTries = 1000; | |
| 417 | ||
| 418 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 419 | //printf("old_key is %d\n",old_key); | |
| 420 | ||
| 421 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 422 | hashloc++; | |
| 423 | hashloc %= hashtablesize; | |
| 424 | ||
| 425 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 426 | icount++; | |
| 427 | } | |
| 428 | ||
| 429 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 430 | #else | |
| 431 | omp_set_lock(&(lock[hashloc])); | |
| 432 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 433 | omp_unset_lock(&(lock[hashloc])); | |
| 434 | hashloc++; | |
| 435 | hashloc = hashloc%hashtablesize; | |
| 436 | omp_set_lock(&(lock[hashloc])); | |
| 437 | icount++; | |
| 438 | } | |
| 439 | ||
| 440 | hash[2*hashloc] = hashkey; | |
| 441 | hash[2*hashloc+1] = ic; | |
| 442 | omp_unset_lock(&(lock[hashloc])); | |
| 443 | #endif | |
| 444 | ||
| 445 | #pragma omp atomic | |
| 446 | write_hash_collisions += icount;; | |
| 447 | #pragma omp atomic | |
| 448 | hash_ncells++; | |
| 449 | } | |
| 450 | ||
| 451 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 452 | void write_hash_linear_openmp_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 453 | #else | |
| 454 | void write_hash_linear_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 455 | #endif | |
| 456 | int icount = 0; | |
| 457 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize;; | |
| 458 | ||
| 459 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 460 | int MaxTries = 1000; | |
| 461 | ||
| 462 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 463 | //printf("old_key is %d\n",old_key); | |
| 464 | ||
| 465 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 466 | hashloc++; | |
| 467 | hashloc %= hashtablesize; | |
| 468 | ||
| 469 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 470 | icount++; | |
| 471 | } | |
| 472 | ||
| 473 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 474 | #else | |
| 475 | omp_set_lock(&(lock[hashloc])); | |
| 476 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 477 | omp_unset_lock(&(lock[hashloc])); | |
| 478 | hashloc++; | |
| 479 | hashloc = hashloc%hashtablesize; | |
| 480 | omp_set_lock(&(lock[hashloc])); | |
| 481 | icount++; | |
| 482 | } | |
| 483 | ||
| 484 | hash[2*hashloc] = hashkey; | |
| 485 | hash[2*hashloc+1] = ic; | |
| 486 | omp_unset_lock(&(lock[hashloc])); | |
| 487 | #endif | |
| 488 | ||
| 489 | #pragma omp atomic | |
| 490 | write_hash_collisions += icount;; | |
| 491 | #pragma omp atomic | |
| 492 | hash_ncells++; | |
| 493 | } | |
| 494 | ||
| 495 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 496 | void write_hash_linear_openmp_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 497 | #else | |
| 498 | void write_hash_linear_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 499 | #endif | |
| 500 | int icount = 0; | |
| 501 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize;; | |
| 502 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 503 | ||
| 504 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 505 | int MaxTries = 1000; | |
| 506 | ||
| 507 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 508 | //printf("old_key is %d\n",old_key); | |
| 509 | ||
| 510 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 511 | hashloc++; | |
| 512 | hashloc %= hashtablesize; | |
| 513 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 514 | ||
| 515 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 516 | icount++; | |
| 517 | } | |
| 518 | ||
| 519 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 520 | #else | |
| 521 | omp_set_lock(&(lock[hashloc])); | |
| 522 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 523 | omp_unset_lock(&(lock[hashloc])); | |
| 524 | hashloc++; | |
| 525 | hashloc = hashloc%hashtablesize; | |
| 526 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 527 | omp_set_lock(&(lock[hashloc])); | |
| 528 | icount++; | |
| 529 | } | |
| 530 | ||
| 531 | hash[2*hashloc] = hashkey; | |
| 532 | hash[2*hashloc+1] = ic; | |
| 533 | omp_unset_lock(&(lock[hashloc])); | |
| 534 | #endif | |
| 535 | ||
| 536 | #pragma omp atomic | |
| 537 | write_hash_collisions += icount;; | |
| 538 | #pragma omp atomic | |
| 539 | hash_ncells++; | |
| 540 | } | |
| 541 | ||
| 542 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 543 | void write_hash_quadratic_openmp(uint ic, ulong hashkey, int *hash){ | |
| 544 | #else | |
| 545 | void write_hash_quadratic_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 546 | #endif | |
| 547 | int icount = 0; | |
| 548 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 549 | ||
| 550 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 551 | int MaxTries = 1000; | |
| 552 | ||
| 553 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 554 | //printf("old_key is %d\n",old_key); | |
| 555 | ||
| 556 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 557 | hashloc+=(icount*icount); | |
| 558 | hashloc %= hashtablesize; | |
| 559 | ||
| 560 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 561 | } | |
| 562 | ||
| 563 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 564 | #else | |
| 565 | omp_set_lock(&(lock[hashloc])); | |
| 566 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 567 | omp_unset_lock(&(lock[hashloc])); | |
| 568 | icount++; | |
| 569 | hashloc+=(icount*icount); | |
| 570 | hashloc = hashloc%hashtablesize; | |
| 571 | omp_set_lock(&(lock[hashloc])); | |
| 572 | } | |
| 573 | ||
| 574 | hash[2*hashloc] = hashkey; | |
| 575 | hash[2*hashloc+1] = ic; | |
| 576 | omp_unset_lock(&(lock[hashloc])); | |
| 577 | #endif | |
| 578 | } | |
| 579 | ||
| 580 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 581 | void write_hash_quadratic_openmp_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 582 | #else | |
| 583 | void write_hash_quadratic_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 584 | #endif | |
| 585 | int icount = 0; | |
| 586 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 587 | ||
| 588 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 589 | int MaxTries = 1000; | |
| 590 | ||
| 591 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 592 | //printf("old_key is %d\n",old_key); | |
| 593 | ||
| 594 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 595 | hashloc+=(icount*icount); | |
| 596 | hashloc %= hashtablesize; | |
| 597 | ||
| 598 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 599 | } | |
| 600 | ||
| 601 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 602 | #else | |
| 603 | omp_set_lock(&(lock[hashloc])); | |
| 604 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 605 | omp_unset_lock(&(lock[hashloc])); | |
| 606 | icount++; | |
| 607 | hashloc+=(icount*icount); | |
| 608 | hashloc = hashloc%hashtablesize; | |
| 609 | omp_set_lock(&(lock[hashloc])); | |
| 610 | } | |
| 611 | ||
| 612 | hash[2*hashloc] = hashkey; | |
| 613 | hash[2*hashloc+1] = ic; | |
| 614 | omp_unset_lock(&(lock[hashloc])); | |
| 615 | #endif | |
| 616 | ||
| 617 | #pragma omp atomic | |
| 618 | write_hash_collisions += icount;; | |
| 619 | #pragma omp atomic | |
| 620 | hash_ncells++; | |
| 621 | } | |
| 622 | ||
| 623 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 624 | void write_hash_quadratic_openmp_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 625 | #else | |
| 626 | void write_hash_quadratic_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 627 | #endif | |
| 628 | int icount = 0; | |
| 629 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 630 | ||
| 631 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 632 | int MaxTries = 1000; | |
| 633 | ||
| 634 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 635 | //printf("old_key is %d\n",old_key); | |
| 636 | ||
| 637 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 638 | hashloc+=(icount*icount); | |
| 639 | hashloc %= hashtablesize; | |
| 640 | ||
| 641 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 642 | } | |
| 643 | ||
| 644 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 645 | #else | |
| 646 | omp_set_lock(&(lock[hashloc])); | |
| 647 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 648 | omp_unset_lock(&(lock[hashloc])); | |
| 649 | icount++; | |
| 650 | hashloc+=(icount*icount); | |
| 651 | hashloc = hashloc%hashtablesize; | |
| 652 | omp_set_lock(&(lock[hashloc])); | |
| 653 | } | |
| 654 | ||
| 655 | hash[2*hashloc] = hashkey; | |
| 656 | hash[2*hashloc+1] = ic; | |
| 657 | omp_unset_lock(&(lock[hashloc])); | |
| 658 | #endif | |
| 659 | ||
| 660 | #pragma omp atomic | |
| 661 | write_hash_collisions += icount;; | |
| 662 | #pragma omp atomic | |
| 663 | hash_ncells++; | |
| 664 | } | |
| 665 | ||
| 666 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 667 | void write_hash_quadratic_openmp_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 668 | #else | |
| 669 | void write_hash_quadratic_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 670 | #endif | |
| 671 | int icount = 0; | |
| 672 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 673 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 674 | ||
| 675 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 676 | int MaxTries = 1000; | |
| 677 | ||
| 678 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 679 | //printf("old_key is %d\n",old_key); | |
| 680 | ||
| 681 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 682 | hashloc+=(icount*icount); | |
| 683 | hashloc %= hashtablesize; | |
| 684 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 685 | ||
| 686 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 687 | } | |
| 688 | ||
| 689 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 690 | #else | |
| 691 | omp_set_lock(&(lock[hashloc])); | |
| 692 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 693 | omp_unset_lock(&(lock[hashloc])); | |
| 694 | icount++; | |
| 695 | hashloc+=(icount*icount); | |
| 696 | hashloc = hashloc%hashtablesize; | |
| 697 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 698 | omp_set_lock(&(lock[hashloc])); | |
| 699 | } | |
| 700 | ||
| 701 | hash[2*hashloc] = hashkey; | |
| 702 | hash[2*hashloc+1] = ic; | |
| 703 | omp_unset_lock(&(lock[hashloc])); | |
| 704 | #endif | |
| 705 | ||
| 706 | #pragma omp atomic | |
| 707 | write_hash_collisions += icount;; | |
| 708 | #pragma omp atomic | |
| 709 | hash_ncells++; | |
| 710 | } | |
| 711 | ||
| 712 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 713 | void write_hash_primejump_openmp(uint ic, ulong hashkey, int *hash){ | |
| 714 | #else | |
| 715 | void write_hash_primejump_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 716 | #endif | |
| 717 | int icount = 0; | |
| 718 | uint jump = 1+hashkey%hash_jump_prime; | |
| 719 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 720 | ||
| 721 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 722 | int MaxTries = 1000; | |
| 723 | ||
| 724 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 725 | //printf("old_key is %d\n",old_key); | |
| 726 | ||
| 727 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 728 | hashloc+=(icount*jump); | |
| 729 | hashloc %= hashtablesize; | |
| 730 | ||
| 731 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 732 | } | |
| 733 | ||
| 734 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 735 | #else | |
| 736 | omp_set_lock(&(lock[hashloc])); | |
| 737 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 738 | omp_unset_lock(&(lock[hashloc])); | |
| 739 | icount++; | |
| 740 | hashloc+=(icount*jump); | |
| 741 | hashloc = hashloc%hashtablesize; | |
| 742 | omp_set_lock(&(lock[hashloc])); | |
| 743 | } | |
| 744 | ||
| 745 | hash[2*hashloc] = hashkey; | |
| 746 | hash[2*hashloc+1] = ic; | |
| 747 | omp_unset_lock(&(lock[hashloc])); | |
| 748 | #endif | |
| 749 | } | |
| 750 | ||
| 751 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 752 | void write_hash_primejump_openmp_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 753 | #else | |
| 754 | void write_hash_primejump_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 755 | #endif | |
| 756 | int icount = 0; | |
| 757 | uint jump = 1+hashkey%hash_jump_prime; | |
| 758 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 759 | ||
| 760 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 761 | int MaxTries = 1000; | |
| 762 | ||
| 763 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 764 | //printf("old_key is %d\n",old_key); | |
| 765 | ||
| 766 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 767 | hashloc+=(icount*jump); | |
| 768 | hashloc %= hashtablesize; | |
| 769 | ||
| 770 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 771 | } | |
| 772 | ||
| 773 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 774 | #else | |
| 775 | omp_set_lock(&(lock[hashloc])); | |
| 776 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 777 | omp_unset_lock(&(lock[hashloc])); | |
| 778 | icount++; | |
| 779 | hashloc+=(icount*jump); | |
| 780 | hashloc = hashloc%hashtablesize; | |
| 781 | omp_set_lock(&(lock[hashloc])); | |
| 782 | } | |
| 783 | ||
| 784 | hash[2*hashloc] = hashkey; | |
| 785 | hash[2*hashloc+1] = ic; | |
| 786 | omp_unset_lock(&(lock[hashloc])); | |
| 787 | #endif | |
| 788 | ||
| 789 | #pragma omp atomic | |
| 790 | write_hash_collisions += icount;; | |
| 791 | #pragma omp atomic | |
| 792 | hash_ncells++; | |
| 793 | } | |
| 794 | ||
| 795 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 796 | void write_hash_primejump_openmp_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 797 | #else | |
| 798 | void write_hash_primejump_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 799 | #endif | |
| 800 | int icount = 0; | |
| 801 | uint jump = 1+hashkey%hash_jump_prime; | |
| 802 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 803 | ||
| 804 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 805 | int MaxTries = 1000; | |
| 806 | ||
| 807 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 808 | //printf("old_key is %d\n",old_key); | |
| 809 | ||
| 810 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 811 | hashloc+=(icount*jump); | |
| 812 | hashloc %= hashtablesize; | |
| 813 | ||
| 814 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 815 | } | |
| 816 | ||
| 817 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 818 | #else | |
| 819 | omp_set_lock(&(lock[hashloc])); | |
| 820 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 821 | omp_unset_lock(&(lock[hashloc])); | |
| 822 | icount++; | |
| 823 | hashloc+=(icount*jump); | |
| 824 | hashloc = hashloc%hashtablesize; | |
| 825 | omp_set_lock(&(lock[hashloc])); | |
| 826 | } | |
| 827 | ||
| 828 | hash[2*hashloc] = hashkey; | |
| 829 | hash[2*hashloc+1] = ic; | |
| 830 | omp_unset_lock(&(lock[hashloc])); | |
| 831 | #endif | |
| 832 | ||
| 833 | #pragma omp atomic | |
| 834 | write_hash_collisions += icount;; | |
| 835 | #pragma omp atomic | |
| 836 | hash_ncells++; | |
| 837 | } | |
| 838 | ||
| 839 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 840 | void write_hash_primejump_openmp_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 841 | #else | |
| 842 | void write_hash_primejump_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 843 | #endif | |
| 844 | int icount = 0; | |
| 845 | uint jump = 1+hashkey%hash_jump_prime; | |
| 846 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 847 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 848 | ||
| 849 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 850 | int MaxTries = 1000; | |
| 851 | ||
| 852 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 853 | //printf("old_key is %d\n",old_key); | |
| 854 | ||
| 855 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 856 | hashloc+=(icount*jump); | |
| 857 | hashloc %= hashtablesize; | |
| 858 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 859 | ||
| 860 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 861 | } | |
| 862 | ||
| 863 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 864 | #else | |
| 865 | omp_set_lock(&(lock[hashloc])); | |
| 866 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 867 | omp_unset_lock(&(lock[hashloc])); | |
| 868 | icount++; | |
| 869 | hashloc+=(icount*jump); | |
| 870 | hashloc = hashloc%hashtablesize; | |
| 871 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 872 | omp_set_lock(&(lock[hashloc])); | |
| 873 | } | |
| 874 | ||
| 875 | hash[2*hashloc] = hashkey; | |
| 876 | hash[2*hashloc+1] = ic; | |
| 877 | omp_unset_lock(&(lock[hashloc])); | |
| 878 | #endif | |
| 879 | ||
| 880 | #pragma omp atomic | |
| 881 | write_hash_collisions += icount;; | |
| 882 | #pragma omp atomic | |
| 883 | hash_ncells++; | |
| 884 | } | |
| 885 | #endif | |
| 886 | ||
| 887 | int read_hash_perfect(ulong hashkey, int *hash){ | |
| 888 | return(hash[hashkey]); | |
| 889 | } | |
| 890 | ||
| 891 | int read_hash_linear(ulong hashkey, int *hash){ | |
| 892 | int hashval = -1; | |
| 893 | uint hashloc; | |
| 894 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize); | |
| 895 | ||
| 896 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 897 | return(hashval); | |
| 898 | } | |
| 899 | ||
| 900 | int read_hash_linear_report_level_1(ulong hashkey, int *hash){ | |
| 901 | int hashval = -1; | |
| 902 | uint hashloc; | |
| 903 | int icount=0; | |
| 904 | ||
| 905 | hash_queries++; | |
| 906 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 907 | icount++; | |
| 908 | } | |
| 909 | read_hash_collisions += icount; | |
| 910 | ||
| 911 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 912 | return(hashval); | |
| 913 | } | |
| 914 | ||
| 915 | int read_hash_linear_report_level_2(ulong hashkey, int *hash){ | |
| 916 | int max_collisions_allowed = 1000; | |
| 917 | int hashval = -1; | |
| 918 | uint hashloc; | |
| 919 | int icount=0; | |
| 920 | ||
| 921 | hash_queries++; | |
| 922 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 923 | icount++; | |
| 924 | if (icount > max_collisions_allowed) { | |
| 925 | printf("Error -- too many read hash collisions\n"); | |
| 926 | exit(0); | |
| 927 | } | |
| 928 | } | |
| 929 | read_hash_collisions += icount; | |
| 930 | ||
| 931 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 932 | return(hashval); | |
| 933 | } | |
| 934 | ||
| 935 | int read_hash_linear_report_level_3(ulong hashkey, int *hash){ | |
| 936 | int max_collisions_allowed = 1000; | |
| 937 | int hashval = -1; | |
| 938 | uint hashloc; | |
| 939 | int icount=0; | |
| 940 | ||
| 941 | hash_queries++; | |
| 942 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 943 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 944 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 945 | icount++; | |
| 946 | uint hashloctmp = hashloc+1; | |
| 947 | hashloctmp = hashloctmp%hashtablesize; | |
| 948 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 949 | if (icount > max_collisions_allowed) { | |
| 950 | printf("Error -- too many read hash collisions\n"); | |
| 951 | exit(0); | |
| 952 | } | |
| 953 | } | |
| 954 | read_hash_collisions += icount; | |
| 955 | ||
| 956 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 957 | return(hashval); | |
| 958 | } | |
| 959 | ||
| 960 | int read_hash_quadratic(ulong hashkey, int *hash){ | |
| 961 | int hashval = -1; | |
| 962 | uint hashloc; | |
| 963 | int icount=0; | |
| 964 | ||
| 965 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 966 | icount++; | |
| 967 | } | |
| 968 | ||
| 969 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 970 | return(hashval); | |
| 971 | } | |
| 972 | ||
| 973 | int read_hash_quadratic_report_level_1(ulong hashkey, int *hash){ | |
| 974 | int hashval = -1; | |
| 975 | uint hashloc; | |
| 976 | int icount=0; | |
| 977 | ||
| 978 | hash_queries++; | |
| 979 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 980 | icount++; | |
| 981 | } | |
| 982 | read_hash_collisions += icount; | |
| 983 | ||
| 984 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 985 | return(hashval); | |
| 986 | } | |
| 987 | ||
| 988 | int read_hash_quadratic_report_level_2(ulong hashkey, int *hash){ | |
| 989 | int max_collisions_allowed = 1000; | |
| 990 | int hashval = -1; | |
| 991 | uint hashloc; | |
| 992 | int icount=0; | |
| 993 | ||
| 994 | hash_queries++; | |
| 995 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 996 | icount++; | |
| 997 | if (icount > max_collisions_allowed) { | |
| 998 | printf("Error -- too many read hash collisions\n"); | |
| 999 | exit(0); | |
| 1000 | } | |
| 1001 | } | |
| 1002 | read_hash_collisions += icount; | |
| 1003 | ||
| 1004 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1005 | return(hashval); | |
| 1006 | } | |
| 1007 | ||
| 1008 | int read_hash_quadratic_report_level_3(ulong hashkey, int *hash){ | |
| 1009 | int max_collisions_allowed = 1000; | |
| 1010 | int hashval = -1; | |
| 1011 | uint hashloc; | |
| 1012 | int icount=0; | |
| 1013 | ||
| 1014 | hash_queries++; | |
| 1015 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1016 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1017 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1018 | icount++; | |
| 1019 | uint hashloctmp = hashloc+1; | |
| 1020 | hashloctmp = hashloctmp%hashtablesize; | |
| 1021 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1022 | if (icount > max_collisions_allowed) { | |
| 1023 | printf("Error -- too many read hash collisions\n"); | |
| 1024 | exit(0); | |
| 1025 | } | |
| 1026 | } | |
| 1027 | read_hash_collisions += icount; | |
| 1028 | ||
| 1029 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1030 | return(hashval); | |
| 1031 | } | |
| 1032 | ||
| 1033 | int read_hash_primejump(ulong hashkey, int *hash){ | |
| 1034 | int hashval = -1; | |
| 1035 | uint hashloc; | |
| 1036 | int icount=0; | |
| 1037 | ||
| 1038 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1039 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1040 | icount++; | |
| 1041 | } | |
| 1042 | ||
| 1043 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1044 | return(hashval); | |
| 1045 | } | |
| 1046 | ||
| 1047 | int read_hash_primejump_report_level_1(ulong hashkey, int *hash){ | |
| 1048 | int hashval = -1; | |
| 1049 | uint hashloc; | |
| 1050 | int icount=0; | |
| 1051 | ||
| 1052 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1053 | hash_queries++; | |
| 1054 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1055 | icount++; | |
| 1056 | } | |
| 1057 | read_hash_collisions += icount; | |
| 1058 | ||
| 1059 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1060 | return(hashval); | |
| 1061 | } | |
| 1062 | ||
| 1063 | int read_hash_primejump_report_level_2(ulong hashkey, int *hash){ | |
| 1064 | int max_collisions_allowed = 1000; | |
| 1065 | int hashval = -1; | |
| 1066 | uint hashloc; | |
| 1067 | int icount=0; | |
| 1068 | ||
| 1069 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1070 | ||
| 1071 | hash_queries++; | |
| 1072 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1073 | icount++; | |
| 1074 | if (icount > max_collisions_allowed) { | |
| 1075 | printf("Error -- too many read hash collisions\n"); | |
| 1076 | exit(0); | |
| 1077 | } | |
| 1078 | } | |
| 1079 | read_hash_collisions += icount; | |
| 1080 | ||
| 1081 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1082 | return(hashval); | |
| 1083 | } | |
| 1084 | ||
| 1085 | int read_hash_primejump_report_level_3(ulong hashkey, int *hash){ | |
| 1086 | int max_collisions_allowed = 1000; | |
| 1087 | int hashval = -1; | |
| 1088 | uint hashloc; | |
| 1089 | int icount=0; | |
| 1090 | ||
| 1091 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1092 | ||
| 1093 | hash_queries++; | |
| 1094 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1095 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1096 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1097 | icount++; | |
| 1098 | uint hashloctmp = hashloc+1; | |
| 1099 | hashloctmp = hashloctmp%hashtablesize; | |
| 1100 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1101 | if (icount > max_collisions_allowed) { | |
| 1102 | printf("Error -- too many read hash collisions\n"); | |
| 1103 | exit(0); | |
| 1104 | } | |
| 1105 | } | |
| 1106 | read_hash_collisions += icount; | |
| 1107 | ||
| 1108 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1109 | return(hashval); | |
| 1110 | } | |
| 1111 | ||
| 1112 | int read_dev_hash(int hash_method, ulong hashtablesize, ulong AA, ulong BB, ulong hashkey, int *hash){ | |
| 1113 | //int hash_report_level = 3; | |
| 1114 | int max_collisions_allowed = 1000; | |
| 1115 | int hashval = -1; | |
| 1116 | uint hashloc; | |
| 1117 | int icount=0; | |
| 1118 | if (hash_method == -1) { | |
| 1119 | return(hash[hashkey]); | |
| 1120 | } | |
| 1121 | if (hash_method == 0) { | |
| 1122 | if (hash_report_level == 0) { | |
| 1123 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 1124 | icount++; | |
| 1125 | } | |
| 1126 | } else if (hash_report_level == 1) { | |
| 1127 | hash_queries++; | |
| 1128 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 1129 | icount++; | |
| 1130 | } | |
| 1131 | read_hash_collisions += icount; | |
| 1132 | } else if (hash_report_level == 2) { | |
| 1133 | hash_queries++; | |
| 1134 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 1135 | icount++; | |
| 1136 | if (icount > max_collisions_allowed) { | |
| 1137 | printf("Error -- too many read hash collisions\n"); | |
| 1138 | exit(0); | |
| 1139 | } | |
| 1140 | } | |
| 1141 | read_hash_collisions += icount; | |
| 1142 | } else if (hash_report_level == 3) { | |
| 1143 | hash_queries++; | |
| 1144 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1145 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1146 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 1147 | icount++; | |
| 1148 | uint hashloctmp = hashloc+1; | |
| 1149 | hashloctmp = hashloctmp%hashtablesize; | |
| 1150 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1151 | if (icount > max_collisions_allowed) { | |
| 1152 | printf("Error -- too many read hash collisions\n"); | |
| 1153 | exit(0); | |
| 1154 | } | |
| 1155 | } | |
| 1156 | read_hash_collisions += icount; | |
| 1157 | } | |
| 1158 | } else if (hash_method == 1) { | |
| 1159 | if (hash_report_level == 0) { | |
| 1160 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1161 | icount++; | |
| 1162 | } | |
| 1163 | } else if (hash_report_level == 1) { | |
| 1164 | hash_queries++; | |
| 1165 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1166 | icount++; | |
| 1167 | } | |
| 1168 | read_hash_collisions += icount; | |
| 1169 | } else if (hash_report_level == 2) { | |
| 1170 | hash_queries++; | |
| 1171 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1172 | icount++; | |
| 1173 | if (icount > max_collisions_allowed) { | |
| 1174 | printf("Error -- too many read hash collisions\n"); | |
| 1175 | exit(0); | |
| 1176 | } | |
| 1177 | } | |
| 1178 | read_hash_collisions += icount; | |
| 1179 | } else if (hash_report_level == 3) { | |
| 1180 | hash_queries++; | |
| 1181 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1182 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1183 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1184 | icount++; | |
| 1185 | uint hashloctmp = hashloc+1; | |
| 1186 | hashloctmp = hashloctmp%hashtablesize; | |
| 1187 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1188 | if (icount > max_collisions_allowed) { | |
| 1189 | printf("Error -- too many read hash collisions\n"); | |
| 1190 | exit(0); | |
| 1191 | } | |
| 1192 | } | |
| 1193 | read_hash_collisions += icount; | |
| 1194 | } | |
| 1195 | } else if (hash_method == 2) { | |
| 1196 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1197 | if (hash_report_level == 0) { | |
| 1198 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1199 | icount++; | |
| 1200 | } | |
| 1201 | } else if (hash_report_level == 1) { | |
| 1202 | hash_queries++; | |
| 1203 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1204 | icount++; | |
| 1205 | } | |
| 1206 | read_hash_collisions += icount; | |
| 1207 | } else if (hash_report_level == 2) { | |
| 1208 | hash_queries++; | |
| 1209 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1210 | icount++; | |
| 1211 | if (icount > max_collisions_allowed) { | |
| 1212 | printf("Error -- too many read hash collisions\n"); | |
| 1213 | exit(0); | |
| 1214 | } | |
| 1215 | } | |
| 1216 | read_hash_collisions += icount; | |
| 1217 | } else if (hash_report_level == 3) { | |
| 1218 | hash_queries++; | |
| 1219 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1220 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1221 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1222 | icount++; | |
| 1223 | uint hashloctmp = hashloc+1; | |
| 1224 | hashloctmp = hashloctmp%hashtablesize; | |
| 1225 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1226 | if (icount > max_collisions_allowed) { | |
| 1227 | printf("Error -- too many read hash collisions\n"); | |
| 1228 | exit(0); | |
| 1229 | } | |
| 1230 | } | |
| 1231 | read_hash_collisions += icount; | |
| 1232 | } | |
| 1233 | } | |
| 1234 | ||
| 1235 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1236 | return(hashval); | |
| 1237 | } | |
| 1238 | ||
| 1239 | void write_hash_collision_report(void){ | |
| 1240 | if (! do_compact_hash) return; | |
| 1241 | if (hash_report_level == 1) { | |
| 1242 | write_hash_collisions_runsum += (double)write_hash_collisions/(double)hash_ncells; | |
| 1243 | write_hash_collisions_count++; | |
| 1244 | } else if (hash_report_level >= 2) { | |
| 1245 | printf("Write hash collision report -- collisions per cell %lf, collisions %d cells %d\n",(double)write_hash_collisions/(double)hash_ncells,write_hash_collisions,hash_ncells); | |
| 1246 | } | |
| 1247 | } | |
| 1248 | ||
| 1249 | void read_hash_collision_report(void){ | |
| 1250 | if (! do_compact_hash) return; | |
| 1251 | if (hash_report_level == 1) { | |
| 1252 | read_hash_collisions_runsum += (double)read_hash_collisions/(double)hash_queries; | |
| 1253 | read_hash_collisions_count++; | |
| 1254 | } else if (hash_report_level >= 2) { | |
| 1255 | printf("Read hash collision report -- collisions per cell %lf, collisions %d cells %d\n",(double)read_hash_collisions/(double)hash_queries,read_hash_collisions,hash_queries); | |
| 1256 | hash_queries = 0; | |
| 1257 | read_hash_collisions = 0; | |
| 1258 | } | |
| 1259 | } | |
| 1260 | ||
| 1261 | void final_hash_collision_report(void){ | |
| 1262 | if (hash_report_level >= 1 && read_hash_collisions_count > 0) { | |
| 1263 | printf("Final hash collision report -- write/read collisions per cell %lf/%lf\n",write_hash_collisions_runsum/(double)write_hash_collisions_count,read_hash_collisions_runsum/(double)read_hash_collisions_count); | |
| 1264 | } | |
| 1265 | } | |
| 1266 |
| … | … | @@ -1,140 +0,0 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | #ifndef _HASH_H | |
| 34 | #define _HASH_H | |
| 35 | ||
| 36 | #include <stdio.h> | |
| 37 | #include <stdlib.h> | |
| 38 | ||
| 39 | #ifdef __cplusplus | |
| 40 | extern "C" | |
| 41 | { | |
| 42 | #endif | |
| 43 | ||
| 44 | typedef unsigned int uint; | |
| 45 | typedef unsigned long ulong; | |
| 46 | ||
| 47 | int *compact_hash_init(int ncells, uint isize, uint jsize, uint report_level); | |
| 48 | ||
| 49 | #ifdef _OPENMP | |
| 50 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 51 | int *compact_hash_init_openmp(int ncells, uint isize, uint jsize, uint report_level); | |
| 52 | #else | |
| 53 | int *compact_hash_init_openmp(int ncells, uint isize, uint jsize, uint report_level, omp_lock_t **lock); | |
| 54 | #endif | |
| 55 | #endif | |
| 56 | ||
| 57 | int get_hash_method(void); | |
| 58 | long long get_hash_table_size(void); | |
| 59 | ||
| 60 | void write_hash_perfect(uint ic, ulong hashkey, int *hash); | |
| 61 | void write_hash_linear(uint ic, ulong hashkey, int *hash); | |
| 62 | void write_hash_linear_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 63 | void write_hash_linear_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 64 | void write_hash_linear_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 65 | void write_hash_quadratic(uint ic, ulong hashkey, int *hash); | |
| 66 | void write_hash_quadratic_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 67 | void write_hash_quadratic_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 68 | void write_hash_quadratic_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 69 | void write_hash_primejump(uint ic, ulong hashkey, int *hash); | |
| 70 | void write_hash_primejump_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 71 | void write_hash_primejump_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 72 | void write_hash_primejump_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 73 | extern void (*write_hash)(uint ic, ulong hashkey, int *hash); // declared in hash.c | |
| 74 | ||
| 75 | #ifdef _OPENMP | |
| 76 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 77 | void write_hash_perfect_openmp(uint ic, ulong hashkey, int *hash); | |
| 78 | void write_hash_linear_openmp(uint ic, ulong hashkey, int *hash); | |
| 79 | void write_hash_linear_openmp_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 80 | void write_hash_linear_openmp_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 81 | void write_hash_linear_openmp_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 82 | void write_hash_quadratic_openmp(uint ic, ulong hashkey, int *hash); | |
| 83 | void write_hash_quadratic_openmp_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 84 | void write_hash_quadratic_openmp_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 85 | void write_hash_quadratic_openmp_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 86 | void write_hash_primejump_openmp(uint ic, ulong hashkey, int *hash); | |
| 87 | void write_hash_primejump_openmp_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 88 | void write_hash_primejump_openmp_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 89 | void write_hash_primejump_openmp_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 90 | extern void (*write_hash_openmp)(uint ic, ulong hashkey, int *hash); // declared in hash.c | |
| 91 | #else | |
| 92 | void write_hash_perfect_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 93 | void write_hash_linear_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 94 | void write_hash_linear_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 95 | void write_hash_linear_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 96 | void write_hash_linear_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 97 | void write_hash_quadratic_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 98 | void write_hash_quadratic_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 99 | void write_hash_quadratic_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 100 | void write_hash_quadratic_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 101 | void write_hash_primejump_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 102 | void write_hash_primejump_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 103 | void write_hash_primejump_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 104 | void write_hash_primejump_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 105 | extern void (*write_hash_openmp)(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); // declared in hash.c | |
| 106 | #endif | |
| 107 | #endif | |
| 108 | ||
| 109 | int read_hash_perfect(ulong hashkey, int *hash); | |
| 110 | int read_hash_linear(ulong hashkey, int *hash); | |
| 111 | int read_hash_linear_report_level_1(ulong hashkey, int *hash); | |
| 112 | int read_hash_linear_report_level_2(ulong hashkey, int *hash); | |
| 113 | int read_hash_linear_report_level_3(ulong hashkey, int *hash); | |
| 114 | int read_hash_quadratic(ulong hashkey, int *hash); | |
| 115 | int read_hash_quadratic_report_level_1(ulong hashkey, int *hash); | |
| 116 | int read_hash_quadratic_report_level_2(ulong hashkey, int *hash); | |
| 117 | int read_hash_quadratic_report_level_3(ulong hashkey, int *hash); | |
| 118 | int read_hash_primejump(ulong hashkey, int *hash); | |
| 119 | int read_hash_primejump_report_level_1(ulong hashkey, int *hash); | |
| 120 | int read_hash_primejump_report_level_2(ulong hashkey, int *hash); | |
| 121 | int read_hash_primejump_report_level_3(ulong hashkey, int *hash); | |
| 122 | extern int (*read_hash)(ulong hashkey, int *hash); // declared in hash.c | |
| 123 | ||
| 124 | void compact_hash_delete(int *hash); | |
| 125 | #ifdef _OPENMP | |
| 126 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 127 | void compact_hash_delete_openmp(int *hash); | |
| 128 | #else | |
| 129 | void compact_hash_delete_openmp(int *hash, omp_lock_t *lock); | |
| 130 | #endif | |
| 131 | #endif | |
| 132 | ||
| 133 | void read_hash_collision_report(void); | |
| 134 | void final_hash_collision_report(void); | |
| 135 | ||
| 136 | #ifdef __cplusplus | |
| 137 | } | |
| 138 | #endif | |
| 139 | ||
| 140 | #endif // _HASH_H |
| … | … | @@ -1,181 +0,0 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | /* | |
| 34 | * Authors: Bob Robey XCP-2 brobey@lanl.gov | |
| 35 | * Peter Ahrens peter.ahrens@lanl.gov, ptrahrens@gmail.com | |
| 36 | * Sara Hartse sara@lanl.gov, sara.hartse@gmail.com | |
| 37 | * Rebecka Tumblin rtumblin@lanl.gov, rebeckatumblin@gmail.com | |
| 38 | */ | |
| 39 | ||
| 40 | /* neigh2d_kern.cl */ | |
| 41 | ||
| 42 | void write_hash( | |
| 43 | const int hash_method, | |
| 44 | const ulong hash_table_size, | |
| 45 | const ulong AA, | |
| 46 | const ulong BB, | |
| 47 | const uint giX, | |
| 48 | const ulong hashkey, | |
| 49 | __global int *hash); | |
| 50 | int read_hash( | |
| 51 | const int hash_method, | |
| 52 | const ulong hash_table_size, | |
| 53 | const ulong AA, | |
| 54 | const ulong BB, | |
| 55 | const ulong hashkey, | |
| 56 | __global const int *hash); | |
| 57 | ||
| 58 | #ifndef __HAVE_CL_DOUBLE_DEFINED__ | |
| 59 | #define __HAVE_CL_DOUBLE_DEFINED__ | |
| 60 | ||
| 61 | #ifdef HAVE_CL_DOUBLE | |
| 62 | #pragma OPENCL EXTENSION cl_khr_fp64 : enable | |
| 63 | typedef double real; | |
| 64 | #else | |
| 65 | typedef float real; | |
| 66 | #endif | |
| 67 | ||
| 68 | #endif | |
| 69 | ||
| 70 | __constant ulong prime = 4294967291; | |
| 71 | __constant uint hash_jump_prime = 41; | |
| 72 | ||
| 73 | void write_hash( | |
| 74 | const int hash_method, | |
| 75 | const ulong hash_table_size, | |
| 76 | const ulong AA, | |
| 77 | const ulong BB, | |
| 78 | const uint giX, | |
| 79 | const ulong hashkey, | |
| 80 | __global int *hash) | |
| 81 | { | |
| 82 | uint hashloc; | |
| 83 | int icount = 0; | |
| 84 | uint jump; | |
| 85 | int old_key; | |
| 86 | int MaxTries = 1000; | |
| 87 | #ifndef __APPLE_CC__ | |
| 88 | switch (hash_method) { | |
| 89 | case -1: | |
| 90 | #endif | |
| 91 | hash[hashkey] = giX; | |
| 92 | #ifndef __APPLE_CC__ | |
| 93 | break; | |
| 94 | case 0: | |
| 95 | hashloc = (hashkey*AA+BB)%prime%hash_table_size; | |
| 96 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 97 | ||
| 98 | for (int icount = 1; old_key != (int)hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 99 | hashloc++; | |
| 100 | hashloc %= hash_table_size; | |
| 101 | ||
| 102 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 103 | } | |
| 104 | ||
| 105 | if (icount < MaxTries) hash[2*hashloc+1] = giX; | |
| 106 | break; | |
| 107 | case 1: | |
| 108 | hashloc = (hashkey*AA+BB)%prime%hash_table_size; | |
| 109 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 110 | ||
| 111 | for (int icount = 1; old_key != (int)hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 112 | hashloc+=(icount*icount); | |
| 113 | hashloc %= hash_table_size; | |
| 114 | ||
| 115 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 116 | } | |
| 117 | ||
| 118 | if (icount < MaxTries) hash[2*hashloc+1] = giX; | |
| 119 | break; | |
| 120 | case 2: | |
| 121 | jump = 1+hashkey%hash_jump_prime; | |
| 122 | hashloc = (hashkey*AA+BB)%prime%hash_table_size; | |
| 123 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 124 | ||
| 125 | for (int icount = 1; old_key != (int)hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 126 | hashloc += (icount*jump); | |
| 127 | hashloc %= hash_table_size; | |
| 128 | ||
| 129 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 130 | } | |
| 131 | ||
| 132 | if (icount < MaxTries) hash[2*hashloc+1] = giX; | |
| 133 | break; | |
| 134 | } | |
| 135 | #endif | |
| 136 | } | |
| 137 | ||
| 138 | int read_hash( | |
| 139 | const int hash_method, | |
| 140 | const ulong hash_table_size, | |
| 141 | const ulong AA, | |
| 142 | const ulong BB, | |
| 143 | const ulong hashkey, | |
| 144 | __global const int *hash) | |
| 145 | { | |
| 146 | int hashval = -1; | |
| 147 | uint hashloc; | |
| 148 | int icount = 0; | |
| 149 | uint jump; | |
| 150 | ||
| 151 | #ifndef __APPLE_CC__ | |
| 152 | switch (hash_method) { | |
| 153 | case -1: | |
| 154 | #endif | |
| 155 | return(hash[hashkey]); | |
| 156 | #ifndef __APPLE_CC__ | |
| 157 | break; | |
| 158 | case 0: | |
| 159 | for (hashloc = (hashkey*AA+BB)%prime%hash_table_size; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc %= hash_table_size); | |
| 160 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 161 | return(hashval); | |
| 162 | break; | |
| 163 | case 1: | |
| 164 | for (hashloc = (hashkey*AA+BB)%prime%hash_table_size; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc %= hash_table_size){ | |
| 165 | icount++; | |
| 166 | } | |
| 167 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 168 | return(hashval); | |
| 169 | break; | |
| 170 | case 2: | |
| 171 | jump = 1+hashkey%hash_jump_prime; | |
| 172 | for (hashloc = (hashkey*AA+BB)%prime%hash_table_size; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc %= hash_table_size){ | |
| 173 | icount++; | |
| 174 | } | |
| 175 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 176 | return(hashval); | |
| 177 | break; | |
| 178 | } | |
| 179 | #endif | |
| 180 | return(hashval); | |
| 181 | } |
| … | … | @@ -1,156 +0,0 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | #include <stdlib.h> | |
| 34 | //#ifdef HAVE_CONFIG_H | |
| 35 | //#include "config.h" | |
| 36 | //#endif | |
| 37 | #include "hasholdlib.h" | |
| 38 | #include "hasholdlib_kern.inc" | |
| 39 | #include "hashold_kern.inc" | |
| 40 | ||
| 41 | static int reportLevel = 0; | |
| 42 | ||
| 43 | char *get_hash_kernel_source_string(void){ | |
| 44 | return (char*) hashold_kern_source; | |
| 45 | } | |
| 46 | ||
| 47 | #ifdef HAVE_OPENCL | |
| 48 | cl_kernel init_kernel; | |
| 49 | void hash_lib_init(cl_context context){ | |
| 50 | ||
| 51 | cl_int error; | |
| 52 | ||
| 53 | cl_program program = clCreateProgramWithSource(context, 1, (const char **)&hasholdlib_kern_source, NULL, &error); | |
| 54 | if (error != CL_SUCCESS){ | |
| 55 | printf("clCreateProgramWithSource returned an error %d at line %d in file %s\n", error,__LINE__,__FILE__); | |
| 56 | } | |
| 57 | ||
| 58 | size_t nReportSize; | |
| 59 | char* BuildReport; | |
| 60 | #ifdef HAVE_CL_DOUBLE | |
| 61 | error = clBuildProgram(program, 0, NULL, "-DHAVE_CL_DOUBLE", NULL, NULL); | |
| 62 | #else | |
| 63 | error = clBuildProgram(program, 0, NULL, "-DNO_CL_DOUBLE -cl-single-precision-constant", NULL, NULL); | |
| 64 | #endif | |
| 65 | if (error != CL_SUCCESS){ | |
| 66 | printf("clBuildProgram returned an error %d at line %d in file %s\n", error,__LINE__,__FILE__); | |
| 67 | ||
| 68 | cl_device_id device; | |
| 69 | ||
| 70 | clGetContextInfo(context, CL_CONTEXT_DEVICES, 1, &device, NULL); | |
| 71 | if (context == NULL){ | |
| 72 | printf("EZCL_DEVTYPE_INIT: Failed to find device and setup context in file %s at line %d\n", __FILE__, __LINE__); | |
| 73 | exit(-1); // No device is available, something is wrong | |
| 74 | } | |
| 75 | ||
| 76 | error = clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &nReportSize); | |
| 77 | if (error != CL_SUCCESS) { | |
| 78 | switch (error){ | |
| 79 | case CL_INVALID_DEVICE: | |
| 80 | printf("Invalid device in clProgramBuildInfo\n"); | |
| 81 | break; | |
| 82 | case CL_INVALID_VALUE: | |
| 83 | printf("Invalid value in clProgramBuildInfo\n"); | |
| 84 | break; | |
| 85 | case CL_INVALID_PROGRAM: | |
| 86 | printf("Invalid program in clProgramBuildInfo\n"); | |
| 87 | break; | |
| 88 | } | |
| 89 | } | |
| 90 | ||
| 91 | BuildReport = (char *)malloc(nReportSize); | |
| 92 | ||
| 93 | error = clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, nReportSize, BuildReport, NULL); | |
| 94 | if (error != CL_SUCCESS) { | |
| 95 | switch (error){ | |
| 96 | case CL_INVALID_DEVICE: | |
| 97 | printf("Invalid device in clProgramBuildInfo\n"); | |
| 98 | break; | |
| 99 | case CL_INVALID_VALUE: | |
| 100 | printf("Invalid value in clProgramBuildInfo\n"); | |
| 101 | break; | |
| 102 | case CL_INVALID_PROGRAM: | |
| 103 | printf("Invalid program in clProgramBuildInfo\n"); | |
| 104 | break; | |
| 105 | } | |
| 106 | } | |
| 107 | printf("%s\n", BuildReport); | |
| 108 | } | |
| 109 | ||
| 110 | ||
| 111 | init_kernel = clCreateKernel(program, "init_kern", &error); | |
| 112 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 113 | } | |
| 114 | ||
| 115 | cl_mem hash_init (int hash_size, int TILE_SIZE, cl_context context, cl_command_queue queue, long *gpu_time) | |
| 116 | { | |
| 117 | cl_int error; | |
| 118 | ||
| 119 | long gpu_time_start, gpu_time_end; | |
| 120 | ||
| 121 | cl_mem hash_buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, hash_size*sizeof(int), NULL, &error); | |
| 122 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 123 | ||
| 124 | //init to -1 | |
| 125 | ||
| 126 | error = clSetKernelArg(init_kernel, 0, sizeof(cl_uint), &hash_size); | |
| 127 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 128 | error = clSetKernelArg(init_kernel, 1, sizeof(cl_mem), (void*)&hash_buffer); | |
| 129 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 130 | ||
| 131 | size_t global_work_size; | |
| 132 | size_t local_work_size; | |
| 133 | ||
| 134 | local_work_size = TILE_SIZE; | |
| 135 | global_work_size = ((hash_size+local_work_size-1)/local_work_size)*local_work_size; | |
| 136 | ||
| 137 | cl_event hash_init_event; | |
| 138 | ||
| 139 | error = clEnqueueNDRangeKernel(queue, init_kernel, 1, 0, &global_work_size, &local_work_size, 0, NULL, &hash_init_event); | |
| 140 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 141 | ||
| 142 | clWaitForEvents(1,&hash_init_event); | |
| 143 | ||
| 144 | clGetEventProfilingInfo(hash_init_event, CL_PROFILING_COMMAND_START, sizeof(gpu_time_start), &gpu_time_start, NULL); | |
| 145 | clGetEventProfilingInfo(hash_init_event, CL_PROFILING_COMMAND_END, sizeof(gpu_time_end), &gpu_time_end, NULL); | |
| 146 | ||
| 147 | ||
| 148 | *gpu_time = gpu_time_end - gpu_time_start; | |
| 149 | ||
| 150 | clReleaseEvent(hash_init_event); | |
| 151 | ||
| 152 | //if (DETAILED_TIMING) printf("\n\tinit %.6lf,", (double)(gpu_time_end - gpu_time_start)*1.0e-9); | |
| 153 | ||
| 154 | return(hash_buffer); | |
| 155 | } | |
| 156 | #endif |
| … | … | @@ -1,50 +0,0 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | #include <stdio.h> | |
| 34 | //#ifdef HAVE_CONFIG_H | |
| 35 | //#include "config.h" | |
| 36 | //#endif | |
| 37 | ||
| 38 | #ifdef HAVE_OPENCL | |
| 39 | #ifdef __APPLE_CC__ | |
| 40 | #include <OpenCL/OpenCL.h> | |
| 41 | #else | |
| 42 | #include <CL/cl.h> | |
| 43 | #endif | |
| 44 | #endif | |
| 45 | ||
| 46 | char *get_hash_kernel_source_string(); | |
| 47 | #ifdef HAVE_OPENCL | |
| 48 | void hash_lib_init(cl_context context); | |
| 49 | cl_mem hash_init (int hash_size, int TILE_SIZE, cl_context context, cl_command_queue queue, long *gpu_time); | |
| 50 | #endif |
| … | … | @@ -1,65 +0,0 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | /* | |
| 34 | * Authors: Bob Robey XCP-2 brobey@lanl.gov | |
| 35 | * Peter Ahrens peter.ahrens@lanl.gov, ptrahrens@gmail.com | |
| 36 | * Sara Hartse sara@lanl.gov, sara.hartse@gmail.com | |
| 37 | * Rebecka Tumblin rtumblin@lanl.gov, rebeckatumblin@gmail.com | |
| 38 | */ | |
| 39 | ||
| 40 | /* neigh2d_kern.cl */ | |
| 41 | ||
| 42 | #ifndef __HAVE_CL_DOUBLE_DEFINED__ | |
| 43 | #define __HAVE_CL_DOUBLE_DEFINED__ | |
| 44 | ||
| 45 | #ifdef HAVE_CL_DOUBLE | |
| 46 | #pragma OPENCL EXTENSION cl_khr_fp64 : enable | |
| 47 | typedef double real; | |
| 48 | #else | |
| 49 | typedef float real; | |
| 50 | #endif | |
| 51 | ||
| 52 | #endif | |
| 53 | ||
| 54 | ||
| 55 | __kernel void init_kern( | |
| 56 | const uint size, | |
| 57 | __global int *temp) { | |
| 58 | ||
| 59 | const uint idx = get_global_id(0); | |
| 60 | ||
| 61 | if (idx >= size) return; | |
| 62 | ||
| 63 | temp[idx] = -1; | |
| 64 | } | |
| 65 |
| … | … | @@ -0,0 +1,28 @@ |
| 1 | default: simplehash.c simplehashlib.c libsimplehash.la | |
| 2 | all: simplehash.c simplehashlib.c libsimplehash.la | |
| 3 | ||
| 4 | AM_MAKEFLAGS = -j 4 | |
| 5 | ||
| 6 | DEFAULT_INCLUDES=-I. -I.. | |
| 7 | ||
| 8 | lib_LTLIBRARIES = libsimplehash.la | |
| 9 | include_HEADERS = simplehash.h simplehashlib.h | |
| 10 | ||
| 11 | H_SRCS = simplehash.h simplehashlib.h | |
| 12 | ||
| 13 | C_SRCS = simplehash.c simplehashlib.c | |
| 14 | ||
| 15 | libsimplehash_la_SOURCES = ${C_SRCS} ${H_SRCS} | |
| 16 | ||
| 17 | simplehashlib.c: simplehashlib_kern.inc simplehash_kern.inc | |
| 18 | ||
| 19 | simplehashlib_kern.inc: | |
| 20 | ./embed_source.pl simplehashlib_kern.cl > simplehashlib_kern.inc | |
| 21 | ||
| 22 | simplehash_kern.inc: | |
| 23 | ./embed_source.pl simplehash_kern.cl > simplehash_kern.inc | |
| 24 | ||
| 25 | EXTRA_DIST = simplehash_kern.cl simplehashlib_kern.cl embed_source.pl | |
| 26 | ||
| 27 | clean-local: | |
| 28 | rm -f *.inc |
| … | … | @@ -0,0 +1,680 @@ |
| 1 | # Makefile.in generated by automake 1.13.4 from Makefile.am. | |
| 2 | # @configure_input@ | |
| 3 | ||
| 4 | # Copyright (C) 1994-2013 Free Software Foundation, Inc. | |
| 5 | ||
| 6 | # This Makefile.in is free software; the Free Software Foundation | |
| 7 | # gives unlimited permission to copy and/or distribute it, | |
| 8 | # with or without modifications, as long as this notice is preserved. | |
| 9 | ||
| 10 | # This program is distributed in the hope that it will be useful, | |
| 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
| 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
| 13 | # PARTICULAR PURPOSE. | |
| 14 | ||
| 15 | @SET_MAKE@ | |
| 16 | ||
| 17 | ||
| 18 | VPATH = @srcdir@ | |
| 19 | am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' | |
| 20 | am__make_running_with_option = \ | |
| 21 | case $${target_option-} in \ | |
| 22 | ?) ;; \ | |
| 23 | *) echo "am__make_running_with_option: internal error: invalid" \ | |
| 24 | "target option '$${target_option-}' specified" >&2; \ | |
| 25 | exit 1;; \ | |
| 26 | esac; \ | |
| 27 | has_opt=no; \ | |
| 28 | sane_makeflags=$$MAKEFLAGS; \ | |
| 29 | if $(am__is_gnu_make); then \ | |
| 30 | sane_makeflags=$$MFLAGS; \ | |
| 31 | else \ | |
| 32 | case $$MAKEFLAGS in \ | |
| 33 | *\\[\ \ ]*) \ | |
| 34 | bs=\\; \ | |
| 35 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | |
| 36 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ | |
| 37 | esac; \ | |
| 38 | fi; \ | |
| 39 | skip_next=no; \ | |
| 40 | strip_trailopt () \ | |
| 41 | { \ | |
| 42 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ | |
| 43 | }; \ | |
| 44 | for flg in $$sane_makeflags; do \ | |
| 45 | test $$skip_next = yes && { skip_next=no; continue; }; \ | |
| 46 | case $$flg in \ | |
| 47 | *=*|--*) continue;; \ | |
| 48 | -*I) strip_trailopt 'I'; skip_next=yes;; \ | |
| 49 | -*I?*) strip_trailopt 'I';; \ | |
| 50 | -*O) strip_trailopt 'O'; skip_next=yes;; \ | |
| 51 | -*O?*) strip_trailopt 'O';; \ | |
| 52 | -*l) strip_trailopt 'l'; skip_next=yes;; \ | |
| 53 | -*l?*) strip_trailopt 'l';; \ | |
| 54 | -[dEDm]) skip_next=yes;; \ | |
| 55 | -[JT]) skip_next=yes;; \ | |
| 56 | esac; \ | |
| 57 | case $$flg in \ | |
| 58 | *$$target_option*) has_opt=yes; break;; \ | |
| 59 | esac; \ | |
| 60 | done; \ | |
| 61 | test $$has_opt = yes | |
| 62 | am__make_dryrun = (target_option=n; $(am__make_running_with_option)) | |
| 63 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) | |
| 64 | pkgdatadir = $(datadir)/@PACKAGE@ | |
| 65 | pkgincludedir = $(includedir)/@PACKAGE@ | |
| 66 | pkglibdir = $(libdir)/@PACKAGE@ | |
| 67 | pkglibexecdir = $(libexecdir)/@PACKAGE@ | |
| 68 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | |
| 69 | install_sh_DATA = $(install_sh) -c -m 644 | |
| 70 | install_sh_PROGRAM = $(install_sh) -c | |
| 71 | install_sh_SCRIPT = $(install_sh) -c | |
| 72 | INSTALL_HEADER = $(INSTALL_DATA) | |
| 73 | transform = $(program_transform_name) | |
| 74 | NORMAL_INSTALL = : | |
| 75 | PRE_INSTALL = : | |
| 76 | POST_INSTALL = : | |
| 77 | NORMAL_UNINSTALL = : | |
| 78 | PRE_UNINSTALL = : | |
| 79 | POST_UNINSTALL = : | |
| 80 | build_triplet = @build@ | |
| 81 | host_triplet = @host@ | |
| 82 | subdir = simplehash | |
| 83 | DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ | |
| 84 | $(top_srcdir)/./config/depcomp $(include_HEADERS) | |
| 85 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | |
| 86 | am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ | |
| 87 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ | |
| 88 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ | |
| 89 | $(top_srcdir)/configure.ac | |
| 90 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | |
| 91 | $(ACLOCAL_M4) | |
| 92 | mkinstalldirs = $(install_sh) -d | |
| 93 | CONFIG_CLEAN_FILES = | |
| 94 | CONFIG_CLEAN_VPATH_FILES = | |
| 95 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | |
| 96 | am__vpath_adj = case $$p in \ | |
| 97 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | |
| 98 | *) f=$$p;; \ | |
| 99 | esac; | |
| 100 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; | |
| 101 | am__install_max = 40 | |
| 102 | am__nobase_strip_setup = \ | |
| 103 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` | |
| 104 | am__nobase_strip = \ | |
| 105 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" | |
| 106 | am__nobase_list = $(am__nobase_strip_setup); \ | |
| 107 | for p in $$list; do echo "$$p $$p"; done | \ | |
| 108 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ | |
| 109 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ | |
| 110 | if (++n[$$2] == $(am__install_max)) \ | |
| 111 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ | |
| 112 | END { for (dir in files) print dir, files[dir] }' | |
| 113 | am__base_list = \ | |
| 114 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ | |
| 115 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | |
| 116 | am__uninstall_files_from_dir = { \ | |
| 117 | test -z "$$files" \ | |
| 118 | || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ | |
| 119 | || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ | |
| 120 | $(am__cd) "$$dir" && rm -f $$files; }; \ | |
| 121 | } | |
| 122 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" | |
| 123 | LTLIBRARIES = $(lib_LTLIBRARIES) | |
| 124 | libsimplehash_la_LIBADD = | |
| 125 | am__objects_1 = simplehash.lo simplehashlib.lo | |
| 126 | am__objects_2 = | |
| 127 | am_libsimplehash_la_OBJECTS = $(am__objects_1) $(am__objects_2) | |
| 128 | libsimplehash_la_OBJECTS = $(am_libsimplehash_la_OBJECTS) | |
| 129 | AM_V_lt = $(am__v_lt_@AM_V@) | |
| 130 | am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) | |
| 131 | am__v_lt_0 = --silent | |
| 132 | am__v_lt_1 = | |
| 133 | AM_V_P = $(am__v_P_@AM_V@) | |
| 134 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) | |
| 135 | am__v_P_0 = false | |
| 136 | am__v_P_1 = : | |
| 137 | AM_V_GEN = $(am__v_GEN_@AM_V@) | |
| 138 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) | |
| 139 | am__v_GEN_0 = @echo " GEN " $@; | |
| 140 | am__v_GEN_1 = | |
| 141 | AM_V_at = $(am__v_at_@AM_V@) | |
| 142 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |
| 143 | am__v_at_0 = @ | |
| 144 | am__v_at_1 = | |
| 145 | depcomp = $(SHELL) $(top_srcdir)/./config/depcomp | |
| 146 | am__depfiles_maybe = depfiles | |
| 147 | am__mv = mv -f | |
| 148 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | |
| 149 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | |
| 150 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | |
| 151 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ | |
| 152 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | |
| 153 | $(AM_CFLAGS) $(CFLAGS) | |
| 154 | AM_V_CC = $(am__v_CC_@AM_V@) | |
| 155 | am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) | |
| 156 | am__v_CC_0 = @echo " CC " $@; | |
| 157 | am__v_CC_1 = | |
| 158 | CCLD = $(CC) | |
| 159 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | |
| 160 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | |
| 161 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | |
| 162 | AM_V_CCLD = $(am__v_CCLD_@AM_V@) | |
| 163 | am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) | |
| 164 | am__v_CCLD_0 = @echo " CCLD " $@; | |
| 165 | am__v_CCLD_1 = | |
| 166 | SOURCES = $(libsimplehash_la_SOURCES) | |
| 167 | DIST_SOURCES = $(libsimplehash_la_SOURCES) | |
| 168 | am__can_run_installinfo = \ | |
| 169 | case $$AM_UPDATE_INFO_DIR in \ | |
| 170 | n|no|NO) false;; \ | |
| 171 | *) (install-info --version) >/dev/null 2>&1;; \ | |
| 172 | esac | |
| 173 | HEADERS = $(include_HEADERS) | |
| 174 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) | |
| 175 | # Read a list of newline-separated strings from the standard input, | |
| 176 | # and print each of them once, without duplicates. Input order is | |
| 177 | # *not* preserved. | |
| 178 | am__uniquify_input = $(AWK) '\ | |
| 179 | BEGIN { nonempty = 0; } \ | |
| 180 | { items[$$0] = 1; nonempty = 1; } \ | |
| 181 | END { if (nonempty) { for (i in items) print i; }; } \ | |
| 182 | ' | |
| 183 | # Make sure the list of sources is unique. This is necessary because, | |
| 184 | # e.g., the same source file might be shared among _SOURCES variables | |
| 185 | # for different programs/libraries. | |
| 186 | am__define_uniq_tagged_files = \ | |
| 187 | list='$(am__tagged_files)'; \ | |
| 188 | unique=`for i in $$list; do \ | |
| 189 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | |
| 190 | done | $(am__uniquify_input)` | |
| 191 | ETAGS = etags | |
| 192 | CTAGS = ctags | |
| 193 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | |
| 194 | ACLOCAL = @ACLOCAL@ | |
| 195 | AMTAR = @AMTAR@ | |
| 196 | AM_CPPFLAGS = @AM_CPPFLAGS@ | |
| 197 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | |
| 198 | AR = @AR@ | |
| 199 | AUTOCONF = @AUTOCONF@ | |
| 200 | AUTOHEADER = @AUTOHEADER@ | |
| 201 | AUTOMAKE = @AUTOMAKE@ | |
| 202 | AWK = @AWK@ | |
| 203 | CC = @CC@ | |
| 204 | CCDEPMODE = @CCDEPMODE@ | |
| 205 | CFLAGS = @CFLAGS@ | |
| 206 | CPP = @CPP@ | |
| 207 | CPPFLAGS = @CPPFLAGS@ | |
| 208 | CPREPROCESSOR = @CPREPROCESSOR@ | |
| 209 | CXX = @CXX@ | |
| 210 | CXXCPP = @CXXCPP@ | |
| 211 | CXXDEPMODE = @CXXDEPMODE@ | |
| 212 | CXXFLAGS = @CXXFLAGS@ | |
| 213 | CYGPATH_W = @CYGPATH_W@ | |
| 214 | DEFS = @DEFS@ | |
| 215 | DEPDIR = @DEPDIR@ | |
| 216 | DLLTOOL = @DLLTOOL@ | |
| 217 | DSYMUTIL = @DSYMUTIL@ | |
| 218 | DUMPBIN = @DUMPBIN@ | |
| 219 | ECHO_C = @ECHO_C@ | |
| 220 | ECHO_N = @ECHO_N@ | |
| 221 | ECHO_T = @ECHO_T@ | |
| 222 | EGREP = @EGREP@ | |
| 223 | EXEEXT = @EXEEXT@ | |
| 224 | FGREP = @FGREP@ | |
| 225 | GREP = @GREP@ | |
| 226 | HAVE_ADDR2LINE = @HAVE_ADDR2LINE@ | |
| 227 | INDENT = @INDENT@ | |
| 228 | INSTALL = @INSTALL@ | |
| 229 | INSTALL_DATA = @INSTALL_DATA@ | |
| 230 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
| 231 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | |
| 232 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | |
| 233 | LD = @LD@ | |
| 234 | LDFLAGS = @LDFLAGS@ | |
| 235 | LIBOBJS = @LIBOBJS@ | |
| 236 | LIBS = @LIBS@ | |
| 237 | LIBTOOL = @LIBTOOL@ | |
| 238 | LIPO = @LIPO@ | |
| 239 | LN_S = @LN_S@ | |
| 240 | LTLIBOBJS = @LTLIBOBJS@ | |
| 241 | MAKEINFO = @MAKEINFO@ | |
| 242 | MANIFEST_TOOL = @MANIFEST_TOOL@ | |
| 243 | MKDIR_P = @MKDIR_P@ | |
| 244 | NM = @NM@ | |
| 245 | NMEDIT = @NMEDIT@ | |
| 246 | OBJDUMP = @OBJDUMP@ | |
| 247 | OBJEXT = @OBJEXT@ | |
| 248 | OTOOL = @OTOOL@ | |
| 249 | OTOOL64 = @OTOOL64@ | |
| 250 | PACKAGE = @PACKAGE@ | |
| 251 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | |
| 252 | PACKAGE_NAME = @PACKAGE_NAME@ | |
| 253 | PACKAGE_STRING = @PACKAGE_STRING@ | |
| 254 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | |
| 255 | PACKAGE_URL = @PACKAGE_URL@ | |
| 256 | PACKAGE_VERSION = @PACKAGE_VERSION@ | |
| 257 | PATH_SEPARATOR = @PATH_SEPARATOR@ | |
| 258 | RANLIB = @RANLIB@ | |
| 259 | SED = @SED@ | |
| 260 | SET_MAKE = @SET_MAKE@ | |
| 261 | SHELL = @SHELL@ | |
| 262 | STRIP = @STRIP@ | |
| 263 | VERSION = @VERSION@ | |
| 264 | abs_builddir = @abs_builddir@ | |
| 265 | abs_srcdir = @abs_srcdir@ | |
| 266 | abs_top_builddir = @abs_top_builddir@ | |
| 267 | abs_top_srcdir = @abs_top_srcdir@ | |
| 268 | ac_ct_AR = @ac_ct_AR@ | |
| 269 | ac_ct_CC = @ac_ct_CC@ | |
| 270 | ac_ct_CXX = @ac_ct_CXX@ | |
| 271 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | |
| 272 | am__include = @am__include@ | |
| 273 | am__leading_dot = @am__leading_dot@ | |
| 274 | am__quote = @am__quote@ | |
| 275 | am__tar = @am__tar@ | |
| 276 | am__untar = @am__untar@ | |
| 277 | bindir = @bindir@ | |
| 278 | build = @build@ | |
| 279 | build_alias = @build_alias@ | |
| 280 | build_cpu = @build_cpu@ | |
| 281 | build_os = @build_os@ | |
| 282 | build_vendor = @build_vendor@ | |
| 283 | builddir = @builddir@ | |
| 284 | datadir = @datadir@ | |
| 285 | datarootdir = @datarootdir@ | |
| 286 | docdir = @docdir@ | |
| 287 | dvidir = @dvidir@ | |
| 288 | exec_prefix = @exec_prefix@ | |
| 289 | host = @host@ | |
| 290 | host_alias = @host_alias@ | |
| 291 | host_cpu = @host_cpu@ | |
| 292 | host_os = @host_os@ | |
| 293 | host_vendor = @host_vendor@ | |
| 294 | htmldir = @htmldir@ | |
| 295 | includedir = @includedir@ | |
| 296 | infodir = @infodir@ | |
| 297 | install_sh = @install_sh@ | |
| 298 | libdir = @libdir@ | |
| 299 | libexecdir = @libexecdir@ | |
| 300 | localedir = @localedir@ | |
| 301 | localstatedir = @localstatedir@ | |
| 302 | lspci_found = @lspci_found@ | |
| 303 | mandir = @mandir@ | |
| 304 | mkdir_p = @mkdir_p@ | |
| 305 | oldincludedir = @oldincludedir@ | |
| 306 | pdfdir = @pdfdir@ | |
| 307 | prefix = @prefix@ | |
| 308 | program_transform_name = @program_transform_name@ | |
| 309 | psdir = @psdir@ | |
| 310 | sbindir = @sbindir@ | |
| 311 | sharedstatedir = @sharedstatedir@ | |
| 312 | srcdir = @srcdir@ | |
| 313 | sysconfdir = @sysconfdir@ | |
| 314 | target_alias = @target_alias@ | |
| 315 | top_build_prefix = @top_build_prefix@ | |
| 316 | top_builddir = @top_builddir@ | |
| 317 | top_srcdir = @top_srcdir@ | |
| 318 | AM_MAKEFLAGS = -j 4 | |
| 319 | DEFAULT_INCLUDES = -I. -I.. | |
| 320 | lib_LTLIBRARIES = libsimplehash.la | |
| 321 | include_HEADERS = simplehash.h simplehashlib.h | |
| 322 | H_SRCS = simplehash.h simplehashlib.h | |
| 323 | C_SRCS = simplehash.c simplehashlib.c | |
| 324 | libsimplehash_la_SOURCES = ${C_SRCS} ${H_SRCS} | |
| 325 | EXTRA_DIST = simplehash_kern.cl simplehashlib_kern.cl embed_source.pl | |
| 326 | all: all-am | |
| 327 | ||
| 328 | .SUFFIXES: | |
| 329 | .SUFFIXES: .c .lo .o .obj | |
| 330 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | |
| 331 | @for dep in $?; do \ | |
| 332 | case '$(am__configure_deps)' in \ | |
| 333 | *$$dep*) \ | |
| 334 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | |
| 335 | && { if test -f $@; then exit 0; else break; fi; }; \ | |
| 336 | exit 1;; \ | |
| 337 | esac; \ | |
| 338 | done; \ | |
| 339 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign simplehash/Makefile'; \ | |
| 340 | $(am__cd) $(top_srcdir) && \ | |
| 341 | $(AUTOMAKE) --foreign simplehash/Makefile | |
| 342 | .PRECIOUS: Makefile | |
| 343 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | |
| 344 | @case '$?' in \ | |
| 345 | *config.status*) \ | |
| 346 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | |
| 347 | *) \ | |
| 348 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | |
| 349 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | |
| 350 | esac; | |
| 351 | ||
| 352 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | |
| 353 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | |
| 354 | ||
| 355 | $(top_srcdir)/configure: $(am__configure_deps) | |
| 356 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | |
| 357 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | |
| 358 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | |
| 359 | $(am__aclocal_m4_deps): | |
| 360 | ||
| 361 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) | |
| 362 | @$(NORMAL_INSTALL) | |
| 363 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | |
| 364 | list2=; for p in $$list; do \ | |
| 365 | if test -f $$p; then \ | |
| 366 | list2="$$list2 $$p"; \ | |
| 367 | else :; fi; \ | |
| 368 | done; \ | |
| 369 | test -z "$$list2" || { \ | |
| 370 | echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ | |
| 371 | $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ | |
| 372 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ | |
| 373 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ | |
| 374 | } | |
| 375 | ||
| 376 | uninstall-libLTLIBRARIES: | |
| 377 | @$(NORMAL_UNINSTALL) | |
| 378 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | |
| 379 | for p in $$list; do \ | |
| 380 | $(am__strip_dir) \ | |
| 381 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ | |
| 382 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ | |
| 383 | done | |
| 384 | ||
| 385 | clean-libLTLIBRARIES: | |
| 386 | -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) | |
| 387 | @list='$(lib_LTLIBRARIES)'; \ | |
| 388 | locs=`for p in $$list; do echo $$p; done | \ | |
| 389 | sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ | |
| 390 | sort -u`; \ | |
| 391 | test -z "$$locs" || { \ | |
| 392 | echo rm -f $${locs}; \ | |
| 393 | rm -f $${locs}; \ | |
| 394 | } | |
| 395 | ||
| 396 | libsimplehash.la: $(libsimplehash_la_OBJECTS) $(libsimplehash_la_DEPENDENCIES) $(EXTRA_libsimplehash_la_DEPENDENCIES) | |
| 397 | $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libsimplehash_la_OBJECTS) $(libsimplehash_la_LIBADD) $(LIBS) | |
| 398 | ||
| 399 | mostlyclean-compile: | |
| 400 | -rm -f *.$(OBJEXT) | |
| 401 | ||
| 402 | distclean-compile: | |
| 403 | -rm -f *.tab.c | |
| 404 | ||
| 405 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplehash.Plo@am__quote@ | |
| 406 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplehashlib.Plo@am__quote@ | |
| 407 | ||
| 408 | .c.o: | |
| 409 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | |
| 410 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | |
| 411 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | |
| 412 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
| 413 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< | |
| 414 | ||
| 415 | .c.obj: | |
| 416 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | |
| 417 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | |
| 418 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | |
| 419 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
| 420 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` | |
| 421 | ||
| 422 | .c.lo: | |
| 423 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | |
| 424 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | |
| 425 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | |
| 426 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
| 427 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< | |
| 428 | ||
| 429 | mostlyclean-libtool: | |
| 430 | -rm -f *.lo | |
| 431 | ||
| 432 | clean-libtool: | |
| 433 | -rm -rf .libs _libs | |
| 434 | install-includeHEADERS: $(include_HEADERS) | |
| 435 | @$(NORMAL_INSTALL) | |
| 436 | @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ | |
| 437 | if test -n "$$list"; then \ | |
| 438 | echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ | |
| 439 | $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ | |
| 440 | fi; \ | |
| 441 | for p in $$list; do \ | |
| 442 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | |
| 443 | echo "$$d$$p"; \ | |
| 444 | done | $(am__base_list) | \ | |
| 445 | while read files; do \ | |
| 446 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ | |
| 447 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ | |
| 448 | done | |
| 449 | ||
| 450 | uninstall-includeHEADERS: | |
| 451 | @$(NORMAL_UNINSTALL) | |
| 452 | @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ | |
| 453 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ | |
| 454 | dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) | |
| 455 | ||
| 456 | ID: $(am__tagged_files) | |
| 457 | $(am__define_uniq_tagged_files); mkid -fID $$unique | |
| 458 | tags: tags-am | |
| 459 | TAGS: tags | |
| 460 | ||
| 461 | tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) | |
| 462 | set x; \ | |
| 463 | here=`pwd`; \ | |
| 464 | $(am__define_uniq_tagged_files); \ | |
| 465 | shift; \ | |
| 466 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | |
| 467 | test -n "$$unique" || unique=$$empty_fix; \ | |
| 468 | if test $$# -gt 0; then \ | |
| 469 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | |
| 470 | "$$@" $$unique; \ | |
| 471 | else \ | |
| 472 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | |
| 473 | $$unique; \ | |
| 474 | fi; \ | |
| 475 | fi | |
| 476 | ctags: ctags-am | |
| 477 | ||
| 478 | CTAGS: ctags | |
| 479 | ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) | |
| 480 | $(am__define_uniq_tagged_files); \ | |
| 481 | test -z "$(CTAGS_ARGS)$$unique" \ | |
| 482 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | |
| 483 | $$unique | |
| 484 | ||
| 485 | GTAGS: | |
| 486 | here=`$(am__cd) $(top_builddir) && pwd` \ | |
| 487 | && $(am__cd) $(top_srcdir) \ | |
| 488 | && gtags -i $(GTAGS_ARGS) "$$here" | |
| 489 | cscopelist: cscopelist-am | |
| 490 | ||
| 491 | cscopelist-am: $(am__tagged_files) | |
| 492 | list='$(am__tagged_files)'; \ | |
| 493 | case "$(srcdir)" in \ | |
| 494 | [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ | |
| 495 | *) sdir=$(subdir)/$(srcdir) ;; \ | |
| 496 | esac; \ | |
| 497 | for i in $$list; do \ | |
| 498 | if test -f "$$i"; then \ | |
| 499 | echo "$(subdir)/$$i"; \ | |
| 500 | else \ | |
| 501 | echo "$$sdir/$$i"; \ | |
| 502 | fi; \ | |
| 503 | done >> $(top_builddir)/cscope.files | |
| 504 | ||
| 505 | distclean-tags: | |
| 506 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | |
| 507 | ||
| 508 | distdir: $(DISTFILES) | |
| 509 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | |
| 510 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | |
| 511 | list='$(DISTFILES)'; \ | |
| 512 | dist_files=`for file in $$list; do echo $$file; done | \ | |
| 513 | sed -e "s|^$$srcdirstrip/||;t" \ | |
| 514 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | |
| 515 | case $$dist_files in \ | |
| 516 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | |
| 517 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | |
| 518 | sort -u` ;; \ | |
| 519 | esac; \ | |
| 520 | for file in $$dist_files; do \ | |
| 521 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | |
| 522 | if test -d $$d/$$file; then \ | |
| 523 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | |
| 524 | if test -d "$(distdir)/$$file"; then \ | |
| 525 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | |
| 526 | fi; \ | |
| 527 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | |
| 528 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | |
| 529 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | |
| 530 | fi; \ | |
| 531 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | |
| 532 | else \ | |
| 533 | test -f "$(distdir)/$$file" \ | |
| 534 | || cp -p $$d/$$file "$(distdir)/$$file" \ | |
| 535 | || exit 1; \ | |
| 536 | fi; \ | |
| 537 | done | |
| 538 | check-am: all-am | |
| 539 | check: check-am | |
| 540 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) | |
| 541 | installdirs: | |
| 542 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ | |
| 543 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | |
| 544 | done | |
| 545 | install: install-am | |
| 546 | install-exec: install-exec-am | |
| 547 | install-data: install-data-am | |
| 548 | uninstall: uninstall-am | |
| 549 | ||
| 550 | install-am: all-am | |
| 551 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | |
| 552 | ||
| 553 | installcheck: installcheck-am | |
| 554 | install-strip: | |
| 555 | if test -z '$(STRIP)'; then \ | |
| 556 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | |
| 557 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | |
| 558 | install; \ | |
| 559 | else \ | |
| 560 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | |
| 561 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | |
| 562 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ | |
| 563 | fi | |
| 564 | mostlyclean-generic: | |
| 565 | ||
| 566 | clean-generic: | |
| 567 | ||
| 568 | distclean-generic: | |
| 569 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | |
| 570 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | |
| 571 | ||
| 572 | maintainer-clean-generic: | |
| 573 | @echo "This command is intended for maintainers to use" | |
| 574 | @echo "it deletes files that may require special tools to rebuild." | |
| 575 | clean: clean-am | |
| 576 | ||
| 577 | clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ | |
| 578 | mostlyclean-am | |
| 579 | ||
| 580 | distclean: distclean-am | |
| 581 | -rm -rf ./$(DEPDIR) | |
| 582 | -rm -f Makefile | |
| 583 | distclean-am: clean-am distclean-compile distclean-generic \ | |
| 584 | distclean-tags | |
| 585 | ||
| 586 | dvi: dvi-am | |
| 587 | ||
| 588 | dvi-am: | |
| 589 | ||
| 590 | html: html-am | |
| 591 | ||
| 592 | html-am: | |
| 593 | ||
| 594 | info: info-am | |
| 595 | ||
| 596 | info-am: | |
| 597 | ||
| 598 | install-data-am: install-includeHEADERS | |
| 599 | ||
| 600 | install-dvi: install-dvi-am | |
| 601 | ||
| 602 | install-dvi-am: | |
| 603 | ||
| 604 | install-exec-am: install-libLTLIBRARIES | |
| 605 | ||
| 606 | install-html: install-html-am | |
| 607 | ||
| 608 | install-html-am: | |
| 609 | ||
| 610 | install-info: install-info-am | |
| 611 | ||
| 612 | install-info-am: | |
| 613 | ||
| 614 | install-man: | |
| 615 | ||
| 616 | install-pdf: install-pdf-am | |
| 617 | ||
| 618 | install-pdf-am: | |
| 619 | ||
| 620 | install-ps: install-ps-am | |
| 621 | ||
| 622 | install-ps-am: | |
| 623 | ||
| 624 | installcheck-am: | |
| 625 | ||
| 626 | maintainer-clean: maintainer-clean-am | |
| 627 | -rm -rf ./$(DEPDIR) | |
| 628 | -rm -f Makefile | |
| 629 | maintainer-clean-am: distclean-am maintainer-clean-generic | |
| 630 | ||
| 631 | mostlyclean: mostlyclean-am | |
| 632 | ||
| 633 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ | |
| 634 | mostlyclean-libtool | |
| 635 | ||
| 636 | pdf: pdf-am | |
| 637 | ||
| 638 | pdf-am: | |
| 639 | ||
| 640 | ps: ps-am | |
| 641 | ||
| 642 | ps-am: | |
| 643 | ||
| 644 | uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES | |
| 645 | ||
| 646 | .MAKE: install-am install-strip | |
| 647 | ||
| 648 | .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ | |
| 649 | clean-libLTLIBRARIES clean-libtool clean-local cscopelist-am \ | |
| 650 | ctags ctags-am distclean distclean-compile distclean-generic \ | |
| 651 | distclean-libtool distclean-tags distdir dvi dvi-am html \ | |
| 652 | html-am info info-am install install-am install-data \ | |
| 653 | install-data-am install-dvi install-dvi-am install-exec \ | |
| 654 | install-exec-am install-html install-html-am \ | |
| 655 | install-includeHEADERS install-info install-info-am \ | |
| 656 | install-libLTLIBRARIES install-man install-pdf install-pdf-am \ | |
| 657 | install-ps install-ps-am install-strip installcheck \ | |
| 658 | installcheck-am installdirs maintainer-clean \ | |
| 659 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | |
| 660 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | |
| 661 | tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ | |
| 662 | uninstall-libLTLIBRARIES | |
| 663 | ||
| 664 | default: simplehash.c simplehashlib.c libsimplehash.la | |
| 665 | all: simplehash.c simplehashlib.c libsimplehash.la | |
| 666 | ||
| 667 | simplehashlib.c: simplehashlib_kern.inc simplehash_kern.inc | |
| 668 | ||
| 669 | simplehashlib_kern.inc: | |
| 670 | ./embed_source.pl simplehashlib_kern.cl > simplehashlib_kern.inc | |
| 671 | ||
| 672 | simplehash_kern.inc: | |
| 673 | ./embed_source.pl simplehash_kern.cl > simplehash_kern.inc | |
| 674 | ||
| 675 | clean-local: | |
| 676 | rm -f *.inc | |
| 677 | ||
| 678 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | |
| 679 | # Otherwise a system limit (for SysV at least) may be exceeded. | |
| 680 | .NOEXPORT: |
| … | … | @@ -0,0 +1,68 @@ |
| 1 | eval 'exec perl -w $0 ${1+"$@"}' | |
| 2 | if 0; | |
| 3 | ||
| 4 | # Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 5 | # under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 6 | # Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 7 | # for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 8 | # reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 9 | # ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 10 | # ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 11 | # to produce derivative works, such modified software should be clearly marked, | |
| 12 | # so as not to confuse it with the version available from LANL. | |
| 13 | # | |
| 14 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 15 | # use this file except in compliance with the License. You may obtain a copy | |
| 16 | # of the License at | |
| 17 | # | |
| 18 | # http://www.apache.org/licenses/LICENSE-2.0 | |
| 19 | # | |
| 20 | # Unless required by applicable law or agreed to in writing, software distributed | |
| 21 | # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 22 | # CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 23 | # specific language governing permissions and limitations under the License. | |
| 24 | # | |
| 25 | # Under this license, it is required to include a reference to this work. We | |
| 26 | # request that each derivative work contain a reference to LANL Copyright | |
| 27 | # Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 28 | # measured. In addition, it is requested that a modifier is included as in | |
| 29 | # the following example: | |
| 30 | # | |
| 31 | # //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 32 | # | |
| 33 | # This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 34 | ||
| 35 | use File::Basename; | |
| 36 | ||
| 37 | $ARGV_LAST = ""; | |
| 38 | ||
| 39 | ($file,,) = fileparse($ARGV[0], qr/\..*/); | |
| 40 | print "const char *",$file,"_source =\n"; | |
| 41 | ||
| 42 | while(<>) { | |
| 43 | if ($ARGV ne $ARGV_LAST){ | |
| 44 | # $comment = 0; | |
| 45 | $ARGV_LAST=$ARGV; | |
| 46 | } | |
| 47 | chop $_; | |
| 48 | ||
| 49 | s/"/""/g; | |
| 50 | ||
| 51 | # if (/^\/\*/){ | |
| 52 | # #print "Setting comment to 1\n"; | |
| 53 | # $comment = 1; | |
| 54 | # } | |
| 55 | # if (/\*\/$/){ | |
| 56 | # #print "Setting comment to 0\n"; | |
| 57 | # $comment = 0; | |
| 58 | # next; | |
| 59 | # } | |
| 60 | # if ($comment eq 1) { | |
| 61 | # #print "Skip line and goto next\n"; | |
| 62 | ## next; | |
| 63 | # } | |
| 64 | ||
| 65 | print '"',$_,'\n','"',"\n"; | |
| 66 | } | |
| 67 | ||
| 68 | print ";\n" |
| … | … | @@ -0,0 +1,1266 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | #include "simplehash.h" | |
| 34 | //#include "timer/timer.h" | |
| 35 | ||
| 36 | static ulong AA; | |
| 37 | static ulong BB; | |
| 38 | static ulong prime=4294967291; | |
| 39 | static uint hashtablesize; | |
| 40 | static uint hash_stride; | |
| 41 | static uint hash_ncells; | |
| 42 | static uint write_hash_collisions; | |
| 43 | static uint read_hash_collisions; | |
| 44 | static double write_hash_collisions_runsum = 0.0; | |
| 45 | static double read_hash_collisions_runsum = 0.0; | |
| 46 | static uint write_hash_collisions_count = 0; | |
| 47 | static uint read_hash_collisions_count = 0; | |
| 48 | static uint hash_report_level = 0; | |
| 49 | static uint hash_queries; | |
| 50 | static uint hash_method = 1; | |
| 51 | static uint hash_jump_prime = 41; | |
| 52 | static double hash_mult = 3.0; | |
| 53 | static int do_compact_hash = 0; | |
| 54 | ||
| 55 | float mem_opt_factor; | |
| 56 | ||
| 57 | void compact_hash_delete(int *hash){ | |
| 58 | free(hash); | |
| 59 | } | |
| 60 | ||
| 61 | int (*read_hash)(ulong, int *); | |
| 62 | void (*write_hash)(uint, ulong, int *); | |
| 63 | ||
| 64 | #ifdef _OPENMP | |
| 65 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 66 | void (*write_hash_openmp)(uint, ulong, int *); | |
| 67 | #else | |
| 68 | void (*write_hash_openmp)(uint, ulong, int *, omp_lock_t * lock); | |
| 69 | #endif | |
| 70 | #endif | |
| 71 | ||
| 72 | int get_hash_method(void) { | |
| 73 | return(hash_method); | |
| 74 | } | |
| 75 | ||
| 76 | long long get_hashtablesize(void) { | |
| 77 | return(hashtablesize); | |
| 78 | } | |
| 79 | ||
| 80 | int *compact_hash_init(int ncells, uint isize, uint jsize, uint report_level){ | |
| 81 | ||
| 82 | hash_ncells = 0; | |
| 83 | write_hash_collisions = 0; | |
| 84 | read_hash_collisions = 0; | |
| 85 | hash_queries = 0; | |
| 86 | hash_report_level = report_level; | |
| 87 | hash_stride = isize; | |
| 88 | int *hash = NULL; | |
| 89 | ||
| 90 | uint compact_hash_size = (uint)((double)ncells*hash_mult); | |
| 91 | compact_hash_size = ncells; | |
| 92 | uint perfect_hash_size = (uint)(isize*jsize); | |
| 93 | float hash_mem_factor = 20.0; | |
| 94 | float hash_mem_ratio = (double)perfect_hash_size/(double)compact_hash_size; | |
| 95 | if (mem_opt_factor != 1.0) hash_mem_factor /= (mem_opt_factor*0.2); | |
| 96 | do_compact_hash = (hash_mem_ratio < hash_mem_factor) ? 0 : 1; | |
| 97 | do_compact_hash = 1; | |
| 98 | if (hash_report_level >= 2) printf("DEBUG do_compact_hash %d hash_mem_ratio %f hash_mem_factor %f mem_opt_factor %f perfect_hash_size %u compact_hash_size %u\n",do_compact_hash,hash_mem_ratio,hash_mem_factor,mem_opt_factor,perfect_hash_size,compact_hash_size); | |
| 99 | ||
| 100 | if (do_compact_hash) { | |
| 101 | hashtablesize = compact_hash_size; | |
| 102 | AA = (ulong)(1.0+(double)(prime-1)*drand48()); | |
| 103 | BB = (ulong)(0.0+(double)(prime-1)*drand48()); | |
| 104 | if (AA > prime-1 || BB > prime-1) exit(0); | |
| 105 | if (hash_report_level > 1) printf("Factors AA %lu BB %lu\n",AA,BB); | |
| 106 | ||
| 107 | hash = (int *)malloc(2*hashtablesize*sizeof(int)); | |
| 108 | for (uint ii = 0; ii<2*hashtablesize; ii+=2){ | |
| 109 | hash[ii] = -1; | |
| 110 | } | |
| 111 | } else { | |
| 112 | hashtablesize = perfect_hash_size; | |
| 113 | ||
| 114 | hash = (int *)malloc(hashtablesize*sizeof(int)); | |
| 115 | for (uint ii = 0; ii<hashtablesize; ii++){ | |
| 116 | hash[ii] = -1; | |
| 117 | } | |
| 118 | } | |
| 119 | ||
| 120 | if (hash_report_level >= 2) { | |
| 121 | printf("Hash table size %u perfect hash table size %u memory savings %u by percentage %lf\n", | |
| 122 | hashtablesize,isize*jsize,isize*jsize-hashtablesize, | |
| 123 | (double)hashtablesize/(double)(isize*jsize)); | |
| 124 | } | |
| 125 | ||
| 126 | if (! do_compact_hash) { | |
| 127 | read_hash = read_hash_perfect; | |
| 128 | write_hash = write_hash_perfect; | |
| 129 | } else if (hash_method == 0){ | |
| 130 | if (hash_report_level == 0){ | |
| 131 | read_hash = read_hash_linear; | |
| 132 | write_hash = write_hash_linear; | |
| 133 | } else if (hash_report_level == 1){ | |
| 134 | read_hash = read_hash_linear_report_level_1; | |
| 135 | write_hash = write_hash_linear_report_level_1; | |
| 136 | } else if (hash_report_level == 2){ | |
| 137 | read_hash = read_hash_linear_report_level_2; | |
| 138 | write_hash = write_hash_linear_report_level_2; | |
| 139 | } else if (hash_report_level == 3){ | |
| 140 | read_hash = read_hash_linear_report_level_3; | |
| 141 | write_hash = write_hash_linear_report_level_3; | |
| 142 | } | |
| 143 | } else if (hash_method == 1){ | |
| 144 | if (hash_report_level == 0){ | |
| 145 | read_hash = read_hash_quadratic; | |
| 146 | write_hash = write_hash_quadratic; | |
| 147 | } else if (hash_report_level == 1){ | |
| 148 | read_hash = read_hash_quadratic_report_level_1; | |
| 149 | write_hash = write_hash_quadratic_report_level_1; | |
| 150 | } else if (hash_report_level == 2){ | |
| 151 | read_hash = read_hash_quadratic_report_level_2; | |
| 152 | write_hash = write_hash_quadratic_report_level_2; | |
| 153 | } else if (hash_report_level == 3){ | |
| 154 | read_hash = read_hash_quadratic_report_level_3; | |
| 155 | write_hash = write_hash_quadratic_report_level_3; | |
| 156 | } | |
| 157 | } else if (hash_method == 2){ | |
| 158 | if (hash_report_level == 0){ | |
| 159 | read_hash = read_hash_primejump; | |
| 160 | write_hash = write_hash_primejump; | |
| 161 | } else if (hash_report_level == 1){ | |
| 162 | read_hash = read_hash_primejump_report_level_1; | |
| 163 | write_hash = write_hash_primejump_report_level_1; | |
| 164 | } else if (hash_report_level == 2){ | |
| 165 | read_hash = read_hash_primejump_report_level_2; | |
| 166 | write_hash = write_hash_primejump_report_level_2; | |
| 167 | } else if (hash_report_level == 3){ | |
| 168 | read_hash = read_hash_primejump_report_level_3; | |
| 169 | write_hash = write_hash_primejump_report_level_3; | |
| 170 | } | |
| 171 | } | |
| 172 | ||
| 173 | return(hash); | |
| 174 | } | |
| 175 | ||
| 176 | void write_hash_perfect(uint ic, ulong hashkey, int *hash){ | |
| 177 | hash[hashkey] = ic; | |
| 178 | } | |
| 179 | ||
| 180 | void write_hash_linear(uint ic, ulong hashkey, int *hash){ | |
| 181 | uint hashloc; | |
| 182 | ||
| 183 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc++,hashloc = hashloc%hashtablesize); | |
| 184 | ||
| 185 | hash[2*hashloc] = hashkey; | |
| 186 | hash[2*hashloc+1] = ic; | |
| 187 | } | |
| 188 | ||
| 189 | void write_hash_linear_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 190 | int icount = 0; | |
| 191 | uint hashloc; | |
| 192 | ||
| 193 | hash_ncells++; | |
| 194 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 195 | write_hash_collisions++; | |
| 196 | } | |
| 197 | ||
| 198 | hash[2*hashloc] = hashkey; | |
| 199 | hash[2*hashloc+1] = ic; | |
| 200 | } | |
| 201 | ||
| 202 | void write_hash_linear_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 203 | int icount = 0; | |
| 204 | uint hashloc; | |
| 205 | ||
| 206 | hash_ncells++; | |
| 207 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 208 | write_hash_collisions++; | |
| 209 | } | |
| 210 | ||
| 211 | hash[2*hashloc] = hashkey; | |
| 212 | hash[2*hashloc+1] = ic; | |
| 213 | } | |
| 214 | ||
| 215 | void write_hash_linear_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 216 | int icount = 0; | |
| 217 | uint hashloc; | |
| 218 | ||
| 219 | hash_ncells++; | |
| 220 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 221 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 222 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 223 | int hashloctmp = hashloc+1; | |
| 224 | hashloctmp = hashloctmp%hashtablesize; | |
| 225 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 226 | icount++; | |
| 227 | } | |
| 228 | write_hash_collisions += icount; | |
| 229 | ||
| 230 | hash[2*hashloc] = hashkey; | |
| 231 | hash[2*hashloc+1] = ic; | |
| 232 | } | |
| 233 | ||
| 234 | void write_hash_quadratic(uint ic, ulong hashkey, int *hash){ | |
| 235 | int icount = 0; | |
| 236 | uint hashloc; | |
| 237 | ||
| 238 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize) { | |
| 239 | icount++; | |
| 240 | } | |
| 241 | ||
| 242 | hash[2*hashloc] = hashkey; | |
| 243 | hash[2*hashloc+1] = ic; | |
| 244 | } | |
| 245 | ||
| 246 | void write_hash_quadratic_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 247 | int icount = 0; | |
| 248 | uint hashloc; | |
| 249 | ||
| 250 | hash_ncells++; | |
| 251 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 252 | icount++; | |
| 253 | } | |
| 254 | write_hash_collisions += icount; | |
| 255 | ||
| 256 | hash[2*hashloc] = hashkey; | |
| 257 | hash[2*hashloc+1] = ic; | |
| 258 | } | |
| 259 | ||
| 260 | void write_hash_quadratic_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 261 | int icount = 0; | |
| 262 | uint hashloc; | |
| 263 | ||
| 264 | hash_ncells++; | |
| 265 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 266 | icount++; | |
| 267 | } | |
| 268 | write_hash_collisions += icount; | |
| 269 | ||
| 270 | hash[2*hashloc] = hashkey; | |
| 271 | hash[2*hashloc+1] = ic; | |
| 272 | } | |
| 273 | ||
| 274 | void write_hash_quadratic_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 275 | int icount = 0; | |
| 276 | uint hashloc; | |
| 277 | ||
| 278 | hash_ncells++; | |
| 279 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 280 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 281 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 282 | icount++; | |
| 283 | int hashloctmp = hashloc+icount*icount; | |
| 284 | hashloctmp = hashloctmp%hashtablesize; | |
| 285 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 286 | } | |
| 287 | write_hash_collisions += icount; | |
| 288 | ||
| 289 | hash[2*hashloc] = hashkey; | |
| 290 | hash[2*hashloc+1] = ic; | |
| 291 | } | |
| 292 | ||
| 293 | void write_hash_primejump(uint ic, ulong hashkey, int *hash){ | |
| 294 | int icount = 0; | |
| 295 | uint hashloc; | |
| 296 | ||
| 297 | uint jump = 1+hashkey%hash_jump_prime; | |
| 298 | ||
| 299 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize) { | |
| 300 | icount++; | |
| 301 | } | |
| 302 | ||
| 303 | hash[2*hashloc] = hashkey; | |
| 304 | hash[2*hashloc+1] = ic; | |
| 305 | } | |
| 306 | ||
| 307 | void write_hash_primejump_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 308 | int icount = 0; | |
| 309 | uint hashloc; | |
| 310 | ||
| 311 | uint jump = 1+hashkey%hash_jump_prime; | |
| 312 | ||
| 313 | hash_ncells++; | |
| 314 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 315 | icount++; | |
| 316 | } | |
| 317 | write_hash_collisions += icount; | |
| 318 | ||
| 319 | hash[2*hashloc] = hashkey; | |
| 320 | hash[2*hashloc+1] = ic; | |
| 321 | } | |
| 322 | ||
| 323 | void write_hash_primejump_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 324 | int icount = 0; | |
| 325 | uint hashloc; | |
| 326 | ||
| 327 | uint jump = 1+hashkey%hash_jump_prime; | |
| 328 | ||
| 329 | hash_ncells++; | |
| 330 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 331 | icount++; | |
| 332 | } | |
| 333 | write_hash_collisions += icount; | |
| 334 | ||
| 335 | hash[2*hashloc] = hashkey; | |
| 336 | hash[2*hashloc+1] = ic; | |
| 337 | } | |
| 338 | ||
| 339 | void write_hash_primejump_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 340 | int icount = 0; | |
| 341 | uint hashloc; | |
| 342 | ||
| 343 | uint jump = 1+hashkey%hash_jump_prime; | |
| 344 | ||
| 345 | hash_ncells++; | |
| 346 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 347 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 348 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 349 | icount++; | |
| 350 | int hashloctmp = hashloc+1; | |
| 351 | hashloctmp = hashloctmp%hashtablesize; | |
| 352 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 353 | } | |
| 354 | write_hash_collisions += icount; | |
| 355 | ||
| 356 | hash[2*hashloc] = hashkey; | |
| 357 | hash[2*hashloc+1] = ic; | |
| 358 | } | |
| 359 | ||
| 360 | #ifdef _OPENMP | |
| 361 | ||
| 362 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 363 | void write_hash_perfect_openmp(uint ic, ulong hashkey, int *hash){ | |
| 364 | #else | |
| 365 | void write_hash_perfect_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 366 | #endif | |
| 367 | hash[hashkey] = ic; | |
| 368 | } | |
| 369 | ||
| 370 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 371 | void write_hash_linear_openmp(uint ic, ulong hashkey, int *hash){ | |
| 372 | #else | |
| 373 | void write_hash_linear_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 374 | #endif | |
| 375 | int icount; | |
| 376 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize;; | |
| 377 | ||
| 378 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 379 | int MaxTries = 1000; | |
| 380 | ||
| 381 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 382 | //printf("old_key is %d\n",old_key); | |
| 383 | ||
| 384 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 385 | hashloc++; | |
| 386 | hashloc %= hashtablesize; | |
| 387 | ||
| 388 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 389 | } | |
| 390 | ||
| 391 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 392 | #else | |
| 393 | omp_set_lock(&(lock[hashloc])); | |
| 394 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 395 | omp_unset_lock(&(lock[hashloc])); | |
| 396 | hashloc++; | |
| 397 | hashloc = hashloc%hashtablesize; | |
| 398 | omp_set_lock(&(lock[hashloc])); | |
| 399 | } | |
| 400 | ||
| 401 | hash[2*hashloc] = hashkey; | |
| 402 | hash[2*hashloc+1] = ic; | |
| 403 | omp_unset_lock(&(lock[hashloc])); | |
| 404 | #endif | |
| 405 | } | |
| 406 | ||
| 407 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 408 | void write_hash_linear_openmp_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 409 | #else | |
| 410 | void write_hash_linear_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 411 | #endif | |
| 412 | int icount = 0; | |
| 413 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize;; | |
| 414 | ||
| 415 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 416 | int MaxTries = 1000; | |
| 417 | ||
| 418 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 419 | //printf("old_key is %d\n",old_key); | |
| 420 | ||
| 421 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 422 | hashloc++; | |
| 423 | hashloc %= hashtablesize; | |
| 424 | ||
| 425 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 426 | icount++; | |
| 427 | } | |
| 428 | ||
| 429 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 430 | #else | |
| 431 | omp_set_lock(&(lock[hashloc])); | |
| 432 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 433 | omp_unset_lock(&(lock[hashloc])); | |
| 434 | hashloc++; | |
| 435 | hashloc = hashloc%hashtablesize; | |
| 436 | omp_set_lock(&(lock[hashloc])); | |
| 437 | icount++; | |
| 438 | } | |
| 439 | ||
| 440 | hash[2*hashloc] = hashkey; | |
| 441 | hash[2*hashloc+1] = ic; | |
| 442 | omp_unset_lock(&(lock[hashloc])); | |
| 443 | #endif | |
| 444 | ||
| 445 | #pragma omp atomic | |
| 446 | write_hash_collisions += icount;; | |
| 447 | #pragma omp atomic | |
| 448 | hash_ncells++; | |
| 449 | } | |
| 450 | ||
| 451 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 452 | void write_hash_linear_openmp_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 453 | #else | |
| 454 | void write_hash_linear_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 455 | #endif | |
| 456 | int icount = 0; | |
| 457 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize;; | |
| 458 | ||
| 459 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 460 | int MaxTries = 1000; | |
| 461 | ||
| 462 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 463 | //printf("old_key is %d\n",old_key); | |
| 464 | ||
| 465 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 466 | hashloc++; | |
| 467 | hashloc %= hashtablesize; | |
| 468 | ||
| 469 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 470 | icount++; | |
| 471 | } | |
| 472 | ||
| 473 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 474 | #else | |
| 475 | omp_set_lock(&(lock[hashloc])); | |
| 476 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 477 | omp_unset_lock(&(lock[hashloc])); | |
| 478 | hashloc++; | |
| 479 | hashloc = hashloc%hashtablesize; | |
| 480 | omp_set_lock(&(lock[hashloc])); | |
| 481 | icount++; | |
| 482 | } | |
| 483 | ||
| 484 | hash[2*hashloc] = hashkey; | |
| 485 | hash[2*hashloc+1] = ic; | |
| 486 | omp_unset_lock(&(lock[hashloc])); | |
| 487 | #endif | |
| 488 | ||
| 489 | #pragma omp atomic | |
| 490 | write_hash_collisions += icount;; | |
| 491 | #pragma omp atomic | |
| 492 | hash_ncells++; | |
| 493 | } | |
| 494 | ||
| 495 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 496 | void write_hash_linear_openmp_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 497 | #else | |
| 498 | void write_hash_linear_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 499 | #endif | |
| 500 | int icount = 0; | |
| 501 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize;; | |
| 502 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 503 | ||
| 504 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 505 | int MaxTries = 1000; | |
| 506 | ||
| 507 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 508 | //printf("old_key is %d\n",old_key); | |
| 509 | ||
| 510 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 511 | hashloc++; | |
| 512 | hashloc %= hashtablesize; | |
| 513 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 514 | ||
| 515 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 516 | icount++; | |
| 517 | } | |
| 518 | ||
| 519 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 520 | #else | |
| 521 | omp_set_lock(&(lock[hashloc])); | |
| 522 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 523 | omp_unset_lock(&(lock[hashloc])); | |
| 524 | hashloc++; | |
| 525 | hashloc = hashloc%hashtablesize; | |
| 526 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 527 | omp_set_lock(&(lock[hashloc])); | |
| 528 | icount++; | |
| 529 | } | |
| 530 | ||
| 531 | hash[2*hashloc] = hashkey; | |
| 532 | hash[2*hashloc+1] = ic; | |
| 533 | omp_unset_lock(&(lock[hashloc])); | |
| 534 | #endif | |
| 535 | ||
| 536 | #pragma omp atomic | |
| 537 | write_hash_collisions += icount;; | |
| 538 | #pragma omp atomic | |
| 539 | hash_ncells++; | |
| 540 | } | |
| 541 | ||
| 542 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 543 | void write_hash_quadratic_openmp(uint ic, ulong hashkey, int *hash){ | |
| 544 | #else | |
| 545 | void write_hash_quadratic_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 546 | #endif | |
| 547 | int icount = 0; | |
| 548 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 549 | ||
| 550 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 551 | int MaxTries = 1000; | |
| 552 | ||
| 553 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 554 | //printf("old_key is %d\n",old_key); | |
| 555 | ||
| 556 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 557 | hashloc+=(icount*icount); | |
| 558 | hashloc %= hashtablesize; | |
| 559 | ||
| 560 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 561 | } | |
| 562 | ||
| 563 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 564 | #else | |
| 565 | omp_set_lock(&(lock[hashloc])); | |
| 566 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 567 | omp_unset_lock(&(lock[hashloc])); | |
| 568 | icount++; | |
| 569 | hashloc+=(icount*icount); | |
| 570 | hashloc = hashloc%hashtablesize; | |
| 571 | omp_set_lock(&(lock[hashloc])); | |
| 572 | } | |
| 573 | ||
| 574 | hash[2*hashloc] = hashkey; | |
| 575 | hash[2*hashloc+1] = ic; | |
| 576 | omp_unset_lock(&(lock[hashloc])); | |
| 577 | #endif | |
| 578 | } | |
| 579 | ||
| 580 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 581 | void write_hash_quadratic_openmp_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 582 | #else | |
| 583 | void write_hash_quadratic_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 584 | #endif | |
| 585 | int icount = 0; | |
| 586 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 587 | ||
| 588 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 589 | int MaxTries = 1000; | |
| 590 | ||
| 591 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 592 | //printf("old_key is %d\n",old_key); | |
| 593 | ||
| 594 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 595 | hashloc+=(icount*icount); | |
| 596 | hashloc %= hashtablesize; | |
| 597 | ||
| 598 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 599 | } | |
| 600 | ||
| 601 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 602 | #else | |
| 603 | omp_set_lock(&(lock[hashloc])); | |
| 604 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 605 | omp_unset_lock(&(lock[hashloc])); | |
| 606 | icount++; | |
| 607 | hashloc+=(icount*icount); | |
| 608 | hashloc = hashloc%hashtablesize; | |
| 609 | omp_set_lock(&(lock[hashloc])); | |
| 610 | } | |
| 611 | ||
| 612 | hash[2*hashloc] = hashkey; | |
| 613 | hash[2*hashloc+1] = ic; | |
| 614 | omp_unset_lock(&(lock[hashloc])); | |
| 615 | #endif | |
| 616 | ||
| 617 | #pragma omp atomic | |
| 618 | write_hash_collisions += icount;; | |
| 619 | #pragma omp atomic | |
| 620 | hash_ncells++; | |
| 621 | } | |
| 622 | ||
| 623 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 624 | void write_hash_quadratic_openmp_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 625 | #else | |
| 626 | void write_hash_quadratic_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 627 | #endif | |
| 628 | int icount = 0; | |
| 629 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 630 | ||
| 631 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 632 | int MaxTries = 1000; | |
| 633 | ||
| 634 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 635 | //printf("old_key is %d\n",old_key); | |
| 636 | ||
| 637 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 638 | hashloc+=(icount*icount); | |
| 639 | hashloc %= hashtablesize; | |
| 640 | ||
| 641 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 642 | } | |
| 643 | ||
| 644 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 645 | #else | |
| 646 | omp_set_lock(&(lock[hashloc])); | |
| 647 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 648 | omp_unset_lock(&(lock[hashloc])); | |
| 649 | icount++; | |
| 650 | hashloc+=(icount*icount); | |
| 651 | hashloc = hashloc%hashtablesize; | |
| 652 | omp_set_lock(&(lock[hashloc])); | |
| 653 | } | |
| 654 | ||
| 655 | hash[2*hashloc] = hashkey; | |
| 656 | hash[2*hashloc+1] = ic; | |
| 657 | omp_unset_lock(&(lock[hashloc])); | |
| 658 | #endif | |
| 659 | ||
| 660 | #pragma omp atomic | |
| 661 | write_hash_collisions += icount;; | |
| 662 | #pragma omp atomic | |
| 663 | hash_ncells++; | |
| 664 | } | |
| 665 | ||
| 666 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 667 | void write_hash_quadratic_openmp_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 668 | #else | |
| 669 | void write_hash_quadratic_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 670 | #endif | |
| 671 | int icount = 0; | |
| 672 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 673 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 674 | ||
| 675 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 676 | int MaxTries = 1000; | |
| 677 | ||
| 678 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 679 | //printf("old_key is %d\n",old_key); | |
| 680 | ||
| 681 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 682 | hashloc+=(icount*icount); | |
| 683 | hashloc %= hashtablesize; | |
| 684 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 685 | ||
| 686 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 687 | } | |
| 688 | ||
| 689 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 690 | #else | |
| 691 | omp_set_lock(&(lock[hashloc])); | |
| 692 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 693 | omp_unset_lock(&(lock[hashloc])); | |
| 694 | icount++; | |
| 695 | hashloc+=(icount*icount); | |
| 696 | hashloc = hashloc%hashtablesize; | |
| 697 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 698 | omp_set_lock(&(lock[hashloc])); | |
| 699 | } | |
| 700 | ||
| 701 | hash[2*hashloc] = hashkey; | |
| 702 | hash[2*hashloc+1] = ic; | |
| 703 | omp_unset_lock(&(lock[hashloc])); | |
| 704 | #endif | |
| 705 | ||
| 706 | #pragma omp atomic | |
| 707 | write_hash_collisions += icount;; | |
| 708 | #pragma omp atomic | |
| 709 | hash_ncells++; | |
| 710 | } | |
| 711 | ||
| 712 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 713 | void write_hash_primejump_openmp(uint ic, ulong hashkey, int *hash){ | |
| 714 | #else | |
| 715 | void write_hash_primejump_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 716 | #endif | |
| 717 | int icount = 0; | |
| 718 | uint jump = 1+hashkey%hash_jump_prime; | |
| 719 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 720 | ||
| 721 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 722 | int MaxTries = 1000; | |
| 723 | ||
| 724 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 725 | //printf("old_key is %d\n",old_key); | |
| 726 | ||
| 727 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 728 | hashloc+=(icount*jump); | |
| 729 | hashloc %= hashtablesize; | |
| 730 | ||
| 731 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 732 | } | |
| 733 | ||
| 734 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 735 | #else | |
| 736 | omp_set_lock(&(lock[hashloc])); | |
| 737 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 738 | omp_unset_lock(&(lock[hashloc])); | |
| 739 | icount++; | |
| 740 | hashloc+=(icount*jump); | |
| 741 | hashloc = hashloc%hashtablesize; | |
| 742 | omp_set_lock(&(lock[hashloc])); | |
| 743 | } | |
| 744 | ||
| 745 | hash[2*hashloc] = hashkey; | |
| 746 | hash[2*hashloc+1] = ic; | |
| 747 | omp_unset_lock(&(lock[hashloc])); | |
| 748 | #endif | |
| 749 | } | |
| 750 | ||
| 751 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 752 | void write_hash_primejump_openmp_report_level_1(uint ic, ulong hashkey, int *hash){ | |
| 753 | #else | |
| 754 | void write_hash_primejump_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 755 | #endif | |
| 756 | int icount = 0; | |
| 757 | uint jump = 1+hashkey%hash_jump_prime; | |
| 758 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 759 | ||
| 760 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 761 | int MaxTries = 1000; | |
| 762 | ||
| 763 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 764 | //printf("old_key is %d\n",old_key); | |
| 765 | ||
| 766 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 767 | hashloc+=(icount*jump); | |
| 768 | hashloc %= hashtablesize; | |
| 769 | ||
| 770 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 771 | } | |
| 772 | ||
| 773 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 774 | #else | |
| 775 | omp_set_lock(&(lock[hashloc])); | |
| 776 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 777 | omp_unset_lock(&(lock[hashloc])); | |
| 778 | icount++; | |
| 779 | hashloc+=(icount*jump); | |
| 780 | hashloc = hashloc%hashtablesize; | |
| 781 | omp_set_lock(&(lock[hashloc])); | |
| 782 | } | |
| 783 | ||
| 784 | hash[2*hashloc] = hashkey; | |
| 785 | hash[2*hashloc+1] = ic; | |
| 786 | omp_unset_lock(&(lock[hashloc])); | |
| 787 | #endif | |
| 788 | ||
| 789 | #pragma omp atomic | |
| 790 | write_hash_collisions += icount;; | |
| 791 | #pragma omp atomic | |
| 792 | hash_ncells++; | |
| 793 | } | |
| 794 | ||
| 795 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 796 | void write_hash_primejump_openmp_report_level_2(uint ic, ulong hashkey, int *hash){ | |
| 797 | #else | |
| 798 | void write_hash_primejump_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 799 | #endif | |
| 800 | int icount = 0; | |
| 801 | uint jump = 1+hashkey%hash_jump_prime; | |
| 802 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 803 | ||
| 804 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 805 | int MaxTries = 1000; | |
| 806 | ||
| 807 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 808 | //printf("old_key is %d\n",old_key); | |
| 809 | ||
| 810 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 811 | hashloc+=(icount*jump); | |
| 812 | hashloc %= hashtablesize; | |
| 813 | ||
| 814 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 815 | } | |
| 816 | ||
| 817 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 818 | #else | |
| 819 | omp_set_lock(&(lock[hashloc])); | |
| 820 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 821 | omp_unset_lock(&(lock[hashloc])); | |
| 822 | icount++; | |
| 823 | hashloc+=(icount*jump); | |
| 824 | hashloc = hashloc%hashtablesize; | |
| 825 | omp_set_lock(&(lock[hashloc])); | |
| 826 | } | |
| 827 | ||
| 828 | hash[2*hashloc] = hashkey; | |
| 829 | hash[2*hashloc+1] = ic; | |
| 830 | omp_unset_lock(&(lock[hashloc])); | |
| 831 | #endif | |
| 832 | ||
| 833 | #pragma omp atomic | |
| 834 | write_hash_collisions += icount;; | |
| 835 | #pragma omp atomic | |
| 836 | hash_ncells++; | |
| 837 | } | |
| 838 | ||
| 839 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 840 | void write_hash_primejump_openmp_report_level_3(uint ic, ulong hashkey, int *hash){ | |
| 841 | #else | |
| 842 | void write_hash_primejump_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock){ | |
| 843 | #endif | |
| 844 | int icount = 0; | |
| 845 | uint jump = 1+hashkey%hash_jump_prime; | |
| 846 | uint hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 847 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 848 | ||
| 849 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 850 | int MaxTries = 1000; | |
| 851 | ||
| 852 | int old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 853 | //printf("old_key is %d\n",old_key); | |
| 854 | ||
| 855 | for (icount = 1; old_key != hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 856 | hashloc+=(icount*jump); | |
| 857 | hashloc %= hashtablesize; | |
| 858 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 859 | ||
| 860 | old_key = __sync_val_compare_and_swap(&hash[2*hashloc], -1, hashkey); | |
| 861 | } | |
| 862 | ||
| 863 | if (icount < MaxTries) hash[2*hashloc+1] = ic; | |
| 864 | #else | |
| 865 | omp_set_lock(&(lock[hashloc])); | |
| 866 | while (hash[2*hashloc] != -1 && hash[2*hashloc]!= (int)hashkey){ | |
| 867 | omp_unset_lock(&(lock[hashloc])); | |
| 868 | icount++; | |
| 869 | hashloc+=(icount*jump); | |
| 870 | hashloc = hashloc%hashtablesize; | |
| 871 | printf("%d: cell %d hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,ic,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 872 | omp_set_lock(&(lock[hashloc])); | |
| 873 | } | |
| 874 | ||
| 875 | hash[2*hashloc] = hashkey; | |
| 876 | hash[2*hashloc+1] = ic; | |
| 877 | omp_unset_lock(&(lock[hashloc])); | |
| 878 | #endif | |
| 879 | ||
| 880 | #pragma omp atomic | |
| 881 | write_hash_collisions += icount;; | |
| 882 | #pragma omp atomic | |
| 883 | hash_ncells++; | |
| 884 | } | |
| 885 | #endif | |
| 886 | ||
| 887 | int read_hash_perfect(ulong hashkey, int *hash){ | |
| 888 | return(hash[hashkey]); | |
| 889 | } | |
| 890 | ||
| 891 | int read_hash_linear(ulong hashkey, int *hash){ | |
| 892 | int hashval = -1; | |
| 893 | uint hashloc; | |
| 894 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize); | |
| 895 | ||
| 896 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 897 | return(hashval); | |
| 898 | } | |
| 899 | ||
| 900 | int read_hash_linear_report_level_1(ulong hashkey, int *hash){ | |
| 901 | int hashval = -1; | |
| 902 | uint hashloc; | |
| 903 | int icount=0; | |
| 904 | ||
| 905 | hash_queries++; | |
| 906 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 907 | icount++; | |
| 908 | } | |
| 909 | read_hash_collisions += icount; | |
| 910 | ||
| 911 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 912 | return(hashval); | |
| 913 | } | |
| 914 | ||
| 915 | int read_hash_linear_report_level_2(ulong hashkey, int *hash){ | |
| 916 | int max_collisions_allowed = 1000; | |
| 917 | int hashval = -1; | |
| 918 | uint hashloc; | |
| 919 | int icount=0; | |
| 920 | ||
| 921 | hash_queries++; | |
| 922 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 923 | icount++; | |
| 924 | if (icount > max_collisions_allowed) { | |
| 925 | printf("Error -- too many read hash collisions\n"); | |
| 926 | exit(0); | |
| 927 | } | |
| 928 | } | |
| 929 | read_hash_collisions += icount; | |
| 930 | ||
| 931 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 932 | return(hashval); | |
| 933 | } | |
| 934 | ||
| 935 | int read_hash_linear_report_level_3(ulong hashkey, int *hash){ | |
| 936 | int max_collisions_allowed = 1000; | |
| 937 | int hashval = -1; | |
| 938 | uint hashloc; | |
| 939 | int icount=0; | |
| 940 | ||
| 941 | hash_queries++; | |
| 942 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 943 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 944 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 945 | icount++; | |
| 946 | uint hashloctmp = hashloc+1; | |
| 947 | hashloctmp = hashloctmp%hashtablesize; | |
| 948 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 949 | if (icount > max_collisions_allowed) { | |
| 950 | printf("Error -- too many read hash collisions\n"); | |
| 951 | exit(0); | |
| 952 | } | |
| 953 | } | |
| 954 | read_hash_collisions += icount; | |
| 955 | ||
| 956 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 957 | return(hashval); | |
| 958 | } | |
| 959 | ||
| 960 | int read_hash_quadratic(ulong hashkey, int *hash){ | |
| 961 | int hashval = -1; | |
| 962 | uint hashloc; | |
| 963 | int icount=0; | |
| 964 | ||
| 965 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 966 | icount++; | |
| 967 | } | |
| 968 | ||
| 969 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 970 | return(hashval); | |
| 971 | } | |
| 972 | ||
| 973 | int read_hash_quadratic_report_level_1(ulong hashkey, int *hash){ | |
| 974 | int hashval = -1; | |
| 975 | uint hashloc; | |
| 976 | int icount=0; | |
| 977 | ||
| 978 | hash_queries++; | |
| 979 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 980 | icount++; | |
| 981 | } | |
| 982 | read_hash_collisions += icount; | |
| 983 | ||
| 984 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 985 | return(hashval); | |
| 986 | } | |
| 987 | ||
| 988 | int read_hash_quadratic_report_level_2(ulong hashkey, int *hash){ | |
| 989 | int max_collisions_allowed = 1000; | |
| 990 | int hashval = -1; | |
| 991 | uint hashloc; | |
| 992 | int icount=0; | |
| 993 | ||
| 994 | hash_queries++; | |
| 995 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 996 | icount++; | |
| 997 | if (icount > max_collisions_allowed) { | |
| 998 | printf("Error -- too many read hash collisions\n"); | |
| 999 | exit(0); | |
| 1000 | } | |
| 1001 | } | |
| 1002 | read_hash_collisions += icount; | |
| 1003 | ||
| 1004 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1005 | return(hashval); | |
| 1006 | } | |
| 1007 | ||
| 1008 | int read_hash_quadratic_report_level_3(ulong hashkey, int *hash){ | |
| 1009 | int max_collisions_allowed = 1000; | |
| 1010 | int hashval = -1; | |
| 1011 | uint hashloc; | |
| 1012 | int icount=0; | |
| 1013 | ||
| 1014 | hash_queries++; | |
| 1015 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1016 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1017 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1018 | icount++; | |
| 1019 | uint hashloctmp = hashloc+1; | |
| 1020 | hashloctmp = hashloctmp%hashtablesize; | |
| 1021 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1022 | if (icount > max_collisions_allowed) { | |
| 1023 | printf("Error -- too many read hash collisions\n"); | |
| 1024 | exit(0); | |
| 1025 | } | |
| 1026 | } | |
| 1027 | read_hash_collisions += icount; | |
| 1028 | ||
| 1029 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1030 | return(hashval); | |
| 1031 | } | |
| 1032 | ||
| 1033 | int read_hash_primejump(ulong hashkey, int *hash){ | |
| 1034 | int hashval = -1; | |
| 1035 | uint hashloc; | |
| 1036 | int icount=0; | |
| 1037 | ||
| 1038 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1039 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1040 | icount++; | |
| 1041 | } | |
| 1042 | ||
| 1043 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1044 | return(hashval); | |
| 1045 | } | |
| 1046 | ||
| 1047 | int read_hash_primejump_report_level_1(ulong hashkey, int *hash){ | |
| 1048 | int hashval = -1; | |
| 1049 | uint hashloc; | |
| 1050 | int icount=0; | |
| 1051 | ||
| 1052 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1053 | hash_queries++; | |
| 1054 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1055 | icount++; | |
| 1056 | } | |
| 1057 | read_hash_collisions += icount; | |
| 1058 | ||
| 1059 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1060 | return(hashval); | |
| 1061 | } | |
| 1062 | ||
| 1063 | int read_hash_primejump_report_level_2(ulong hashkey, int *hash){ | |
| 1064 | int max_collisions_allowed = 1000; | |
| 1065 | int hashval = -1; | |
| 1066 | uint hashloc; | |
| 1067 | int icount=0; | |
| 1068 | ||
| 1069 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1070 | ||
| 1071 | hash_queries++; | |
| 1072 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1073 | icount++; | |
| 1074 | if (icount > max_collisions_allowed) { | |
| 1075 | printf("Error -- too many read hash collisions\n"); | |
| 1076 | exit(0); | |
| 1077 | } | |
| 1078 | } | |
| 1079 | read_hash_collisions += icount; | |
| 1080 | ||
| 1081 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1082 | return(hashval); | |
| 1083 | } | |
| 1084 | ||
| 1085 | int read_hash_primejump_report_level_3(ulong hashkey, int *hash){ | |
| 1086 | int max_collisions_allowed = 1000; | |
| 1087 | int hashval = -1; | |
| 1088 | uint hashloc; | |
| 1089 | int icount=0; | |
| 1090 | ||
| 1091 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1092 | ||
| 1093 | hash_queries++; | |
| 1094 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1095 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1096 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1097 | icount++; | |
| 1098 | uint hashloctmp = hashloc+1; | |
| 1099 | hashloctmp = hashloctmp%hashtablesize; | |
| 1100 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1101 | if (icount > max_collisions_allowed) { | |
| 1102 | printf("Error -- too many read hash collisions\n"); | |
| 1103 | exit(0); | |
| 1104 | } | |
| 1105 | } | |
| 1106 | read_hash_collisions += icount; | |
| 1107 | ||
| 1108 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1109 | return(hashval); | |
| 1110 | } | |
| 1111 | ||
| 1112 | int read_dev_hash(int hash_method, ulong hashtablesize, ulong AA, ulong BB, ulong hashkey, int *hash){ | |
| 1113 | //int hash_report_level = 3; | |
| 1114 | int max_collisions_allowed = 1000; | |
| 1115 | int hashval = -1; | |
| 1116 | uint hashloc; | |
| 1117 | int icount=0; | |
| 1118 | if (hash_method == -1) { | |
| 1119 | return(hash[hashkey]); | |
| 1120 | } | |
| 1121 | if (hash_method == 0) { | |
| 1122 | if (hash_report_level == 0) { | |
| 1123 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 1124 | icount++; | |
| 1125 | } | |
| 1126 | } else if (hash_report_level == 1) { | |
| 1127 | hash_queries++; | |
| 1128 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 1129 | icount++; | |
| 1130 | } | |
| 1131 | read_hash_collisions += icount; | |
| 1132 | } else if (hash_report_level == 2) { | |
| 1133 | hash_queries++; | |
| 1134 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 1135 | icount++; | |
| 1136 | if (icount > max_collisions_allowed) { | |
| 1137 | printf("Error -- too many read hash collisions\n"); | |
| 1138 | exit(0); | |
| 1139 | } | |
| 1140 | } | |
| 1141 | read_hash_collisions += icount; | |
| 1142 | } else if (hash_report_level == 3) { | |
| 1143 | hash_queries++; | |
| 1144 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1145 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1146 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc = hashloc%hashtablesize){ | |
| 1147 | icount++; | |
| 1148 | uint hashloctmp = hashloc+1; | |
| 1149 | hashloctmp = hashloctmp%hashtablesize; | |
| 1150 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1151 | if (icount > max_collisions_allowed) { | |
| 1152 | printf("Error -- too many read hash collisions\n"); | |
| 1153 | exit(0); | |
| 1154 | } | |
| 1155 | } | |
| 1156 | read_hash_collisions += icount; | |
| 1157 | } | |
| 1158 | } else if (hash_method == 1) { | |
| 1159 | if (hash_report_level == 0) { | |
| 1160 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1161 | icount++; | |
| 1162 | } | |
| 1163 | } else if (hash_report_level == 1) { | |
| 1164 | hash_queries++; | |
| 1165 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1166 | icount++; | |
| 1167 | } | |
| 1168 | read_hash_collisions += icount; | |
| 1169 | } else if (hash_report_level == 2) { | |
| 1170 | hash_queries++; | |
| 1171 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1172 | icount++; | |
| 1173 | if (icount > max_collisions_allowed) { | |
| 1174 | printf("Error -- too many read hash collisions\n"); | |
| 1175 | exit(0); | |
| 1176 | } | |
| 1177 | } | |
| 1178 | read_hash_collisions += icount; | |
| 1179 | } else if (hash_report_level == 3) { | |
| 1180 | hash_queries++; | |
| 1181 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1182 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1183 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc = hashloc%hashtablesize){ | |
| 1184 | icount++; | |
| 1185 | uint hashloctmp = hashloc+1; | |
| 1186 | hashloctmp = hashloctmp%hashtablesize; | |
| 1187 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1188 | if (icount > max_collisions_allowed) { | |
| 1189 | printf("Error -- too many read hash collisions\n"); | |
| 1190 | exit(0); | |
| 1191 | } | |
| 1192 | } | |
| 1193 | read_hash_collisions += icount; | |
| 1194 | } | |
| 1195 | } else if (hash_method == 2) { | |
| 1196 | uint jump = 1+hashkey%hash_jump_prime; | |
| 1197 | if (hash_report_level == 0) { | |
| 1198 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1199 | icount++; | |
| 1200 | } | |
| 1201 | } else if (hash_report_level == 1) { | |
| 1202 | hash_queries++; | |
| 1203 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1204 | icount++; | |
| 1205 | } | |
| 1206 | read_hash_collisions += icount; | |
| 1207 | } else if (hash_report_level == 2) { | |
| 1208 | hash_queries++; | |
| 1209 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1210 | icount++; | |
| 1211 | if (icount > max_collisions_allowed) { | |
| 1212 | printf("Error -- too many read hash collisions\n"); | |
| 1213 | exit(0); | |
| 1214 | } | |
| 1215 | } | |
| 1216 | read_hash_collisions += icount; | |
| 1217 | } else if (hash_report_level == 3) { | |
| 1218 | hash_queries++; | |
| 1219 | hashloc = (hashkey*AA+BB)%prime%hashtablesize; | |
| 1220 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloc,hash[2*hashloc],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1221 | for (hashloc = (hashkey*AA+BB)%prime%hashtablesize; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc = hashloc%hashtablesize){ | |
| 1222 | icount++; | |
| 1223 | uint hashloctmp = hashloc+1; | |
| 1224 | hashloctmp = hashloctmp%hashtablesize; | |
| 1225 | printf("%d: hashloc is %d hash[2*hashloc] = %d hashkey %lu ii %lu jj %lu\n",icount,hashloctmp,hash[2*hashloctmp],hashkey,hashkey%hash_stride,hashkey/hash_stride); | |
| 1226 | if (icount > max_collisions_allowed) { | |
| 1227 | printf("Error -- too many read hash collisions\n"); | |
| 1228 | exit(0); | |
| 1229 | } | |
| 1230 | } | |
| 1231 | read_hash_collisions += icount; | |
| 1232 | } | |
| 1233 | } | |
| 1234 | ||
| 1235 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 1236 | return(hashval); | |
| 1237 | } | |
| 1238 | ||
| 1239 | void write_hash_collision_report(void){ | |
| 1240 | if (! do_compact_hash) return; | |
| 1241 | if (hash_report_level == 1) { | |
| 1242 | write_hash_collisions_runsum += (double)write_hash_collisions/(double)hash_ncells; | |
| 1243 | write_hash_collisions_count++; | |
| 1244 | } else if (hash_report_level >= 2) { | |
| 1245 | printf("Write hash collision report -- collisions per cell %lf, collisions %d cells %d\n",(double)write_hash_collisions/(double)hash_ncells,write_hash_collisions,hash_ncells); | |
| 1246 | } | |
| 1247 | } | |
| 1248 | ||
| 1249 | void read_hash_collision_report(void){ | |
| 1250 | if (! do_compact_hash) return; | |
| 1251 | if (hash_report_level == 1) { | |
| 1252 | read_hash_collisions_runsum += (double)read_hash_collisions/(double)hash_queries; | |
| 1253 | read_hash_collisions_count++; | |
| 1254 | } else if (hash_report_level >= 2) { | |
| 1255 | printf("Read hash collision report -- collisions per cell %lf, collisions %d cells %d\n",(double)read_hash_collisions/(double)hash_queries,read_hash_collisions,hash_queries); | |
| 1256 | hash_queries = 0; | |
| 1257 | read_hash_collisions = 0; | |
| 1258 | } | |
| 1259 | } | |
| 1260 | ||
| 1261 | void final_hash_collision_report(void){ | |
| 1262 | if (hash_report_level >= 1 && read_hash_collisions_count > 0) { | |
| 1263 | printf("Final hash collision report -- write/read collisions per cell %lf/%lf\n",write_hash_collisions_runsum/(double)write_hash_collisions_count,read_hash_collisions_runsum/(double)read_hash_collisions_count); | |
| 1264 | } | |
| 1265 | } | |
| 1266 |
| … | … | @@ -0,0 +1,140 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | #ifndef _HASH_H | |
| 34 | #define _HASH_H | |
| 35 | ||
| 36 | #include <stdio.h> | |
| 37 | #include <stdlib.h> | |
| 38 | ||
| 39 | #ifdef __cplusplus | |
| 40 | extern "C" | |
| 41 | { | |
| 42 | #endif | |
| 43 | ||
| 44 | typedef unsigned int uint; | |
| 45 | typedef unsigned long ulong; | |
| 46 | ||
| 47 | int *compact_hash_init(int ncells, uint isize, uint jsize, uint report_level); | |
| 48 | ||
| 49 | #ifdef _OPENMP | |
| 50 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 51 | int *compact_hash_init_openmp(int ncells, uint isize, uint jsize, uint report_level); | |
| 52 | #else | |
| 53 | int *compact_hash_init_openmp(int ncells, uint isize, uint jsize, uint report_level, omp_lock_t **lock); | |
| 54 | #endif | |
| 55 | #endif | |
| 56 | ||
| 57 | int get_hash_method(void); | |
| 58 | long long get_hash_table_size(void); | |
| 59 | ||
| 60 | void write_hash_perfect(uint ic, ulong hashkey, int *hash); | |
| 61 | void write_hash_linear(uint ic, ulong hashkey, int *hash); | |
| 62 | void write_hash_linear_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 63 | void write_hash_linear_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 64 | void write_hash_linear_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 65 | void write_hash_quadratic(uint ic, ulong hashkey, int *hash); | |
| 66 | void write_hash_quadratic_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 67 | void write_hash_quadratic_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 68 | void write_hash_quadratic_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 69 | void write_hash_primejump(uint ic, ulong hashkey, int *hash); | |
| 70 | void write_hash_primejump_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 71 | void write_hash_primejump_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 72 | void write_hash_primejump_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 73 | extern void (*write_hash)(uint ic, ulong hashkey, int *hash); // declared in hash.c | |
| 74 | ||
| 75 | #ifdef _OPENMP | |
| 76 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 77 | void write_hash_perfect_openmp(uint ic, ulong hashkey, int *hash); | |
| 78 | void write_hash_linear_openmp(uint ic, ulong hashkey, int *hash); | |
| 79 | void write_hash_linear_openmp_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 80 | void write_hash_linear_openmp_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 81 | void write_hash_linear_openmp_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 82 | void write_hash_quadratic_openmp(uint ic, ulong hashkey, int *hash); | |
| 83 | void write_hash_quadratic_openmp_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 84 | void write_hash_quadratic_openmp_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 85 | void write_hash_quadratic_openmp_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 86 | void write_hash_primejump_openmp(uint ic, ulong hashkey, int *hash); | |
| 87 | void write_hash_primejump_openmp_report_level_1(uint ic, ulong hashkey, int *hash); | |
| 88 | void write_hash_primejump_openmp_report_level_2(uint ic, ulong hashkey, int *hash); | |
| 89 | void write_hash_primejump_openmp_report_level_3(uint ic, ulong hashkey, int *hash); | |
| 90 | extern void (*write_hash_openmp)(uint ic, ulong hashkey, int *hash); // declared in hash.c | |
| 91 | #else | |
| 92 | void write_hash_perfect_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 93 | void write_hash_linear_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 94 | void write_hash_linear_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 95 | void write_hash_linear_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 96 | void write_hash_linear_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 97 | void write_hash_quadratic_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 98 | void write_hash_quadratic_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 99 | void write_hash_quadratic_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 100 | void write_hash_quadratic_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 101 | void write_hash_primejump_openmp(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 102 | void write_hash_primejump_openmp_report_level_1(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 103 | void write_hash_primejump_openmp_report_level_2(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 104 | void write_hash_primejump_openmp_report_level_3(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); | |
| 105 | extern void (*write_hash_openmp)(uint ic, ulong hashkey, int *hash, omp_lock_t *lock); // declared in hash.c | |
| 106 | #endif | |
| 107 | #endif | |
| 108 | ||
| 109 | int read_hash_perfect(ulong hashkey, int *hash); | |
| 110 | int read_hash_linear(ulong hashkey, int *hash); | |
| 111 | int read_hash_linear_report_level_1(ulong hashkey, int *hash); | |
| 112 | int read_hash_linear_report_level_2(ulong hashkey, int *hash); | |
| 113 | int read_hash_linear_report_level_3(ulong hashkey, int *hash); | |
| 114 | int read_hash_quadratic(ulong hashkey, int *hash); | |
| 115 | int read_hash_quadratic_report_level_1(ulong hashkey, int *hash); | |
| 116 | int read_hash_quadratic_report_level_2(ulong hashkey, int *hash); | |
| 117 | int read_hash_quadratic_report_level_3(ulong hashkey, int *hash); | |
| 118 | int read_hash_primejump(ulong hashkey, int *hash); | |
| 119 | int read_hash_primejump_report_level_1(ulong hashkey, int *hash); | |
| 120 | int read_hash_primejump_report_level_2(ulong hashkey, int *hash); | |
| 121 | int read_hash_primejump_report_level_3(ulong hashkey, int *hash); | |
| 122 | extern int (*read_hash)(ulong hashkey, int *hash); // declared in hash.c | |
| 123 | ||
| 124 | void compact_hash_delete(int *hash); | |
| 125 | #ifdef _OPENMP | |
| 126 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
| 127 | void compact_hash_delete_openmp(int *hash); | |
| 128 | #else | |
| 129 | void compact_hash_delete_openmp(int *hash, omp_lock_t *lock); | |
| 130 | #endif | |
| 131 | #endif | |
| 132 | ||
| 133 | void read_hash_collision_report(void); | |
| 134 | void final_hash_collision_report(void); | |
| 135 | ||
| 136 | #ifdef __cplusplus | |
| 137 | } | |
| 138 | #endif | |
| 139 | ||
| 140 | #endif // _HASH_H |
| … | … | @@ -0,0 +1,181 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | /* | |
| 34 | * Authors: Bob Robey XCP-2 brobey@lanl.gov | |
| 35 | * Peter Ahrens peter.ahrens@lanl.gov, ptrahrens@gmail.com | |
| 36 | * Sara Hartse sara@lanl.gov, sara.hartse@gmail.com | |
| 37 | * Rebecka Tumblin rtumblin@lanl.gov, rebeckatumblin@gmail.com | |
| 38 | */ | |
| 39 | ||
| 40 | /* neigh2d_kern.cl */ | |
| 41 | ||
| 42 | void write_hash( | |
| 43 | const int hash_method, | |
| 44 | const ulong hash_table_size, | |
| 45 | const ulong AA, | |
| 46 | const ulong BB, | |
| 47 | const uint giX, | |
| 48 | const ulong hashkey, | |
| 49 | __global int *hash); | |
| 50 | int read_hash( | |
| 51 | const int hash_method, | |
| 52 | const ulong hash_table_size, | |
| 53 | const ulong AA, | |
| 54 | const ulong BB, | |
| 55 | const ulong hashkey, | |
| 56 | __global const int *hash); | |
| 57 | ||
| 58 | #ifndef __HAVE_CL_DOUBLE_DEFINED__ | |
| 59 | #define __HAVE_CL_DOUBLE_DEFINED__ | |
| 60 | ||
| 61 | #ifdef HAVE_CL_DOUBLE | |
| 62 | #pragma OPENCL EXTENSION cl_khr_fp64 : enable | |
| 63 | typedef double real; | |
| 64 | #else | |
| 65 | typedef float real; | |
| 66 | #endif | |
| 67 | ||
| 68 | #endif | |
| 69 | ||
| 70 | __constant ulong prime = 4294967291; | |
| 71 | __constant uint hash_jump_prime = 41; | |
| 72 | ||
| 73 | void write_hash( | |
| 74 | const int hash_method, | |
| 75 | const ulong hash_table_size, | |
| 76 | const ulong AA, | |
| 77 | const ulong BB, | |
| 78 | const uint giX, | |
| 79 | const ulong hashkey, | |
| 80 | __global int *hash) | |
| 81 | { | |
| 82 | uint hashloc; | |
| 83 | int icount = 0; | |
| 84 | uint jump; | |
| 85 | int old_key; | |
| 86 | int MaxTries = 1000; | |
| 87 | #ifndef __APPLE_CC__ | |
| 88 | switch (hash_method) { | |
| 89 | case -1: | |
| 90 | #endif | |
| 91 | hash[hashkey] = giX; | |
| 92 | #ifndef __APPLE_CC__ | |
| 93 | break; | |
| 94 | case 0: | |
| 95 | hashloc = (hashkey*AA+BB)%prime%hash_table_size; | |
| 96 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 97 | ||
| 98 | for (int icount = 1; old_key != (int)hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 99 | hashloc++; | |
| 100 | hashloc %= hash_table_size; | |
| 101 | ||
| 102 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 103 | } | |
| 104 | ||
| 105 | if (icount < MaxTries) hash[2*hashloc+1] = giX; | |
| 106 | break; | |
| 107 | case 1: | |
| 108 | hashloc = (hashkey*AA+BB)%prime%hash_table_size; | |
| 109 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 110 | ||
| 111 | for (int icount = 1; old_key != (int)hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 112 | hashloc+=(icount*icount); | |
| 113 | hashloc %= hash_table_size; | |
| 114 | ||
| 115 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 116 | } | |
| 117 | ||
| 118 | if (icount < MaxTries) hash[2*hashloc+1] = giX; | |
| 119 | break; | |
| 120 | case 2: | |
| 121 | jump = 1+hashkey%hash_jump_prime; | |
| 122 | hashloc = (hashkey*AA+BB)%prime%hash_table_size; | |
| 123 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 124 | ||
| 125 | for (int icount = 1; old_key != (int)hashkey && old_key != -1 && icount < MaxTries; icount++){ | |
| 126 | hashloc += (icount*jump); | |
| 127 | hashloc %= hash_table_size; | |
| 128 | ||
| 129 | old_key = atomic_cmpxchg(&hash[2*hashloc],-1,hashkey); | |
| 130 | } | |
| 131 | ||
| 132 | if (icount < MaxTries) hash[2*hashloc+1] = giX; | |
| 133 | break; | |
| 134 | } | |
| 135 | #endif | |
| 136 | } | |
| 137 | ||
| 138 | int read_hash( | |
| 139 | const int hash_method, | |
| 140 | const ulong hash_table_size, | |
| 141 | const ulong AA, | |
| 142 | const ulong BB, | |
| 143 | const ulong hashkey, | |
| 144 | __global const int *hash) | |
| 145 | { | |
| 146 | int hashval = -1; | |
| 147 | uint hashloc; | |
| 148 | int icount = 0; | |
| 149 | uint jump; | |
| 150 | ||
| 151 | #ifndef __APPLE_CC__ | |
| 152 | switch (hash_method) { | |
| 153 | case -1: | |
| 154 | #endif | |
| 155 | return(hash[hashkey]); | |
| 156 | #ifndef __APPLE_CC__ | |
| 157 | break; | |
| 158 | case 0: | |
| 159 | for (hashloc = (hashkey*AA+BB)%prime%hash_table_size; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc++,hashloc %= hash_table_size); | |
| 160 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 161 | return(hashval); | |
| 162 | break; | |
| 163 | case 1: | |
| 164 | for (hashloc = (hashkey*AA+BB)%prime%hash_table_size; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*icount),hashloc %= hash_table_size){ | |
| 165 | icount++; | |
| 166 | } | |
| 167 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 168 | return(hashval); | |
| 169 | break; | |
| 170 | case 2: | |
| 171 | jump = 1+hashkey%hash_jump_prime; | |
| 172 | for (hashloc = (hashkey*AA+BB)%prime%hash_table_size; hash[2*hashloc] != (int)hashkey && hash[2*hashloc] != -1; hashloc+=(icount*jump),hashloc %= hash_table_size){ | |
| 173 | icount++; | |
| 174 | } | |
| 175 | if (hash[2*hashloc] != -1) hashval = hash[2*hashloc+1]; | |
| 176 | return(hashval); | |
| 177 | break; | |
| 178 | } | |
| 179 | #endif | |
| 180 | return(hashval); | |
| 181 | } |
| … | … | @@ -0,0 +1,156 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | #include <stdlib.h> | |
| 34 | //#ifdef HAVE_CONFIG_H | |
| 35 | //#include "config.h" | |
| 36 | //#endif | |
| 37 | #include "simplehashlib.h" | |
| 38 | #include "simplehashlib_kern.inc" | |
| 39 | #include "simplehash_kern.inc" | |
| 40 | ||
| 41 | static int reportLevel = 0; | |
| 42 | ||
| 43 | char *get_hash_kernel_source_string(void){ | |
| 44 | return (char*) simplehash_kern_source; | |
| 45 | } | |
| 46 | ||
| 47 | #ifdef HAVE_OPENCL | |
| 48 | cl_kernel init_kernel; | |
| 49 | void hash_lib_init(cl_context context){ | |
| 50 | ||
| 51 | cl_int error; | |
| 52 | ||
| 53 | cl_program program = clCreateProgramWithSource(context, 1, (const char **)&simplehashlib_kern_source, NULL, &error); | |
| 54 | if (error != CL_SUCCESS){ | |
| 55 | printf("clCreateProgramWithSource returned an error %d at line %d in file %s\n", error,__LINE__,__FILE__); | |
| 56 | } | |
| 57 | ||
| 58 | size_t nReportSize; | |
| 59 | char* BuildReport; | |
| 60 | #ifdef HAVE_CL_DOUBLE | |
| 61 | error = clBuildProgram(program, 0, NULL, "-DHAVE_CL_DOUBLE", NULL, NULL); | |
| 62 | #else | |
| 63 | error = clBuildProgram(program, 0, NULL, "-DNO_CL_DOUBLE -cl-single-precision-constant", NULL, NULL); | |
| 64 | #endif | |
| 65 | if (error != CL_SUCCESS){ | |
| 66 | printf("clBuildProgram returned an error %d at line %d in file %s\n", error,__LINE__,__FILE__); | |
| 67 | ||
| 68 | cl_device_id device; | |
| 69 | ||
| 70 | clGetContextInfo(context, CL_CONTEXT_DEVICES, 1, &device, NULL); | |
| 71 | if (context == NULL){ | |
| 72 | printf("EZCL_DEVTYPE_INIT: Failed to find device and setup context in file %s at line %d\n", __FILE__, __LINE__); | |
| 73 | exit(-1); // No device is available, something is wrong | |
| 74 | } | |
| 75 | ||
| 76 | error = clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &nReportSize); | |
| 77 | if (error != CL_SUCCESS) { | |
| 78 | switch (error){ | |
| 79 | case CL_INVALID_DEVICE: | |
| 80 | printf("Invalid device in clProgramBuildInfo\n"); | |
| 81 | break; | |
| 82 | case CL_INVALID_VALUE: | |
| 83 | printf("Invalid value in clProgramBuildInfo\n"); | |
| 84 | break; | |
| 85 | case CL_INVALID_PROGRAM: | |
| 86 | printf("Invalid program in clProgramBuildInfo\n"); | |
| 87 | break; | |
| 88 | } | |
| 89 | } | |
| 90 | ||
| 91 | BuildReport = (char *)malloc(nReportSize); | |
| 92 | ||
| 93 | error = clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, nReportSize, BuildReport, NULL); | |
| 94 | if (error != CL_SUCCESS) { | |
| 95 | switch (error){ | |
| 96 | case CL_INVALID_DEVICE: | |
| 97 | printf("Invalid device in clProgramBuildInfo\n"); | |
| 98 | break; | |
| 99 | case CL_INVALID_VALUE: | |
| 100 | printf("Invalid value in clProgramBuildInfo\n"); | |
| 101 | break; | |
| 102 | case CL_INVALID_PROGRAM: | |
| 103 | printf("Invalid program in clProgramBuildInfo\n"); | |
| 104 | break; | |
| 105 | } | |
| 106 | } | |
| 107 | printf("%s\n", BuildReport); | |
| 108 | } | |
| 109 | ||
| 110 | ||
| 111 | init_kernel = clCreateKernel(program, "init_kern", &error); | |
| 112 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 113 | } | |
| 114 | ||
| 115 | cl_mem hash_init (int hash_size, int TILE_SIZE, cl_context context, cl_command_queue queue, long *gpu_time) | |
| 116 | { | |
| 117 | cl_int error; | |
| 118 | ||
| 119 | long gpu_time_start, gpu_time_end; | |
| 120 | ||
| 121 | cl_mem hash_buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, hash_size*sizeof(int), NULL, &error); | |
| 122 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 123 | ||
| 124 | //init to -1 | |
| 125 | ||
| 126 | error = clSetKernelArg(init_kernel, 0, sizeof(cl_uint), &hash_size); | |
| 127 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 128 | error = clSetKernelArg(init_kernel, 1, sizeof(cl_mem), (void*)&hash_buffer); | |
| 129 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 130 | ||
| 131 | size_t global_work_size; | |
| 132 | size_t local_work_size; | |
| 133 | ||
| 134 | local_work_size = TILE_SIZE; | |
| 135 | global_work_size = ((hash_size+local_work_size-1)/local_work_size)*local_work_size; | |
| 136 | ||
| 137 | cl_event hash_init_event; | |
| 138 | ||
| 139 | error = clEnqueueNDRangeKernel(queue, init_kernel, 1, 0, &global_work_size, &local_work_size, 0, NULL, &hash_init_event); | |
| 140 | if (error != CL_SUCCESS) printf("Error is %d at line %d\n",error,__LINE__); | |
| 141 | ||
| 142 | clWaitForEvents(1,&hash_init_event); | |
| 143 | ||
| 144 | clGetEventProfilingInfo(hash_init_event, CL_PROFILING_COMMAND_START, sizeof(gpu_time_start), &gpu_time_start, NULL); | |
| 145 | clGetEventProfilingInfo(hash_init_event, CL_PROFILING_COMMAND_END, sizeof(gpu_time_end), &gpu_time_end, NULL); | |
| 146 | ||
| 147 | ||
| 148 | *gpu_time = gpu_time_end - gpu_time_start; | |
| 149 | ||
| 150 | clReleaseEvent(hash_init_event); | |
| 151 | ||
| 152 | //if (DETAILED_TIMING) printf("\n\tinit %.6lf,", (double)(gpu_time_end - gpu_time_start)*1.0e-9); | |
| 153 | ||
| 154 | return(hash_buffer); | |
| 155 | } | |
| 156 | #endif |
| … | … | @@ -0,0 +1,50 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | #include <stdio.h> | |
| 34 | //#ifdef HAVE_CONFIG_H | |
| 35 | //#include "config.h" | |
| 36 | //#endif | |
| 37 | ||
| 38 | #ifdef HAVE_OPENCL | |
| 39 | #ifdef __APPLE_CC__ | |
| 40 | #include <OpenCL/OpenCL.h> | |
| 41 | #else | |
| 42 | #include <CL/cl.h> | |
| 43 | #endif | |
| 44 | #endif | |
| 45 | ||
| 46 | char *get_hash_kernel_source_string(); | |
| 47 | #ifdef HAVE_OPENCL | |
| 48 | void hash_lib_init(cl_context context); | |
| 49 | cl_mem hash_init (int hash_size, int TILE_SIZE, cl_context context, cl_command_queue queue, long *gpu_time); | |
| 50 | #endif |
| … | … | @@ -0,0 +1,65 @@ |
| 1 | /* Copyright 2013-14. Los Alamos National Security, LLC. This material was produced | |
| 2 | * under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National | |
| 3 | * Laboratory (LANL), which is operated by Los Alamos National Security, LLC | |
| 4 | * for the U.S. Department of Energy. The U.S. Government has rights to use, | |
| 5 | * reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS | |
| 6 | * ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR | |
| 7 | * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified | |
| 8 | * to produce derivative works, such modified software should be clearly marked, | |
| 9 | * so as not to confuse it with the version available from LANL. | |
| 10 | * | |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| 12 | * use this file except in compliance with the License. You may obtain a copy | |
| 13 | * of the License at | |
| 14 | * | |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 16 | * | |
| 17 | * Unless required by applicable law or agreed to in writing, software distributed | |
| 18 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
| 19 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| 20 | * specific language governing permissions and limitations under the License. | |
| 21 | * | |
| 22 | * Under this license, it is required to include a reference to this work. We | |
| 23 | * request that each derivative work contain a reference to LANL Copyright | |
| 24 | * Disclosure C14043/LA-CC-14-003 so that this work's impact can be roughly | |
| 25 | * measured. In addition, it is requested that a modifier is included as in | |
| 26 | * the following example: | |
| 27 | * | |
| 28 | * //<Uses | improves on | modified from> LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 29 | * | |
| 30 | * This is LANL Copyright Disclosure C14043/LA-CC-14-003 | |
| 31 | */ | |
| 32 | ||
| 33 | /* | |
| 34 | * Authors: Bob Robey XCP-2 brobey@lanl.gov | |
| 35 | * Peter Ahrens peter.ahrens@lanl.gov, ptrahrens@gmail.com | |
| 36 | * Sara Hartse sara@lanl.gov, sara.hartse@gmail.com | |
| 37 | * Rebecka Tumblin rtumblin@lanl.gov, rebeckatumblin@gmail.com | |
| 38 | */ | |
| 39 | ||
| 40 | /* neigh2d_kern.cl */ | |
| 41 | ||
| 42 | #ifndef __HAVE_CL_DOUBLE_DEFINED__ | |
| 43 | #define __HAVE_CL_DOUBLE_DEFINED__ | |
| 44 | ||
| 45 | #ifdef HAVE_CL_DOUBLE | |
| 46 | #pragma OPENCL EXTENSION cl_khr_fp64 : enable | |
| 47 | typedef double real; | |
| 48 | #else | |
| 49 | typedef float real; | |
| 50 | #endif | |
| 51 | ||
| 52 | #endif | |
| 53 | ||
| 54 | ||
| 55 | __kernel void init_kern( | |
| 56 | const uint size, | |
| 57 | __global int *temp) { | |
| 58 | ||
| 59 | const uint idx = get_global_id(0); | |
| 60 | ||
| 61 | if (idx >= size) return; | |
| 62 | ||
| 63 | temp[idx] = -1; | |
| 64 | } | |
| 65 |