42 tids = (
int *) malloc (
sizeof (
int) * (
CFSMAX_SIZE + 1));
65 #pragma omp parallel shared(tids,maxiter)
71 tid = omp_get_thread_num ();
73 #pragma omp for nowait schedule(guided)
76 #pragma omp flush(maxiter)
84 #pragma omp flush(maxiter,notout)
86 #pragma omp flush(maxiter,notout)
94 if (
count > 0.) printf(
" waited %lf s\n",
count);
99 printf(
"%d finished by %d\n",
j,tid);
103 #pragma omp flush(maxiter,notout)
110 int determined_chunksize = 1;
111 int last_threadnr = tids[0];
112 int global_chunknr = 0;
114 int expected_chunk_size;
115 int* local_chunknr = (
int*)malloc(threads *
sizeof(
int));
118 for (
i = 0;
i < threads;
i++)
119 local_chunknr[
i] = 0;
128 if (last_threadnr==tids[
i]) {
129 determined_chunksize++;
134 local_chunknr[last_threadnr]++;
135 last_threadnr = tids[
i];
136 determined_chunksize = 1;
140 chunksizes = (
int*)malloc(global_chunknr *
sizeof(
int));
146 determined_chunksize = 1;
147 last_threadnr = tids[0];
154 if (last_threadnr == tids[
i]) {
155 determined_chunksize++;
157 chunksizes[global_chunknr] = determined_chunksize;
159 local_chunknr[last_threadnr]++;
160 last_threadnr = tids[
i];
161 determined_chunksize = 1;
166 fprintf(stderr,
"found\texpected\tconstant\n");
171 expected_chunk_size = openwork / threads;
172 c = (
double) chunksizes[0] / expected_chunk_size;
174 for (
i = 0;
i < global_chunknr;
i++) {
176 if (expected_chunk_size > 1)
177 expected_chunk_size = c * openwork / threads;
179 fprintf(stderr,
"%8d\t%8d\t%lf\n", chunksizes[
i],
180 expected_chunk_size, c * chunksizes[
i]/expected_chunk_size);
183 if (abs (chunksizes[
i] - expected_chunk_size) >= 2) {
186 fprintf(stderr,
"Chunksize differed from expected "
187 "value: %d instead of %d\n", chunksizes[
i],
188 expected_chunk_size);
194 if (expected_chunk_size - chunksizes[
i] < 0)
195 fprintf(stderr,
"Chunksize did not decrease: %d"
196 " instead of %d\n", chunksizes[
i],expected_chunk_size);
200 openwork -= chunksizes[
i];