Changeset: 94cdd56ed2a1 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=94cdd56ed2a1 Modified Files: monetdb5/extras/crackers/crackers_selectholpl_ops.mx Branch: holindex Log Message:
New holistic indexing operators with vectorized parallel cracking. diffs (203 lines): diff --git a/monetdb5/extras/crackers/crackers_selectholpl_ops.mx b/monetdb5/extras/crackers/crackers_selectholpl_ops.mx --- a/monetdb5/extras/crackers/crackers_selectholpl_ops.mx +++ b/monetdb5/extras/crackers/crackers_selectholpl_ops.mx @@ -66,6 +66,17 @@ crackers_export str CRKthetaselectholpl_ crackers_export str CRKthetauselectholpl_@1(int *vid, int *bid, @1 *val, str *op); crackers_export str CRKsumholplBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh); crackers_export int CRKrandomholpl_@1(int *bid, bit *inclusiveHgh); +/*new multi-threaded versions*/ +crackers_export str CRKselectholplBounds_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh, const int *nthreads, const int *vector_elements); +crackers_export str CRKuselectholplBounds_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh, const int *nthreads, const int *vector_elements); +crackers_export str CRKselectholplValue_@1_MT(int *vid, int *bid, @1 *value, const int *nthreads, const int *vector_elements); +crackers_export str CRKuselectholplValue_@1_MT(int *vid, int *bid, @1 *value, const int *nthreads, const int *vector_elements); +crackers_export str CRKselectholpl_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, const int *nthreads, const int *vector_elements); +crackers_export str CRKuselectholpl_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, const int *nthreads, const int *vector_elements); +crackers_export str CRKthetaselectholpl_@1_MT(int *vid, int *bid, @1 *val, str *op, const int *nthreads, const int *vector_elements); +crackers_export str CRKthetauselectholpl_@1_MT(int *vid, int *bid, @1 *val, str *op, const int *nthreads, const int *vector_elements); +crackers_export str CRKsumholplBounds_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh, const int *nthreads, const int *vector_elements); +crackers_export int CRKrandomholpl_@1_MT(int *bid, bit *inclusiveHgh, int nthreads, int vector_elements); @ @c @@ -90,51 +101,73 @@ crackers_export int CRKrandomholpl_@1(in @= SelectholplFunctions_impl str -CRKselectholplBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh){ +CRKselectholplBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh){ + return CRKselectholplBounds_@1_MT(vid, bid, low, hgh, inclusiveLow, inclusiveHgh, &int_nil, &int_nil); +} +str +CRKselectholplBounds_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh, const int *nthreads, const int *vector_elements){ if (@2_EQ(low,ATOMnilptr(TYPE_@1),@3@1)) - return CRKRangeLeftNilTree_@1(vid, bid, hgh, inclusiveHgh, TRUE); + return CRKRangeLeftNilTree_@1(vid, bid, hgh, inclusiveHgh, TRUE, *nthreads, *vector_elements); else if (@2_EQ(hgh,ATOMnilptr(TYPE_@1),@3@1)) - return CRKRangeRightNilTree_@1(vid, bid, low, inclusiveLow, TRUE); + return CRKRangeRightNilTree_@1(vid, bid, low, inclusiveLow, TRUE, *nthreads, *vector_elements); else - return CRKRangeTree_@1(vid, bid, low, hgh, inclusiveLow, inclusiveHgh, TRUE); + return CRKRangeTree_@1(vid, bid, low, hgh, inclusiveLow, inclusiveHgh, TRUE, *nthreads, *vector_elements); } - str CRKuselectholplBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh){ + return CRKuselectholplBounds_@1_MT(vid, bid, low, hgh, inclusiveLow, inclusiveHgh, &int_nil, &int_nil); +} +str +CRKuselectholplBounds_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh, const int *nthreads, const int *vector_elements){ if (@2_EQ(low,ATOMnilptr(TYPE_@1),@3@1)) - return CRKRangeLeftNilTree_@1(vid, bid, hgh, inclusiveHgh, FALSE); + return CRKRangeLeftNilTree_@1(vid, bid, hgh, inclusiveHgh, FALSE, *nthreads, *vector_elements); else if (@2_EQ(hgh,ATOMnilptr(TYPE_@1),@3@1)) - return CRKRangeRightNilTree_@1(vid, bid, low, inclusiveLow, FALSE); + return CRKRangeRightNilTree_@1(vid, bid, low, inclusiveLow, FALSE, *nthreads, *vector_elements); else - return CRKRangeTree_@1(vid, bid, low, hgh, inclusiveLow, inclusiveHgh, FALSE); + return CRKRangeTree_@1(vid, bid, low, hgh, inclusiveLow, inclusiveHgh, FALSE, *nthreads, *vector_elements); } - str CRKselectholplValue_@1(int *vid, int *bid, @1 *value){ + return CRKselectholplValue_@1_MT(vid, bid, value, &int_nil, &int_nil); +} +str +CRKselectholplValue_@1_MT(int *vid, int *bid, @1 *value, const int *nthreads, const int *vector_elements){ bit inclusive = TRUE; - return CRKuselectholplBounds_@1(vid, bid, value, value, &inclusive, &inclusive); + return CRKuselectholplBounds_@1_MT(vid, bid, value, value, &inclusive, &inclusive, nthreads, vector_elements); } - str CRKuselectholplValue_@1(int *vid, int *bid, @1 *value){ + return CRKuselectholplValue_@1_MT(vid, bid, value, &int_nil, &int_nil); +} +str +CRKuselectholplValue_@1_MT(int *vid, int *bid, @1 *value, const int *nthreads, const int *vector_elements){ bit inclusive = TRUE; - return CRKuselectholplBounds_@1(vid, bid, value, value, &inclusive, &inclusive); + return CRKuselectholplBounds_@1_MT(vid, bid, value, value, &inclusive, &inclusive, nthreads, vector_elements); } - str CRKselectholpl_@1(int *vid, int *bid, @1 *low, @1 *hgh){ + return CRKselectholpl_@1_MT(vid, bid, low, hgh, &int_nil, &int_nil); +} +str +CRKselectholpl_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, const int *nthreads, const int *vector_elements){ bit inclusive = TRUE; - return CRKselectholplBounds_@1(vid, bid, low, hgh, &inclusive, &inclusive); + return CRKselectholplBounds_@1_MT(vid, bid, low, hgh, &inclusive, &inclusive, nthreads, vector_elements); } - str CRKuselectholpl_@1(int *vid, int *bid, @1 *low, @1 *hgh){ + return CRKuselectholpl_@1_MT(vid, bid, low, hgh, &int_nil, &int_nil); +} +str +CRKuselectholpl_@1_MT(int *vid, int *bid, @1 *low, @1 *hgh, const int *nthreads, const int *vector_elements){ bit inclusive = TRUE; - return CRKuselectholplBounds_@1(vid, bid, low, hgh, &inclusive, &inclusive); + return CRKuselectholplBounds_@1_MT(vid, bid, low, hgh, &inclusive, &inclusive, nthreads, vector_elements); } - str CRKthetaselectholpl_@1(int *vid, int *bid, @1 *val, str *OP){ + return CRKthetaselectholpl_@1_MT(vid, bid, val, OP, &int_nil, &int_nil); +} +str +CRKthetaselectholpl_@1_MT(int *vid, int *bid, @1 *val, str *OP, const int *nthreads, const int *vector_elements){ ptr nilptr = ATOMnilptr(TYPE_@1); char *op = *OP; bit lin = TRUE, rin = TRUE; @@ -153,11 +186,14 @@ CRKthetaselectholpl_@1(int *vid, int *bi throw(MAL, "crackers.thetaselectholpl", "unknown operator"); } - return CRKselectholplBounds_@1(vid, bid, low, high, &lin, &rin); + return CRKselectholplBounds_@1_MT(vid, bid, low, high, &lin, &rin, nthreads, vector_elements); } - str CRKthetauselectholpl_@1(int *vid, int *bid, @1 *val, str *OP){ + return CRKthetauselectholpl_@1_MT(vid, bid, val, OP, &int_nil, &int_nil); +} +str +CRKthetauselectholpl_@1_MT(int *vid, int *bid, @1 *val, str *OP, const int *nthreads, const int *vector_elements){ ptr nilptr = ATOMnilptr(TYPE_@1); char *op = *OP; bit lin = TRUE, rin = TRUE; @@ -175,15 +211,19 @@ CRKthetauselectholpl_@1(int *vid, int *b throw(MAL, "crackers.thetauselectholpl", "unknown operator"); } - return CRKuselectholplBounds_@1(vid, bid, low, high, &lin, &rin); + return CRKuselectholplBounds_@1_MT(vid, bid, low, high, &lin, &rin, nthreads, vector_elements); } str CRKsumholplBounds_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh){ return CRKRangeSumTree_@1(vid, bid, low, hgh, inclusiveLow, inclusiveHgh, FALSE); } - int -CRKrandomholpl_@1(int *bid, bit *inclusiveHgh){ +CRKrandomholpl_@1(int *bid, bit *inclusiveHgh) +{ + return CRKrandomholpl_@1_MT(bid, inclusiveHgh, int_nil, int_nil); +} +int +CRKrandomholpl_@1_MT(int *bid, bit *inclusiveHgh, int nthreads, int vector_elements){ BAT *b,*c; int m; @@ -375,9 +415,9 @@ CRKrandomholpl_@1(int *bid, bit *inclusi @= crkTwoLTree /*CRACK in two pieces cl1-ch1 using >incLow bound*/ if (*inclusiveLow == TRUE) - CRKcrackUnorderedZero@2_RE_@1(b,*low, cl1, ch1,&vl, int_nil, int_nil); + CRKcrackUnorderedZero@2_RE_@1(b,*low, cl1, ch1,&vl, nthreads, vector_elements); else - CRKcrackUnorderedZero@2_LE_@1(b,*low, cl1, ch1,&vl, int_nil, int_nil); + CRKcrackUnorderedZero@2_LE_@1(b,*low, cl1, ch1,&vl, nthreads, vector_elements); if (vl < cl1){ /*then the left piece is empty*/ @@ -396,9 +436,9 @@ CRKrandomholpl_@1(int *bid, bit *inclusi @= crkTwoRTree /*CRACK in two pieces cl2-ch2 using <incHgh bound*/ if (*inclusiveHgh == TRUE) - CRKcrackUnorderedZero@2_LE_@1(b,*hgh, cl2, ch2,&vh, int_nil, int_nil); + CRKcrackUnorderedZero@2_LE_@1(b,*hgh, cl2, ch2,&vh, nthreads, vector_elements); else - CRKcrackUnorderedZero@2_RE_@1(b,*hgh, cl2, ch2,&vh, int_nil, int_nil); + CRKcrackUnorderedZero@2_RE_@1(b,*hgh, cl2, ch2,&vh, nthreads, vector_elements); if (vh < cl2) /*then the left piece is empty*/ @@ -1286,7 +1326,7 @@ To do that, we first search the index to know and which parts we have to crack. Then we crack, if necessary, the appropriate pieces, update the index and return the result */ static str -CRKRangeTree_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh, bit tail){ +CRKRangeTree_@1(int *vid, int *bid, @1 *low, @1 *hgh, bit *inclusiveLow, bit *inclusiveHgh, bit tail, int nthreads, int vector_elements){ @:RangeSelectBody(@1,@2,@3,@4,)@ } static str @@ -1295,7 +1335,7 @@ CRKRangeSumTree_@1(int *vid, int *bid, @ } static str -CRKRangeLeftNilTree_@1(int *vid, int *bid, @1 *hgh, bit *inclusiveHgh, bit tail){ +CRKRangeLeftNilTree_@1(int *vid, int *bid, @1 *hgh, bit *inclusiveHgh, bit tail, int nthreads, int vector_elements){ BAT *b,*c,*bo; BAT *view; int m; @@ -1536,7 +1576,7 @@ CRKRangeLeftNilTree_@1(int *vid, int *bi } static str -CRKRangeRightNilTree_@1(int *vid, int *bid, @1 *low, bit *inclusiveLow, bit tail){ +CRKRangeRightNilTree_@1(int *vid, int *bid, @1 *low, bit *inclusiveLow, bit tail, int nthreads, int vector_elements){ BAT *b,*c,*bo; BAT *view; int m; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list