Commit 909ba4ab authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

Balancers: threads must not become zero

parent c46809e1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -14,11 +14,12 @@ public:
	LoadBalancerDefault(SizeType ntasks, SizeType nthreads)
	    : blockSize_(ntasks/nthreads)
	{
		if (ntasks < nthreads) {
		if (ntasks < nthreads && ntasks > 0) {
			nthreads = ntasks;
			blockSize_ = 1;
		}

		assert(nthreads > 0);
		if ((ntasks % nthreads) != 0) ++blockSize_;
	}

+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ public:
	    : taskNumber_(nthreads)
	{
		SizeType ntasks = weights.size();
		if (ntasks < nthreads) nthreads = ntasks;
		if (ntasks < nthreads && ntasks > 0) nthreads = ntasks;
		VectorSizeType workLoad(nthreads, 0);
		VectorSizeType weights2 = weights;
		VectorSizeType iperm(ntasks, 0);