FUNCTIONS_OPENMP Demonstrate a few of OpenMP's library functions. While NOT in a parallel region: omp_get_max_threads ( ) = 1 omp_get_num_threads ( ) = 1 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279615 While NOT in a parallel region, after calling omp_set_num_threads ( 5 ): omp_get_max_threads ( ) = 5 omp_get_num_threads ( ) = 1 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279615 Enter a parallel region. Enter a parallel region. after calling omp_set_num_threads ( 3 ): after calling omp_set_num_threads ( 3 ): omp_get_thread_num ( ) = 1 omp_get_thread_num ( ) = 0 While in a parallel region, printing from a single thread: omp_get_max_threads ( ) = 3 omp_get_num_threads ( ) = 3 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279615 Enter a parallel region. after calling omp_set_num_threads ( 3 ): omp_get_thread_num ( ) = 2 omp_get_wtime estimates duration of sleep(5) as 5.00127 seconds. FUNCTIONS_OPENMP Normal end of execution. FUNCTIONS_OPENMP Demonstrate a few of OpenMP's library functions. While NOT in a parallel region: omp_get_max_threads ( ) = 2 omp_get_num_threads ( ) = 1 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279620 While NOT in a parallel region, after calling omp_set_num_threads ( 5 ): omp_get_max_threads ( ) = 5 omp_get_num_threads ( ) = 1 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279620 Enter a parallel region. after calling omp_set_num_threads ( 3 ): Enter a parallel region. Enter a parallel region. after calling omp_set_num_threads ( 3 ): omp_get_thread_num ( ) = 1 While in a parallel region, printing from a single thread: omp_get_max_threads ( ) = 3 omp_get_num_threads ( ) = 3 omp_get_thread_num ( ) = 1 after calling omp_set_num_threads ( 3 ): omp_get_thread_num ( ) = 2 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279620 omp_get_thread_num ( ) = 0 omp_get_wtime estimates duration of sleep(5) as 5.00128 seconds. FUNCTIONS_OPENMP Normal end of execution. FUNCTIONS_OPENMP Demonstrate a few of OpenMP's library functions. While NOT in a parallel region: omp_get_max_threads ( ) = 4 omp_get_num_threads ( ) = 1 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279625 While NOT in a parallel region, after calling omp_set_num_threads ( 5 ): omp_get_max_threads ( ) = 5 omp_get_num_threads ( ) = 1 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279625 Enter a parallel region. Enter a parallel region. after calling omp_set_num_threads ( 3 ): omp_get_thread_num ( ) = 0 While in a parallel region, printing from a single thread: omp_get_max_threads ( ) = 3 omp_get_num_threads ( ) = 3 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279625 Enter a parallel region. after calling omp_set_num_threads ( 3 ): omp_get_thread_num ( ) = 1 after calling omp_set_num_threads ( 3 ): omp_get_thread_num ( ) = 2 omp_get_wtime estimates duration of sleep(5) as 5.00055 seconds. FUNCTIONS_OPENMP Normal end of execution. FUNCTIONS_OPENMP Demonstrate a few of OpenMP's library functions. While NOT in a parallel region: omp_get_max_threads ( ) = 8 omp_get_num_threads ( ) = 1 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279630 While NOT in a parallel region, after calling omp_set_num_threads ( 5 ): omp_get_max_threads ( ) = 5 omp_get_num_threads ( ) = 1 omp_get_thread_num ( ) = 0 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279630 Enter a parallel region. after calling omp_set_num_threads ( 3 ): Enter a parallel region. omp_get_thread_num ( ) = 0 Enter a parallel region. after calling omp_set_num_threads ( 3 ): While in a parallel region, printing from a single thread: after calling omp_set_num_threads ( 3 ): omp_get_max_threads ( ) = 3 omp_get_num_threads ( ) = 3 omp_get_thread_num ( ) = 0 omp_get_thread_num ( ) = 2 omp_get_num_procs ( ) = 8 omp_get_wtime ( ) = 279630 omp_get_thread_num ( ) = 1 omp_get_wtime estimates duration of sleep(5) as 5.00129 seconds. FUNCTIONS_OPENMP Normal end of execution.