linux 上的 gcc 使用哪个线程库来实现 OpenMP

Which threading library does gcc on linux use to implement OpenMP?

本文关键字:线程 实现 OpenMP 上的 gcc linux      更新时间:2023-10-16

它是否使用pthreads或其他线程API?

是的,Linux 上的 gcc 使用 pthreads。

这取决于你用什么编译GCC,标准的Linux实现带有OpenMP的posix线程,在终端上键入gcc -v

这是我笔记本电脑的输出,感兴趣的部分以粗体显示

[n@N-pc-t61 ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.6.3/lto-wrapper
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
**Thread model: posix**

以下是海湾合作委员会网站上的所有可用选项

--enable-threads=lib
    Specify that lib is the thread support library. This affects the Objective-C compiler and runtime library, and exception handling for other languages like C++ and Java. The possibilities for lib are:
    aix
        AIX thread support.
    dce
        DCE thread support.
    lynx
        LynxOS thread support.
    mipssde
        MIPS SDE thread support.
    no
        This is an alias for `single'.
    posix
        Generic POSIX/Unix98 thread support.
    rtems
        RTEMS thread support.
    single
        Disable thread support, should work for all platforms.
    tpf
        TPF thread support.
    vxworks
        VxWorks thread support.
    win32
        Microsoft Win32 API thread support.