Changeset: 5184967f30fb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5184967f30fb Modified Files: MonetDB5/src/mal/mal_interpreter.mx MonetDB5/src/optimizer/opt_mitosis.mx Branch: Oct2010 Log Message:
More protection against uninitialized global. diffs (64 lines): diff -r c5a4c98a6480 -r 5184967f30fb MonetDB5/src/mal/mal_interpreter.mx --- a/MonetDB5/src/mal/mal_interpreter.mx Fri Nov 26 21:21:46 2010 +0100 +++ b/MonetDB5/src/mal/mal_interpreter.mx Fri Nov 26 21:34:55 2010 +0100 @@ -1497,7 +1497,7 @@ } flow->worker = NULL; - flow->nway = GDKnr_threads; + flow->nway = GDKnr_threads ? GDKnr_threads:1; flow->worker= (FlowTask *) GDKzalloc(sizeof(FlowTask)*flow->nway); for(i=0; i<flow->nway; i++) { flow->worker[i].id = workerid++; diff -r c5a4c98a6480 -r 5184967f30fb MonetDB5/src/optimizer/opt_mitosis.mx --- a/MonetDB5/src/optimizer/opt_mitosis.mx Fri Nov 26 21:21:46 2010 +0100 +++ b/MonetDB5/src/optimizer/opt_mitosis.mx Fri Nov 26 21:34:55 2010 +0100 @@ -70,7 +70,7 @@ #include "opt_octopus.h" #include "mal_interpreter.h" -#define PARTITION_THRESHOLD (wrd) GDKnr_threads /* should be increased in production version */ +#define PARTITION_THRESHOLD (wrd) threads /* should be increased in production version */ static int eligible(MalBlkPtr mb ) { @@ -98,6 +98,7 @@ wrd r = 0, rowcnt=0; /* table should be sizeable to consider parallel execution*/ InstrPtr q,*old, target= 0, matq; size_t typewidth= 3 *sizeof(lng); /* 2 arguments and a result */ + int threads = GDKnr_threads ? GDKnr_threads:1; (void)cntxt; (void) stk; @@ -145,17 +146,17 @@ pieces = i; else { /* ensure that GDKnr_threads partitions fit into main memory */ - r = (BUN) (monet_memory / typewidth / (GDKnr_threads ? GDKnr_threads: 1) ); + r = (BUN) (monet_memory / typewidth / threads); if (rowcnt > r) - pieces = MAX ( (int)(rowcnt / r + 1) , (GDKnr_threads ? GDKnr_threads: 1) ); + pieces = MAX ( (int)(rowcnt / r + 1) , threads); else /* exploit parallelism, but ensure minimal partition size to limit overhead */ if (rowcnt > MINPARTCNT) - pieces = MIN ( (int)(rowcnt / MINPARTCNT) , GDKnr_threads ); + pieces = MIN ( (int)(rowcnt / MINPARTCNT) , threads); /* when testing, split also small BATs, but avoid empty pieces */ FORCEMITODEBUG - if (pieces < GDKnr_threads) - pieces = MIN ( GDKnr_threads , (int)rowcnt ); + if (pieces < threads) + pieces = MIN ( threads , (int)rowcnt ); /* prevent plan explosion */ if (pieces > MAXSLICES) pieces = MAXSLICES; @@ -168,7 +169,7 @@ " with " BUNFMT " rows into " BUNFMT " rows/piece %d threads %d pieces\n", getVarConstant(mb, getArg(target,2)).val.sval, getVarConstant(mb, getArg(target,3)).val.sval, - rowcnt, r, GDKnr_threads,pieces); + rowcnt, r, threads, pieces); old = mb->stmt; limit= mb->stop; _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list