7#define CFSMAX_SIZE 1000
12#define SLEEPTIME 0.0005
25 int lastthreadsstarttid = -1;
29 tids = (
int *) malloc (
sizeof (
int) * (
CFSMAX_SIZE + 1));
33 #pragma omp parallel shared(tids,counter)
45 fprintf (stderr,
"Using an internal count of %d\nUsing a specified"
48 #pragma omp parallel shared(tids)
54 tid = omp_get_thread_num ();
56 #pragma omp for nowait schedule(static,chunk_size)
59 #pragma omp flush(maxiter)
68 #pragma omp flush(maxiter,notout)
74 if (
count > 0.) printf(
" waited %lf s\n",
count);
79 printf(
"%d finished by %d\n",
j,tid);
83 #pragma omp flush(maxiter,notout)
93 if (tids[
i] == lasttid) {
96 fprintf (stderr,
"%d: %d \n",
i, tids[
i]);
104 if (tids[
i] == (lasttid + 1) % threads || tids[
i] == -1) {
110 fprintf (stderr,
"OK\n");
116 fprintf (stderr,
"Last thread had chunk size %d\n",
120 fprintf (stderr,
"ERROR: Last thread (thread with"
121 " number -1) was found before the end.\n");
125 fprintf (stderr,
"ERROR: chunk size was %d. (assigned"
131 fprintf(stderr,
"ERROR: Found thread with number %d (should be"
132 " inbetween 0 and %d).", tids[
i], threads - 1);
136 fprintf (stderr,
"%d: %d \n",
i, tids[
i]);
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t count
#define omp_set_num_threads
int test_omp_for_schedule_static()
static void my_sleep(double sleeptime)
Utility function to have a sleep function with better resolution and which only stops one thread.
int omp_get_num_threads()