Parallel dasturlash savollar num threads optsiyasi G’afurov Ibrohim
Download 26.9 Kb.
|
Parallel dasturlash savollar
private optsiyasi
ixtiyoriy n butun son qabul qiluvchi o’zgaruvchi hosil qiling va unga qiymat kiriting. #include #include using namespace std; int main() { int n; cout << "n = "; cin >> n; #pragma omp parallel private(n) num_threads(3) { cout << "Parallel hududda n - " << n << endl; cout << "Parallel oqimlar soni: " << omp_get_num_threads()<< endl; } cout << "Ketma-ket sohada : " << n << endl; return 0; } Ixtiyoriy ucburchak yuzini hisoblaydigan va natijani #include #include using namespace std; void uch_yuz(int a, int b, int c){ int = S; S=a*b*c; #pragma omp parallel private(S) num_threads(3) { S = omp_get_thread_num(); cout << "Parallel hududda xususiylashtirlgan uchburchak yuzi = " << S << endl; cout << "Parallel oqimlar soni: " << omp_get_num_threads()<< endl; } cout << "Ketma-ket sohada uchburchak yuzi = " << S << endl; } int main(){ int a, b; cout<< “ Uchburchak tomonlarini kiriting : “ << endl; cout<< “ a= “ ; cin>>a; cout<< “ b= “ ; cin>>b; cout<< “ c= “ ; cin>>c; uch_yuz(a,b,c); return 0; } Ixtiyoriy N butun son qabul qiluvchi o’zgaruvchi hosil qiling va unga qiymat kiriting. #include #include using namespace std; int main() { int N; cout << "N = "; cin >> N; #pragma omp parallel private(N) num_threads(20) { N = omp_get_thread_num(); cout << "Parallel hududda N = " << N<< endl; cout << "Parallel oqimlar soni: " << omp_get_num_threads()<< endl; } return 0;} Ixtiyoriy N butun son qabul qiluvchi o’zgaruvchi hosil qiling va unga qiymat kiriting. #include #include using namespace std; int main() { int N; cout << "N = "; cin >> N; #pragma omp parallel private(N) num_threads(7) { N = omp_get_thread_num(); cout << "Parallel hududda N = " << N<< endl; cout << "Parallel oqimlar soni: " << omp_get_num_threads()<< endl; } return 0;} Download 26.9 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling