Changes between Version 5 and Version 6 of YMU110509/Lab2


Ignore:
Timestamp:
May 9, 2011, 12:08:03 PM (13 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • YMU110509/Lab2

    v5 v6  
    1212 * GCC 4.2 以上版本就有支援 OpenMP 了....用 "gcc '''-fopenmp'''" 就可以編譯
    1313
    14 = Example 1 : HelloWorld ==
     14== Example 1 : !HelloWorld ==
    1515
    1616 * 首先從 [https://computing.llnl.gov/tutorials/openMP/exercise.html OpenMP Exercise] 下載 omp_hello.c
     
    4141}}}
    4242
    43 = OpenMP 參考資料 =
     43== Example 2 : Loop work-sharing ==
     44
     45 * 首先從 [https://computing.llnl.gov/tutorials/openMP/exercise.html OpenMP Exercise] 下載 omp_workshare1.c
     46{{{
     47~$ wget https://computing.llnl.gov/tutorials/openMP/samples/C/omp_workshare1.c
     48}}}
     49 * 使用 GCC 編譯 omp_workshare1.c
     50{{{
     51~$ gcc -o omp_workshare1 -fopenmp omp_workshare1.c
     52}}}
     53 * 執行 omp_workshare1 執行檔
     54{{{
     55~$ ./omp_workshare1
     56~$ ./omp_workshare1
     57Thread 3 starting...
     58Thread 1 starting...
     59Number of threads = 4
     60Thread 0 starting...
     61Thread 0: c[20]= 40.000000
     62Thread 0: c[21]= 42.000000
     63Thread 0: c[22]= 44.000000
     64Thread 0: c[23]= 46.000000
     65Thread 0: c[24]= 48.000000
     66Thread 0: c[25]= 50.000000
     67
     68 ... skipped ...
     69
     70Thread 2 starting...
     71Thread 2: c[90]= 180.000000
     72Thread 2: c[91]= 182.000000
     73Thread 2: c[92]= 184.000000
     74Thread 2: c[93]= 186.000000
     75Thread 2: c[94]= 188.000000
     76
     77 ... skipped ...
     78
     79Thread 3: c[0]= 0.000000
     80Thread 3: c[1]= 2.000000
     81Thread 3: c[2]= 4.000000
     82Thread 3: c[3]= 6.000000
     83Thread 3: c[4]= 8.000000
     84Thread 3: c[5]= 10.000000
     85 
     86 ... skipped ...
     87
     88Thread 1: c[10]= 20.000000
     89Thread 1: c[11]= 22.000000
     90Thread 1: c[12]= 24.000000
     91Thread 1: c[13]= 26.000000
     92Thread 1: c[14]= 28.000000
     93
     94}}}
     95
     96== OpenMP 參考資料 ==
    4497
    4598 * 多核心平行化程式設計 Multi-Cores Programming