Re: [問題] openmp for loop 多迴圈 parallel

作者: johnjohnlin (嗯?)   2014-06-20 14:09:11
※ 引述《manquentin (明天會更好)》之銘言:
: 開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
: Linus
↑這個是人名 XD
: 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
: 問題(Question):
: for(int i = 0; i<N; i++){
: for(int j = i+1; j<N; j++){
: for(int k = j+1; k<N; k++){
: for(int l = k+1; l<N; l++){
: //parallelize this code here
: }
: }
: }
: }
這樣
#pragma omp parallel
for(int i = 0; i<N; i++){
for(int j = i+1; j<N; j++){
for(int k = j+1; k<N; k++){
#pragma omp for schedule(xxx) private(xxx)
for(int l = k+1; l<N; l++){
//parallelize this code here
}
}
}
}
: 單層用簡單的#pragma omp parallel for就是以做到平行化,
: 想請教如何用openmp 進行多層for loop的平行化
: 感謝
: 餵入的資料(Input):
: 預期的正確結果(Expected Output):
: 錯誤結果(Wrong Output):
: 程式碼(Code):(請善用置底文網頁, 記得排版)
: 補充說明(Supplement):
作者: manquentin (明天會更好)   2014-06-22 23:31:00
感謝,我嘗試看看

Links booklink

Contact Us: admin [ a t ] ucptt.com