Changeset: 44d35b37c3c4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=44d35b37c3c4
Modified Files:
geom/monetdb5/geomBulk.c
Branch: sfcgal
Log Message:
Put all the OpenMP code inside ifdef, remove old code which was already
commented out
diffs (truncated from 906 to 300 lines):
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -12,6 +12,7 @@
#include "geom.h"
#include <omp.h>
+//#define GEOMBULK_DEBUG 1
/*******************************/
/********** One input **********/
@@ -44,32 +45,35 @@ geom_2_geom_bat(bat *outBAT_id, bat *inB
//iterator over the BAT
inBAT_iter = bat_iterator(inBAT);
- omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
- omp_set_num_threads(OPENCL_THREADS);
q = BUNlast(inBAT);
+
#ifdef GEOMBULK_DEBUG
- fprintf(stdout, "batcalc.wkb %d %d\n", p, q);
gettimeofday(&start, NULL);
#endif
outs = (wkb**) GDKmalloc(sizeof(wkb*) * BATcount(inBAT));
- //BATloop(inBAT, p, q) { //iterate over all valid elements
+
+#ifdef OPENMP
+ omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
+ omp_set_num_threads(OPENCL_THREADS);
#pragma omp parallel for
+#endif
for (p = 0; p < q; p++) {
str err = NULL;
wkb *inWKB = NULL, *outWKB = NULL;
if (msg)
continue;
- //if for used --> inWKB = (wkb *) BUNtail(inBATi, i);
+
inWKB = (wkb *) BUNtail(inBAT_iter, p);
if ((err = geom_2_geom(&outWKB, &inWKB, columnType,
columnSRID)) != MAL_SUCCEED) { //check type
msg = err;
+#ifdef OPENMP
#pragma omp cancelregion
+#else
+ break;
+#endif
}
outs[p] = outWKB;
- //BUNappend(outBAT, outWKB, TRUE); //add the point to the
new BAT
- //GDKfree(outWKB);
- //outWKB = NULL;
}
#ifdef GEOMBULK_DEBUG
gettimeofday(&stop, NULL);
@@ -101,9 +105,6 @@ geom_2_geom_bat(bat *outBAT_id, bat *inB
fprintf(stdout, "batcalc.wkb BUNappend %llu ms\n", t);
#endif
- //BATrmprops(outBAT)
- //BATsetcount(outBAT, BATcount(inBAT));
- //BATsettrivprop(outBAT);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
return MAL_SUCCEED;
@@ -146,9 +147,6 @@ wkbFromText_bat(bat *outBAT_id, bat *inB
outSingle = NULL;
}
- //set the number of elements in the outBAT
- //BATsetcount(outBAT, BATcount(inBAT));
-
BBPunfix(inBAT->batCacheid);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
@@ -185,31 +183,32 @@ wkbCoordinateFromMBR_bat(bat *outBAT_id,
//iterator over the BAT
inBAT_iter = bat_iterator(inBAT);
+ q = BUNlast(inBAT);
+#ifdef GEOMBULK_DEBUG
+ gettimeofday(&start, NULL);
+#endif
+ outs = (double*) Tloc(outBAT, 0);
+
+#ifdef OPENMP
omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
omp_set_num_threads(OPENCL_THREADS);
- q = BUNlast(inBAT);
-#ifdef GEOMBULK_DEBUG
- fprintf(stdout, "batgeom.coordinateFromMBR %d %d\n", p, q);
- gettimeofday(&start, NULL);
+ #pragma omp parallel for
#endif
- //BATloop(inBAT, p, q) { //iterate over all valid elements
- outs = (double*) Tloc(outBAT, 0);
- #pragma omp parallel for
- //BATloop(inBAT, p, q) { //iterate over all valid elements
for (p = 0; p < q; p++) {
str err = NULL;
mbr *inMBR = NULL;
- //double outDbl = 0.0;
if (msg)
continue;
inMBR = (mbr *) BUNtail(inBAT_iter, p);
- //if ((err = wkbCoordinateFromMBR(&outDbl, &inMBR,
coordinateIdx)) != MAL_SUCCEED) {
if ((err = wkbCoordinateFromMBR(&outs[p], &inMBR,
coordinateIdx)) != MAL_SUCCEED) {
msg = err;
+#ifdef OPENMP
#pragma omp cancelregion
+#else
+ break;
+#endif
}
- //BUNappend(outBAT, &outDbl, TRUE);
}
#ifdef GEOMBULK_DEBUG
gettimeofday(&stop, NULL);
@@ -272,9 +271,6 @@ WKBtoSTRflagINT_bat(bat *outBAT_id, bat
outSingle = NULL;
}
- //set the number of elements in the outBAT
- //BATsetcount(outBAT, BATcount(inBAT));
-
BBPunfix(inBAT->batCacheid);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
@@ -324,16 +320,17 @@ WKBtoDBL_bat(bat *outBAT_id, bat *inBAT_
//iterator over the input BAT
inBAT_iter = bat_iterator(inBAT);
+ q = BUNlast(inBAT);
+#ifdef GEOMBULK_DEBUG
+ gettimeofday(&start, NULL);
+#endif
+ outs = (double*) Tloc(outBAT, 0);
+
+#ifdef OPENMP
omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
omp_set_num_threads(OPENCL_THREADS);
- q = BUNlast(inBAT);
-#ifdef GEOMBULK_DEBUG
- fprintf(stdout, "%s %d %d\n", name, p, q);
- gettimeofday(&start, NULL);
+ #pragma omp parallel for
#endif
- //BATloop(inBAT, p, q) { //iterate over all valid elements
- outs = (double*) Tloc(outBAT, 0);
- #pragma omp parallel for
for (p = 0; p < q; p++) {
str err = NULL;
wkb *inWKB = NULL;
@@ -342,12 +339,14 @@ WKBtoDBL_bat(bat *outBAT_id, bat *inBAT_
continue;
inWKB = (wkb *) BUNtail(inBAT_iter, p);
- //if ((err = (*func) (&outSingle, &inWKB)) != MAL_SUCCEED) {
if ((err = (*func) (&outs[p], &inWKB)) != MAL_SUCCEED) {
msg = err;
+#ifdef OPENMP
#pragma omp cancelregion
+#else
+ break;
+#endif
}
- //BUNappend(outBAT, &outSingle, TRUE); //add the result to the
new BAT
}
#ifdef GEOMBULK_DEBUG
gettimeofday(&stop, NULL);
@@ -408,16 +407,17 @@ WKBtoWKB_bat(bat *outBAT_id, bat *inBAT_
//iterator over the input BAT
inBAT_iter = bat_iterator(inBAT);
- omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
- omp_set_num_threads(OPENCL_THREADS);
q = BUNlast(inBAT);
#ifdef GEOMBULK_DEBUG
- fprintf(stdout, "%s %d %d\n", name, p, q);
gettimeofday(&start, NULL);
#endif
outs = (wkb**) GDKmalloc(sizeof(wkb*) * BATcount(inBAT));
- //BATloop(inBAT, p, q) { //iterate over all valid elements
+
+#ifdef OPENMP
+ omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
+ omp_set_num_threads(OPENCL_THREADS);
#pragma omp parallel for
+#endif
for (p = 0; p < q; p++) {
str err = NULL;
wkb *outSingle;
@@ -428,12 +428,13 @@ WKBtoWKB_bat(bat *outBAT_id, bat *inBAT_
inWKB = (wkb *) BUNtail(inBAT_iter, p);
if ((err = (*func) (&outSingle, &inWKB)) != MAL_SUCCEED) {
msg = err;
+#ifdef OPENMP
#pragma omp cancelregion
+#else
+ break;
+#endif
}
outs[p] = outSingle;
- //BUNappend(outBAT, outSingle, TRUE); //add the result to the
new BAT
- //GDKfree(outSingle);
- //outSingle = NULL;
}
#ifdef GEOMBULK_DEBUG
gettimeofday(&stop, NULL);
@@ -465,10 +466,6 @@ WKBtoWKB_bat(bat *outBAT_id, bat *inBAT_
fprintf(stdout, "batcalc.wkb BUNappend %llu ms\n", t);
#endif
- //set the number of elements in the outBAT
- //BATrmprops(outBAT)
- //BATsetcount(outBAT, BATcount(inBAT));
- //BATsettrivprop(outBAT);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
return MAL_SUCCEED;
@@ -517,16 +514,17 @@ WKBtoWKBflagINT_bat(bat *outBAT_id, bat
//iterator over the input BAT
inBAT_iter = bat_iterator(inBAT);
- omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
- omp_set_num_threads(OPENCL_THREADS);
q = BUNlast(inBAT);
#ifdef GEOMBULK_DEBUG
- fprintf(stdout, "%s %d %d\n", name, p, q);
gettimeofday(&start, NULL);
#endif
outs = (wkb**) GDKmalloc(sizeof(wkb*) * BATcount(inBAT));
- //BATloop(inBAT, p, q) { //iterate over all valid elements
+
+#ifdef OPENMP
+ omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
+ omp_set_num_threads(OPENCL_THREADS);
#pragma omp parallel for
+#endif
for (p = 0; p < q; p++) {
str err = NULL;
wkb *outSingle;
@@ -537,12 +535,13 @@ WKBtoWKBflagINT_bat(bat *outBAT_id, bat
inWKB = (wkb *) BUNtail(inBAT_iter, p);
if ((err = (*func) (&outSingle, &inWKB, flag)) != MAL_SUCCEED) {
msg = err;
+#ifdef OPENMP
#pragma omp cancelregion
+#else
+ break;
+#endif
}
outs[p] = outSingle;
- //BUNappend(outBAT, outSingle, TRUE); //add the result to the
new BAT
- //GDKfree(outSingle);
- //outSingle = NULL;
}
#ifdef GEOMBULK_DEBUG
gettimeofday(&stop, NULL);
@@ -574,9 +573,6 @@ WKBtoWKBflagINT_bat(bat *outBAT_id, bat
fprintf(stdout, "batcalc.wkb BUNappend %llu ms\n", t);
#endif
- //BATrmprops(outBAT)
- //BATsetcount(outBAT, BATcount(inBAT));
- //BATsettrivprop(outBAT);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
return MAL_SUCCEED;
@@ -631,16 +627,17 @@ WKBtoWKBflagDBL_bat(bat *outBAT_id, bat
//iterator over the input BAT
inBAT_iter = bat_iterator(inBAT);
- omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
- omp_set_num_threads(OPENCL_THREADS);
q = BUNlast(inBAT);
#ifdef GEOMBULK_DEBUG
- fprintf(stdout, "%s %d %d\n", name, p, q);
gettimeofday(&start, NULL);
#endif
outs = (wkb**) GDKmalloc(sizeof(wkb*) * BATcount(inBAT));
- //BATloop(inBAT, p, q) { //iterate over all valid elements
+
+#ifdef OPENMP
+ omp_set_dynamic(OPENCL_DYNAMIC); // Explicitly disable dynamic teams
+ omp_set_num_threads(OPENCL_THREADS);
#pragma omp parallel for
+#endif
for (p = 0; p < q; p++) {
str err = NULL;
wkb *outSingle;
@@ -651,12 +648,13 @@ WKBtoWKBflagDBL_bat(bat *outBAT_id, bat
inWKB = (wkb *) BUNtail(inBAT_iter, p);
if ((err = (*func) (&outSingle, &inWKB, flag)) != MAL_SUCCEED) {
msg = err;
+#ifdef OPENMP
#pragma omp cancelregion
+#else
+ break;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list