Moim problemem jest to, że nie dostaję równoległości do OpenMP.brak równoległych wątków z openMP
My System: ubuntu 11,4 Intel (R) główny (TM) i5 CPU M 430 @ 2.27GHz
Kompilator: g ++ wersja: 4.5.2 z flagą -fopenmp
Tym Kod widzę, że istnieje tylko jeden wątek:
int nthreads, tid, procs, maxt, inpar, dynamic, nested;
// Start parallel region
#pragma omp parallel private(nthreads, tid) {
// Obtain thread number
tid = omp_get_thread_num();
// Only master thread does this
if (tid == 0)
{
printf("Thread %d getting environment info...\n", tid);
// Get environment information
procs = omp_get_num_procs();
nthreads = omp_get_num_threads();
maxt = omp_get_max_threads();
inpar = omp_in_parallel();
dynamic = omp_get_dynamic();
nested = omp_get_nested();
// Print environment information
printf("Number of processors = %d\n", procs);
printf("Number of threads = %d\n", nthreads);
printf("Max threads = %d\n", maxt);
printf("In parallel? = %d\n", inpar);
printf("Dynamic threads enabled? = %d\n", dynamic);
printf("Nested parallelism supported? = %d\n", nested);
}
}
bo widzę następujący wynik:
Number of processors = 4
Number of threads = 1
Max threads = 4
In parallel? = 0
Dynamic threads enabled? = 0
Nested parallelism supported? = 0
Na czym polega problem?
Czy ktoś może pomóc, proszę?
Czy ustawiłeś zmienną środowiskową OMP_NUM_THREADS? –
Hej! Nie, nie mam. Ale po wykonaniu omp_set_num_threads (2); mam następujący wynik: liczba procesorów = 4 Ilość nici = 1 Maks nici = 2 Równolegle? = 0 Włączone wątki dynamiczne? = 0 Obsługiwany jest równoległy zagnieżdżony? = 0 liczba wątków jest wciąż 1. – Sankp