Skip to content

Instantly share code, notes, and snippets.

@jdoerfert jdoerfert/test.c
Created Jun 14, 2019

Embed
What would you like to do?
#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
You can’t perform that action at this time.