Архитектура Аудит Военная наука Иностранные языки Медицина Металлургия Метрология Образование Политология Производство Психология Стандартизация Технологии |
Describe the OpenMP programming model and compile programs with OpenMP.Стр 1 из 3Следующая ⇒
Describe the OpenMP programming model and compile programs with OpenMP. Shared Memory Model: OpenMP is designed for multi-processor/core, shared memory machines. Thread Based Parallelism:
Explicit Parallelism:
Compiler Directive Based:
#pragma omp parallel default(shared) private(beta,pi) Make definition of the classification of computer architectures, classification of parallel computing systems
Symmetric multiprocessing (SMP) involves a symmetric multiprocessor system hardware and software architecture where two or more identical processors connect to a single, shared main memory, have full access to all I/O devices, and are controlled by a single operating system instance that treats all processors equally, reserving none for special purposes.
Critically evaluate Synchronization in OpenMP. Only one thread at a time can enter a critical region. It is high level synch. There are two pragmas for critical sections: critical and atomic . The second one is more limited but has performance advantages. The typical application of a critical section is to update a variable: #pragma omp parallel{ int mytid = omp_get_thread_num(); double tmp = some_function(mytid);#pragma omp critical sum += tmp;}
Define the concepts of Stream, thread, process. Describe flow differences (filament) from the process. Processes · Process : "An execution stream in the context of a particular process state." 1.Execution stream: a sequence of instructions (only one thing happens at a time). 2.Process state: everything that can affect, or be affected by, the process: code, data, call stack, open files, network connections, etc. · Is a process the same as a program? · Uniprogramming system: only supports a single process. Simplifies some parts of OS, but many other things are hard to do. 1.Some early personal computer operating systems were uniprogramming (e.g. MS-DOS), but these systems are almost unheard of today. 2.This is not called "uniprocessing": that refers to a system with only one processor. · Virtually all modern operating systems are multiprogramming systems: multiple processes can exist simultaneously and share the machine. Threads · Most modern operating systems also support threads: multiple execution streams within a single process 1.Threads share process state such as memory, open files, etc. 2.Each thread has a separate stack for procedure calls (in shared memory) 3.Thread is unit of sequential execution · Why support threads? 1.Concurrent execution on multiprocessors 2.Manage I/O more efficiently: some threads wait for I/O while others compute 3.Most common usage for threads: large server applications
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.
Describe the OpenMP programming model and compile programs with OpenMP. Shared Memory Model: OpenMP is designed for multi-processor/core, shared memory machines. Thread Based Parallelism:
Explicit Parallelism:
Compiler Directive Based:
#pragma omp parallel default(shared) private(beta,pi) |
Последнее изменение этой страницы: 2019-04-01; Просмотров: 354; Нарушение авторского права страницы