라즈베리는 나름(!) 쿼드코어니까 openmp 테스트 하긴 적절ㅋ
$ cat mp.cpp #include <iostream> int main(int argc, char **argv) { #pragma omp parallel for(;;) { int a = 0; a++; } return 0 ; } |
$ g++ -fopenmp mp.cpp $ ./a.out |
쓰레드도 lightweight process 랬으니... 3*로 뜨는게 당연한건가?
$ pstree init─┬─avahi-daemon───avahi-daemon ├─console-kit-dae───64*[{console-kit-dae}] ├─cron ├─2*[dbus-daemon] ├─dbus-launch ├─dhcpcd ├─7*[getty] ├─gvfs-afc-volume───{gvfs-afc-volume} ├─gvfs-gdu-volume───{gvfs-gdu-volume} ├─gvfs-gphoto2-vo ├─gvfsd ├─gvfsd-trash───{gvfsd-trash} ├─2*[ifplugd] ├─lightdm─┬─Xorg │ ├─lightdm─┬─lxsession─┬─lxpanel───3*[{lxpanel}] │ │ │ ├─openbox │ │ │ ├─pcmanfm───{pcmanfm} │ │ │ ├─ssh-agent │ │ │ └─{lxsession} │ │ └─{lightdm} │ └─2*[{lightdm}] ├─lxpolkit───{lxpolkit} ├─menu-cached───{menu-cached} ├─ntpd ├─polkitd───2*[{polkitd}] ├─rsyslogd───3*[{rsyslogd}] ├─sshd─┬─sshd───sshd───bash───a.out───3*[{a.out}] │ └─sshd───sshd───bash───pstree ├─thd ├─udevd───2*[udevd] └─udisks-daemon─┬─udisks-daemon └─{udisks-daemon} |
4개 cpu 100%씩 총합 399.2%.. 흐음..
$ top top - 13:00:53 up 4:21, 2 users, load average: 0.54, 0.28, 0.16 Tasks: 109 total, 2 running, 107 sleeping, 0 stopped, 0 zombie %Cpu0 :100.0 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu1 :100.0 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu2 :100.0 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu3 : 99.7 us, 0.3 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem: 883168 total, 779332 used, 103836 free, 70232 buffers KiB Swap: 102396 total, 0 used, 102396 free, 622940 cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 16224 pi 20 0 27992 900 784 R 399.2 0.1 0:36.16 a.out |
'Programming > openMP' 카테고리의 다른 글
openMP g++ -E -S (2) | 2015.10.12 |
---|---|
openmp 관련 정리글(win32) (0) | 2015.10.08 |
openCV + openMP (0) | 2015.09.30 |
openMP affinity 관련.. (0) | 2015.07.23 |
openMP parallel for private (4) | 2013.12.12 |