Пономаренко Роман
@rerand0m
rerandom@ispras.ru
Спецификация, описывающая программный интерфейс параллельного программирования.
Первая спецификация (для Fortran) была опубликована в октябре 1997г.
В настоящий момент актуальной является версия 5.2. (с ноября 2021)
Num of processors = 10
Consecutive part, myid = 0, num of threads = 1
Parallel part, myid = 0, num of threads = 2
Parallel part, myid = 1, num of threads = 2
$ g++ -fopenmp main.cpp $ ./a.out Num of processors = 10 Consecutive part, myid = 0, num of threads = 1 Parallel part, myid = 0, num of threads = 2 Parallel part, myid = 1, num of threads = 2
# sudo apt install libomp-dev # sudo pacman -Sy openmp $ clang++ -fopenmp=libomp main.cpp $ ./a.out Num of processors = 10 Consecutive part, myid = 0, num of threads = 1 Parallel part, myid = 0, num of threads = 2 Parallel part, myid = 1, num of threads = 2
$ brew install llvm libomp ... If you need to have llvm first in your PATH, run: echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc For compilers to find llvm you may need to set: export LDFLAGS="-L/opt/homebrew/opt/llvm/lib" export CPPFLAGS="-I/opt/homebrew/opt/llvm/include" ... For compilers to find libomp you may need to set: export LDFLAGS="-L/opt/homebrew/opt/libomp/lib" export CPPFLAGS="-I/opt/homebrew/opt/libomp/include" $ /opt/homebrew/opt/llvm/bin/clang++ -fopenmp=libomp \ -I/opt/homebrew/opt/libomp/include \ -L/opt/homebrew/opt/libomp/lib \ main.cpp $ $ ./a.out Num of processors = 10 Consecutive part, myid = 0, num of threads = 1 Parallel part, myid = 0, num of threads = 2 Parallel part, myid = 1, num of threads = 2
Num of processors = 10
Consecutive part, myid = 0, num of threads = 1
Parallel part, myid = 0, num of threads = 2
Parallel part, myid = 1, num of threads = 2
Num of processors = 10
Consecutive part, myid = 0, num of threads = 1
Parallel part, myid = 0, num of threads = Parallel part, myid = 810, num of threads = Parallel part, myid = 10
Parallel part, myid = 4, num of threads = 10
Parallel part, myid = Parallel part, myid = 5, num of threads = 10
3, num of threads = 10
Parallel part, myid = 9, num of threads = 10
1, num of threads = 10
Parallel part, myid = 6, num of threads = 10
Parallel part, myid = 7, num of threads = 10
Parallel part, myid = 2, num of threads = 10
Num of processors = 10
Consecutive part, myid = 0, num of threads = 1
Parallel part, myid = 0, num of threads = 10
Parallel part, myid = 8, num of threads = 10
Parallel part, myid = 4, num of threads = 10
Parallel part, myid = 7, num of threads = 10
Parallel part, myid = 9, num of threads = 10
Parallel part, myid = 2, num of threads = 10
Parallel part, myid = 6, num of threads = 10
Parallel part, myid = 3, num of threads = 10
Parallel part, myid = 1, num of threads = 10
Parallel part, myid = 5, num of threads = 10
Parallel part 1, myid = 0
Parallel part 1, myid = 4
Parallel part 1, myid = 2
Parallel part 1, myid = 3
Parallel part 1, myid = 1
Parallel part 2, myid = 4
Parallel part 2, myid = 3
Parallel part 2, myid = 0
Parallel part 2, myid = 2
Parallel part 2, myid = 1
0) cntr = 1
8) cntr = 3
9) cntr = 3
7) cntr = 4
6) cntr = 6
4) cntr = 7
3) cntr = 9
2) cntr = 9
1) cntr = 10
5) cntr = 10
10
Running in thread 0
Message from thread 2
Report from thread 1
double omp_get_wtime(void)
Описать класс с перегруженными конструкторами и деструктором, и попытаться передать объект такого класса при помощи атрибутов shared, private.
Оценить результат.