source: CIVL/examples/backend/mallocInputArray.cvl@ e2570cd

main test-branch
Last change on this file since e2570cd was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 556 bytes
Line 
1#include <civlc.cvh>
2#include <concurrency.cvh>
3
4
5$input int N;
6int** A;
7$assume(3<N && N<5);
8$scope root = $here;
9
10int main(){
11 $gbarrier gb = $gbarrier_create($here, N);
12 $barrier bs[N];
13 $scope sc=$here;
14
15 A=(int**)$malloc(root, sizeof(int*)*N);
16 for(int i =0; i<N; i++)
17 A[i]=(int*)$malloc(sc, sizeof(int)*N);
18 for(int i=N-1; i>=0; i--)
19 $free(A[i]);
20 $free(A);
21 for(int i=0; i<N;i++)
22 bs[i] = $barrier_create(sc, gb, i);
23 $gbarrier_destroy(gb);
24 for(int i=N-1; i>=0; i--)
25 $barrier_destroy(bs[i]);
26}
Note: See TracBrowser for help on using the repository browser.