랭귀지/OpenMP
-
[OpenMP] Fibonacci 병렬화랭귀지/OpenMP 2012. 9. 20. 15:05
피보나치 병렬화 실패 #include #include long Sequential_FIB(int n) { long fnm1, fnm2, fn; if(n == 0 || n == 1) return (n); fnm1 = Sequential_FIB(n-1); fnm2 = Sequential_FIB(n-2); fn = fnm1 + fnm2; return (fn); } long openMP_FIB(int n) { long fnm1, fnm2, fn; if(n == 0 || n == 1) return (n); #pragma omp task shared(fnm1) { fnm1 = openMP_FIB(n-1); } #pragma omp task shared(fnm2) { fnm2 = openMP_FIB(n-2); } #..