OpenMP采用fork-join的执行模式。开始的时候只存在一个主线程,当需要进行并行计算的时候,派生出若干个分支线程来执行并行任务。当并行代码执行完成之后,分支线程会合,并把控制流程交给单独的主线程。
一个典型的fork-join执行模型的示意图如下:
OpenMP编程模型以线程为基础,通过编译制导指令制导并行化,有三种编程要素可以实现并行化控制,他们分别是编译directive、API函数集和环境变量。
具体可以参考这篇博客:
OpenMP基本概念_yu132563的专栏-CSDN博客_openmp OpenMP是一种用于共享内存并行系统的多线程程序设计方案,支持的编程语言包括C、C++和Fortran。OpenMP提供了对并行算法的高层抽象描述,特别适合在多核CPU机器上的并行程序设计。编译器根据程序中添加的pragma指令,自动将程序并行处理,使用OpenMP降低了并行编程的难度和复杂度。当编译器不支持OpenMP时,程序会退化成普通(串行)程序。程序中已有的OpenMP指令不会影响...https://blog.csdn.net/yu132563/article/details/82704993测试代码:
#include
int main(void) {
#pragma omp parallel
{
int i;
printf("Hello World\n");
for(i=0;i <6;i++)
printf("Iter:%d\n",i);
}
printf("GoodBye World\n");
}
编译:
gcc -o test openmp.c -fopenmp -Wl,-Map=openmp.map
增加了-fopenmap选项,如果需要调试和静态链接,可以继续添加 -static 和 -g选项。
Map文件,从中可以看出,引用了额外的libgomp库链接.
czl@czl-VirtualBox:~/WorkSpace/cnn$ cat openmp.map
Archive member included to satisfy reference by file (symbol)
/usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o (__libc_csu_init)
As-needed library included to satisfy reference by file (symbol)
libgomp.so.1 /tmp/ccFkqztK.o (GOMP_parallel@@GOMP_4.0)
libc.so.6 /tmp/ccFkqztK.o (puts@@GLIBC_2.2.5)
Discarded input sections
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadbegin.o
.note.GNU-stack
0x0000000000000000 0x0 /tmp/ccFkqztK.o
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadend.o
Memory Configuration
Name Origin Length Attributes
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadbegin.o
LOAD /tmp/ccFkqztK.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.so
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgcc.a
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so
START GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgcc.a
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libpthread.so
START GROUP
LOAD /lib/x86_64-linux-gnu/libpthread.so.0
LOAD /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libc.so
START GROUP
LOAD /lib/x86_64-linux-gnu/libc.so.6
LOAD /usr/lib/x86_64-linux-gnu/libc_nonshared.a
LOAD /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgcc.a
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so
START GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/libgcc.a
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadend.o
[!provide] PROVIDE (__executable_start = SEGMENT_START ("text-segment", 0x0))
0x0000000000000238 . = (SEGMENT_START ("text-segment", 0x0) + SIZEOF_HEADERS)
.interp 0x0000000000000238 0x1c
*(.interp)
.interp 0x0000000000000238 0x1c /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.note.ABI-tag 0x0000000000000254 0x20
.note.ABI-tag 0x0000000000000254 0x20 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.note.gnu.build-id
0x0000000000000274 0x24
*(.note.gnu.build-id)
.note.gnu.build-id
0x0000000000000274 0x24 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.hash
*(.hash)
.gnu.hash 0x0000000000000298 0x1c
*(.gnu.hash)
.gnu.hash 0x0000000000000298 0x1c /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.dynsym 0x00000000000002b8 0xd8
*(.dynsym)
.dynsym 0x00000000000002b8 0xd8 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.dynstr 0x0000000000000390 0xad
*(.dynstr)
.dynstr 0x0000000000000390 0xad /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.gnu.version 0x000000000000043e 0x12
*(.gnu.version)
.gnu.version 0x000000000000043e 0x12 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.gnu.version_d 0x0000000000000450 0x0
*(.gnu.version_d)
.gnu.version_d
0x0000000000000450 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.gnu.version_r 0x0000000000000450 0x40
*(.gnu.version_r)
.gnu.version_r
0x0000000000000450 0x40 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.rela.dyn 0x0000000000000490 0xc0
*(.rela.init)
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
.rela.text 0x0000000000000490 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
*(.rela.fini)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
.rela.data.rel.ro
0x0000000000000490 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.rela.data.rel.local
0x0000000000000490 0x18 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rela.ctors)
*(.rela.dtors)
*(.rela.got)
.rela.got 0x00000000000004a8 0x78 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
.rela.bss 0x0000000000000520 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
*(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*)
*(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*)
*(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*)
*(.rela.ifunc)
.rela.ifunc 0x0000000000000520 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.rela.fini_array
0x0000000000000520 0x18 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.rela.init_array
0x0000000000000538 0x18 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.rela.plt 0x0000000000000550 0x48
*(.rela.plt)
.rela.plt 0x0000000000000550 0x48 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
[!provide] PROVIDE (__rela_iplt_start = .)
*(.rela.iplt)
[!provide] PROVIDE (__rela_iplt_end = .)
.init 0x0000000000000598 0x17
*(SORT_NONE(.init))
.init 0x0000000000000598 0x12 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o
0x0000000000000598 _init
.init 0x00000000000005aa 0x5 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
.plt 0x00000000000005b0 0x40
*(.plt)
.plt 0x00000000000005b0 0x40 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
*(.iplt)
.plt.got 0x00000000000005f0 0x8
*(.plt.got)
.plt.got 0x00000000000005f0 0x8 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.plt.sec
*(.plt.sec)
.text 0x0000000000000600 0x202
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
.text 0x0000000000000600 0x2b /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
0x0000000000000600 _start
.text 0x000000000000062b 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o
*fill* 0x000000000000062b 0x5
.text 0x0000000000000630 0xda /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
.text 0x000000000000070a 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadbegin.o
.text 0x000000000000070a 0x7a /tmp/ccFkqztK.o
0x000000000000070a main
*fill* 0x0000000000000784 0xc
.text 0x0000000000000790 0x72 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
0x0000000000000790 __libc_csu_init
0x0000000000000800 __libc_csu_fini
.text 0x0000000000000802 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
.text 0x0000000000000802 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
.text 0x0000000000000802 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadend.o
*(.gnu.warning)
.fini 0x0000000000000804 0x9
*(SORT_NONE(.fini))
.fini 0x0000000000000804 0x4 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o
0x0000000000000804 _fini
.fini 0x0000000000000808 0x5 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
[!provide] PROVIDE (__etext = .)
[!provide] PROVIDE (_etext = .)
[!provide] PROVIDE (etext = .)
.rodata 0x0000000000000810 0x28
*(.rodata .rodata.* .gnu.linkonce.r.*)
.rodata.cst4 0x0000000000000810 0x4 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
0x0000000000000810 _IO_stdin_used
.rodata 0x0000000000000814 0x24 /tmp/ccFkqztK.o
.gnu.offload_funcs
0x0000000000000838 0x0
.gnu.offload_funcs
0x0000000000000838 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadbegin.o
.gnu.offload_funcs
0x0000000000000838 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadend.o
.gnu.offload_vars
0x0000000000000838 0x0
.gnu.offload_vars
0x0000000000000838 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadbegin.o
.gnu.offload_vars
0x0000000000000838 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadend.o
.rodata1
*(.rodata1)
.eh_frame_hdr 0x0000000000000838 0x44
*(.eh_frame_hdr)
.eh_frame_hdr 0x0000000000000838 0x44 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
0x0000000000000838 __GNU_EH_FRAME_HDR
*(.eh_frame_entry .eh_frame_entry.*)
.eh_frame 0x0000000000000880 0x128
*(.eh_frame)
.eh_frame 0x0000000000000880 0x30 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
0x2c (size before relaxing)
*fill* 0x00000000000008b0 0x0
.eh_frame 0x00000000000008b0 0x40 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.eh_frame 0x00000000000008f0 0x18 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
0x30 (size before relaxing)
.eh_frame 0x0000000000000908 0x40 /tmp/ccFkqztK.o
0x58 (size before relaxing)
.eh_frame 0x0000000000000948 0x5c /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
0x78 (size before relaxing)
.eh_frame 0x00000000000009a4 0x4 /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
*(.eh_frame.*)
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
.gnu_extab
*(.gnu_extab*)
.exception_ranges
*(.exception_ranges .exception_ranges*)
0x0000000000200d98 . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE))
.eh_frame
*(.eh_frame)
*(.eh_frame.*)
.gnu_extab
*(.gnu_extab)
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
.exception_ranges
*(.exception_ranges .exception_ranges*)
.tdata
*(.tdata .tdata.* .gnu.linkonce.td.*)
.tbss
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
.preinit_array 0x0000000000200d98 0x0
[!provide] PROVIDE (__preinit_array_start = .)
*(.preinit_array)
[!provide] PROVIDE (__preinit_array_end = .)
.init_array 0x0000000000200d98 0x8
0x0000000000200d98 PROVIDE (__init_array_start = .)
*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))
*(.init_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .ctors)
.init_array 0x0000000000200d98 0x8 /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
0x0000000000200da0 PROVIDE (__init_array_end = .)
.fini_array 0x0000000000200da0 0x8
[!provide] PROVIDE (__fini_array_start = .)
*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))
*(.fini_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .dtors)
.fini_array 0x0000000000200da0 0x8 /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
[!provide] PROVIDE (__fini_array_end = .)
.ctors
*crtbegin.o(.ctors)
*crtbegin?.o(.ctors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
*(SORT_BY_NAME(.ctors.*))
*(.ctors)
.dtors
*crtbegin.o(.dtors)
*crtbegin?.o(.dtors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT_BY_NAME(.dtors.*))
*(.dtors)
.jcr
*(.jcr)
.data.rel.ro 0x0000000000200da8 0x0
*(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
*(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)
.data.rel.ro 0x0000000000200da8 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.dynamic 0x0000000000200da8 0x200
*(.dynamic)
.dynamic 0x0000000000200da8 0x200 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
0x0000000000200da8 _DYNAMIC
.got 0x0000000000200fa8 0x58
*(.got.plt)
.got.plt 0x0000000000200fa8 0x30 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
0x0000000000200fa8 _GLOBAL_OFFSET_TABLE_
*(.igot.plt)
*(.got)
.got 0x0000000000200fd8 0x28 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
*(.igot)
0x0000000000201000 . = DATA_SEGMENT_RELRO_END (., 0x0)
.data 0x0000000000201000 0x10
*(.data .data.* .gnu.linkonce.d.*)
.data 0x0000000000201000 0x4 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
0x0000000000201000 data_start
0x0000000000201000 __data_start
.data 0x0000000000201004 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o
.data 0x0000000000201004 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
*fill* 0x0000000000201004 0x4
.data.rel.local
0x0000000000201008 0x8 /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
0x0000000000201008 __dso_handle
.data 0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadbegin.o
.data 0x0000000000201010 0x0 /tmp/ccFkqztK.o
.data 0x0000000000201010 0x0 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
.data 0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
.data 0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
.data 0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadend.o
.tm_clone_table
0x0000000000201010 0x0
.tm_clone_table
0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
.tm_clone_table
0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
.data1
*(.data1)
0x0000000000201010 _edata = .
[!provide] PROVIDE (edata = .)
0x0000000000201010 . = .
0x0000000000201010 __bss_start = .
.bss 0x0000000000201010 0x8
*(.dynbss)
.dynbss 0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
*(.bss .bss.* .gnu.linkonce.b.*)
.bss 0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
.bss 0x0000000000201010 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o
.bss 0x0000000000201010 0x1 /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
.bss 0x0000000000201011 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadbegin.o
.bss 0x0000000000201011 0x0 /tmp/ccFkqztK.o
.bss 0x0000000000201011 0x0 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
.bss 0x0000000000201011 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
.bss 0x0000000000201011 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
.bss 0x0000000000201011 0x0 /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadend.o
*(COMMON)
0x0000000000201018 . = ALIGN ((. != 0x0)?0x8:0x1)
*fill* 0x0000000000201011 0x7
.lbss
*(.dynlbss)
*(.lbss .lbss.* .gnu.linkonce.lb.*)
*(LARGE_COMMON)
0x0000000000201018 . = ALIGN (0x8)
0x0000000000201018 . = SEGMENT_START ("ldata-segment", .)
.lrodata
*(.lrodata .lrodata.* .gnu.linkonce.lr.*)
.ldata 0x0000000000601018 0x0
*(.ldata .ldata.* .gnu.linkonce.l.*)
0x0000000000601018 . = ALIGN ((. != 0x0)?0x8:0x1)
0x0000000000601018 . = ALIGN (0x8)
0x0000000000601018 _end = .
[!provide] PROVIDE (end = .)
0x0000000000601018 . = DATA_SEGMENT_END (.)
.stab
*(.stab)
.stabstr
*(.stabstr)
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x0000000000000000 0x29
*(.comment)
.comment 0x0000000000000000 0x29 /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o
0x2a (size before relaxing)
.comment 0x0000000000000029 0x2a /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadbegin.o
.comment 0x0000000000000029 0x2a /tmp/ccFkqztK.o
.comment 0x0000000000000029 0x2a /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
.comment 0x0000000000000029 0x2a /usr/lib/gcc/x86_64-linux-gnu/7/crtoffloadend.o
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges
*(.debug_aranges)
.debug_pubnames
*(.debug_pubnames)
.debug_info
*(.debug_info .gnu.linkonce.wi.*)
.debug_abbrev
*(.debug_abbrev)
.debug_line
*(.debug_line .debug_line.* .debug_line_end)
.debug_frame
*(.debug_frame)
.debug_str
*(.debug_str)
.debug_loc
*(.debug_loc)
.debug_macinfo
*(.debug_macinfo)
.debug_weaknames
*(.debug_weaknames)
.debug_funcnames
*(.debug_funcnames)
.debug_typenames
*(.debug_typenames)
.debug_varnames
*(.debug_varnames)
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges
*(.debug_ranges)
.debug_macro
*(.debug_macro)
.debug_addr
*(.debug_addr)
.gnu.attributes
*(.gnu.attributes)
/DISCARD/
*(.note.GNU-stack)
*(.gnu_debuglink)
*(.gnu.lto_*)
OUTPUT(test elf64-x86-64)
czl@czl-VirtualBox:~/WorkSpace/cnn$
OpenMP虽好,但它只对多核的平台起到加速的作用,对于单核心来说,OpenMP不但不能性能,还会由于多出来的任务调度降低系统计算能力。