source: CIVL/examples/omp/simple/eijkhout.c

main
Last change on this file 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: 389 bytes
Line 
1#include <omp.h>
2#include <stdio.h>
3int N=2;
4int main() {
5 int a[N], b[N];
6#pragma omp parallel
7 {
8 int i, tid=omp_get_thread_num();
9#pragma omp for nowait
10 for (i=0; i<N; i++) {
11 $atomic{ printf("Thread %d writes a[%d]\n", tid, i); a[i]=i; }
12 }
13#pragma omp for
14 for (i=0; i<N; i++) {
15 $atomic{ printf("Thread %d reads a[%d]\n", tid, i); b[i]=2*a[i]; }
16 }
17 }
18}
Note: See TracBrowser for help on using the repository browser.