Skip to content

Instantly share code, notes, and snippets.

@stelleg
Created January 18, 2018 18:10
Show Gist options
  • Save stelleg/2ba28a561273f14fcc014760f508f4af to your computer and use it in GitHub Desktop.
Save stelleg/2ba28a561273f14fcc014760f508f4af to your computer and use it in GitHub Desktop.
simple cilk_for loop
#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