1234567891011121314151617181920212223 |
- #include <omp.h>
- #include <stdio.h>
- #include <stdlib.h>
- /* src de l'exemple: http://igrida.gforge.inria.fr/tutorial.html */
-
- int main (int argc, char *argv[]) {
- int th_id, nthreads;
- #pragma omp parallel private(th_id)
- {
- th_id = omp_get_thread_num();
- printf("Hello World from thread %d\n", th_id);
- sleep(60);
- #pragma omp barrier
- if ( th_id == 0 ) {
- nthreads = omp_get_num_threads();
- printf("There are %d threads\n",nthreads);
- }
- }
- return EXIT_SUCCESS;
- }
|