Created
January 18, 2018 18:10
-
-
Save stelleg/2ba28a561273f14fcc014760f508f4af to your computer and use it in GitHub Desktop.
simple cilk_for loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#include <cilk/cilk.h> | |
int main(int argc, char** argv){ | |
int n = argc > 1 ? atoi(argv[1]) : 100000000; | |
int *a=malloc(n*sizeof(int)); | |
cilk_for(int i=0; i<n; i++){ | |
a[i] = i; | |
} | |
for(int i=0; i<n; i++){ | |
assert(a[i] == i); | |
} | |
printf("done\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment