Skip to content

Instantly share code, notes, and snippets.

@jdoerfert
Created June 14, 2019 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdoerfert/d2b18ca8bb5c3443cc1d26b23236866f to your computer and use it in GitHub Desktop.
Save jdoerfert/d2b18ca8bb5c3443cc1d26b23236866f to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
for (int i = 0; i < 1000; ++i) {
int Count = 0;
#pragma omp target parallel for reduction(+: Count) schedule(dynamic, 2) num_threads(64)
for (int J = 0; J < 1000; ++J) {
Count += J;
}
if (Count != 499500)
printf("ERROR [@%i] %i\n", i, Count);
}
// Final result of Count is 1000 * (999-0) / 2
// CHECK: Expected count with dynamic scheduling = 499500
// printf("Expected count with dynamic scheduling = %d\n", Count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment