OpenMPを動かすのに都合の良いPCを用意します。
- 2コア以上のCPU
- ちょっと多めのメモリ
- OSはLinuxが良いかと(筆者はCentOSを使用しています)
- テキストエディタ必須
- GCC(GNU Compiler Collection)にOpenMPのライブラリを追加
2コア以上のCPUは今や簡単に手に入ります。むしろシングルコアのCPUを見つけることのほうが難しいです。
筆者はCentOS7.9を使用しています。
$ cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)
ライブラリとしてlibgompを入れておけば万事OKです。RPMの情報は以下の通りです。
$ rpm -qi libgomp Name : libgomp Version : 4.8.5 Release : 44.el7 Architecture: x86_64 Install Date: Sun Oct 10 07:08:55 2021 Group : System Environment/Libraries Size : 212144 License : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD Signature : RSA/SHA256, Thu Oct 15 03:53:06 2020, Key ID 24c6a8a7f4a80eb5 Source RPM : gcc-4.8.5-44.el7.src.rpm Build Date : Wed Sep 30 11:42:39 2020 Build Host : x86-02.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://gcc.gnu.org Summary : GCC OpenMP v3.0 shared support library Description : This package contains GCC shared support library which is needed for OpenMP v3.0 support.
CPU情報は以下の通りです。
$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 8 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 158 Model name: Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz Stepping: 13 CPU MHz: 799.987 CPU max MHz: 4700.0000 CPU min MHz: 800.0000 BogoMIPS: 6000.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 12288K NUMA node0 CPU(s): 0-7 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb invpcid_single intel_pt ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities
メモリは以下の通りです。
$ cat /proc/meminfo MemTotal: 65817712 kB MemFree: 58987996 kB MemAvailable: 61384320 kB Buffers: 393352 kB Cached: 2379092 kB SwapCached: 0 kB Active: 3707512 kB Inactive: 1720508 kB Active(anon): 2657888 kB Inactive(anon): 167864 kB Active(file): 1049624 kB Inactive(file): 1552644 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 134217724 kB SwapFree: 134217724 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 2655600 kB Mapped: 398024 kB Shmem: 170180 kB Slab: 419492 kB SReclaimable: 328868 kB SUnreclaim: 90624 kB KernelStack: 11584 kB PageTables: 49468 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 167126580 kB Committed_AS: 6389456 kB VmallocTotal: 34359738367 kB VmallocUsed: 685492 kB VmallocChunk: 34358423548 kB Percpu: 3136 kB HardwareCorrupted: 0 kB AnonHugePages: 587776 kB CmaTotal: 0 kB CmaFree: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 138672 kB DirectMap2M: 4945920 kB DirectMap1G: 61865984 kB
準備ができたら次へ進みましょう。