- •1.3.Describe the OpenMp programming model and compile programs with OpenMp.
- •1.4.Make definition of the classification of computer architectures, classification of parallel computing systems
- •1.5.Describe the process of setting the number of parallel streams in OpenMp.
- •1.8.Critically evaluate Synchronization in OpenMp.
- •1.9.Describe Directive #pragma omp for.
- •1.11.Specify iteration distribution modes cycle in OpenMp threads
- •1.14.Describe Directive #pragma omp parallel. Purpose. The omp parallel directive explicitly instructs the compiler to parallelize the chosen block of code.
- •1.12.Define the Amdahl's Law and its meaning for the programmer
- •1.13.Define the concepts of Stream, thread, process. Describe flow differences (filament) from the process. Processes
- •Threads
- •Parameters. Clause is any of the following clauses:
- •1.15.Critically evaluate locks (mutexes) in OpenMp
- •1.17. Critically evaluate the mpi programming model. Specify Communicator and ranks in the mpi.
- •1.18. Write, how the performance of computers is measured, in what units is measured, according to what law is growing, what are the limits of growth
- •1.20.Describe the function of creating and stop pThreads threads
- •2.1.Give an example of identification streams.
- •2.2.Prove the importance of protecting shared data with a mutex
- •2.3.Specify required elements of the program in mpi
- •2.4.Prove the importance of working with time in mpi. Describe procedure Measurements time of the program portion.
- •2.5.Passing arguments specify flow function
- •2.6.Provide examples of basic stream control operation
- •2.7. Prove the importance of data separation problems between the streams.
- •2.8.Prove the importance of using nVidia cuda in parallel programs.
Parameters. Clause is any of the following clauses:
if (exp). When the if argument is specified, the program code executes in parallel only if the scalar expression represented by exp evaluates to a nonzero value at run time.
private (list). Declares the scope of the data variables in list to be private to each thread. Data variables in list are separated by commas.
num_threads (int_exp). The value of int_exp is an integer expression that specifies the number of threads to use for the parallel region.
shared (list). Declares the scope of the comma-separated data variables in list to be shared across all threads.
1.15.Critically evaluate locks (mutexes) in OpenMp
A lock is somewhat similar to a critical section: it guarantees that some instructions can only be performed by one process at a time. However, a critical section is indeed about code; a lock is about data. With a lock you make sure that some data elements can only be touched by one process at a time.
A thread lock is a form of mutual exclusion. A lock in OpenMP is an object (omp_lock_t) that can be held by at most one thread at a time. The four operations are:
omp_init_lock(omp_lock_t *) – initialize a lock
• omp_set_lock(omp_lock_t*) – wait until the lock is available, then set it. No other thread can set the lock until it is released
• omp_unset_lock(omp_lock_t*) – unset (release) the lock
• omp_destroy_lock(omp_lock_t*) – The reverse of omp_init_lock.
1.16.Critically evaluate Nested parallel sections in OpenMP. Directives specify description single and master in OpenMP. OpenMP parallel regions can be nested inside each other. If nested parallelism is disabled, then the new team created by a thread encountering a parallel construct inside a parallel region consists only of the encountering thread. If nested parallelism is enabled, then the new team may consist of more than one thread.
The OpenMP runtime library maintains a pool of threads that can be used as slave threads in parallel regions. When a thread encounters a parallel construct and needs to create a team of more than one thread, the thread will check the pool and grab idle threads from the pool, making them slave threads of the team. The master thread might get fewer slave threads than it needs if there is not a sufficient number of the idle threads in the pool. When the team finishes executing the parallel region, the slave threads return to the pool.
Nested parallelism can be controlled at runtime by setting various environment variables prior to execution of the program.
Nested parallelism can be enabled or disabled by setting the OMP_NESTED environment variable or calling omp_set_nested() function.
#pragma omp single{
}
int main(){
omp_set_dynamic(0);
#pragma omp parallel num_threads(2){
report_num_threads(1);
#pragma omp parallel num_threads(2){
report_num_threads(2);
#pragma omp parallel num_threads(2){
report_num_threads(3);} }}
return(0);}
