Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 27 lines (19 sloc) 0.489 kb
b34beb7 Andreas Klöckner Add lec 2 demos.
inducer authored
1
2
3 #include <omp.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6
7 int main(int argc, char *argv[]) {
8
9 int nThreads;
10
11 if (argc != 2){
12 printf("Must enter integer for number threads on command line\n");
13 fflush(stdout);
14 exit(-1);
15 }
16 else {
17 nThreads = atoi(argv[1]);
18 printf("Using %d threads\n",nThreads);
19 }
20
21 #pragma omp parallel num_threads(nThreads)
22 printf("Hello world from thread %d of %d\n",
23 omp_get_thread_num(),omp_get_num_threads());
24
25 return 0;
26 }
Something went wrong with that request. Please try again.