Compare commits
273
Commits
release_37
...
release_39
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f38e0ce0f1 | ||
|
|
b402abdbbf | ||
|
|
ae6d028427 | ||
|
|
91b0f59656 | ||
|
|
05cf7728d5 | ||
|
|
168b27e91b | ||
|
|
82fb5e6198 | ||
|
|
17265704ce | ||
|
|
e942708d81 | ||
|
|
643c28a2e4 | ||
|
|
fa6d122132 | ||
|
|
7ff70929d2 | ||
|
|
248f6cc602 | ||
|
|
d72ef36ee0 | ||
|
|
da4548933a | ||
|
|
e570daa772 | ||
|
|
4720bb4a5c | ||
|
|
5afb0c9897 | ||
|
|
f01e27f138 | ||
|
|
1a885988bf | ||
|
|
ad958989b0 | ||
|
|
153bf3fb97 | ||
|
|
d770e3b3e6 | ||
|
|
e402afb408 | ||
|
|
d2f54c3c3b | ||
|
|
5fda24f1d2 | ||
|
|
ab79479bbf | ||
|
|
8d07e31950 | ||
|
|
de40b77396 | ||
|
|
bef163a8b2 | ||
|
|
1860d030e5 | ||
|
|
555cbc14bd | ||
|
|
e82ed9c802 | ||
|
|
c1cd14fc40 | ||
|
|
24cb1f28b4 | ||
|
|
e5a6ff39db | ||
|
|
7ffaa1b0a4 | ||
|
|
5c280a4383 | ||
|
|
5ff54f36e0 | ||
|
|
4cbdcd9d46 | ||
|
|
0951fde96b | ||
|
|
cdab46b74d | ||
|
|
171ddd1f23 | ||
|
|
f7dc7b1746 | ||
|
|
146e0c7b5f | ||
|
|
021a4a2897 | ||
|
|
ed25b3ab12 | ||
|
|
8672b2ed72 | ||
|
|
49c056c6db | ||
|
|
f981e33157 | ||
|
|
6018ddafaa | ||
|
|
56168b3a23 | ||
|
|
93153d271f | ||
|
|
a763c59623 | ||
|
|
8951c8e6f3 | ||
|
|
e75e989062 | ||
|
|
50df1d2f4c | ||
|
|
a93f24d670 | ||
|
|
ce32bac98c | ||
|
|
cbb2a49897 | ||
|
|
541b718def | ||
|
|
100061452c | ||
|
|
5ecfa9d187 | ||
|
|
fea1a1cd1a | ||
|
|
9c04b6d2d7 | ||
|
|
177c3c8777 | ||
|
|
58cc7e0de3 | ||
|
|
531ce2ade7 | ||
|
|
43eef9805e | ||
|
|
561ebb5943 | ||
|
|
f7f0293db9 | ||
|
|
9cab9c8fc5 | ||
|
|
fcef12cd45 | ||
|
|
9c8a7db909 | ||
|
|
b0081632c4 | ||
|
|
aa4e4f26ff | ||
|
|
da1e2c84c3 | ||
|
|
9c0b306f7d | ||
|
|
d19f27349b | ||
|
|
65f68b9d4b | ||
|
|
1238ecb8f7 | ||
|
|
700a1a0f37 | ||
|
|
e0719d4bb6 | ||
|
|
bac3f87342 | ||
|
|
8a3c7df762 | ||
|
|
2f585ea95f | ||
|
|
039c3ab59a | ||
|
|
45c857dc34 | ||
|
|
843428ce2a | ||
|
|
3bef31a43c | ||
|
|
d3e4ccd5d4 | ||
|
|
43ffd46990 | ||
|
|
56dc65916c | ||
|
|
376dc01a45 | ||
|
|
0a8fbe6d06 | ||
|
|
c87f146dfd | ||
|
|
bda570af9c | ||
|
|
3fb06fd2fe | ||
|
|
be019e9440 | ||
|
|
949a018241 | ||
|
|
089e14d905 | ||
|
|
84ea928f38 | ||
|
|
7b70a4f1f5 | ||
|
|
7b93f85cfe | ||
|
|
30f9d73139 | ||
|
|
65298d8318 | ||
|
|
f2e12f4e42 | ||
|
|
71b975dd98 | ||
|
|
3bcc68623b | ||
|
|
014497155a | ||
|
|
0dd34acf87 | ||
|
|
b6ab8f8fd7 | ||
|
|
55582d0683 | ||
|
|
569d1e46d8 | ||
|
|
a83f15dc1f | ||
|
|
cc34ba0458 | ||
|
|
b5e41b49f7 | ||
|
|
53e20db26d | ||
|
|
8d0a576cf4 | ||
|
|
4ceed43a1f | ||
|
|
03208f6d91 | ||
|
|
9a5f28cca8 | ||
|
|
85b4f2c9cf | ||
|
|
c0a469edc3 | ||
|
|
d64c3d7995 | ||
|
|
3d4a12f1c0 | ||
|
|
9a94fcde13 | ||
|
|
33b0f4a88e | ||
|
|
ad1775a1cf | ||
|
|
1588c74337 | ||
|
|
0c1f627ac8 | ||
|
|
a5496bff70 | ||
|
|
c62c0fa658 | ||
|
|
4255e2f88d | ||
|
|
373c7b45ae | ||
|
|
e0df9a933b | ||
|
|
662997c02a | ||
|
|
1251a47e34 | ||
|
|
cb7899d667 | ||
|
|
1256a5d50f | ||
|
|
20e20fe91a | ||
|
|
db9f0656a6 | ||
|
|
ccd4e436a1 | ||
|
|
0ccf0552f5 | ||
|
|
09d935a93e | ||
|
|
7ed52f6efa | ||
|
|
38c9e1422e | ||
|
|
0355c11c1d | ||
|
|
5b35c4a417 | ||
|
|
fa6b30f80a | ||
|
|
78e62243f9 | ||
|
|
2db9469c66 | ||
|
|
b035b29274 | ||
|
|
dc8116e660 | ||
|
|
bfffb780fe | ||
|
|
86a6c9071f | ||
|
|
306381bbda | ||
|
|
940dd50273 | ||
|
|
444b0e1c07 | ||
|
|
4f88c88870 | ||
|
|
3d9851ae3c | ||
|
|
a632fb38bb | ||
|
|
c73da114f8 | ||
|
|
da540cd0d0 | ||
|
|
c77957295e | ||
|
|
7209df241a | ||
|
|
0d9b4ce671 | ||
|
|
98c0f1f794 | ||
|
|
ac919e8776 | ||
|
|
ef79bf6744 | ||
|
|
3c0db8d0f0 | ||
|
|
c4efcf656b | ||
|
|
acb7b535be | ||
|
|
93b3e400ad | ||
|
|
ce2fd30954 | ||
|
|
63a38dc75a | ||
|
|
ea87904bc4 | ||
|
|
8d380df97b | ||
|
|
d62fdbdc17 | ||
|
|
c33a75a1ae | ||
|
|
8d8e4657d1 | ||
|
|
271a72612d | ||
|
|
59fd2d5636 | ||
|
|
5fedb90a30 | ||
|
|
22361cf975 | ||
|
|
de99836584 | ||
|
|
e2b86ca4e4 | ||
|
|
0d94178f2d | ||
|
|
18e13ca264 | ||
|
|
21b23ce699 | ||
|
|
6e98151883 | ||
|
|
9543a7dad8 | ||
|
|
5677b5095c | ||
|
|
f15a791e85 | ||
|
|
103648dd39 | ||
|
|
dfa0ba085a | ||
|
|
2332aabedb | ||
|
|
b9e8048db1 | ||
|
|
e73ff632d5 | ||
|
|
7e9ea404f1 | ||
|
|
a4032ada02 | ||
|
|
dfa603c6ec | ||
|
|
73bdc170b5 | ||
|
|
120e5c4db4 | ||
|
|
62e3cf352c | ||
|
|
5e4f900fd0 | ||
|
|
d1e8ef1834 | ||
|
|
eee928503e | ||
|
|
8ec4ec3838 | ||
|
|
2a541f0d91 | ||
|
|
c64cfb2ef1 | ||
|
|
d76e1838f1 | ||
|
|
90185a5f18 | ||
|
|
fd69bc2810 | ||
|
|
89eb36ffe7 | ||
|
|
25344f9ecc | ||
|
|
a2b144ab95 | ||
|
|
b62edcf6b8 | ||
|
|
d18f8d4d8c | ||
|
|
7811d1db7f | ||
|
|
9e321cbfc5 | ||
|
|
2aec68db20 | ||
|
|
61bb8dd178 | ||
|
|
70eac4ffbd | ||
|
|
60a90c830f | ||
|
|
8cd13fe13e | ||
|
|
98bea25703 | ||
|
|
cecce61d1e | ||
|
|
f56794a06c | ||
|
|
05e6b65636 | ||
|
|
9a904471e9 | ||
|
|
5c72f9ce80 | ||
|
|
0401c9a540 | ||
|
|
8aa5b7d146 | ||
|
|
34260e3af7 | ||
|
|
48df373982 | ||
|
|
0b3c56d5b5 | ||
|
|
ccc39aacca | ||
|
|
e78ed18a55 | ||
|
|
fb9db4c128 | ||
|
|
349425018c | ||
|
|
f8089721ae | ||
|
|
a774451283 | ||
|
|
b6c63f3ee3 | ||
|
|
45318d1e6f | ||
|
|
ac4964ceea | ||
|
|
1960f887c7 | ||
|
|
d78ef70561 | ||
|
|
9c8205e43f | ||
|
|
0e47cdd237 | ||
|
|
1887f0f2ed | ||
|
|
c3e1a461e2 | ||
|
|
fc660a2d58 | ||
|
|
fc8ef92585 | ||
|
|
a5220977d0 | ||
|
|
aab4548382 | ||
|
|
6a56f9430c | ||
|
|
7bd6023443 | ||
|
|
9eca9d092c | ||
|
|
9d7a4861d7 | ||
|
|
d90b41fbda | ||
|
|
2991608ede | ||
|
|
4738131753 | ||
|
|
9a343549b4 | ||
|
|
7edc770912 | ||
|
|
416a19a376 | ||
|
|
a02bbb9b3a | ||
|
|
50be853810 | ||
|
|
d907054da3 | ||
|
|
9b32683178 | ||
|
|
b2e5aba353 | ||
|
|
9d41ae24e1 | ||
|
|
81551056dc |
@@ -1,2 +1,5 @@
|
||||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||
|
||||
set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing")
|
||||
|
||||
add_subdirectory(runtime)
|
||||
|
||||
+6
-2
@@ -18,7 +18,7 @@ D: Contributor to testsuite from OpenUH
|
||||
N: Barbara Chapman
|
||||
D: Contributor to testsuite from OpenUH
|
||||
|
||||
N: University of Houston
|
||||
N: University of Houston
|
||||
W: http://web.cs.uh.edu/~openuh/download/
|
||||
D: OpenUH test suite
|
||||
|
||||
@@ -49,5 +49,9 @@ N: Alp Toker
|
||||
E: alp@nuanti.com
|
||||
D: Making build work for FreeBSD.
|
||||
|
||||
N: Cheng Wang
|
||||
N: Cheng Wang
|
||||
D: Contributor to testsuite from OpenUH
|
||||
|
||||
N: Diego Caballero
|
||||
E: diego.l.caballero@gmail.com
|
||||
D: Fork performance improvements
|
||||
|
||||
+52
-2
@@ -14,7 +14,7 @@ software contained in this directory tree is included below.
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 1997-2015 Intel Corporation
|
||||
Copyright (c) 1997-2016 Intel Corporation
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -51,7 +51,7 @@ SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 1997-2014 Intel Corporation
|
||||
Copyright (c) 1997-2016 Intel Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -122,3 +122,53 @@ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
ARM Limited
|
||||
|
||||
Software Grant License Agreement ("Agreement")
|
||||
|
||||
Except for the license granted herein to you, ARM Limited ("ARM") reserves all
|
||||
right, title, and interest in and to the Software (defined below).
|
||||
|
||||
Definition
|
||||
|
||||
"Software" means the code and documentation as well as any original work of
|
||||
authorship, including any modifications or additions to an existing work, that
|
||||
is intentionally submitted by ARM to llvm.org (http://llvm.org) ("LLVM") for
|
||||
inclusion in, or documentation of, any of the products owned or managed by LLVM
|
||||
(the "Work"). For the purposes of this definition, "submitted" means any form of
|
||||
electronic, verbal, or written communication sent to LLVM or its
|
||||
representatives, including but not limited to communication on electronic
|
||||
mailing lists, source code control systems, and issue tracking systems that are
|
||||
managed by, or on behalf of, LLVM for the purpose of discussing and improving
|
||||
the Work, but excluding communication that is conspicuously marked otherwise.
|
||||
|
||||
1. Grant of Copyright License. Subject to the terms and conditions of this
|
||||
Agreement, ARM hereby grants to you and to recipients of the Software
|
||||
distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge,
|
||||
royalty-free, irrevocable copyright license to reproduce, prepare derivative
|
||||
works of, publicly display, publicly perform, sublicense, and distribute the
|
||||
Software and such derivative works.
|
||||
|
||||
2. Grant of Patent License. Subject to the terms and conditions of this
|
||||
Agreement, ARM hereby grants you and to recipients of the Software
|
||||
distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge,
|
||||
royalty-free, irrevocable (except as stated in this section) patent license
|
||||
to make, have made, use, offer to sell, sell, import, and otherwise transfer
|
||||
the Work, where such license applies only to those patent claims licensable
|
||||
by ARM that are necessarily infringed by ARM's Software alone or by
|
||||
combination of the Software with the Work to which such Software was
|
||||
submitted. If any entity institutes patent litigation against ARM or any
|
||||
other entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that ARM's Software, or the Work to which ARM has contributed constitutes
|
||||
direct or contributory patent infringement, then any patent licenses granted
|
||||
to that entity under this Agreement for the Software or Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the software is
|
||||
provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
either express or implied, including, without limitation, any warranties or
|
||||
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
+120
-138
@@ -9,11 +9,12 @@
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
How to Build the LLVM* OpenMP* Runtime Library using CMake
|
||||
===========================================
|
||||
==========================================================
|
||||
How to Build the LLVM* OpenMP* Runtime Library using CMake
|
||||
==========================================================
|
||||
|
||||
==== Version of CMake required: v2.8.0 or above ====
|
||||
|
||||
---- Version of CMake required: v2.8.0 or above ----
|
||||
|
||||
============================================
|
||||
How to call cmake initially, then repeatedly
|
||||
============================================
|
||||
@@ -25,23 +26,23 @@ How to call cmake initially, then repeatedly
|
||||
- Example of configuring, building, reconfiguring, rebuilding:
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=32 .. # Initial configuration
|
||||
$ make all common
|
||||
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=i386 .. # Initial configuration
|
||||
$ make
|
||||
...
|
||||
$ make clean
|
||||
$ cmake -DLIBOMP_ARCH=32e -DCMAKE_BUILD_TYPE=Debug .. # Second configuration
|
||||
$ make all common
|
||||
$ cmake -DLIBOMP_ARCH=x86_64 -DCMAKE_BUILD_TYPE=Debug .. # Second configuration
|
||||
$ make
|
||||
...
|
||||
$ rm -rf *
|
||||
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=32e .. # Third configuration
|
||||
$ make all common
|
||||
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=x86_64 .. # Third configuration
|
||||
$ make
|
||||
- Notice in the example how the compiler definitions are only specified
|
||||
for an empty build directory, but other Build options are used at any time.
|
||||
- The file CMakeCache.txt which is created after the first call to cmake
|
||||
is a configuration file which holds all the values for the Build options.
|
||||
These configuration values can be changed using a text editor to modify
|
||||
These configuration values can be changed using a text editor to modify
|
||||
CMakeCache.txt as opposed to using definitions on the command line.
|
||||
- To have cmake create a particular type of build generator file simply
|
||||
- To have cmake create a particular type of build generator file simply
|
||||
inlude the -G <Generator name> option:
|
||||
$ cmake -G "Unix Makefiles" ...
|
||||
You can see a list of generators cmake supports by executing cmake with
|
||||
@@ -54,189 +55,170 @@ Instructions to Build
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
|
||||
[ Linux* , Mac* Libraries ]
|
||||
[ Unix* Libraries ]
|
||||
$ cmake -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> ..
|
||||
|
||||
[ Intel(R) Many Integrated Core Library (Intel(R) MIC Library) ]
|
||||
$ cmake -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -DLIBOMP_ARCH=mic ..
|
||||
|
||||
[ Windows Libraries ]
|
||||
$ cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -DCMAKE_ASM_MASM_COMPILER=[ml | ml64] -DCMAKE_BUILD_TYPE=Release ..
|
||||
$ cmake -G <Generator Type> -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -DCMAKE_ASM_MASM_COMPILER=[ml | ml64] -DCMAKE_BUILD_TYPE=Release ..
|
||||
|
||||
$ make all common
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
=================
|
||||
==================
|
||||
Mac* Fat Libraries
|
||||
=================
|
||||
==================
|
||||
On OS X* machines, it is possible to build universal (or fat) libraries which
|
||||
include both IA-32 architecture and Intel(R) 64 architecture objects in a
|
||||
single archive; just build the 32 and 32e libraries separately:
|
||||
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBOMP_ARCH=32 ..
|
||||
include both i386 and x86_64 architecture objects in a
|
||||
single archive.
|
||||
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_OSX_ARCHITECTURES='i386;x86_64' ..
|
||||
$ make
|
||||
$ cmake -DLIBOMP_ARCH=32e ..
|
||||
$ make
|
||||
then invoke make again with a special argument as follows:
|
||||
$ make fat
|
||||
- The fat target is only available for the LIBOMP_ARCH=32e configuration.
|
||||
- The fat libraries will be put in exports/mac_32e/lib while the "thin" libraries
|
||||
will be in exports/mac_32e/lib.thin and exports/mac_32/lib.thin
|
||||
There is also an option -DLIBOMP_OSX_ARCHITECTURES which can be set in case
|
||||
this is an LLVM source tree build which will only set the libomp library
|
||||
to a universal fat library and prevent having the entire llvm/clang build
|
||||
produce universal binaries.
|
||||
|
||||
================
|
||||
Compiler options
|
||||
================
|
||||
===========
|
||||
Micro tests
|
||||
===========
|
||||
After the library has been built, there are five optional microtests that
|
||||
can be performed. Some will be skipped based upon the platform.
|
||||
To run the tests,
|
||||
$ make libomp-micro-tests
|
||||
|
||||
=============
|
||||
CMake options
|
||||
=============
|
||||
-DCMAKE_C_COMPILER=<C compiler name>
|
||||
Specify the C compiler
|
||||
|
||||
-DCMAKE_CXX_COMPILER=<C++ compiler name>
|
||||
Specify the C++ compiler
|
||||
|
||||
-DCMAKE_Fortran_COMPILER=<Fortran compiler name>
|
||||
Unix* systems (Optional as compiler is default):
|
||||
This option is only needed when -DLIBOMP_FORTRAN_MODULES is true
|
||||
This option is only needed when -DLIBOMP_FORTRAN_MODULES is on.
|
||||
So typically, a Fortran compiler is not needed during the build.
|
||||
Specify the Fortran compiler
|
||||
|
||||
-DCMAKE_ASM_MASM_COMPILER=[ml | ml64 ]
|
||||
This option is Windows* Only
|
||||
|
||||
=============
|
||||
Build options
|
||||
=============
|
||||
-DLIBOMP_ARCH=i386|x86_64|arm|ppc64|ppc64le|aarch64|mic
|
||||
The default for the option is chosen based on the probing the compiler for
|
||||
architecture macros (e.g., is __x86_64__ predefined by compiler?).
|
||||
|
||||
==========================
|
||||
==== Operating System ====
|
||||
==========================
|
||||
-DLIBOMP_OS=lin|mac|win
|
||||
* Operating system can be lin (Linux*), mac (Mac*), or win (Windows*).
|
||||
If not specified, cmake will try to determine your current operating system.
|
||||
|
||||
======================
|
||||
==== Architecture ====
|
||||
======================
|
||||
-DLIBOMP_ARCH=32|32e|arm|ppc64|ppc64le|aarch64|mic
|
||||
* Architecture can be 32 (IA-32 architecture), 32e (Intel(R) 64 architecture),
|
||||
arm (ARM architecture), aarch64 (ARMv8 architecture), ppc64 (PPC64 architecture),
|
||||
or ppc64le (little endian PPC64 architecture).
|
||||
* This option, by default is chosen based on the probing the compiler for
|
||||
architecture macros (e.g., is __x86_64__ predefined by compiler?).
|
||||
|
||||
---- First values listed are the default value ----
|
||||
==== First values listed are the default value ====
|
||||
-DLIBOMP_LIB_TYPE=normal|profile|stubs
|
||||
Library type can be normal, profile, or stubs.
|
||||
|
||||
-DCMAKE_BUILD_TYPE=Release|Debug|RelWithDebInfo
|
||||
Build type can be Release, Debug, or RelWithDebInfo.
|
||||
|
||||
-DLIBOMP_VERSION=5|4
|
||||
libomp version can be 5 or 4.
|
||||
|
||||
-DLIBOMP_OMP_VERSION=40|30
|
||||
OpenMP version can be either 40 or 30.
|
||||
-DLIBOMP_OMP_VERSION=45|40|30
|
||||
OpenMP version can be either 45, 40 or 30.
|
||||
|
||||
-DLIBOMP_MIC_ARCH=knc|knf
|
||||
Intel(R) MIC Architecture, can be knf or knc.
|
||||
This value is ignored if LIBOMP_ARCH != mic
|
||||
|
||||
Intel(R) MIC Architecture, can be knf or knc.
|
||||
|
||||
-DLIBOMP_FORTRAN_MODULES=off|on
|
||||
Should the Fortran modules be created (requires Fortran compiler)
|
||||
|
||||
-DLIBOMP_STATS=off|on
|
||||
Should include stats-gathering code?
|
||||
-DLIBOMP_USE_ADAPTIVE_LOCKS=on|off
|
||||
Should adaptive (TSX-based) locks be included?
|
||||
These are x86 specific. This feature is turned on by default
|
||||
for i386 and x86_64. Otherwise, it is turned off.
|
||||
|
||||
-DLIBOMP_OMPT_SUPPORT=off|on
|
||||
Should OMPT support be turned on? (Not supported on Windows)
|
||||
If LIBOMP_OMPT_SUPPORT is off, then both ompt_blame and ompt_trace are ignored.
|
||||
|
||||
-DLIBOMP_OMPT_BLAME=on|off
|
||||
Should OMPT blame functionality be turned on?
|
||||
|
||||
-DLIBOMP_OMPT_TRACE=on|off
|
||||
Should OMPT trace functionality be turned on?
|
||||
|
||||
=====================
|
||||
==== Micro tests ====
|
||||
=====================
|
||||
After the library has been built, there are five optional microtests that
|
||||
can be performed. Some will be skipped based upon the platform.
|
||||
These tests can be turned on (default) or off with the following options:
|
||||
-DLIBOMP_TEST_TOUCH=on|off -- Should the touch test be done?
|
||||
-DLIBOMP_TEST_RELO=on|off -- Should the position independent code test be done?
|
||||
-DLIBOMP_TEST_EXECSTACK=on|off -- Should the stack be checked for executability?
|
||||
-DLIBOMP_TEST_INSTR=on|off -- Should the Intel(R) MIC Libraries be checked
|
||||
for correct instruction set?
|
||||
-DLIBOMP_TEST_DEPS=on|off -- Should libomp's dependencies be checked?
|
||||
-DLIBOMP_MICRO_TESTS=off|on -- Should any of the above tests be done?
|
||||
If -DLIBOMP_MICRO_TESTS=on is specified, the user can then call:
|
||||
$ make libomp-micro-tests
|
||||
which runs the tests.
|
||||
|
||||
============================================
|
||||
==== How to append flags to compilation ====
|
||||
============================================
|
||||
- These flags are *appended*. They do not
|
||||
overwrite any of the preset flags.
|
||||
-DLIBOMP_CPPFLAGS=<space-separated flags> -- Additional C Preprocessor flags
|
||||
(typically additional -Ddef=val flags)
|
||||
-DLIBOMP_CFLAGS=<space-separated flags> -- Additional C compiler flags
|
||||
-DLIBOMP_CXXFLAGS=<space-separated flags> -- Additional C++ compiler flags
|
||||
-DLIBOMP_ASMFLAGS=<space-separated flags> -- Additional assembly flags
|
||||
-DLIBOMP_LDFLAGS=<space-separated flags> -- Additional linker flags
|
||||
-DLIBOMP_LIBFLAGS=<space-separated flags> -- Additional libraries to link
|
||||
to during link phase
|
||||
-DLIBOMP_FFLAGS=<space-separated flags> -- Additional Fortran compiler flags
|
||||
|
||||
===================================
|
||||
==== Feature Based Compilation ====
|
||||
===================================
|
||||
-DLIBOMP_USE_BUILDPL_RULES=false|true
|
||||
Should the build imitate build.pl's build process.
|
||||
When this is true, the Unix* Release builds will build libomp
|
||||
with -O2 and -g flags activated (same as RelWithDebInfo). Then,
|
||||
the debug info is stripped out of the library and put into libomp.dbg
|
||||
This is done for interaction with Intel(R) Parallel Amplifier.
|
||||
|
||||
-DLIBOMP_USE_ADAPTIVE_LOCKS=true|false
|
||||
Should adaptive (TSX-based) locks be included?
|
||||
These are x86 specific. This feature is turned on by default
|
||||
for IA-32 architecture and Intel(R) 64 architecture.
|
||||
Otherwise, it is turned off.
|
||||
|
||||
-DLIBOMP_USE_INTERNODE_ALIGNMENT=false|true
|
||||
-DLIBOMP_USE_INTERNODE_ALIGNMENT=off|on
|
||||
Should 4096-byte alignment be used for certain data structures?
|
||||
This option is useful on multinode systems where a small CACHE_LINE
|
||||
setting leads to false sharing. This option is off by default.
|
||||
|
||||
-DLIBOMP_USE_VERSION_SYMBOLS=true|false
|
||||
-DLIBOMP_USE_VERSION_SYMBOLS=on|off
|
||||
Should versioned symbols be used for building the library?
|
||||
This option only makes sense for ELF based libraries where version
|
||||
symbols are supported (Linux, some BSD* variants). It is off
|
||||
by default for Windows and Mac, but on for other Unix based operating
|
||||
systems.
|
||||
|
||||
-DLIBOMP_USE_PREDEFINED_LINKER_FLAGS=true|false
|
||||
Should the predefined linker flags in CommonFlags.cmake be included
|
||||
in the link command? This is true by default and should work for
|
||||
Linux*, Mac*, and Windows*. The --version-script flag on Unix* based
|
||||
operating systems will be included regardless.
|
||||
-DLIBOMP_ENABLE_SHARED=on|off
|
||||
Shared library instead of static library? (Note: static libraries are not
|
||||
supported on Windows). If LIBOMP_ENABLE_SHARED is off, then static OpenMP
|
||||
libraries will be built instead of dynamic ones.
|
||||
|
||||
========================
|
||||
Examples usages of CMake
|
||||
========================
|
||||
-DLIBOMP_OMPT_SUPPORT=off|on
|
||||
Should OMPT support be included in the build? (Not supported on Windows)
|
||||
If LIBOMP_OMPT_SUPPORT is off, then both ompt_blame and ompt_trace are ignored.
|
||||
|
||||
-DLIBOMP_OMPT_BLAME=on|off
|
||||
Should OMPT blame functionality be included in the build?
|
||||
|
||||
-DLIBOMP_OMPT_TRACE=on|off
|
||||
Should OMPT trace functionality be included in the build?
|
||||
|
||||
-DLIBOMP_STATS=off|on
|
||||
Should include stats-gathering code be included in the build?
|
||||
|
||||
-DLIBOMP_USE_DEBUGGER=off|on
|
||||
Should the friendly debugger interface be included in the build?
|
||||
|
||||
-DLIBOMP_USE_HWLOC=off|on
|
||||
Should the Hwloc library be used for affinity?
|
||||
This option is not supported on Windows.
|
||||
http://www.open-mpi.org/projects/hwloc
|
||||
|
||||
-DLIBOMP_HWLOC_INSTALL_DIR=/path/to/hwloc/install/dir
|
||||
Default: /usr/local
|
||||
This option is only used if LIBOMP_USE_HWLOC is on.
|
||||
Specifies install location of Hwloc. The configuration system will look for
|
||||
hwloc.h in ${LIBOMP_HWLOC_INSTALL_DIR}/include and the library in
|
||||
${LIBOMP_HWLOC_INSTALL_DIR}/lib.
|
||||
|
||||
-DLIBOMP_LLVM_LIT_EXECUTABLE=/path/to/llvm-lit
|
||||
Default: search in PATH
|
||||
Specifiy full path to llvm-lit executable for running tests.
|
||||
|
||||
-DOPENMP_LLVM_TOOLS_DIR=/path/to/built/llvm/tools
|
||||
Default: search for tools in path
|
||||
Additional path to search for LLVM tools needed by tests.
|
||||
|
||||
================================
|
||||
How to append flags to the build
|
||||
================================
|
||||
- These flags are *appended*. They do not
|
||||
overwrite any of the preset flags.
|
||||
-DLIBOMP_CPPFLAGS=<space-separated flags> -- Additional C preprocessor flags
|
||||
-DLIBOMP_CFLAGS=<space-separated flags> -- Additional C compiler flags
|
||||
-DLIBOMP_CXXFLAGS=<space-separated flags> -- Additional C++ compiler flags
|
||||
-DLIBOMP_ASMFLAGS=<space-separated flags> -- Additional assembly flags
|
||||
-DLIBOMP_LDFLAGS=<space-separated flags> -- Additional linker flags
|
||||
-DLIBOMP_LIBFLAGS=<space-separated flags> -- Additional libraries to link
|
||||
-DLIBOMP_FFLAGS=<space-separated flags> -- Additional Fortran compiler flags
|
||||
|
||||
=======================
|
||||
Example usages of CMake
|
||||
=======================
|
||||
---- Typical usage ----
|
||||
cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc ..
|
||||
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..
|
||||
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
|
||||
|
||||
---- With Various Options ----
|
||||
- Build the 32 bit Linux library using GCC*
|
||||
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_OS=lin -DLIBOMP_ARCH=32 ..
|
||||
- Build the i386 Linux library using GCC*
|
||||
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=i386 ..
|
||||
|
||||
- Build the 32 bit debug Mac library using Clang*
|
||||
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBOMP_OS=mac -DLIBOMP_ARCH=32 -DCMAKE_BUILD_TYPE=Debug ..
|
||||
- Build the x86_64 debug Mac library using Clang*
|
||||
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBOMP_ARCH=x86_64 -DCMAKE_BUILD_TYPE=Debug ..
|
||||
|
||||
- Build the library (architecture determined by probing compiler) using the
|
||||
Intel(R) C Compiler and the Intel(R) C++ Compiler. Also, create the fortran modules using
|
||||
the Intel(R) Fortran Compiler, enabling the libomp-micro-tests target and using similar rules that build.pl
|
||||
would use to build the library.
|
||||
cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort -DLIBOMP_MICRO_TESTS=on -DLIBOMP_FORTRAN_MODULES=on -DLIBOMP_USE_BUILDPL_RULES=on ..
|
||||
the Intel(R) Fortran Compiler.
|
||||
cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort -DLIBOMP_FORTRAN_MODULES=on ..
|
||||
|
||||
- Have CMake Find the C/C++ compiler, and specify additional flags for the C compiler, preprocessor, and C++ compiler.
|
||||
cmake -DLIBOMP_CFLAGS='Werror' -DLIBOMP_CPPFLAGS='-DNEW_FEATURE=1 -DOLD_FEATURE=0' -DLIBOMP_CXXFLAGS='-Werror -Wsign-compare' ..
|
||||
cmake -DLIBOMP_CFLAGS='-specific-flag' -DLIBOMP_CPPFLAGS='-DNEW_FEATURE=1 -DOLD_FEATURE=0' -DLIBOMP_CXXFLAGS='--one-specific-flag --two-specific-flag' ..
|
||||
|
||||
---- Build the stubs library ----
|
||||
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_LIB_TYPE=stubs ..
|
||||
|
||||
+279
-514
@@ -9,224 +9,157 @@
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
################
|
||||
# CMAKE libomp
|
||||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||
|
||||
#########
|
||||
# GLOBALS
|
||||
set(GLOBAL_DEBUG 0)
|
||||
|
||||
# Add cmake directory to search for custom cmake functions
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
#######################################################################
|
||||
# Standalone build or part of LLVM?
|
||||
set(LIBOMP_STANDALONE_BUILD FALSE)
|
||||
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" OR
|
||||
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" OR
|
||||
"${CMAKE_SOURCE_DIR}/runtime" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
project(libomp C CXX)
|
||||
set(LIBOMP_STANDALONE_BUILD TRUE)
|
||||
project(libomp C CXX)
|
||||
set(LIBOMP_STANDALONE_BUILD TRUE)
|
||||
endif()
|
||||
|
||||
# These include files are in cmake/ subdirectory except for FindPerl which is a cmake standard module
|
||||
include(HelperFunctions)
|
||||
include(Definitions) # -D definitions when compiling
|
||||
include(CommonFlags) # compiler, assembler, fortran, linker flags common for all compilers
|
||||
include(SourceFiles) # source files to compile
|
||||
include(PerlFlags) # Perl flags for generate-def.pl and expand-vars.pl
|
||||
include(FindPerl) # Standard cmake module to check for Perl
|
||||
include(GetArchitecture) # get_architecture()
|
||||
# Set libomp version
|
||||
set(LIBOMP_VERSION_MAJOR 5)
|
||||
set(LIBOMP_VERSION_MINOR 0)
|
||||
|
||||
####################################################################
|
||||
# CONFIGURATION
|
||||
#
|
||||
# * Any variable/value that is CACHE-ed can be changed after the initial run of cmake
|
||||
# through the file, CMakeCache.txt which is in the build directory.
|
||||
# * If you change any value in CMakeCache.txt, then just run cmake ..
|
||||
# and the changed will be picked up. One can also use -DVARIABLE=VALUE
|
||||
# when calling cmake to changed configuration values.
|
||||
# * CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_ASM_MASM_COMPILER, CMAKE_ASM_COMPILER,
|
||||
# CMAKE_Fortran_COMPILER can only by specified on the initial run of cmake.
|
||||
# This means you cannot specify -DCMAKE_C_COMPILER= on a subsequent run of cmake
|
||||
# in the same build directory until that build directory is emptied.
|
||||
# If you want to change the compiler, then empty the build directory and rerun cmake.
|
||||
# These include files are in the cmake/ subdirectory
|
||||
include(LibompUtils)
|
||||
include(LibompGetArchitecture)
|
||||
include(LibompHandleFlags)
|
||||
include(LibompDefinitions)
|
||||
|
||||
# Build Configuration
|
||||
set(os_possible_values lin mac win)
|
||||
set(arch_possible_values 32e 32 arm ppc64 ppc64le aarch64 mic)
|
||||
set(build_type_possible_values release debug relwithdebinfo)
|
||||
set(omp_version_possible_values 41 40 30)
|
||||
set(lib_type_possible_values normal profile stubs)
|
||||
set(mic_arch_possible_values knf knc)
|
||||
|
||||
# Below, cmake will try and determine the operating system and architecture for you.
|
||||
# These values are set in CMakeCache.txt when cmake is first run (-Dvar_name=... will take precedence)
|
||||
# parameter | default value
|
||||
# ----------------------------
|
||||
# Right now, this build system considers os=lin to mean "Unix-like that is not MAC"
|
||||
# Apple goes first because CMake considers Mac to be a Unix based
|
||||
# operating system, while libomp considers it a special case
|
||||
if(${APPLE})
|
||||
set(temp_os mac)
|
||||
elseif(${UNIX})
|
||||
set(temp_os lin)
|
||||
elseif(${WIN32})
|
||||
set(temp_os win)
|
||||
else()
|
||||
set(temp_os lin)
|
||||
# Determine the target architecture
|
||||
if(${LIBOMP_STANDALONE_BUILD})
|
||||
# If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake
|
||||
libomp_get_architecture(LIBOMP_DETECTED_ARCH)
|
||||
set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING
|
||||
"The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic).")
|
||||
# Allow user to choose a suffix for the installation directory.
|
||||
set(LIBOMP_LIBDIR_SUFFIX "" CACHE STRING
|
||||
"suffix of lib installation directory e.g., 64 => lib64")
|
||||
# Should assertions be enabled? They are on by default.
|
||||
set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL
|
||||
"enable assertions?")
|
||||
set(LIBOMP_ENABLE_WERROR FALSE CACHE BOOL
|
||||
"Enable -Werror flags to turn warnings into errors for supporting compilers.")
|
||||
# CMAKE_BUILD_TYPE was not defined, set default to Release
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
else() # Part of LLVM build
|
||||
# Determine the native architecture from LLVM.
|
||||
string(TOLOWER "${LLVM_TARGET_ARCH}" LIBOMP_NATIVE_ARCH)
|
||||
if( LIBOMP_NATIVE_ARCH STREQUAL "host" )
|
||||
string(REGEX MATCH "^[^-]*" LIBOMP_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
|
||||
endif ()
|
||||
if(LIBOMP_NATIVE_ARCH MATCHES "i[2-6]86")
|
||||
set(LIBOMP_ARCH i386)
|
||||
elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86")
|
||||
set(LIBOMP_ARCH i386)
|
||||
elseif(LIBOMP_NATIVE_ARCH STREQUAL "amd64")
|
||||
set(LIBOMP_ARCH x86_64)
|
||||
elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86_64")
|
||||
set(LIBOMP_ARCH x86_64)
|
||||
elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc")
|
||||
set(LIBOMP_ARCH ppc64)
|
||||
elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64")
|
||||
set(LIBOMP_ARCH aarch64)
|
||||
elseif(LIBOMP_NATIVE_ARCH MATCHES "arm64")
|
||||
set(LIBOMP_ARCH aarch64)
|
||||
elseif(LIBOMP_NATIVE_ARCH MATCHES "arm")
|
||||
set(LIBOMP_ARCH arm)
|
||||
else()
|
||||
# last ditch effort
|
||||
libomp_get_architecture(LIBOMP_ARCH)
|
||||
endif ()
|
||||
set(LIBOMP_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
|
||||
set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
|
||||
set(LIBOMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
|
||||
endif()
|
||||
libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 mic)
|
||||
|
||||
# If adding a new architecture, take a look at cmake/GetArchitecture.cmake
|
||||
get_architecture(detected_arch)
|
||||
|
||||
set(LIBOMP_OS ${temp_os} CACHE STRING
|
||||
"The operating system to build for (lin/mac/win)")
|
||||
set(LIBOMP_ARCH ${detected_arch} CACHE STRING
|
||||
"The architecture to build for (32e/32/arm/ppc64/ppc64le/aarch64/mic). 32e is Intel(R) 64 architecture, 32 is IA-32 architecture")
|
||||
set(LIBOMP_LIB_TYPE normal CACHE STRING
|
||||
"Performance,Profiling,Stubs library (normal/profile/stubs)")
|
||||
set(LIBOMP_VERSION 5 CACHE STRING
|
||||
"Produce libguide (version 4) or libomp (version 5)")
|
||||
set(LIBOMP_OMP_VERSION 41 CACHE STRING
|
||||
"The OpenMP version (41/40/30)")
|
||||
set(LIBOMP_MIC_ARCH knc CACHE STRING
|
||||
"Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) (knf/knc). Ignored if not Intel(R) MIC Architecture build.")
|
||||
set(LIBOMP_FORTRAN_MODULES false CACHE BOOL
|
||||
"Create Fortran module files? (requires fortran compiler)")
|
||||
|
||||
# - These tests are little tests performed after the library is formed.
|
||||
# - The library won't be copied to the exports directory
|
||||
# until it has passed/skipped all below tests
|
||||
# - To skip these tests, just pass -DLIBOMP_MICRO_TESTS=OFF to cmake
|
||||
set(LIBOMP_TEST_TOUCH true CACHE BOOL
|
||||
"Perform a small touch test?")
|
||||
set(LIBOMP_TEST_RELO true CACHE BOOL
|
||||
"Perform a relocation test for dynamic libraries?")
|
||||
set(LIBOMP_TEST_EXECSTACK true CACHE BOOL
|
||||
"Perform a execstack test for linux dynamic libraries?")
|
||||
set(LIBOMP_TEST_INSTR true CACHE BOOL
|
||||
"Perform an instruction test for Intel(R) MIC Architecture libraries?")
|
||||
set(LIBOMP_TEST_DEPS true CACHE BOOL
|
||||
"Perform a library dependency test?")
|
||||
set(LIBOMP_MICRO_TESTS false CACHE BOOL
|
||||
"Perform touch, relo, execstack, instr, and deps tests?")
|
||||
|
||||
# - stats-gathering enables OpenMP stats where things like the number of
|
||||
# parallel regions, clock ticks spent in particular openmp regions are recorded.
|
||||
set(LIBOMP_STATS false CACHE BOOL
|
||||
"Stats-Gathering functionality?")
|
||||
"Performance,Profiling,Stubs library (normal/profile/stubs)")
|
||||
libomp_check_variable(LIBOMP_LIB_TYPE normal profile stubs)
|
||||
set(LIBOMP_OMP_VERSION 45 CACHE STRING
|
||||
"The OpenMP version (45/40/30)")
|
||||
if(LIBOMP_OMP_VERSION EQUAL 41)
|
||||
libomp_warning_say("LIBOMP_OMP_VERSION=41 is deprecated and will be removed in a later version. Please use 45.")
|
||||
set(LIBOMP_OMP_VERSION 45)
|
||||
endif()
|
||||
libomp_check_variable(LIBOMP_OMP_VERSION 45 40 30)
|
||||
# Set the OpenMP Year and Month assiociated with version
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
|
||||
set(LIBOMP_OMP_YEAR_MONTH 201307)
|
||||
elseif(${LIBOMP_OMP_VERSION} GREATER 30 OR ${LIBOMP_OMP_VERSION} EQUAL 30)
|
||||
set(LIBOMP_OMP_YEAR_MONTH 201107)
|
||||
else()
|
||||
set(LIBOMP_OMP_YEAR_MONTH 200505)
|
||||
endif()
|
||||
set(LIBOMP_MIC_ARCH knc CACHE STRING
|
||||
"Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) (knf/knc). Ignored if not Intel(R) MIC Architecture build.")
|
||||
if("${LIBOMP_ARCH}" STREQUAL "mic")
|
||||
libomp_check_variable(LIBOMP_MIC_ARCH knf knc)
|
||||
endif()
|
||||
set(LIBOMP_FORTRAN_MODULES FALSE CACHE BOOL
|
||||
"Create Fortran module files? (requires fortran compiler)")
|
||||
|
||||
# - Support for universal fat binary builds on Mac
|
||||
# - Having this extra variable allows people to build this library as a universal library
|
||||
# - Having this extra variable allows people to build this library as a universal library
|
||||
# without forcing a universal build of the llvm/clang compiler.
|
||||
set(LIBOMP_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING
|
||||
"For Mac builds, semicolon separated list of architectures to build for universal fat binary.")
|
||||
"For Mac builds, semicolon separated list of architectures to build for universal fat binary.")
|
||||
set(CMAKE_OSX_ARCHITECTURES ${LIBOMP_OSX_ARCHITECTURES})
|
||||
|
||||
# - Code that allows the OpenMP library to conveniently interface with debuggers
|
||||
set(LIBOMP_USE_DEBUGGER false CACHE BOOL
|
||||
"Enable debugger interface code?")
|
||||
# Should @rpath be used for dynamic libraries on Mac?
|
||||
# The if(NOT DEFINED) is there to guard a cached value of the variable if one
|
||||
# exists so there is no interference with what the user wants. Also, no cache entry
|
||||
# is created so there are no inadvertant effects on other parts of LLVM.
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH TRUE)
|
||||
endif()
|
||||
|
||||
# OMPT-support
|
||||
set(LIBOMP_OMPT_SUPPORT false CACHE BOOL
|
||||
"OMPT-support?")
|
||||
set(LIBOMP_OMPT_BLAME true CACHE BOOL
|
||||
"OMPT-blame?")
|
||||
set(LIBOMP_OMPT_TRACE true CACHE BOOL
|
||||
"OMPT-trace?")
|
||||
|
||||
# User specified flags. These are appended to the predetermined flags found
|
||||
# in CommonFlags.cmake and ${CMAKE_C_COMPILER_ID}/*Flags.cmake (e.g., GNU/CFlags.cmake)
|
||||
# User specified flags. These are appended to the configured flags.
|
||||
set(LIBOMP_CFLAGS "" CACHE STRING
|
||||
"Appended user specified C compiler flags.")
|
||||
"Appended user specified C compiler flags.")
|
||||
set(LIBOMP_CXXFLAGS "" CACHE STRING
|
||||
"Appended user specified C++ compiler flags.")
|
||||
"Appended user specified C++ compiler flags.")
|
||||
set(LIBOMP_CPPFLAGS "" CACHE STRING
|
||||
"Appended user specified C preprocessor flags.")
|
||||
"Appended user specified C preprocessor flags.")
|
||||
set(LIBOMP_ASMFLAGS "" CACHE STRING
|
||||
"Appended user specified assembler flags.")
|
||||
"Appended user specified assembler flags.")
|
||||
set(LIBOMP_LDFLAGS "" CACHE STRING
|
||||
"Appended user specified linker flags.")
|
||||
"Appended user specified linker flags.")
|
||||
set(LIBOMP_LIBFLAGS "" CACHE STRING
|
||||
"Appended user specified linked libs flags. (e.g., -lm)")
|
||||
set(LIBOMP_FFLAGS "" CACHE STRING
|
||||
"Appended user specified Fortran compiler flags. These are only used if LIBOMP_FORTRAN_MODULES==true.")
|
||||
"Appended user specified linked libs flags. (e.g., -lm)")
|
||||
set(LIBOMP_FFLAGS "" CACHE STRING
|
||||
"Appended user specified Fortran compiler flags. These are only used if LIBOMP_FORTRAN_MODULES==TRUE.")
|
||||
|
||||
# Should the libomp library and generated headers be copied into the original source exports/ directory
|
||||
# Turning this to false aids parallel builds to not interfere with each other.
|
||||
set(LIBOMP_COPY_EXPORTS true CACHE STRING
|
||||
"Should exports be copied into source exports/ directory?")
|
||||
# Turning this to FALSE aids parallel builds to not interfere with each other.
|
||||
# Currently, the testsuite module expects the just built OpenMP library to be located inside the exports/
|
||||
# directory. TODO: have testsuite run under llvm-lit directly. We can then get rid of copying to exports/
|
||||
set(LIBOMP_COPY_EXPORTS TRUE CACHE STRING
|
||||
"Should exports be copied into source exports/ directory?")
|
||||
|
||||
# - Allow three build types: Release, Debug, RelWithDebInfo (these relate to build.pl's release, debug, and diag settings respectively)
|
||||
# - default is Release (when CMAKE_BUILD_TYPE is not defined)
|
||||
# - CMAKE_BUILD_TYPE affects the -O and -g flags (CMake magically includes correct version of them on per compiler basis)
|
||||
# - typical: Release = -O3 -DNDEBUG
|
||||
# RelWithDebInfo = -O2 -g -DNDEBUG
|
||||
# Debug = -g
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
# CMAKE_BUILD_TYPE was defined, check for validity
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lowercase)
|
||||
check_variable(cmake_build_type_lowercase "${build_type_possible_values}")
|
||||
else()
|
||||
# CMAKE_BUILD_TYPE was not defined, set default to Release
|
||||
unset(CMAKE_BUILD_TYPE CACHE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING
|
||||
"Choose the type of build, options are: Release/Debug/RelWithDebInfo")
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lowercase)
|
||||
check_variable(cmake_build_type_lowercase "${build_type_possible_values}")
|
||||
endif()
|
||||
# HWLOC-support
|
||||
set(LIBOMP_USE_HWLOC FALSE CACHE BOOL
|
||||
"Use Hwloc (http://www.open-mpi.org/projects/hwloc/) library for affinity?")
|
||||
set(LIBOMP_HWLOC_INSTALL_DIR /usr/local CACHE PATH
|
||||
"Install path for hwloc library")
|
||||
|
||||
if(${LIBOMP_STANDALONE_BUILD})
|
||||
# Allow user to choose a suffix for the installation directory, or if part of
|
||||
# LLVM build then just use LLVM_LIBDIR_SUFFIX
|
||||
set(LIBOMP_LIBDIR_SUFFIX "" CACHE STRING
|
||||
"suffix of lib installation directory e.g., 64 => lib64")
|
||||
# Should assertions be enabled? They are on by default, or it part of
|
||||
# LLVM build then just use LLVM_ENABLE_ASSERTIONS
|
||||
set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL
|
||||
"enable assertions?")
|
||||
else()
|
||||
set(LIBOMP_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
|
||||
set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
|
||||
endif()
|
||||
|
||||
# Check valid values
|
||||
check_variable(LIBOMP_OS "${os_possible_values}")
|
||||
check_variable(LIBOMP_ARCH "${arch_possible_values}")
|
||||
check_variable(LIBOMP_OMP_VERSION "${omp_version_possible_values}")
|
||||
check_variable(LIBOMP_LIB_TYPE "${lib_type_possible_values}")
|
||||
if("${LIBOMP_ARCH}" STREQUAL "mic")
|
||||
check_variable(LIBOMP_MIC_ARCH "${mic_arch_possible_values}")
|
||||
endif()
|
||||
# Get the build number from kmp_version.c
|
||||
get_build_number("${CMAKE_CURRENT_SOURCE_DIR}" build_number)
|
||||
libomp_get_build_number("${CMAKE_CURRENT_SOURCE_DIR}" LIBOMP_VERSION_BUILD)
|
||||
math(EXPR LIBOMP_VERSION_BUILD_YEAR "${LIBOMP_VERSION_BUILD}/10000")
|
||||
math(EXPR LIBOMP_VERSION_BUILD_MONTH_DAY "${LIBOMP_VERSION_BUILD}%10000")
|
||||
|
||||
# Getting time and date
|
||||
# As of now, no timestamp will be created.
|
||||
set(date "No Timestamp")
|
||||
|
||||
#################################################################
|
||||
# Set some useful flags variables for other parts of cmake to use
|
||||
# Operating System
|
||||
set(LINUX FALSE)
|
||||
set(MAC FALSE)
|
||||
set(WINDOWS FALSE)
|
||||
set(MIC FALSE)
|
||||
set(FREEBSD FALSE)
|
||||
if("${LIBOMP_OS}" STREQUAL "lin")
|
||||
set(LINUX TRUE)
|
||||
set(real_os lin)
|
||||
elseif("${LIBOMP_OS}" STREQUAL "mac")
|
||||
set(MAC TRUE)
|
||||
set(real_os mac)
|
||||
elseif("${LIBOMP_OS}" STREQUAL "win")
|
||||
set(WINDOWS TRUE)
|
||||
set(real_os win)
|
||||
endif()
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
|
||||
set(FREEBSD TRUE)
|
||||
endif()
|
||||
# Currently don't record any timestamps
|
||||
set(LIBOMP_BUILD_DATE "No_Timestamp")
|
||||
|
||||
# Architecture
|
||||
set(IA32 FALSE)
|
||||
@@ -236,375 +169,207 @@ set(AARCH64 FALSE)
|
||||
set(PPC64BE FALSE)
|
||||
set(PPC64LE FALSE)
|
||||
set(PPC64 FALSE)
|
||||
if("${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture
|
||||
set(IA32 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture
|
||||
set(INTEL64 TRUE)
|
||||
set(MIC FALSE)
|
||||
if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture
|
||||
set(IA32 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "x86_64" OR "${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture
|
||||
set(INTEL64 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "arm") # ARM architecture
|
||||
set(ARM TRUE)
|
||||
set(ARM TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "ppc64") # PPC64BE architecture
|
||||
set(PPC64BE TRUE)
|
||||
set(PPC64 TRUE)
|
||||
set(PPC64BE TRUE)
|
||||
set(PPC64 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "ppc64le") # PPC64LE architecture
|
||||
set(PPC64LE TRUE)
|
||||
set(PPC64 TRUE)
|
||||
set(PPC64LE TRUE)
|
||||
set(PPC64 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "aarch64") # AARCH64 architecture
|
||||
set(AARCH64 TRUE)
|
||||
set(AARCH64 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "mic") # Intel(R) Many Integrated Core Architecture
|
||||
set(MIC TRUE)
|
||||
set(MIC TRUE)
|
||||
endif()
|
||||
|
||||
# Set some flags based on build_type
|
||||
# cmake_build_type_lowercase is based off of CMAKE_BUILD_TYPE, just put in lowercase.
|
||||
set(RELEASE_BUILD FALSE)
|
||||
set(DEBUG_BUILD FALSE)
|
||||
set(RELWITHDEBINFO_BUILD FALSE)
|
||||
if("${cmake_build_type_lowercase}" STREQUAL "release")
|
||||
set(RELEASE_BUILD TRUE)
|
||||
elseif("${cmake_build_type_lowercase}" STREQUAL "debug")
|
||||
set(DEBUG_BUILD TRUE)
|
||||
elseif("${cmake_build_type_lowercase}" STREQUAL "relwithdebinfo")
|
||||
set(RELWITHDEBINFO_BUILD TRUE)
|
||||
set(MINSIZEREL_BUILD FALSE)
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" libomp_build_type_lowercase)
|
||||
if("${libomp_build_type_lowercase}" STREQUAL "release")
|
||||
set(RELEASE_BUILD TRUE)
|
||||
elseif("${libomp_build_type_lowercase}" STREQUAL "debug")
|
||||
set(DEBUG_BUILD TRUE)
|
||||
elseif("${libomp_build_type_lowercase}" STREQUAL "relwithdebinfo")
|
||||
set(RELWITHDEBINFO_BUILD TRUE)
|
||||
elseif("${libomp_build_type_lowercase}" STREQUAL "minsizerel")
|
||||
set(MINSIZEREL_BUILD TRUE)
|
||||
endif()
|
||||
|
||||
# Include itt notify interface? Right now, always.
|
||||
set(LIBOMP_USE_ITT_NOTIFY TRUE)
|
||||
# Include itt notify interface?
|
||||
set(LIBOMP_USE_ITT_NOTIFY TRUE CACHE BOOL
|
||||
"Enable ITT notify?")
|
||||
|
||||
# normal, profile, stubs library.
|
||||
set(NORMAL_LIBRARY FALSE)
|
||||
set(STUBS_LIBRARY FALSE)
|
||||
set(PROFILE_LIBRARY FALSE)
|
||||
if("${LIBOMP_LIB_TYPE}" STREQUAL "normal")
|
||||
set(NORMAL_LIBRARY TRUE)
|
||||
set(NORMAL_LIBRARY TRUE)
|
||||
elseif("${LIBOMP_LIB_TYPE}" STREQUAL "profile")
|
||||
set(PROFILE_LIBRARY TRUE)
|
||||
set(PROFILE_LIBRARY TRUE)
|
||||
elseif("${LIBOMP_LIB_TYPE}" STREQUAL "stubs")
|
||||
set(STUBS_LIBRARY TRUE)
|
||||
set(STUBS_LIBRARY TRUE)
|
||||
endif()
|
||||
|
||||
###############################################
|
||||
# Features for compilation and build in general
|
||||
|
||||
# - Does the compiler support a 128-bit floating point data type? Default is false
|
||||
# - If a compiler does, then change it in the CMakeCache.txt file (or using the cmake GUI)
|
||||
# or send to cmake -DCOMPILER_SUPPORTS_QUAD_PRECISION=true
|
||||
# - If COMPILER_SUPPORTS_QUAD_PRECISION is true, then a corresponding COMPILER_QUAD_TYPE must be given
|
||||
# This is the compiler's quad-precision data type.
|
||||
# ** TODO: This isn't complete yet. Finish it. Requires changing macros in kmp_os.h **
|
||||
set(LIBOMP_COMPILER_SUPPORTS_QUAD_PRECISION false CACHE BOOL
|
||||
"*INCOMPLETE* Does the compiler support a 128-bit floating point type?")
|
||||
set(LIBOMP_COMPILER_QUAD_TYPE "" CACHE STRING
|
||||
"*INCOMPLETE* The quad precision data type (e.g., for gcc, __float128)")
|
||||
|
||||
# - Should the orignal build rules for builds be used? (cmake/OriginalBuildRules.cmake). This setting is off by default.
|
||||
# - This always compiles with -g. And if it is a release build, the debug info is stripped out via objcopy and put into libomp.dbg.
|
||||
set(LIBOMP_USE_BUILDPL_RULES false CACHE BOOL
|
||||
"Should the build follow build.pl rules/recipes?")
|
||||
|
||||
# - Should the build use the predefined linker flags (OS-dependent) in CommonFlags.cmake?
|
||||
# - these predefined linker flags should work for Windows, Mac, and True Linux for the most popular compilers/linkers
|
||||
set(LIBOMP_USE_PREDEFINED_LINKER_FLAGS true CACHE BOOL
|
||||
"Should the build use the predefined linker flags in CommonFlags.cmake?")
|
||||
|
||||
# - On multinode systems, larger alignment is desired to avoid false sharing
|
||||
set(LIBOMP_USE_INTERNODE_ALIGNMENT false CACHE BOOL
|
||||
"Should larger alignment (4096 bytes) be used for some locks and data structures?")
|
||||
|
||||
# - libgomp drop-in compatibility
|
||||
if(${LINUX} AND NOT ${PPC64})
|
||||
set(LIBOMP_USE_VERSION_SYMBOLS true CACHE BOOL
|
||||
"Should version symbols be used? These provide binary compatibility with libgomp.")
|
||||
else()
|
||||
set(LIBOMP_USE_VERSION_SYMBOLS false)
|
||||
endif()
|
||||
|
||||
# - TSX based locks have __asm code which can be troublesome for some compilers. This feature is also x86 specific.
|
||||
if(${IA32} OR ${INTEL64})
|
||||
set(LIBOMP_USE_ADAPTIVE_LOCKS true CACHE BOOL
|
||||
"Should TSX-based lock be compiled (adaptive lock in kmp_lock.cpp). These are x86 specific.")
|
||||
else()
|
||||
set(LIBOMP_USE_ADAPTIVE_LOCKS false)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
# Error checking the configuration
|
||||
if(${LIBOMP_STATS} AND (${WINDOWS} OR ${MAC}))
|
||||
error_say("Stats-gathering functionality is only supported on x86-Linux and Intel(R) MIC Architecture")
|
||||
endif()
|
||||
if(${LIBOMP_STATS} AND NOT (${IA32} OR ${INTEL64} OR ${MIC}))
|
||||
error_say("Stats-gathering functionality is only supported on x86-Linux and Intel(R) MIC Architecture")
|
||||
endif()
|
||||
if(${LIBOMP_USE_ADAPTIVE_LOCKS} AND NOT(${IA32} OR ${INTEL64}))
|
||||
error_say("Adaptive locks (TSX) functionality is only supported on x86 Architecture")
|
||||
endif()
|
||||
if(${LIBOMP_OMPT_SUPPORT} AND ${WINDOWS})
|
||||
error_say("OpenMP Tools Interface is not supported on Windows")
|
||||
endif()
|
||||
|
||||
###############################################
|
||||
# - Create the suffix for the export directory
|
||||
# - Only add to suffix when not a default value
|
||||
# - Example suffix: .deb.30.s1
|
||||
# final export directory: exports/lin_32e.deb.30.s1/lib
|
||||
# - These suffixes imply the build is a Debug, OpenMP 3.0, Stats-Gathering version of the library
|
||||
if(NOT "${cmake_build_type_lowercase}" STREQUAL "release")
|
||||
string(SUBSTRING "${cmake_build_type_lowercase}" 0 3 build_type_suffix)
|
||||
set(suffix "${suffix}.${build_type_suffix}")
|
||||
endif()
|
||||
if(NOT "${LIBOMP_OMP_VERSION}" STREQUAL "41")
|
||||
set(suffix "${suffix}.${LIBOMP_OMP_VERSION}")
|
||||
endif()
|
||||
if(${LIBOMP_STATS})
|
||||
set(suffix "${suffix}.s1")
|
||||
endif()
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
set(suffix "${suffix}.ompt")
|
||||
if(NOT ${LIBOMP_OMPT_BLAME})
|
||||
set(suffix "${suffix}.no-ompt-blame")
|
||||
endif()
|
||||
if(NOT ${LIBOMP_OMPT_TRACE})
|
||||
set(suffix "${suffix}.no-ompt-trace")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
####################################
|
||||
# Setting file extensions / suffixes
|
||||
set(obj ${CMAKE_C_OUTPUT_EXTENSION})
|
||||
set(lib ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
set(exe ${CMAKE_EXECUTABLE_SUFFIX})
|
||||
|
||||
######################
|
||||
# Find perl executable
|
||||
# Perl is used to create omp.h (and other headers) along with kmp_i18n_id.inc and kmp_i18n_default.inc (see below in Rules section)
|
||||
if(NOT "${PERL_FOUND}") # variable is defined in FindPerl Standard CMake Module
|
||||
error_say("Error: Could not find valid perl")
|
||||
endif()
|
||||
|
||||
#########################
|
||||
# Setting directory names
|
||||
if(${MIC})
|
||||
set(platform "${real_os}_${LIBOMP_MIC_ARCH}") # e.g., lin_knf, lin_knc
|
||||
else()
|
||||
set(platform "${real_os}_${LIBOMP_ARCH}") # e.g., lin_32e, mac_32
|
||||
endif()
|
||||
# build directory (Where CMakeCache.txt is created, build files generated)
|
||||
set(build_dir "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
set(tools_dir "${CMAKE_CURRENT_SOURCE_DIR}/tools")
|
||||
set(export_dir "${CMAKE_CURRENT_SOURCE_DIR}/exports")
|
||||
set(export_ptf_dir "${export_dir}/${platform}${suffix}")
|
||||
set(export_cmn_dir "${export_dir}/common${suffix}/include")
|
||||
set(export_inc_dir "${export_ptf_dir}/include")
|
||||
set(export_mod_dir "${export_ptf_dir}/include_compat")
|
||||
_export_lib_dir(${platform} export_lib_dir) # set exports directory (relative to build_dir) e.g., ../exports/lin_32e/lib/
|
||||
# or ../exports/mac_32e/lib.thin/ for mac
|
||||
if(${MAC})
|
||||
# macs use lib.thin/ subdirectory for non-fat libraries that only contain one architecture
|
||||
# macs use lib/ subdirectory for fat libraries that contain both IA-32 architecture and Intel(R) 64 architecture code.
|
||||
_export_lib_fat_dir(${platform} export_lib_fat_dir)
|
||||
endif()
|
||||
set(inc_dir "${src_dir}/include/${LIBOMP_OMP_VERSION}")
|
||||
set(LIBOMP_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(LIBOMP_SRC_DIR ${LIBOMP_BASE_DIR}/src)
|
||||
set(LIBOMP_TOOLS_DIR ${LIBOMP_BASE_DIR}/tools)
|
||||
set(LIBOMP_INC_DIR ${LIBOMP_SRC_DIR}/include/${LIBOMP_OMP_VERSION})
|
||||
set(LIBOMP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Enabling Fortran if it is needed
|
||||
if(${LIBOMP_FORTRAN_MODULES})
|
||||
enable_language(Fortran)
|
||||
endif()
|
||||
# Enable MASM Compiler if it is needed (Windows only)
|
||||
if(WIN32)
|
||||
enable_language(ASM_MASM)
|
||||
endif()
|
||||
|
||||
# Getting legal type/arch
|
||||
libomp_get_legal_type(LIBOMP_LEGAL_TYPE)
|
||||
libomp_get_legal_arch(LIBOMP_LEGAL_ARCH)
|
||||
|
||||
# Compiler flag checks, library checks, threading check, etc.
|
||||
include(config-ix)
|
||||
|
||||
# Is there a quad precision data type available?
|
||||
# TODO: Make this a real feature check
|
||||
set(LIBOMP_USE_QUAD_PRECISION "${LIBOMP_HAVE_QUAD_PRECISION}" CACHE BOOL
|
||||
"Should 128-bit precision entry points be built?")
|
||||
if(LIBOMP_USE_QUAD_PRECISION AND (NOT LIBOMP_HAVE_QUAD_PRECISION))
|
||||
libomp_error_say("128-bit quad precision functionality requested but not available")
|
||||
endif()
|
||||
|
||||
# libgomp drop-in compatibility requires versioned symbols
|
||||
set(LIBOMP_USE_VERSION_SYMBOLS "${LIBOMP_HAVE_VERSION_SYMBOLS}" CACHE BOOL
|
||||
"Should version symbols be used? These provide binary compatibility with libgomp.")
|
||||
if(LIBOMP_USE_VERSION_SYMBOLS AND (NOT LIBOMP_HAVE_VERSION_SYMBOLS))
|
||||
libomp_error_say("Version symbols functionality requested but not available")
|
||||
endif()
|
||||
|
||||
# On multinode systems, larger alignment is desired to avoid false sharing
|
||||
set(LIBOMP_USE_INTERNODE_ALIGNMENT FALSE CACHE BOOL
|
||||
"Should larger alignment (4096 bytes) be used for some locks and data structures?")
|
||||
|
||||
# Build code that allows the OpenMP library to conveniently interface with debuggers
|
||||
set(LIBOMP_USE_DEBUGGER FALSE CACHE BOOL
|
||||
"Enable debugger interface code?")
|
||||
|
||||
# Should we link to C++ library?
|
||||
set(LIBOMP_USE_STDCPPLIB FALSE CACHE BOOL
|
||||
"Should we link to C++ library?")
|
||||
|
||||
# TSX (x86) based locks have __asm code which can be troublesome for some compilers.
|
||||
# TODO: Make this a real feature check
|
||||
set(LIBOMP_USE_ADAPTIVE_LOCKS "${LIBOMP_HAVE_ADAPTIVE_LOCKS}" CACHE BOOL
|
||||
"Should TSX-based lock be compiled (adaptive lock in kmp_lock.cpp). These are x86 specific.")
|
||||
if(LIBOMP_USE_ADAPTIVE_LOCKS AND (NOT LIBOMP_HAVE_ADAPTIVE_LOCKS))
|
||||
libomp_error_say("Adaptive locks (TSX) functionality requested but not available")
|
||||
endif()
|
||||
|
||||
# - stats-gathering enables OpenMP stats where things like the number of
|
||||
# parallel regions, clock ticks spent in particular openmp regions are recorded.
|
||||
set(LIBOMP_STATS FALSE CACHE BOOL
|
||||
"Stats-Gathering functionality?")
|
||||
if(LIBOMP_STATS AND (NOT LIBOMP_HAVE_STATS))
|
||||
libomp_error_say("Stats-gathering functionality requested but not available")
|
||||
endif()
|
||||
# The stats functionality requires the std c++ library
|
||||
if(LIBOMP_STATS)
|
||||
set(LIBOMP_USE_STDCPPLIB TRUE)
|
||||
endif()
|
||||
|
||||
# Shared library can be switched to a static library
|
||||
set(LIBOMP_ENABLE_SHARED TRUE CACHE BOOL
|
||||
"Shared library instead of static library?")
|
||||
|
||||
if(WIN32 AND NOT LIBOMP_ENABLE_SHARED)
|
||||
libomp_error_say("Static libraries requested but not available on Windows")
|
||||
endif()
|
||||
|
||||
# OMPT-support
|
||||
set(LIBOMP_OMPT_DEBUG FALSE CACHE BOOL
|
||||
"Trace OMPT initialization?")
|
||||
set(LIBOMP_OMPT_SUPPORT FALSE CACHE BOOL
|
||||
"OMPT-support?")
|
||||
set(LIBOMP_OMPT_BLAME TRUE CACHE BOOL
|
||||
"OMPT-blame?")
|
||||
set(LIBOMP_OMPT_TRACE TRUE CACHE BOOL
|
||||
"OMPT-trace?")
|
||||
if(LIBOMP_OMPT_SUPPORT AND (NOT LIBOMP_HAVE_OMPT_SUPPORT))
|
||||
libomp_error_say("OpenMP Tools Interface requested but not available")
|
||||
endif()
|
||||
|
||||
# Error check hwloc support after config-ix has run
|
||||
if(LIBOMP_USE_HWLOC AND (NOT LIBOMP_HAVE_HWLOC))
|
||||
libomp_error_say("Hwloc requested but not available")
|
||||
endif()
|
||||
|
||||
############################
|
||||
# Setting final library name
|
||||
set(lib_item "libomp")
|
||||
set(LIBOMP_DEFAULT_LIB_NAME libomp)
|
||||
if(${PROFILE_LIBRARY})
|
||||
set(lib_item "${lib_item}prof")
|
||||
set(LIBOMP_DEFAULT_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME}prof)
|
||||
endif()
|
||||
if(${STUBS_LIBRARY})
|
||||
set(lib_item "${lib_item}stubs")
|
||||
set(LIBOMP_DEFAULT_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME}stubs)
|
||||
endif()
|
||||
if(${WINDOWS})
|
||||
set(lib_item "${lib_item}md")
|
||||
endif()
|
||||
set(LIBOMP_LIB_NAME "${lib_item}" CACHE STRING "OMP library name")
|
||||
set(lib_ext "${dll}")
|
||||
# ${lib_file} is real library name:
|
||||
# libomp.so for Linux
|
||||
# libomp.dylib for Mac
|
||||
# libompmd.dll for Windows
|
||||
set(lib_file "${LIBOMP_LIB_NAME}${lib_ext}")
|
||||
set(LIBOMP_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME} CACHE STRING "Base OMP library name")
|
||||
|
||||
########################################
|
||||
# Setting export file names
|
||||
if(${WINDOWS})
|
||||
set(imp_file "${lib_item}${lib}") # this is exported (libomp.lib)
|
||||
set(def_file "${lib_item}.def") # this is not exported
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR
|
||||
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" OR
|
||||
${LIBOMP_USE_BUILDPL_RULES})
|
||||
set(pdb_file "${lib_file}.pdb") # this is exported if it exists (libompmd.dll.pdb)
|
||||
endif()
|
||||
endif()
|
||||
set(export_lib_files "${lib_file}" "${imp_file}" "${pdb_file}")
|
||||
set(export_mod_files "omp_lib.mod" "omp_lib_kinds.mod")
|
||||
set(export_cmn_files "omp.h" "omp_lib.h" "omp_lib.f" "omp_lib.f90")
|
||||
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
set(export_cmn_files ${export_cmn_files} "ompt.h")
|
||||
endif()
|
||||
|
||||
if("${export_lib_fat_dir}")
|
||||
set(export_lib_fat_files "${lib_file}" "${imp_file}")
|
||||
endif()
|
||||
|
||||
#########################
|
||||
# Getting legal type/arch
|
||||
set_legal_type(legal_type)
|
||||
set_legal_arch(legal_arch)
|
||||
|
||||
#################################################
|
||||
# Preprocessor Definitions (cmake/Definitions.cmake)
|
||||
# Preprocessor Includes
|
||||
# Compiler (C/C++) Flags (cmake/CommonFlags.cmake)
|
||||
# Assembler Flags (cmake/CommonFlags.cmake)
|
||||
# Fortran Flags (cmake/CommonFlags.cmake)
|
||||
# Linker Flags (cmake/CommonFlags.cmake)
|
||||
# Archiver Flags (cmake/CommonFlags.cmake)
|
||||
# Helper Perl Script Flags (cmake/PerlFlags.cmake)
|
||||
# * Inside the cmake/CommonFlags.cmake file, the LIBOMP_*FLAGS are added.
|
||||
# * Cannot use CMAKE_*_FLAGS directly because -x c++ is put in the linker command and mangles the linking phase.
|
||||
|
||||
# Grab compiler-dependent flags
|
||||
# Cmake will look for cmake/${CMAKE_C_COMPILER_ID}/CFlags.cmake to append additional c, cxx, and linker flags.
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_C_COMPILER_ID} ${CMAKE_MODULE_PATH})
|
||||
find_file(compiler_specific_include_file_found CFlags.cmake ${CMAKE_MODULE_PATH})
|
||||
if(compiler_specific_include_file_found)
|
||||
include(CFlags) # COMPILER_SUPPORTS_QUAD_PRECISION changed in here
|
||||
append_compiler_specific_c_and_cxx_flags(C_FLAGS CXX_FLAGS)
|
||||
append_compiler_specific_linker_flags(LD_FLAGS LD_LIB_FLAGS)
|
||||
if(${LIBOMP_ENABLE_SHARED})
|
||||
set(LIBOMP_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
set(LIBOMP_LIBRARY_KIND SHARED)
|
||||
set(LIBOMP_INSTALL_KIND LIBRARY)
|
||||
else()
|
||||
warning_say("Could not find cmake/${CMAKE_C_COMPILER_ID}/CFlags.cmake: will only use default flags")
|
||||
endif()
|
||||
# Grab assembler-dependent flags
|
||||
# CMake will look for cmake/${CMAKE_ASM_COMPILER_ID}/AsmFlags.cmake to append additional assembler flags.
|
||||
if(${WINDOWS})
|
||||
# Windows based systems use CMAKE_ASM_MASM_COMPILER
|
||||
# The windows assembly files are in MASM format, and they require a tool that can handle MASM syntax (ml.exe or ml64.exe typically)
|
||||
enable_language(ASM_MASM)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_ASM_MASM_COMPILER_ID} ${CMAKE_MODULE_PATH})
|
||||
find_file(assembler_specific_include_file_found AsmFlags.cmake ${CMAKE_MODULE_PATH})
|
||||
if(assembler_specific_include_file_found)
|
||||
include(AsmFlags)
|
||||
append_assembler_specific_asm_flags(ASM_FLAGS)
|
||||
else()
|
||||
warning_say("Could not find cmake/${CMAKE_ASM_MASM_COMPILER_ID}/AsmFlags.cmake: will only use default flags")
|
||||
endif()
|
||||
else()
|
||||
# Unix (including Mac) based systems use CMAKE_ASM_COMPILER
|
||||
# Unix assembly files can be handled by compiler usually.
|
||||
find_file(assembler_specific_include_file_found AsmFlags.cmake ${CMAKE_MODULE_PATH})
|
||||
if(assembler_specific_include_file_found)
|
||||
include(AsmFlags)
|
||||
append_assembler_specific_asm_flags(ASM_FLAGS)
|
||||
else()
|
||||
warning_say("Could not find cmake/${CMAKE_ASM_COMPILER_ID}/AsmFlags.cmake: will only use default flags")
|
||||
endif()
|
||||
set(LIBOMP_LIBRARY_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set(LIBOMP_LIBRARY_KIND STATIC)
|
||||
set(LIBOMP_INSTALL_KIND ARCHIVE)
|
||||
endif()
|
||||
|
||||
# Grab all the compiler-independent flags
|
||||
append_c_and_cxx_flags_common(C_FLAGS CXX_FLAGS)
|
||||
append_asm_flags_common(ASM_FLAGS)
|
||||
append_fort_flags_common(F_FLAGS)
|
||||
append_linker_flags_common(LD_FLAGS LD_LIB_FLAGS)
|
||||
append_archiver_flags_common(AR_FLAGS)
|
||||
append_cpp_flags(DEFINITIONS_FLAGS)
|
||||
set(LIBOMP_LIB_FILE ${LIBOMP_LIB_NAME}${LIBOMP_LIBRARY_SUFFIX})
|
||||
|
||||
# Setup the flags correctly for cmake (covert to string)
|
||||
# Pretty them up (STRIP any beginning and trailing whitespace)
|
||||
list_to_string("${DEFINITIONS_FLAGS}" DEFINITIONS_FLAGS)
|
||||
list_to_string("${C_FLAGS}" C_FLAGS)
|
||||
list_to_string("${CXX_FLAGS}" CXX_FLAGS)
|
||||
list_to_string("${ASM_FLAGS}" ASM_FLAGS)
|
||||
list_to_string("${LD_FLAGS}" LD_FLAGS)
|
||||
list_to_string("${LD_LIB_FLAGS}" LD_LIB_FLAGS)
|
||||
# Windows specific for creating import library
|
||||
list_to_string("${AR_FLAGS}" AR_FLAGS)
|
||||
string(STRIP "${DEFINITIONS_FLAGS}" DEFINITIONS_FLAGS)
|
||||
string(STRIP "${C_FLAGS}" C_FLAGS)
|
||||
string(STRIP "${CXX_FLAGS}" CXX_FLAGS)
|
||||
string(STRIP "${ASM_FLAGS}" ASM_FLAGS)
|
||||
string(STRIP "${LD_FLAGS}" LD_FLAGS)
|
||||
string(STRIP "${LD_LIB_FLAGS}" LD_LIB_FLAGS)
|
||||
# Windows specific for creating import library
|
||||
string(STRIP "${AR_FLAGS}" AR_FLAGS)
|
||||
|
||||
# Grab the Perl flags
|
||||
set_ev_flags(ev_flags) # expand-vars.pl flags
|
||||
set_gd_flags(gd_flags) # generate-def.pl flags (Windows only)
|
||||
set(oa_opts "--os=${real_os}" "--arch=${LIBOMP_ARCH}") # sent to the perl scripts
|
||||
|
||||
#########################################################
|
||||
# Getting correct source files (cmake/SourceFiles.cmake)
|
||||
set_c_files(lib_c_items)
|
||||
set_cpp_files(lib_cxx_items)
|
||||
set_asm_files(lib_asm_items)
|
||||
set_imp_c_files(imp_c_items) # Windows-specific
|
||||
set(lib_src_files "${lib_c_items}" "${lib_cxx_items}" "${lib_asm_items}")
|
||||
set(imp_src_files "${imp_c_items}")
|
||||
|
||||
#####################################################################
|
||||
# Debug print outs. Will print "variable = ${variable}" if GLOBAL_DEBUG == 1
|
||||
if(GLOBAL_DEBUG)
|
||||
include(CMakePrintSystemInformation)
|
||||
endif()
|
||||
debug_say_var(CMAKE_ASM_COMPILE_OBJECT)
|
||||
debug_say_var(CMAKE_RC_COMPILER)
|
||||
debug_say_var(CMAKE_C_COMPILER_ID)
|
||||
debug_say_var(date)
|
||||
debug_say_var(LIBOMP_STATS)
|
||||
debug_say_var(lib_file)
|
||||
debug_say_var(export_lib_files)
|
||||
debug_say_var(DEFINITIONS_FLAGS)
|
||||
debug_say_var(C_FLAGS)
|
||||
debug_say_var(CXX_FLAGS)
|
||||
debug_say_var(ASM_FLAGS)
|
||||
debug_say_var(F_FLAGS)
|
||||
debug_say_var(LD_FLAGS)
|
||||
debug_say_var(LD_LIB_FLAGS)
|
||||
debug_say_var(AR_FLAGS)
|
||||
debug_say_var(ev_flags)
|
||||
debug_say_var(gd_flags)
|
||||
debug_say_var(oa_opts)
|
||||
debug_say_var(lib_c_items)
|
||||
debug_say_var(lib_cxx_items)
|
||||
debug_say_var(lib_asm_items)
|
||||
debug_say_var(imp_c_items)
|
||||
debug_say_var(lib_src_files)
|
||||
debug_say_var(imp_src_files)
|
||||
|
||||
####################################################################
|
||||
# Print configuration after all variables are set.
|
||||
if(${LIBOMP_STANDALONE_BUILD})
|
||||
say("LIBOMP: Operating System -- ${LIBOMP_OS}")
|
||||
say("LIBOMP: Target Architecture -- ${LIBOMP_ARCH}")
|
||||
if(${MIC})
|
||||
say("LIBOMP: Intel(R) MIC Architecture -- ${LIBOMP_MIC_ARCH}")
|
||||
endif()
|
||||
say("LIBOMP: Build Type -- ${CMAKE_BUILD_TYPE}")
|
||||
say("LIBOMP: OpenMP Version -- ${LIBOMP_OMP_VERSION}")
|
||||
say("LIBOMP: Lib Type -- ${LIBOMP_LIB_TYPE}")
|
||||
say("LIBOMP: Fortran Modules -- ${LIBOMP_FORTRAN_MODULES}")
|
||||
# will say development if all zeros
|
||||
if("${build_number}" STREQUAL "00000000")
|
||||
set(build "development")
|
||||
else()
|
||||
set(build "${build_number}")
|
||||
endif()
|
||||
say("LIBOMP: Build -- ${build}")
|
||||
say("LIBOMP: Stats-Gathering -- ${LIBOMP_STATS}")
|
||||
say("LIBOMP: Debugger-support -- ${LIBOMP_USE_DEBUGGER}")
|
||||
say("LIBOMP: OMPT-support -- ${LIBOMP_OMPT_SUPPORT}")
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
say("LIBOMP: OMPT-blame -- ${LIBOMP_OMPT_BLAME}")
|
||||
say("LIBOMP: OMPT-trace -- ${LIBOMP_OMPT_TRACE}")
|
||||
endif()
|
||||
say("LIBOMP: Use build.pl rules -- ${LIBOMP_USE_BUILDPL_RULES}")
|
||||
say("LIBOMP: Adaptive locks -- ${LIBOMP_USE_ADAPTIVE_LOCKS}")
|
||||
say("LIBOMP: Use predefined linker flags -- ${LIBOMP_USE_PREDEFINED_LINKER_FLAGS}")
|
||||
say("LIBOMP: Compiler supports quad precision -- ${LIBOMP_COMPILER_SUPPORTS_QUAD_PRECISION}")
|
||||
libomp_say("Operating System -- ${CMAKE_SYSTEM_NAME}")
|
||||
libomp_say("Target Architecture -- ${LIBOMP_ARCH}")
|
||||
if(${MIC})
|
||||
libomp_say("Intel(R) MIC Architecture -- ${LIBOMP_MIC_ARCH}")
|
||||
endif()
|
||||
libomp_say("Build Type -- ${CMAKE_BUILD_TYPE}")
|
||||
libomp_say("OpenMP Version -- ${LIBOMP_OMP_VERSION}")
|
||||
libomp_say("Library Kind -- ${LIBOMP_LIBRARY_KIND}")
|
||||
libomp_say("Library Type -- ${LIBOMP_LIB_TYPE}")
|
||||
libomp_say("Fortran Modules -- ${LIBOMP_FORTRAN_MODULES}")
|
||||
# will say development if all zeros
|
||||
if(${LIBOMP_VERSION_BUILD} STREQUAL 00000000)
|
||||
set(LIBOMP_BUILD Development)
|
||||
else()
|
||||
set(LIBOMP_BUILD ${LIBOMP_VERSION_BUILD})
|
||||
endif()
|
||||
libomp_say("Build -- ${LIBOMP_BUILD}")
|
||||
libomp_say("Use Stats-gathering -- ${LIBOMP_STATS}")
|
||||
libomp_say("Use Debugger-support -- ${LIBOMP_USE_DEBUGGER}")
|
||||
libomp_say("Use ITT notify -- ${LIBOMP_USE_ITT_NOTIFY}")
|
||||
libomp_say("Use OMPT-support -- ${LIBOMP_OMPT_SUPPORT}")
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
libomp_say("Use OMPT-blame -- ${LIBOMP_OMPT_BLAME}")
|
||||
libomp_say("Use OMPT-trace -- ${LIBOMP_OMPT_TRACE}")
|
||||
endif()
|
||||
libomp_say("Use Adaptive locks -- ${LIBOMP_USE_ADAPTIVE_LOCKS}")
|
||||
libomp_say("Use quad precision -- ${LIBOMP_USE_QUAD_PRECISION}")
|
||||
libomp_say("Use Hwloc library -- ${LIBOMP_USE_HWLOC}")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(test)
|
||||
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
omp_root?=.
|
||||
include $(omp_root)/tools/common.inc
|
||||
.PHONY: default all omp
|
||||
|
||||
default: omp
|
||||
|
||||
all: omp stubs
|
||||
|
||||
omp: info mkdir
|
||||
@echo $(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) lib inc common -- -j$(jobs)
|
||||
$(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) lib inc common -- -j$(jobs)
|
||||
|
||||
stubs: mkdir
|
||||
@echo $(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) --stubs lib inc common -- -j$(jobs)
|
||||
$(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) --stubs lib inc common -- -j$(jobs)
|
||||
|
||||
.PHONY: clean info
|
||||
|
||||
clean:
|
||||
$(shell $(RM) -rf $(omp_root)$(SLASH)tmp)
|
||||
@echo clean done
|
||||
|
||||
mkdir:
|
||||
$(shell $(MD) $(omp_root)$(SLASH)tmp >$(NUL) 2>$(NUL))
|
||||
@echo Created $(omp_root)$(SLASH)tmp directory
|
||||
|
||||
info:
|
||||
@echo omp_root=$(omp_root)
|
||||
@echo omp_os=$(omp_os)
|
||||
@echo arch=$(arch)
|
||||
ifeq "$(arch)" "mic"
|
||||
@echo mic_arch=$(mic_arch)
|
||||
endif
|
||||
@echo compiler=$(compiler)
|
||||
@echo mic=$(mic)
|
||||
@echo mode=$(mode)
|
||||
@echo jobs=$(jobs)
|
||||
|
||||
|
||||
|
||||
libomp_path=$(shell $(omp_root)/tools/check-openmp.pl)
|
||||
test_path=$(shell $(omp_root)/tools/check-openmp-test.pl)
|
||||
|
||||
# Please do not change this rule.
|
||||
# -------------------------------
|
||||
# Intentionally changing directory into "testsuite" in order to generate output results and errors
|
||||
# over there and keep this directory clean.
|
||||
test: omp
|
||||
@$(Verb) if which llvm-lit &> /dev/null; then \
|
||||
if [ -d "$(omp_root)$(SLASH)..$(SLASH)testsuite$(SLASH)LLVM-IR" ] ; then \
|
||||
export TESTSUITE_TEMP=$(realpath $(omp_root))$(SLASH)tmp ; \
|
||||
export LIBRARY_PATH=$(libomp_path):$(LIBRARY_PATH) ; \
|
||||
export C_INCLUDE_PATH=$(libomp_path)$(SLASH)..$(SLASH)..$(SLASH)common$(SLASH)include:$(C_INCLUDE_PATH) ; \
|
||||
export LD_LIBRARY_PATH=$(libomp_path):$(LD_LIBRARY_PATH) ; \
|
||||
export DYLD_LIBRARY_PATH=$(libomp_path):$(DYLD_LIBRARY_PATH) ; \
|
||||
cd $(omp_root)$(SLASH)..$(SLASH)testsuite ; \
|
||||
make ctest ; \
|
||||
python adding_xfails.py ; \
|
||||
llvm-lit -j 1 $(realpath $(omp_root))$(SLASH)..$(SLASH)testsuite$(SLASH)LLVM-IR$(SLASH)$(test_path) -v ; \
|
||||
else \
|
||||
echo "No test directory" ; exit 1; \
|
||||
fi; else echo "No llvm-lit in $(PATH)"; exit 1; fi
|
||||
|
||||
test-clean:
|
||||
make -C ..$(SLASH)testsuite cleanall
|
||||
|
||||
|
||||
+45
-73
@@ -6,10 +6,10 @@ How to Build Documentation
|
||||
==========================
|
||||
|
||||
The main documentation is in Doxygen* format, and this distribution
|
||||
should come with pre-built PDF documentation in doc/Reference.pdf.
|
||||
should come with pre-built PDF documentation in doc/Reference.pdf.
|
||||
However, an HTML version can be built by executing:
|
||||
|
||||
% doxygen doc/doxygen/config
|
||||
% doxygen doc/doxygen/config
|
||||
|
||||
in the runtime directory.
|
||||
|
||||
@@ -23,82 +23,40 @@ www.doxygen.org.
|
||||
|
||||
How to Build the LLVM* OpenMP* Runtime Library
|
||||
==============================================
|
||||
In-tree build:
|
||||
|
||||
The library can be built either using Cmake, or using a makefile that
|
||||
in turn invokes various Perl scripts. For porting, non X86
|
||||
architectures, and for those already familiar with Cmake that may be
|
||||
an easier route to take than the one described here.
|
||||
$ cd where-you-want-to-live
|
||||
Check out openmp into llvm/projects
|
||||
$ cd where-you-want-to-build
|
||||
$ mkdir build && cd build
|
||||
$ cmake path/to/llvm -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
|
||||
$ make omp
|
||||
|
||||
Building with CMake
|
||||
===================
|
||||
The runtime/Build_With_CMake.txt file has a description of how to
|
||||
build with Cmake.
|
||||
Out-of-tree build:
|
||||
|
||||
Building with the Makefile
|
||||
==========================
|
||||
The Makefile at the top-level will attempt to detect what it needs to
|
||||
build the LLVM* OpenMP* Runtime Library. To see the default settings,
|
||||
type:
|
||||
$ cd where-you-want-to-live
|
||||
Check out openmp
|
||||
$ cd where-you-want-to-live/openmp/runtime
|
||||
$ mkdir build && cd build
|
||||
$ cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
|
||||
$ make
|
||||
|
||||
make info
|
||||
For details about building, please look at Build_With_CMake.txt
|
||||
|
||||
You can change the Makefile's behavior with the following options:
|
||||
|
||||
omp_root: The path to the top-level directory containing the top-level
|
||||
Makefile. By default, this will take on the value of the
|
||||
current working directory.
|
||||
|
||||
omp_os: Operating system. By default, the build will attempt to
|
||||
detect this. Currently supports "linux", "freebsd", "macos", and
|
||||
"windows".
|
||||
|
||||
arch: Architecture. By default, the build will attempt to
|
||||
detect this if not specified by the user. Currently
|
||||
supported values are
|
||||
"32" for IA-32 architecture
|
||||
"32e" for Intel(R) 64 architecture
|
||||
"mic" for Intel(R) Many Integrated Core Architecture
|
||||
"arm" for ARM* architecture
|
||||
"aarch64" for Aarch64 (64-bit ARM) architecture
|
||||
"ppc64" for IBM(R) Power architecture (big endian)
|
||||
"ppc64le" for IBM(R) Power architecture (little endian)
|
||||
|
||||
If "mic" is specified then "icc" will be used as the
|
||||
compiler, and appropriate k1om binutils will be used. The
|
||||
necessary packages must be installed on the build machine
|
||||
for this to be possible (but an Intel(R) Xeon Phi(TM)
|
||||
coprocessor card is not required to build the library).
|
||||
|
||||
compiler: Which compiler to use for the build. Defaults to "icc"
|
||||
or "icl" depending on the value of omp_os. Also supports
|
||||
some versions of "gcc"* when omp_os is "linux". The selected
|
||||
compiler should be installed and in the user's path. The
|
||||
corresponding Fortran compiler should also be in the path.
|
||||
See "Supported RTL Build Configurations" below for more
|
||||
information on compiler versions.
|
||||
|
||||
mode: Library mode: default is "release". Also supports "debug".
|
||||
|
||||
jobs: The number of parallel jobs for the underlying call to make.
|
||||
This value is sent as the parameter to the -j flag for make.
|
||||
This value defaults to "1", but can be set to any positive integer.
|
||||
|
||||
To use any of the options above, simple add <option_name>=<value>. For
|
||||
example, if you want to build with gcc instead of icc, type:
|
||||
|
||||
make compiler=gcc
|
||||
|
||||
On OS X* machines, it is possible to build universal (or fat) libraries which
|
||||
include both IA-32 architecture and Intel(R) 64 architecture objects in a
|
||||
single archive; just build the 32 and 32e libraries separately, then invoke
|
||||
make again with a special argument as follows:
|
||||
|
||||
make compiler=clang build_args=fat
|
||||
Architectures Supported
|
||||
=======================
|
||||
* IA-32 architecture
|
||||
* Intel(R) 64 architecture
|
||||
* Intel(R) Many Integrated Core Architecture
|
||||
* ARM* architecture
|
||||
* Aarch64 (64-bit ARM) architecture
|
||||
* IBM(R) Power architecture (big endian)
|
||||
* IBM(R) Power architecture (little endian)
|
||||
|
||||
Supported RTL Build Configurations
|
||||
==================================
|
||||
|
||||
Supported Architectures: IA-32 architecture, Intel(R) 64, and
|
||||
Supported Architectures: IA-32 architecture, Intel(R) 64, and
|
||||
Intel(R) Many Integrated Core Architecture
|
||||
|
||||
----------------------------------------------
|
||||
@@ -110,15 +68,15 @@ Intel(R) Many Integrated Core Architecture
|
||||
| Windows* OS | Yes(1,4) | No | No |
|
||||
------------------------------------------------------------
|
||||
|
||||
(1) On IA-32 architecture and Intel(R) 64, icc/icl versions 12.x are
|
||||
(1) On IA-32 architecture and Intel(R) 64, icc/icl versions 12.x are
|
||||
supported (12.1 is recommended).
|
||||
(2) GCC* version 4.6.2 is supported.
|
||||
(2) GCC* version 4.7 is supported.
|
||||
(3) For icc on OS X*, OS X* version 10.5.8 is supported.
|
||||
(4) Intel(R) Many Integrated Core Architecture not supported.
|
||||
(5) On Intel(R) Many Integrated Core Architecture, icc/icl versions 13.0
|
||||
(5) On Intel(R) Many Integrated Core Architecture, icc/icl versions 13.0
|
||||
or later are required.
|
||||
(6) Clang* version 3.3 is supported.
|
||||
(7) Clang* currently does not offer a software-implemented 128 bit extended
|
||||
(7) Clang* currently does not offer a software-implemented 128 bit extended
|
||||
precision type. Thus, all entry points reliant on this type are removed
|
||||
from the library and cannot be called in the user program. The following
|
||||
functions are not available:
|
||||
@@ -127,6 +85,20 @@ Intel(R) Many Integrated Core Architecture
|
||||
__kmpc_atomic_*_fp
|
||||
(8) Community contribution provided AS IS, not tested by Intel.
|
||||
|
||||
Supported Architectures: IBM(R) Power 7 and Power 8
|
||||
|
||||
-----------------------------
|
||||
| gcc | clang |
|
||||
--------------|------------|--------------|
|
||||
| Linux* OS | Yes(1,2) | Yes(3,4) |
|
||||
-------------------------------------------
|
||||
|
||||
(1) On Power 7, gcc version 4.8.2 is supported.
|
||||
(2) On Power 8, gcc version 4.8.2 is supported.
|
||||
(3) On Power 7, clang version 3.7 is supported.
|
||||
(4) On Power 8, clang version 3.7 is supported.
|
||||
|
||||
|
||||
Front-end Compilers that work with this RTL
|
||||
===========================================
|
||||
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file contains additional build rules that correspond to build.pl's rules.
|
||||
# Building libomp.dbg is linux only, Windows will build libompmd.dll.pdb
|
||||
# This file is only active if ${LIBOMP_USE_BUILDPL_RULES} is true.
|
||||
#
|
||||
# ######### BUILD DEPENDENCIES ##########
|
||||
#
|
||||
# exports/.../libomp.so exports/.../libomp.dbg
|
||||
# [copy] | | [copy]
|
||||
# | |
|
||||
# ./libomp.so ./libomp.dbg
|
||||
# [copy] / OR \____________ [copy] | [copy]
|
||||
# / \ |
|
||||
# ./unstripped/libomp.so ./stripped/libomp.so ./unstripped/libomp.dbg
|
||||
# / \ /
|
||||
# / [linking] \[strip] /[strip and store]
|
||||
# / \ /
|
||||
# ${objs} (maybe compiled with -g) ./unstripped/libomp.so (library with debug info in it)
|
||||
# |
|
||||
# | [linking]
|
||||
# |
|
||||
# ${objs} (always compiled with -g)
|
||||
#
|
||||
# For icc Linux builds, we always include debugging information via -g and create libomp.dbg
|
||||
# so that Intel(R) Parallel Amplifier can use the .dbg file.
|
||||
# For icc Windows builds, we always include debugging information via -Zi and create libomp.pdb
|
||||
# in a fashion similar to libomp.dbg
|
||||
# For icc Mac builds, we don't bother with the debug info.
|
||||
|
||||
# We build library in unstripped directory
|
||||
file(MAKE_DIRECTORY ${build_dir}/unstripped)
|
||||
|
||||
# Only build the .dbg file for Release builds
|
||||
# Debug and RelWithDebInfo builds should not create a .dbg file.
|
||||
# The debug info should remain in the library file.
|
||||
if(${LINUX} AND ${RELEASE_BUILD})
|
||||
set(dbg_file ${lib_item}.dbg)
|
||||
endif()
|
||||
|
||||
################################
|
||||
# --- Create $(lib_file).dbg ---
|
||||
if(NOT "${dbg_file}" STREQUAL "")
|
||||
# if a ${dbg_file} file is going to be created, then
|
||||
file(MAKE_DIRECTORY ${build_dir}/stripped)
|
||||
|
||||
# ./${lib_file} : stripped/${lib_file}
|
||||
# copy stripped/${lib_file} ./${lib_file}
|
||||
simple_copy_recipe("${lib_file}" "${build_dir}/stripped" "${build_dir}")
|
||||
|
||||
# stripped/${lib_file} : unstripped/${lib_file} ./${dbg_file}
|
||||
# objcopy --strip-debug unstripped/${lib_file} stripped/${lib_file}.tmp
|
||||
# objcopy --add-gnu-debuglink=${dbg_file} stripped/${lib_file}.tmp stripped/${lib_file}
|
||||
add_custom_command(
|
||||
OUTPUT ${build_dir}/stripped/${lib_file}
|
||||
COMMAND ${CMAKE_OBJCOPY} --strip-debug ${build_dir}/unstripped/${lib_file} ${build_dir}/stripped/${lib_file}.tmp
|
||||
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${dbg_file} ${build_dir}/stripped/${lib_file}.tmp ${build_dir}/stripped/${lib_file}
|
||||
DEPENDS "${build_dir}/${dbg_file}"
|
||||
)
|
||||
|
||||
# ./${dbg_file} : unstripped/${dbg_file}
|
||||
# copy unstripped/${dbg_file} ./${dbg_file}
|
||||
simple_copy_recipe("${dbg_file}" "${build_dir}/unstripped" "${build_dir}")
|
||||
|
||||
# unstripped/${dbg_file} : unstripped/${lib_file}
|
||||
# objcopy --only-keep-debug unstripped/${lib_file} unstripped/${dbg_file}
|
||||
add_custom_command(
|
||||
OUTPUT ${build_dir}/unstripped/${dbg_file}
|
||||
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${build_dir}/unstripped/${lib_file} ${build_dir}/unstripped/${dbg_file}
|
||||
DEPENDS omp
|
||||
)
|
||||
|
||||
else()
|
||||
|
||||
# ./${lib_file} : unstripped/${lib_file}
|
||||
# copy unstripped/${lib_file} ./${lib_file}
|
||||
simple_copy_recipe("${lib_file}" "${build_dir}/unstripped" "${build_dir}")
|
||||
endif()
|
||||
|
||||
# Windows specific command to move around debug info files post-build
|
||||
if(NOT "${pdb_file}" STREQUAL "" AND ${RELEASE_BUILD})
|
||||
add_custom_command(TARGET omp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E rename ${pdb_file} ${pdb_file}.nonstripped
|
||||
COMMAND ${CMAKE_COMMAND} -E rename ${pdb_file}.stripped ${pdb_file}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Have icc build libomp in unstripped directory
|
||||
set_target_properties(omp PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${build_dir}/unstripped"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${build_dir}/unstripped"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${build_dir}"
|
||||
)
|
||||
|
||||
# Always use RelWithDebInfo flags for Release builds when using the build.pl's build rules (use -g -O2 instead of just -O3)
|
||||
# The debug info is then stripped out at the end of the build and put into libomp.dbg for Linux
|
||||
if(${RELEASE_BUILD} AND NOT ${MAC})
|
||||
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELWITHDEBINFO} )
|
||||
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
|
||||
set(CMAKE_ASM_FLAGS_RELEASE ${CMAKE_ASM_FLAGS_RELWITHDEBINFO})
|
||||
endif()
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds Clang (clang/clang++) specific compiler dependent flags
|
||||
# The flag types are:
|
||||
# 1) Assembly flags
|
||||
|
||||
#########################################################
|
||||
# Assembly flags
|
||||
function(append_assembler_specific_asm_flags input_asm_flags)
|
||||
set(local_asm_flags)
|
||||
append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed
|
||||
if(${IA32})
|
||||
append_asm_flags("-m32") # Generate 32 bit IA-32 architecture code
|
||||
append_asm_flags("-msse2") # Allow use of Streaming SIMD Instructions
|
||||
endif()
|
||||
set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds Clang (clang/clang++) specific compiler dependent flags
|
||||
# The flag types are:
|
||||
# 1) C/C++ Compiler flags
|
||||
# 2) Linker flags
|
||||
|
||||
#########################################################
|
||||
# C/C++ Compiler flags
|
||||
function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags)
|
||||
set(local_c_flags)
|
||||
set(local_cxx_flags)
|
||||
append_c_and_cxx_flags("-std=c++0x") # Enables support for many C++11 (formerly known as C++0x) features. The following are the most recently added features:
|
||||
append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled.
|
||||
append_c_and_cxx_flags("-x c++") # Compile C files as C++ files
|
||||
if(${IA32})
|
||||
append_c_and_cxx_flags("-m32") # Generate 32 bit IA-32 architecture code
|
||||
append_c_and_cxx_flags("-msse2") # Allow use of Streaming SIMD Instructions
|
||||
elseif(${ARM})
|
||||
append_c_and_cxx_flags("-marm") # Target the ARM architecture
|
||||
endif()
|
||||
append_c_and_cxx_flags("-Wno-unused-value") # Don't warn about unused values
|
||||
append_c_and_cxx_flags("-Wno-switch") # Don't warn about switch statements that don't cover entire range of values
|
||||
append_c_and_cxx_flags("-Wno-deprecated-register") # Don't warn about using register keyword
|
||||
set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE)
|
||||
set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#########################################################
|
||||
# Linker flags
|
||||
function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs)
|
||||
set(local_ld_flags)
|
||||
set(local_ld_flags_libs)
|
||||
if(${IA32})
|
||||
append_linker_flags("-m32")
|
||||
append_linker_flags("-msse2")
|
||||
endif()
|
||||
set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE)
|
||||
set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds the common flags independent of compiler
|
||||
# The flag types are:
|
||||
# 1) Assembly flags (append_asm_flags_common)
|
||||
# 2) C/C++ Compiler flags (append_c_and_cxx_flags_common)
|
||||
# 3) Fortran Compiler flags (append_fort_flags_common)
|
||||
# 4) Linker flags (append_linker_flags_common)
|
||||
# 5) Archiver flags (append_archiver_flags_common)
|
||||
|
||||
# These append_* macros all append to the corresponding list variable holding the flags.
|
||||
macro(append_c_flags new_flag)
|
||||
list(APPEND local_c_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
macro(append_cxx_flags new_flag)
|
||||
list(APPEND local_cxx_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
macro(append_c_and_cxx_flags new_flag)
|
||||
append_c_flags("${new_flag}")
|
||||
append_cxx_flags("${new_flag}")
|
||||
endmacro()
|
||||
|
||||
macro(append_asm_flags new_flag)
|
||||
list(APPEND local_asm_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
macro(append_fort_flags new_flag)
|
||||
list(APPEND local_fort_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
# The difference between linker_flags and linker_flags_libs is linker_flags_libs
|
||||
# is put at the end of the linker command where linking libraries should be done.
|
||||
macro(append_linker_flags new_flag)
|
||||
list(APPEND local_ld_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
macro(append_linker_flags_library new_flag)
|
||||
list(APPEND local_ld_flags_libs "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
macro(append_archiver_flags new_flag)
|
||||
list(APPEND local_ar_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
#########################################################
|
||||
# Global Assembly flags
|
||||
function(append_asm_flags_common input_asm_flags)
|
||||
set(local_asm_flags)
|
||||
set(${input_asm_flags} "${${input_asm_flags}}" "${local_asm_flags}" "${LIBOMP_ASMFLAGS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#########################################################
|
||||
# Global C/C++ Compiler flags
|
||||
function(append_c_and_cxx_flags_common input_c_flags input_cxx_flags)
|
||||
set(local_c_flags)
|
||||
set(local_cxx_flags)
|
||||
set(${input_c_flags} "${${input_c_flags}}" "${local_c_flags}" "${LIBOMP_CFLAGS}" PARENT_SCOPE)
|
||||
set(${input_cxx_flags} "${${input_cxx_flags}}" "${local_cxx_flags}" "${LIBOMP_CXXFLAGS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#########################################################
|
||||
# Global Fortran Compiler flags (for creating .mod files)
|
||||
function(append_fort_flags_common input_fort_flags)
|
||||
set(local_fort_flags)
|
||||
set(${input_fort_flags} "${${input_fort_flags}}" "${local_fort_flags}" "${LIBOMP_FFLAGS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#########################################################
|
||||
# Linker flags
|
||||
function(append_linker_flags_common input_ld_flags input_ld_flags_libs)
|
||||
set(local_ld_flags)
|
||||
set(local_ld_flags_libs)
|
||||
|
||||
if(${LIBOMP_USE_PREDEFINED_LINKER_FLAGS})
|
||||
|
||||
#################################
|
||||
# Windows linker flags
|
||||
if(${WINDOWS})
|
||||
|
||||
##################
|
||||
# MAC linker flags
|
||||
elseif(${MAC})
|
||||
append_linker_flags("-single_module")
|
||||
append_linker_flags("-current_version ${LIBOMP_VERSION}.0")
|
||||
append_linker_flags("-compatibility_version ${LIBOMP_VERSION}.0")
|
||||
#####################################################################################
|
||||
# Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) linker flags
|
||||
elseif(${MIC})
|
||||
append_linker_flags("-Wl,-x")
|
||||
append_linker_flags("-Wl,--warn-shared-textrel") # Warn if the linker adds a DT_TEXTREL to a shared object.
|
||||
append_linker_flags("-Wl,--as-needed")
|
||||
append_linker_flags("-Wl,--version-script=${src_dir}/exports_so.txt") # Use exports_so.txt as version script to create versioned symbols for ELF libraries
|
||||
if(NOT ${STUBS_LIBRARY})
|
||||
append_linker_flags_library("-pthread") # link in pthread library
|
||||
endif()
|
||||
if(${LIBOMP_STATS})
|
||||
append_linker_flags_library("-Wl,-lstdc++") # link in standard c++ library (stats-gathering needs it)
|
||||
endif()
|
||||
#########################
|
||||
# Unix based linker flags
|
||||
else()
|
||||
# For now, always include --version-script flag on Unix systems.
|
||||
append_linker_flags("-Wl,--version-script=${src_dir}/exports_so.txt") # Use exports_so.txt as version script to create versioned symbols for ELF libraries
|
||||
append_linker_flags("-Wl,-z,noexecstack") # Marks the object as not requiring executable stack.
|
||||
append_linker_flags("-Wl,--as-needed") # Only adds library dependencies as they are needed. (if libomp actually uses a function from the library, then add it)
|
||||
if(NOT ${STUBS_LIBRARY})
|
||||
append_linker_flags("-Wl,--warn-shared-textrel") # Warn if the linker adds a DT_TEXTREL to a shared object.
|
||||
append_linker_flags("-Wl,-fini=__kmp_internal_end_fini") # When creating an ELF executable or shared object, call NAME when the
|
||||
# executable or shared object is unloaded, by setting DT_FINI to the
|
||||
# address of the function. By default, the linker uses "_fini" as the function to call.
|
||||
append_linker_flags_library("-pthread") # link pthread library
|
||||
endif()
|
||||
endif() # if(${OPERATING_SYSTEM}) ...
|
||||
|
||||
endif() # LIBOMP_USE_PREDEFINED_LINKER_FLAGS
|
||||
|
||||
set(${input_ld_flags} "${${input_ld_flags}}" "${local_ld_flags}" "${LIBOMP_LDFLAGS}" PARENT_SCOPE)
|
||||
set(${input_ld_flags_libs} "${${input_ld_flags_libs}}" "${local_ld_flags_libs}" "${LIBOMP_LIBFLAGS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#########################################################
|
||||
# Archiver Flags
|
||||
function(append_archiver_flags_common input_ar_flags)
|
||||
set(local_ar_flags)
|
||||
set(${input_ar_flags} "${${input_ar_flags}}" "${local_ar_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# void append_definitions(string new_flag);
|
||||
# - appends new_flag to cpp_flags list
|
||||
macro(append_definitions new_flag)
|
||||
list(APPEND local_cpp_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
function(append_cpp_flags input_cpp_flags)
|
||||
set(local_cpp_flags)
|
||||
|
||||
append_definitions("-D USE_ITT_BUILD")
|
||||
append_definitions("-D KMP_ARCH_STR=\"\\\\\"${legal_arch}\\\\\"\"")
|
||||
append_definitions("-D BUILD_I8")
|
||||
append_definitions("-D KMP_LIBRARY_FILE=\\\\\"${lib_file}\\\\\"") # yes... you need 5 backslashes...
|
||||
append_definitions("-D KMP_VERSION_MAJOR=${LIBOMP_VERSION}")
|
||||
append_definitions("-D KMP_NESTED_HOT_TEAMS")
|
||||
|
||||
# customize to 128 bytes for ppc64
|
||||
if(${PPC64})
|
||||
append_definitions("-D CACHE_LINE=128")
|
||||
else()
|
||||
append_definitions("-D CACHE_LINE=64")
|
||||
endif()
|
||||
|
||||
append_definitions("-D KMP_ADJUST_BLOCKTIME=1")
|
||||
append_definitions("-D BUILD_PARALLEL_ORDERED")
|
||||
append_definitions("-D KMP_ASM_INTRINS")
|
||||
if(${LIBOMP_USE_ITT_NOTIFY})
|
||||
append_definitions("-D USE_ITT_NOTIFY=1")
|
||||
else()
|
||||
append_definitions("-D USE_ITT_NOTIFY=0")
|
||||
append_definitions("-D INTEL_NO_ITTNOTIFY_API")
|
||||
endif()
|
||||
append_definitions("-D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_")
|
||||
|
||||
if(${LIBOMP_USE_VERSION_SYMBOLS})
|
||||
append_definitions("-D KMP_USE_VERSION_SYMBOLS")
|
||||
endif()
|
||||
|
||||
#####################
|
||||
# Windows definitions
|
||||
if(${WINDOWS})
|
||||
append_definitions("-D _CRT_SECURE_NO_WARNINGS")
|
||||
append_definitions("-D _CRT_SECURE_NO_DEPRECATE")
|
||||
append_definitions("-D _WINDOWS")
|
||||
append_definitions("-D _WINNT")
|
||||
append_definitions("-D _WIN32_WINNT=0x0501")
|
||||
append_definitions("-D KMP_WIN_CDECL")
|
||||
append_definitions("-D _USRDLL")
|
||||
if(${DEBUG_BUILD})
|
||||
append_definitions("-D _ITERATOR_DEBUG_LEVEL=0")
|
||||
endif()
|
||||
else() # Other than windows... (Unix based systems, Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture), and Mac)
|
||||
append_definitions("-D _GNU_SOURCE")
|
||||
append_definitions("-D _REENTRANT")
|
||||
append_definitions("-D BUILD_TV")
|
||||
append_definitions("-D USE_CBLKDATA")
|
||||
if(NOT "${LIBOMP_VERSION}" STREQUAL "4")
|
||||
append_definitions("-D KMP_GOMP_COMPAT")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Any architecture other than Intel(R) MIC Architecture
|
||||
if(NOT ${MIC})
|
||||
append_definitions("-D USE_LOAD_BALANCE")
|
||||
endif()
|
||||
|
||||
##################
|
||||
# Unix definitions
|
||||
if(${LINUX})
|
||||
append_definitions("-D KMP_TDATA_GTID")
|
||||
endif()
|
||||
|
||||
##################################
|
||||
# Other conditional definitions
|
||||
if(${LIBOMP_ENABLE_ASSERTIONS})
|
||||
append_definitions("-D KMP_USE_ASSERT")
|
||||
endif()
|
||||
append_definitions("-D KMP_DYNAMIC_LIB")
|
||||
if(${STUBS_LIBRARY})
|
||||
append_definitions("-D KMP_STUB")
|
||||
endif()
|
||||
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
append_definitions("-D KMP_DEBUG")
|
||||
endif()
|
||||
if(${DEBUG_BUILD})
|
||||
append_definitions("-D _DEBUG")
|
||||
append_definitions("-D BUILD_DEBUG")
|
||||
endif()
|
||||
if(${LIBOMP_STATS})
|
||||
append_definitions("-D KMP_STATS_ENABLED=1")
|
||||
else()
|
||||
append_definitions("-D KMP_STATS_ENABLED=0")
|
||||
endif()
|
||||
if(${LIBOMP_USE_DEBUGGER})
|
||||
append_definitions("-D USE_DEBUGGER=1")
|
||||
else()
|
||||
append_definitions("-D USE_DEBUGGER=0")
|
||||
endif()
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
append_definitions("-D OMPT_SUPPORT=1")
|
||||
else()
|
||||
append_definitions("-D OMPT_SUPPORT=0")
|
||||
endif()
|
||||
if(${LIBOMP_OMPT_BLAME})
|
||||
append_definitions("-D OMPT_BLAME=1")
|
||||
else()
|
||||
append_definitions("-D OMPT_BLAME=0")
|
||||
endif()
|
||||
if(${LIBOMP_OMPT_TRACE})
|
||||
append_definitions("-D OMPT_TRACE=1")
|
||||
else()
|
||||
append_definitions("-D OMPT_TRACE=0")
|
||||
endif()
|
||||
|
||||
# OpenMP version flags
|
||||
set(have_omp_50 0)
|
||||
set(have_omp_41 0)
|
||||
set(have_omp_40 0)
|
||||
set(have_omp_30 0)
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 50 OR ${LIBOMP_OMP_VERSION} GREATER 50)
|
||||
set(have_omp_50 1)
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 41 OR ${LIBOMP_OMP_VERSION} GREATER 41)
|
||||
set(have_omp_41 1)
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 40 OR ${LIBOMP_OMP_VERSION} GREATER 40)
|
||||
set(have_omp_40 1)
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 30 OR ${LIBOMP_OMP_VERSION} GREATER 30)
|
||||
set(have_omp_30 1)
|
||||
endif()
|
||||
append_definitions("-D OMP_50_ENABLED=${have_omp_50}")
|
||||
append_definitions("-D OMP_41_ENABLED=${have_omp_41}")
|
||||
append_definitions("-D OMP_40_ENABLED=${have_omp_40}")
|
||||
append_definitions("-D OMP_30_ENABLED=${have_omp_30}")
|
||||
|
||||
# Architectural definitions
|
||||
if(${INTEL64} OR ${IA32})
|
||||
if(${LIBOMP_USE_ADAPTIVE_LOCKS})
|
||||
append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=1")
|
||||
else()
|
||||
append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=0")
|
||||
endif()
|
||||
append_definitions("-D KMP_DEBUG_ADAPTIVE_LOCKS=0")
|
||||
else()
|
||||
append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=0")
|
||||
append_definitions("-D KMP_DEBUG_ADAPTIVE_LOCKS=0")
|
||||
endif()
|
||||
if(${LIBOMP_USE_INTERNODE_ALIGNMENT})
|
||||
append_definitions("-D KMP_USE_INTERNODE_ALIGNMENT=1")
|
||||
else()
|
||||
append_definitions("-D KMP_USE_INTERNODE_ALIGNMENT=0")
|
||||
endif()
|
||||
set(${input_cpp_flags} "${${input_cpp_flags}}" "${local_cpp_flags}" "${LIBOMP_CPPFLAGS}" "$ENV{CPPFLAGS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds GNU (gcc/g++) specific compiler dependent flags
|
||||
# The flag types are:
|
||||
# 1) Assembly flags
|
||||
|
||||
#########################################################
|
||||
# Assembly flags
|
||||
function(append_assembler_specific_asm_flags input_asm_flags)
|
||||
set(local_asm_flags)
|
||||
append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed
|
||||
if(${IA32})
|
||||
append_asm_flags("-m32") # Generate 32 bit IA-32 architecture code
|
||||
append_asm_flags("-msse2") # Allow use of Streaming SIMD Instructions
|
||||
endif()
|
||||
set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds GNU (gcc/g++) specific compiler dependent flags
|
||||
# The flag types are:
|
||||
# 2) C/C++ Compiler flags
|
||||
# 4) Linker flags
|
||||
unset(COMPILER_SUPPORTS_QUAD_PRECISION CACHE)
|
||||
set(COMPILER_SUPPORTS_QUAD_PRECISION true CACHE BOOL "Does the compiler support a 128-bit floating point type?")
|
||||
set(COMPILER_QUAD_TYPE __float128)
|
||||
|
||||
#########################################################
|
||||
# C/C++ Compiler flags
|
||||
function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags)
|
||||
set(local_c_flags)
|
||||
set(local_cxx_flags)
|
||||
append_c_and_cxx_flags("-std=c++0x") # Enables support for many C++11 (formerly known as C++0x) features. The following are the most recently added features:
|
||||
append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled.
|
||||
append_c_and_cxx_flags("-x c++") # Compile C files as C++ files
|
||||
if(${IA32})
|
||||
append_c_and_cxx_flags("-m32") # Generate 32 bit IA-32 architecture code
|
||||
append_c_and_cxx_flags("-msse2") # Allow use of Streaming SIMD Instructions
|
||||
elseif(${ARM})
|
||||
append_c_and_cxx_flags("-marm") # Target the ARM architecture
|
||||
endif()
|
||||
set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE)
|
||||
set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#########################################################
|
||||
# Linker flags
|
||||
function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs)
|
||||
set(local_ld_flags)
|
||||
set(local_ld_flags_libs)
|
||||
if(${WINDOWS})
|
||||
elseif(${MAC})
|
||||
elseif(${MIC})
|
||||
else()
|
||||
append_linker_flags("-static-libgcc") # Causes libgcc to be linked in statically
|
||||
endif()
|
||||
if(${IA32})
|
||||
append_linker_flags("-m32")
|
||||
append_linker_flags("-msse2")
|
||||
endif()
|
||||
set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE)
|
||||
set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds GNU (gcc/g++) specific compiler dependent flags
|
||||
# The flag types are:
|
||||
# 1) Fortran Compiler flags
|
||||
|
||||
#########################################################
|
||||
# Fortran Compiler flags (for creating .mod files)
|
||||
function(append_fortran_compiler_specific_fort_flags input_fort_flags)
|
||||
set(local_fort_flags)
|
||||
if(${IA32})
|
||||
append_fort_flags("-m32")
|
||||
append_fort_flags("-msse2")
|
||||
endif()
|
||||
set(${input_fort_flags} ${${input_fort_flags}} "${local_fort_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -1,260 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
####################################### FUNCTIONS/MACROS ###########################################
|
||||
# It should be noted that in cmake, functions can only be used on a single line with the return value
|
||||
# stored in a parameter you send to the function. There isn't a true return value. So technically,
|
||||
# all functions would have a C/C++ prototype of:
|
||||
# void function_name(parameter1, parameter2, ...);
|
||||
#
|
||||
# If you want a return value, you have to use a parameter so the function prototype would be:
|
||||
# void function_name(input_parameter1, input_parameter2, ..., return_value)
|
||||
# ##################
|
||||
|
||||
# void say(string message_to_user);
|
||||
# - prints out message_to_user
|
||||
macro(say message_to_user)
|
||||
message(STATUS "${message_to_user}")
|
||||
endmacro()
|
||||
|
||||
# void warning_say(string message_to_user);
|
||||
# - prints out message_to_user with a warning
|
||||
macro(warning_say message_to_user)
|
||||
message(WARNING "${message_to_user}")
|
||||
endmacro()
|
||||
|
||||
# void error_say(string message_to_user);
|
||||
# - prints out message_to_user with an error and exits cmake
|
||||
macro(error_say message_to_user)
|
||||
message(FATAL_ERROR "${message_to_user}")
|
||||
endmacro()
|
||||
|
||||
# void debug_say(string message_to_developer);
|
||||
# - prints out message when GLOBAL_DEBUG == 1 (for debugging cmake build)
|
||||
macro(debug_say message_to_developer)
|
||||
if(${GLOBAL_DEBUG} STREQUAL "1")
|
||||
say("DEBUG: ${message_to_developer}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# void debug_say_var(variable var);
|
||||
# - prints the variable name and its value (for debugging cmake build)
|
||||
macro(debug_say_var var)
|
||||
if(${GLOBAL_DEBUG} STREQUAL "1")
|
||||
say("DEBUG: Variable: ${var} = ${${var}} ")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# void set_legal_arch(string* return_arch_string);
|
||||
# - returns (through return_arch_string) the formal architecture
|
||||
# string or warns user of unknown architecture
|
||||
function(set_legal_arch return_arch_string)
|
||||
if(${IA32})
|
||||
set(${return_arch_string} "IA-32" PARENT_SCOPE)
|
||||
elseif(${INTEL64})
|
||||
set(${return_arch_string} "Intel(R) 64" PARENT_SCOPE)
|
||||
elseif(${MIC})
|
||||
set(${return_arch_string} "Intel(R) Many Integrated Core Architecture" PARENT_SCOPE)
|
||||
elseif(${LIBOMP_ARCH} STREQUAL "l1")
|
||||
set(${return_arch_string} "L1OM" PARENT_SCOPE)
|
||||
elseif(${ARM})
|
||||
set(${return_arch_string} "ARM" PARENT_SCOPE)
|
||||
elseif(${PPC64BE})
|
||||
set(${return_arch_string} "PPC64BE" PARENT_SCOPE)
|
||||
elseif(${PPC64LE})
|
||||
set(${return_arch_string} "PPC64LE" PARENT_SCOPE)
|
||||
elseif(${AARCH64})
|
||||
set(${return_arch_string} "AARCH64" PARENT_SCOPE)
|
||||
else()
|
||||
warning_say("set_legal_arch(): Warning: Unknown architecture...")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# void check_variable(string var, string var_name, list<string>values_list);
|
||||
# - runs through values_list checking if ${var} == values_list[i] for any i.
|
||||
# - if the var is found, then just print it out
|
||||
# - if the var is not found, then warn user
|
||||
function(check_variable var values_list)
|
||||
set(valid_flag 0)
|
||||
foreach(value IN LISTS values_list)
|
||||
if("${${var}}" STREQUAL "${value}")
|
||||
set(valid_flag 1)
|
||||
set(the_value "${value}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(${valid_flag} EQUAL 0)
|
||||
error_say("check_variable(): ${var} = ${${var}} is unknown")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# void _export_lib_dir(string export_dir, string platform, string suffix, string* return_value);
|
||||
# - basically a special case for mac platforms where it adds '.thin' to the output lib directory
|
||||
function(_export_lib_dir pltfrm return_value)
|
||||
if(${MAC})
|
||||
set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib.thin" PARENT_SCOPE)
|
||||
else()
|
||||
set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# void _export_lib_fat_dir(string export_dir, string platform, string suffix, string* return_value);
|
||||
# - another mac specialty case for fat libraries.
|
||||
# - this sets export_lib_fat_dir in the MAIN part of CMakeLists.txt
|
||||
function(_export_lib_fat_dir pltfrm return_value)
|
||||
set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# void get_build_number(string src_dir, string* return_build_number);
|
||||
# - grab the eight digit build number (or 00000000) from kmp_version.c
|
||||
function(get_build_number src_dir return_build_number)
|
||||
# sets file_lines_list to a list of all lines in kmp_version.c
|
||||
file(STRINGS "${src_dir}/src/kmp_version.c" file_lines_list)
|
||||
|
||||
# runs through each line in kmp_version.c
|
||||
foreach(line IN LISTS file_lines_list)
|
||||
# if the line begins with "#define KMP_VERSION_BUILD" then we take not of the build number
|
||||
string(REGEX MATCH "^[ \t]*#define[ \t]+KMP_VERSION_BUILD" valid "${line}")
|
||||
if(NOT "${valid}" STREQUAL "") # if we matched "#define KMP_VERSION_BUILD", then grab the build number
|
||||
string(REGEX REPLACE "^[ \t]*#define[ \t]+KMP_VERSION_BUILD[ \t]+([0-9]+)" "\\1"
|
||||
build_number "${line}"
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
set(${return_build_number} "${build_number}" PARENT_SCOPE) # return build number
|
||||
endfunction()
|
||||
|
||||
# void set_legal_type(string* return_legal_type);
|
||||
# - set the legal type name Performance/Profiling/Stub
|
||||
function(set_legal_type return_legal_type)
|
||||
if(${NORMAL_LIBRARY})
|
||||
set(${return_legal_type} "Performance" PARENT_SCOPE)
|
||||
elseif(${PROFILE_LIBRARY})
|
||||
set(${return_legal_type} "Profiling" PARENT_SCOPE)
|
||||
elseif(${STUBS_LIBRARY})
|
||||
set(${return_legal_type} "Stub" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# void set_mac_os_new(bool* return_mac_os_new);
|
||||
# - sets the return_mac_os_new variable to true or false based on macosx version
|
||||
# - no real "cmakey" way to do this. Have to call execute_process()
|
||||
function(set_mac_os_new return_mac_os_new)
|
||||
execute_process(COMMAND "sw_vers" "-productVersion" OUTPUT_VARIABLE mac_osx_version)
|
||||
if("${mac_osx_version}" VERSION_GREATER "10.6")
|
||||
set(${return_mac_os_new} TRUE PARENT_SCOPE)
|
||||
else()
|
||||
set(${return_mac_os_new} FALSE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# void add_prefix(string prefix, list<string>* list_of_items);
|
||||
# - returns list_of_items with prefix prepended to all items
|
||||
# - original list is modified
|
||||
function(add_prefix prefix list_of_items)
|
||||
set(local_list "")
|
||||
foreach(item IN LISTS "${list_of_items}")
|
||||
if(NOT "${item}" STREQUAL "")
|
||||
list(APPEND local_list "${prefix}${item}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(${list_of_items} "${local_list}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# void add_suffix(string suffix, list<string>* list_of_items);
|
||||
# - returns list_of_items with suffix appended to all items
|
||||
# - original list is modified
|
||||
function(add_suffix suffix list_of_items)
|
||||
set(local_list "")
|
||||
foreach(item IN LISTS "${list_of_items}")
|
||||
if(NOT "${item}" STREQUAL "")
|
||||
list(APPEND local_list "${item}${suffix}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(${list_of_items} "${local_list}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# void strip_suffix(list<string> list_of_items, list<string>* return_list);
|
||||
# - returns a new list with suffix stripped (i.e., foo.c => foo)
|
||||
# - list_of_items is not modified, return_list is modified
|
||||
function(strip_suffix list_of_items return_list)
|
||||
set(local_list "")
|
||||
foreach(item IN LISTS "${list_of_items}")
|
||||
if(NOT "${item}" STREQUAL "")
|
||||
get_filename_component(filename "${item}" NAME_WE)
|
||||
list(APPEND local_list "${filename}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(${return_list} "${local_list}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# void list_to_string(list<string> list_of_things, string* return_string);
|
||||
# - converts a list to a space separated string
|
||||
function(list_to_string list_of_things return_string)
|
||||
string(REPLACE ";" " " output_variable "${list_of_things}")
|
||||
set(${return_string} "${output_variable}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# void string_to_list(string str, list<string>* return_list);
|
||||
# - converts a string to a semicolon separated list
|
||||
# - what it really does is just string_replace all running whitespace to a semicolon
|
||||
# - in cmake, a list is strings separated by semicolons: i.e., list of four items, list = "item1;item2;item3;item4"
|
||||
function(string_to_list str return_list)
|
||||
set(outstr)
|
||||
string(REGEX REPLACE "[ \t]+" ";" outstr "${str}")
|
||||
set(${return_list} "${outstr}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# void get_date(string* return_date);
|
||||
# - returns the current date "yyyy-mm-dd hh:mm:ss UTC"
|
||||
# - this function alone causes the need for CMake v2.8.11 (TIMESTAMP)
|
||||
#function(get_date return_date)
|
||||
# string(TIMESTAMP local_date "%Y-%m-%d %H:%M:%S UTC" UTC)
|
||||
# set(${return_date} ${local_date} PARENT_SCOPE)
|
||||
#endfunction()
|
||||
|
||||
# void find_a_program(string program_name, list<string> extra_paths, bool fail_on_not_found, string return_variable_name);
|
||||
# - returns the full path of a program_name
|
||||
# - first looks in the list of extra_paths
|
||||
# - if not found in extra_paths, then look through system path
|
||||
# - errors out if fail_on_not_found == true and cmake could not find program_name.
|
||||
function(find_a_program program_name extra_paths fail_on_not_found return_variable_name)
|
||||
# first try to find the program in the extra_paths
|
||||
find_program(${return_variable_name} "${program_name}" PATHS "${extra_paths}" DOC "Path to ${program_name}" NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
|
||||
if("${${return_variable_name}}" MATCHES NOTFOUND)
|
||||
# if no extra_paths, or couldn't find it, then look in system $PATH
|
||||
find_program(${return_variable_name} "${program_name}" DOC "Path to ${program_name}")
|
||||
if("${${return_variable_name}}" MATCHES NOTFOUND AND ${fail_on_not_found})
|
||||
error_say("Error: Could not find program: ${program_name}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT "${${return_variable_name}}" MATCHES NOTFOUND)
|
||||
say("-- Found ${program_name}: ${${return_variable_name}}")
|
||||
endif()
|
||||
|
||||
set(${return_variable_name} ${${return_variable_name}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# WINDOWS SPECIFIC
|
||||
# void replace_md_with_mt(string flags_var)
|
||||
# - This macro replaces the /MD compiler flags (Windows specific) with /MT compiler flags
|
||||
# - This does nothing if no /MD flags were replaced.
|
||||
macro(replace_md_with_mt flags_var)
|
||||
set(flags_var_name ${flags_var}) # i.e., CMAKE_C_FLAGS_RELEASE
|
||||
set(flags_var_value ${${flags_var}}) # i.e., "/MD /O2 ..."
|
||||
string(REPLACE /MD /MT temp_out "${flags_var_value}")
|
||||
string(COMPARE NOTEQUAL "${temp_out}" "${flags_var_value}" something_was_replaced)
|
||||
if("${something_was_replaced}")
|
||||
unset(${flags_var_name} CACHE)
|
||||
set(${flags_var_name} ${temp_out} CACHE STRING "Replaced /MD with /MT compiler flags")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags
|
||||
# The flag types are:
|
||||
# 1) Assembly flags
|
||||
|
||||
#########################################################
|
||||
# Assembly flags
|
||||
function(append_assembler_specific_asm_flags input_asm_flags)
|
||||
set(local_asm_flags)
|
||||
append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed
|
||||
if(${MIC})
|
||||
append_asm_flags("-mmic") # Build Intel(R) MIC Architecture native code
|
||||
endif()
|
||||
if(${WINDOWS})
|
||||
if(${IA32})
|
||||
append_asm_flags("-safeseh") # Registers exception handlers for safe exception handling.
|
||||
append_asm_flags("-coff") # Generates common object file format (COFF) type of object module.
|
||||
# Generally required for Win32 assembly language development.
|
||||
append_asm_flags("-D _M_IA32")
|
||||
elseif(${INTEL64})
|
||||
append_asm_flags("-D _M_AMD64")
|
||||
endif()
|
||||
# CMake prefers the /MD flags when compiling Windows sources, but libomp needs to use /MT instead
|
||||
# So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE.
|
||||
# replace_md_with_mt() is in HelperFunctions.cmake
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG)
|
||||
endif()
|
||||
set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -1,160 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags
|
||||
# The flag types are:
|
||||
# 2) C/C++ Compiler flags
|
||||
# 4) Linker flags
|
||||
|
||||
# icc has a 128-bit floating point type called _Quad. Always compile with 128-bit floating point if it exists.
|
||||
unset(COMPILER_SUPPORTS_QUAD_PRECISION CACHE)
|
||||
set(COMPILER_SUPPORTS_QUAD_PRECISION true CACHE BOOL "Does the compiler support a 128-bit floating point type?")
|
||||
set(COMPILER_QUAD_TYPE _Quad)
|
||||
|
||||
#########################################################
|
||||
# icc C/C++ Compiler flags
|
||||
function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags)
|
||||
set(local_c_flags)
|
||||
set(local_cxx_flags)
|
||||
if(${WINDOWS})
|
||||
|
||||
append_c_flags("-TP") # Tells the compiler to process a file as a C++ source file.
|
||||
append_cxx_flags("-EHsc") # Enable C++ exception handling.
|
||||
append_c_and_cxx_flags("-nologo") # Turn off tool banner.
|
||||
append_c_and_cxx_flags("-W3") # Enables diagnostics for remarks, warnings, and errors.
|
||||
# Additional warnings are also enabled above level 2 warnings.
|
||||
append_c_and_cxx_flags("-WX") # Change all Warnings to Errors
|
||||
append_c_and_cxx_flags("-GS") # Lets you control the threshold at which the stack checking routine is called or not called.
|
||||
append_c_and_cxx_flags("-Qoption,cpp,--extended_float_types") # Enabled _Quad type.
|
||||
if(${IA32})
|
||||
append_c_and_cxx_flags("-arch:ia32") # Tells the compiler which features it may target (ia32)
|
||||
append_c_and_cxx_flags("-Oy-") # equivalent to -fno-omit-frame-pointer
|
||||
endif()
|
||||
append_c_and_cxx_flags("-Qlong_double") # enable long double
|
||||
append_c_and_cxx_flags("-Qdiag-disable:177") # Disable warning: "... declared but never referenced"
|
||||
if(${IA32})
|
||||
append_c_and_cxx_flags("-Qsafeseh") # Registers exception handlers for safe exception handling.
|
||||
endif()
|
||||
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
append_c_and_cxx_flags("-Qinline-min-size=1") # Specifies the upper limit for the size of what the inliner considers to be a small routine.
|
||||
else()
|
||||
append_c_and_cxx_flags("-Od") # Disables all optimizations.
|
||||
append_c_and_cxx_flags("-RTC1") # Enables run-time checks of the stack frame, and enables run-time checks for unintialized variables.
|
||||
append_c_and_cxx_flags("-MTd") # Tells the linker to search for unresolved references in a multithreaded, static run-time library.
|
||||
endif()
|
||||
else()
|
||||
append_c_and_cxx_flags("-Wsign-compare") # warn on sign comparisons
|
||||
append_c_and_cxx_flags("-Qoption,cpp,--extended_float_types") # Enabled _Quad type.
|
||||
append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled.
|
||||
append_c_and_cxx_flags("-x c++") # Compile C files as C++ files
|
||||
if(${LINUX})
|
||||
if(NOT ${MIC})
|
||||
append_c_and_cxx_flags("-Werror") # Changes all warnings to errors.
|
||||
endif()
|
||||
append_c_and_cxx_flags("-sox") # Tells the compiler to save the compilation options and version number
|
||||
# in the executable file. It also lets you choose whether to include
|
||||
# lists of certain functions.
|
||||
if(${MIC})
|
||||
append_c_and_cxx_flags("-mmic") # Build Intel(R) MIC Architecture native code
|
||||
append_c_and_cxx_flags("-ftls-model=initial-exec") # Changes the thread local storage (TLS) model. Generates a restrictive, optimized TLS code.
|
||||
# To use this setting, the thread-local variables accessed must be defined in one of the
|
||||
# modules available to the program.
|
||||
append_c_and_cxx_flags("-opt-streaming-stores never") # Disables generation of streaming stores for optimization.
|
||||
elseif(${IA32})
|
||||
append_c_and_cxx_flags("-falign-stack=maintain-16-byte") # Tells the compiler the stack alignment to use on entry to routines.
|
||||
append_c_and_cxx_flags("-mia32") # Tells the compiler which features it may target (ia32)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
# CMake prefers the /MD flags when compiling Windows sources, but libomp needs to use /MT instead
|
||||
# So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE.
|
||||
# replace_md_with_mt() is in HelperFunctions.cmake
|
||||
if(${WINDOWS})
|
||||
replace_md_with_mt(CMAKE_C_FLAGS)
|
||||
replace_md_with_mt(CMAKE_C_FLAGS_RELEASE)
|
||||
replace_md_with_mt(CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
replace_md_with_mt(CMAKE_C_FLAGS_DEBUG)
|
||||
replace_md_with_mt(CMAKE_CXX_FLAGS)
|
||||
replace_md_with_mt(CMAKE_CXX_FLAGS_RELEASE)
|
||||
replace_md_with_mt(CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
replace_md_with_mt(CMAKE_CXX_FLAGS_DEBUG)
|
||||
endif()
|
||||
set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE)
|
||||
set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#########################################################
|
||||
# icc Linker flags
|
||||
function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs)
|
||||
set(local_ld_flags)
|
||||
set(local_ld_flags_libs)
|
||||
if(${WINDOWS})
|
||||
# Have icc use link.exe directly when Windows
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY "link.exe /out:<TARGET> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>" PARENT_SCOPE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "$ENV{LDFLAGS}" CACHE STRING "Linker Flags" FORCE)
|
||||
append_linker_flags("-nologo") # Turn off tool banner.
|
||||
append_linker_flags("-dll")
|
||||
append_linker_flags("-WX:NO")
|
||||
append_linker_flags("-incremental:no")
|
||||
append_linker_flags("-version:${LIBOMP_VERSION}.0")
|
||||
append_linker_flags("-NXCompat")
|
||||
append_linker_flags("-DynamicBase") # This option modifies the header of an executable to indicate
|
||||
# whether the application should be randomly rebased at load time.
|
||||
if(${IA32})
|
||||
append_linker_flags("-machine:i386")
|
||||
append_linker_flags("-safeseh")
|
||||
elseif(${INTEL64})
|
||||
append_linker_flags("-machine:amd64")
|
||||
endif()
|
||||
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
if(NOT "${pdb_file}" STREQUAL "")
|
||||
append_linker_flags("-debug")
|
||||
append_linker_flags("-pdb:${pdb_file}")
|
||||
endif()
|
||||
else()
|
||||
if(NOT "${pdb_file}" STREQUAL "")
|
||||
append_linker_flags("-debug")
|
||||
append_linker_flags("-pdb:${pdb_file}")
|
||||
append_linker_flags("-pdbstripped:${pdb_file}.stripped")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT "${imp_file}" STREQUAL "")
|
||||
append_linker_flags("-implib:${lib_file}${lib}")
|
||||
endif()
|
||||
if(NOT "${def_file}" STREQUAL "")
|
||||
append_linker_flags("-def:${def_file}")
|
||||
endif()
|
||||
elseif(${MAC})
|
||||
append_linker_flags("-no-intel-extensions")
|
||||
if(NOT ${STUBS_LIBRARY})
|
||||
append_linker_flags_library("-pthread") # link in pthread library
|
||||
append_linker_flags_library("-ldl") # link in libdl (dynamic loader library)
|
||||
endif()
|
||||
if(${LIBOMP_STATS})
|
||||
append_linker_flags_library("-Wl,-lstdc++") # link in standard c++ library (stats-gathering needs it)
|
||||
endif()
|
||||
else()
|
||||
if(${MIC})
|
||||
append_linker_flags("-mmic") # enable MIC linking
|
||||
append_linker_flags("-no-intel-extensions") # Enables or disables all Intel C and Intel C++ language extensions.
|
||||
elseif(${IA32})
|
||||
append_linker_flags_library("-lirc_pic") # link in libirc_pic
|
||||
endif()
|
||||
append_linker_flags("-static-intel") # Causes Intel-provided libraries to be linked in statically.
|
||||
if(NOT ${MIC})
|
||||
append_linker_flags("-Werror") # Warnings become errors
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE)
|
||||
set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags
|
||||
# The flag types are:
|
||||
# 1) Fortran Compiler flags
|
||||
|
||||
#########################################################
|
||||
# icc Fortran Compiler flags (for creating .mod files)
|
||||
function(append_fortran_compiler_specific_fort_flags input_fort_flags)
|
||||
set(local_fort_flags)
|
||||
#set(CMAKE_Fortran_FLAGS "$ENV{FFLAGS}" CACHE STRING "Fortran flags" FORCE)
|
||||
#set(CMAKE_Fortran_FLAGS_RELEASE "" CACHE STRING "Fortran flags" FORCE)
|
||||
#set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Fortran flags" FORCE)
|
||||
#set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "" CACHE STRING "Fortran flags" FORCE)
|
||||
if(${WINDOWS})
|
||||
append_fort_flags("-Qdiag-disable:177,5082")
|
||||
append_fort_flags("-Qsox")
|
||||
append_fort_flags("-nologo")
|
||||
append_fort_flags("-GS")
|
||||
append_fort_flags("-DynamicBase")
|
||||
append_fort_flags("-Zi")
|
||||
# On Linux and Windows Intel(R) 64 architecture we need offload attribute
|
||||
# for all Fortran entries in order to support OpenMP function calls inside device contructs
|
||||
if(${INTEL64})
|
||||
append_fort_flags("/Qoffload-attribute-target:mic")
|
||||
endif()
|
||||
else()
|
||||
if(${MIC})
|
||||
append_fort_flags("-mmic")
|
||||
endif()
|
||||
if(NOT ${MAC})
|
||||
append_fort_flags("-sox")
|
||||
if(${INTEL64} AND ${LINUX})
|
||||
append_fort_flags("-offload-attribute-target=mic")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(${input_fort_flags} ${${input_fort_flags}} "${local_fort_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,73 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# Checking a fortran compiler flag
|
||||
# There is no real trivial way to do this in CMake, so we implement it here
|
||||
# this will have ${boolean} = TRUE if the flag succeeds, otherwise false.
|
||||
function(libomp_check_fortran_flag flag boolean)
|
||||
if(NOT DEFINED "${boolean}")
|
||||
set(retval TRUE)
|
||||
set(fortran_source
|
||||
" program hello
|
||||
print *, \"Hello World!\"
|
||||
end program hello")
|
||||
|
||||
set(failed_regexes "[Ee]rror;[Uu]nknown;[Ss]kipping")
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.1 OR CMAKE_VERSION VERSION_EQUAL 3.1)
|
||||
include(CheckFortranSourceCompiles)
|
||||
check_fortran_source_compiles("${fortran_source}" ${boolean} FAIL_REGEX "${failed_regexes}")
|
||||
set(${boolean} ${${boolean}} PARENT_SCOPE)
|
||||
return()
|
||||
else()
|
||||
# Our manual check for cmake versions that don't have CheckFortranSourceCompiles
|
||||
set(base_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_flag_check)
|
||||
file(MAKE_DIRECTORY ${base_dir})
|
||||
file(WRITE ${base_dir}/fortran_source.f "${fortran_source}")
|
||||
|
||||
message(STATUS "Performing Test ${boolean}")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_Fortran_COMPILER} "${flag}" ${base_dir}/fortran_source.f
|
||||
WORKING_DIRECTORY ${base_dir}
|
||||
RESULT_VARIABLE exit_code
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
ERROR_VARIABLE OUTPUT
|
||||
)
|
||||
|
||||
if(${exit_code} EQUAL 0)
|
||||
foreach(regex IN LISTS failed_regexes)
|
||||
if("${OUTPUT}" MATCHES ${regex})
|
||||
set(retval FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
set(retval FALSE)
|
||||
endif()
|
||||
|
||||
if(${retval})
|
||||
set(${boolean} 1 CACHE INTERNAL "Test ${boolean}")
|
||||
message(STATUS "Performing Test ${boolean} - Success")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Performing Fortran Compiler Flag test ${boolean} succeeded with the following output:\n"
|
||||
"${OUTPUT}\n"
|
||||
"Source file was:\n${fortran_source}\n")
|
||||
else()
|
||||
set(${boolean} "" CACHE INTERNAL "Test ${boolean}")
|
||||
message(STATUS "Performing Test ${boolean} - Failed")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Performing Fortran Compiler Flag test ${boolean} failed with the following output:\n"
|
||||
"${OUTPUT}\n"
|
||||
"Source file was:\n${fortran_source}\n")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(${boolean} ${retval} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,68 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# Checking a linker flag to build a shared library
|
||||
# There is no real trivial way to do this in CMake, so we implement it here
|
||||
# this will have ${boolean} = TRUE if the flag succeeds, otherwise FALSE.
|
||||
function(libomp_check_linker_flag flag boolean)
|
||||
if(NOT DEFINED "${boolean}")
|
||||
set(retval TRUE)
|
||||
set(library_source
|
||||
"int foo(int a) { return a*a; }")
|
||||
set(cmake_source
|
||||
"cmake_minimum_required(VERSION 2.8)
|
||||
project(foo C)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS \"${flag}\")
|
||||
add_library(foo SHARED src_to_link.c)")
|
||||
set(failed_regexes "[Ee]rror;[Uu]nknown;[Ss]kipping;LINK : warning")
|
||||
set(base_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/link_flag_check_${boolean})
|
||||
file(MAKE_DIRECTORY ${base_dir})
|
||||
file(MAKE_DIRECTORY ${base_dir}/build)
|
||||
file(WRITE ${base_dir}/src_to_link.c "${library_source}")
|
||||
file(WRITE ${base_dir}/CMakeLists.txt "${cmake_source}")
|
||||
|
||||
message(STATUS "Performing Test ${boolean}")
|
||||
try_compile(
|
||||
try_compile_result
|
||||
${base_dir}/build
|
||||
${base_dir}
|
||||
foo
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
||||
if(try_compile_result)
|
||||
foreach(regex IN LISTS failed_regexes)
|
||||
if("${OUTPUT}" MATCHES ${regex})
|
||||
set(retval FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
set(retval FALSE)
|
||||
endif()
|
||||
|
||||
if(${retval})
|
||||
set(${boolean} 1 CACHE INTERNAL "Test ${boolean}")
|
||||
message(STATUS "Performing Test ${boolean} - Success")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Performing C Linker Flag test ${boolean} succeeded with the following output:\n"
|
||||
"${OUTPUT}\n"
|
||||
"Source file was:\n${library_source}\n")
|
||||
else()
|
||||
set(${boolean} "" CACHE INTERNAL "Test ${boolean}")
|
||||
message(STATUS "Performing Test ${boolean} - Failed")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Performing C Linker Flag test ${boolean} failed with the following output:\n"
|
||||
"${OUTPUT}\n"
|
||||
"Source file was:\n${library_source}\n")
|
||||
endif()
|
||||
|
||||
set(${boolean} ${retval} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,32 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
function(libomp_get_definitions_flags cppflags)
|
||||
set(cppflags_local)
|
||||
|
||||
if(WIN32)
|
||||
libomp_append(cppflags_local "-D _CRT_SECURE_NO_WARNINGS")
|
||||
libomp_append(cppflags_local "-D _CRT_SECURE_NO_DEPRECATE")
|
||||
libomp_append(cppflags_local "-D _WINDOWS")
|
||||
libomp_append(cppflags_local "-D _WINNT")
|
||||
libomp_append(cppflags_local "-D _WIN32_WINNT=0x0501")
|
||||
libomp_append(cppflags_local "-D _USRDLL")
|
||||
libomp_append(cppflags_local "-D _ITERATOR_DEBUG_LEVEL=0" IF_TRUE DEBUG_BUILD)
|
||||
libomp_append(cppflags_local "-D _DEBUG" IF_TRUE DEBUG_BUILD)
|
||||
else()
|
||||
libomp_append(cppflags_local "-D _GNU_SOURCE")
|
||||
libomp_append(cppflags_local "-D _REENTRANT")
|
||||
endif()
|
||||
|
||||
# CMake doesn't include CPPFLAGS from environment, but we will.
|
||||
set(${cppflags} ${cppflags_local} ${LIBOMP_CPPFLAGS} $ENV{CPPFLAGS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# LibompExports.cmake
|
||||
# Copy library and header files into the exports/ subdirectory after library build
|
||||
|
||||
# Create the suffix for the export directory
|
||||
# - Only add to suffix when not a default value
|
||||
# - Example suffix: .deb.30.s1
|
||||
# final export directory: exports/lin_32e.deb.30.s1/lib
|
||||
# - These suffixes imply the build is a Debug, OpenMP 3.0, Stats-Gathering version of the library
|
||||
set(libomp_suffix)
|
||||
libomp_append(libomp_suffix .deb DEBUG_BUILD)
|
||||
libomp_append(libomp_suffix .dia RELWITHDEBINFO_BUILD)
|
||||
libomp_append(libomp_suffix .min MINSIZEREL_BUILD)
|
||||
if(NOT "${LIBOMP_OMP_VERSION}" STREQUAL "45")
|
||||
libomp_append(libomp_suffix .${LIBOMP_OMP_VERSION})
|
||||
endif()
|
||||
libomp_append(libomp_suffix .s1 LIBOMP_STATS)
|
||||
libomp_append(libomp_suffix .ompt LIBOMP_OMPT_SUPPORT)
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
libomp_append(libomp_suffix .no-ompt-blame IF_FALSE LIBOMP_OMPT_BLAME)
|
||||
libomp_append(libomp_suffix .no-ompt-trace IF_FALSE LIBOMP_OMPT_TRACE)
|
||||
endif()
|
||||
string(REPLACE ";" "" libomp_suffix "${libomp_suffix}")
|
||||
|
||||
# Set exports locations
|
||||
if(${MIC})
|
||||
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_${LIBOMP_MIC_ARCH}") # e.g., lin_knf, lin_knc
|
||||
else()
|
||||
if(${IA32})
|
||||
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_32")
|
||||
elseif(${INTEL64})
|
||||
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_32e")
|
||||
else()
|
||||
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_${LIBOMP_ARCH}") # e.g., lin_arm, lin_ppc64
|
||||
endif()
|
||||
endif()
|
||||
set(LIBOMP_EXPORTS_DIR "${LIBOMP_BASE_DIR}/exports")
|
||||
set(LIBOMP_EXPORTS_PLATFORM_DIR "${LIBOMP_EXPORTS_DIR}/${libomp_platform}${libomp_suffix}")
|
||||
set(LIBOMP_EXPORTS_CMN_DIR "${LIBOMP_EXPORTS_DIR}/common${libomp_suffix}/include")
|
||||
set(LIBOMP_EXPORTS_INC_DIR "${LIBOMP_EXPORTS_PLATFORM_DIR}/include")
|
||||
set(LIBOMP_EXPORTS_MOD_DIR "${LIBOMP_EXPORTS_PLATFORM_DIR}/include_compat")
|
||||
set(LIBOMP_EXPORTS_LIB_DIR "${LIBOMP_EXPORTS_DIR}/${libomp_platform}${libomp_suffix}/lib")
|
||||
|
||||
# Put headers in exports/ directory post build
|
||||
add_custom_command(TARGET omp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_CMN_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp.h ${LIBOMP_EXPORTS_CMN_DIR}
|
||||
)
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
add_custom_command(TARGET omp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ompt.h ${LIBOMP_EXPORTS_CMN_DIR}
|
||||
)
|
||||
endif()
|
||||
if(${LIBOMP_FORTRAN_MODULES})
|
||||
add_custom_command(TARGET libomp-mod POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_MOD_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.h ${LIBOMP_EXPORTS_CMN_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.mod ${LIBOMP_EXPORTS_MOD_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp_lib_kinds.mod ${LIBOMP_EXPORTS_MOD_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Copy OpenMP library into exports/ directory post build
|
||||
if(WIN32)
|
||||
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp RUNTIME_OUTPUT_DIRECTORY)
|
||||
else()
|
||||
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp LIBRARY_OUTPUT_DIRECTORY)
|
||||
endif()
|
||||
if(NOT LIBOMP_OUTPUT_DIRECTORY)
|
||||
set(LIBOMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
add_custom_command(TARGET omp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_LIB_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE} ${LIBOMP_EXPORTS_LIB_DIR}
|
||||
)
|
||||
|
||||
# Copy Windows import library into exports/ directory post build
|
||||
if(WIN32)
|
||||
get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
|
||||
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
|
||||
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
add_custom_command(TARGET ompimp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_LIB_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMPIMP_OUTPUT_DIRECTORY}/${LIBOMP_IMP_LIB_FILE} ${LIBOMP_EXPORTS_LIB_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -14,54 +14,53 @@
|
||||
|
||||
# void get_architecture(string* return_arch)
|
||||
# - Returns the architecture in return_arch
|
||||
function(get_architecture return_arch)
|
||||
set(detect_arch_src_txt "
|
||||
function(libomp_get_architecture return_arch)
|
||||
set(detect_arch_src_txt "
|
||||
#if defined(__KNC__)
|
||||
#error ARCHITECTURE=mic
|
||||
#error ARCHITECTURE=mic
|
||||
#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
|
||||
#error ARCHITECTURE=32e
|
||||
#error ARCHITECTURE=x86_64
|
||||
#elif defined(__i386) || defined(__i386__) || defined(__IA32__) || defined(_M_I86) || defined(_M_IX86) || defined(__X86__) || defined(_X86_)
|
||||
#error ARCHITECTURE=32
|
||||
#error ARCHITECTURE=i386
|
||||
#elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
|
||||
#error ARCHITECTURE=arm
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6ZK__)
|
||||
#error ARCHITECTURE=arm
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__)
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
|
||||
#error ARCHITECTURE=arm
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__ARM_ARCH_3__) || defined(__ARM_ARCH_3M__)
|
||||
#error ARCHITECTURE=arm
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__ARM_ARCH_2__)
|
||||
#error ARCHITECTURE=arm
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__arm__) || defined(_M_ARM) || defined(_ARM)
|
||||
#error ARCHITECTURE=arm
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__aarch64__)
|
||||
#error ARCHITECTURE=aarch64
|
||||
#error ARCHITECTURE=aarch64
|
||||
#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
|
||||
#error ARCHITECTURE=ppc64le
|
||||
#error ARCHITECTURE=ppc64le
|
||||
#elif defined(__powerpc64__)
|
||||
#error ARCHITECTURE=ppc64
|
||||
#error ARCHITECTURE=ppc64
|
||||
#else
|
||||
#error ARCHITECTURE=UnknownArchitecture
|
||||
#error ARCHITECTURE=UnknownArchitecture
|
||||
#endif
|
||||
"
|
||||
)
|
||||
# Write out ${detect_arch_src_txt} to a file within the cmake/ subdirectory
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/detect_arch.c" ${detect_arch_src_txt})
|
||||
")
|
||||
# Write out ${detect_arch_src_txt} to a file within the cmake/ subdirectory
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libomp_detect_arch.c" ${detect_arch_src_txt})
|
||||
|
||||
# Try to compile using the C Compiler. It will always error out with an #error directive, so store error output to ${local_architecture}
|
||||
try_run(run_dummy compile_dummy "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/detect_arch.c" COMPILE_OUTPUT_VARIABLE local_architecture)
|
||||
# Try to compile using the C Compiler. It will always error out with an #error directive, so store error output to ${local_architecture}
|
||||
try_run(run_dummy compile_dummy "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/libomp_detect_arch.c" COMPILE_OUTPUT_VARIABLE local_architecture)
|
||||
|
||||
# Match the important architecture line and store only that matching string in ${local_architecture}
|
||||
string(REGEX MATCH "ARCHITECTURE=([a-zA-Z0-9_]+)" local_architecture "${local_architecture}")
|
||||
# Match the important architecture line and store only that matching string in ${local_architecture}
|
||||
string(REGEX MATCH "ARCHITECTURE=([a-zA-Z0-9_]+)" local_architecture "${local_architecture}")
|
||||
|
||||
# Get rid of the ARCHITECTURE= part of the string
|
||||
string(REPLACE "ARCHITECTURE=" "" local_architecture "${local_architecture}")
|
||||
# Get rid of the ARCHITECTURE= part of the string
|
||||
string(REPLACE "ARCHITECTURE=" "" local_architecture "${local_architecture}")
|
||||
|
||||
# set the return value to the architecture detected (e.g., 32e, 32, arm, ppc64, etc.)
|
||||
set(${return_arch} "${local_architecture}" PARENT_SCOPE)
|
||||
# set the return value to the architecture detected (e.g., 32e, 32, arm, ppc64, etc.)
|
||||
set(${return_arch} "${local_architecture}" PARENT_SCOPE)
|
||||
|
||||
# Remove ${detect_arch_src_txt} from cmake/ subdirectory
|
||||
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/detect_arch.c")
|
||||
# Remove ${detect_arch_src_txt} from cmake/ subdirectory
|
||||
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/libomp_detect_arch.c")
|
||||
endfunction()
|
||||
@@ -0,0 +1,207 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# Setup the flags correctly for cmake (covert to string)
|
||||
# Pretty them up (STRIP any beginning and trailing whitespace,
|
||||
# remove duplicates, remove empty entries)
|
||||
macro(libomp_setup_flags flags)
|
||||
if(NOT "${${flags}}" STREQUAL "") # if flags are empty, don't do anything
|
||||
set(flags_local)
|
||||
list(REMOVE_DUPLICATES ${flags}) # remove duplicates
|
||||
list(REMOVE_ITEM ${flags} "") # remove empty items
|
||||
libomp_list_to_string("${${flags}}" flags_local)
|
||||
string(STRIP "${flags_local}" flags_local)
|
||||
set(${flags} "${flags_local}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Gets flags common to both the C and C++ compiler
|
||||
function(libomp_get_c_and_cxxflags_common flags)
|
||||
set(flags_local)
|
||||
libomp_append(flags_local -std=c++11 LIBOMP_HAVE_STD_CPP11_FLAG)
|
||||
libomp_append(flags_local -fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
|
||||
if(${LIBOMP_ENABLE_WERROR})
|
||||
libomp_append(flags_local -Werror LIBOMP_HAVE_WERROR_FLAG)
|
||||
endif()
|
||||
libomp_append(flags_local -Wno-sign-compare LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG)
|
||||
libomp_append(flags_local -Wno-unused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
|
||||
libomp_append(flags_local -Wno-unused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
|
||||
libomp_append(flags_local -Wno-unused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)
|
||||
libomp_append(flags_local -Wno-unused-variable LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG)
|
||||
libomp_append(flags_local -Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG)
|
||||
libomp_append(flags_local -Wno-covered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG)
|
||||
libomp_append(flags_local -Wno-deprecated-register LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG)
|
||||
libomp_append(flags_local -Wno-gnu-anonymous-struct LIBOMP_HAVE_WNO_GNU_ANONYMOUS_STRUCT_FLAG)
|
||||
libomp_append(flags_local -Wno-unknown-pragmas LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG)
|
||||
libomp_append(flags_local -Wno-missing-field-initializers LIBOMP_HAVE_WNO_MISSING_FIELD_INITIALIZERS_FLAG)
|
||||
libomp_append(flags_local -Wno-missing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG)
|
||||
libomp_append(flags_local -Wno-comment LIBOMP_HAVE_WNO_COMMENT_FLAG)
|
||||
libomp_append(flags_local -Wno-self-assign LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG)
|
||||
libomp_append(flags_local -Wno-vla-extension LIBOMP_HAVE_WNO_VLA_EXTENSION_FLAG)
|
||||
libomp_append(flags_local -Wno-format-pedantic LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_FLAG)
|
||||
libomp_append(flags_local /GS LIBOMP_HAVE_GS_FLAG)
|
||||
libomp_append(flags_local /EHsc LIBOMP_HAVE_EHSC_FLAG)
|
||||
libomp_append(flags_local /Oy- LIBOMP_HAVE_OY__FLAG)
|
||||
# Intel(R) C Compiler flags
|
||||
libomp_append(flags_local /Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG)
|
||||
libomp_append(flags_local -Qoption,cpp,--extended_float_types LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)
|
||||
libomp_append(flags_local -Qlong_double LIBOMP_HAVE_LONG_DOUBLE_FLAG)
|
||||
libomp_append(flags_local -Qdiag-disable:177 LIBOMP_HAVE_DIAG_DISABLE_177_FLAG)
|
||||
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
libomp_append(flags_local -Qinline-min-size=1 LIBOMP_HAVE_INLINE_MIN_SIZE_FLAG)
|
||||
endif()
|
||||
# Architectural C and C++ flags
|
||||
if(${IA32})
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
libomp_append(flags_local -m32 LIBOMP_HAVE_M32_FLAG)
|
||||
endif()
|
||||
libomp_append(flags_local /arch:SSE2 LIBOMP_HAVE_ARCH_SSE2_FLAG)
|
||||
libomp_append(flags_local -msse2 LIBOMP_HAVE_MSSE2_FLAG)
|
||||
libomp_append(flags_local -falign-stack=maintain-16-byte LIBOMP_HAVE_FALIGN_STACK_FLAG)
|
||||
elseif(${MIC})
|
||||
libomp_append(flags_local -mmic LIBOMP_HAVE_MMIC_FLAG)
|
||||
libomp_append(flags_local -ftls-model=initial-exec LIBOMP_HAVE_FTLS_MODEL_FLAG)
|
||||
libomp_append(flags_local "-opt-streaming-stores never" LIBOMP_HAVE_OPT_STREAMING_STORES_FLAG)
|
||||
endif()
|
||||
set(${flags} ${flags_local} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# C compiler flags
|
||||
function(libomp_get_cflags cflags)
|
||||
set(cflags_local)
|
||||
libomp_get_c_and_cxxflags_common(cflags_local)
|
||||
# flags only for the C Compiler
|
||||
libomp_append(cflags_local /TP LIBOMP_HAVE_TP_FLAG)
|
||||
libomp_append(cflags_local "-x c++" LIBOMP_HAVE_X_CPP_FLAG)
|
||||
set(cflags_local ${cflags_local} ${LIBOMP_CFLAGS})
|
||||
libomp_setup_flags(cflags_local)
|
||||
set(${cflags} ${cflags_local} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# C++ compiler flags
|
||||
function(libomp_get_cxxflags cxxflags)
|
||||
set(cxxflags_local)
|
||||
libomp_get_c_and_cxxflags_common(cxxflags_local)
|
||||
set(cxxflags_local ${cxxflags_local} ${LIBOMP_CXXFLAGS})
|
||||
libomp_setup_flags(cxxflags_local)
|
||||
set(${cxxflags} ${cxxflags_local} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Assembler flags
|
||||
function(libomp_get_asmflags asmflags)
|
||||
set(asmflags_local)
|
||||
libomp_append(asmflags_local "-x assembler-with-cpp" LIBOMP_HAVE_X_ASSEMBLER_WITH_CPP_FLAG)
|
||||
# Architectural assembler flags
|
||||
if(${IA32})
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
libomp_append(asmflags_local -m32 LIBOMP_HAVE_M32_FLAG)
|
||||
endif()
|
||||
libomp_append(asmflags_local /safeseh LIBOMP_HAVE_SAFESEH_MASM_FLAG)
|
||||
libomp_append(asmflags_local /coff LIBOMP_HAVE_COFF_MASM_FLAG)
|
||||
elseif(${MIC})
|
||||
libomp_append(asmflags_local -mmic LIBOMP_HAVE_MMIC_FLAG)
|
||||
endif()
|
||||
set(asmflags_local ${asmflags_local} ${LIBOMP_ASMFLAGS})
|
||||
libomp_setup_flags(asmflags_local)
|
||||
set(${asmflags} ${asmflags_local} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Linker flags
|
||||
function(libomp_get_ldflags ldflags)
|
||||
set(ldflags_local)
|
||||
libomp_append(ldflags_local "${CMAKE_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_LIB_NAME}.def"
|
||||
IF_DEFINED CMAKE_LINK_DEF_FILE_FLAG)
|
||||
libomp_append(ldflags_local "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR}"
|
||||
IF_DEFINED CMAKE_C_OSX_CURRENT_VERSION_FLAG)
|
||||
libomp_append(ldflags_local "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR}"
|
||||
IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
|
||||
libomp_append(ldflags_local -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
|
||||
libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
|
||||
libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
|
||||
libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
|
||||
libomp_append(ldflags_local -Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
|
||||
libomp_append(ldflags_local -Wl,-fini=__kmp_internal_end_fini LIBOMP_HAVE_FINI_FLAG)
|
||||
libomp_append(ldflags_local -no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)
|
||||
libomp_append(ldflags_local -static-intel LIBOMP_HAVE_STATIC_INTEL_FLAG)
|
||||
libomp_append(ldflags_local /SAFESEH LIBOMP_HAVE_SAFESEH_FLAG)
|
||||
# Architectural linker flags
|
||||
if(${IA32})
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
libomp_append(ldflags_local -m32 LIBOMP_HAVE_M32_FLAG)
|
||||
endif()
|
||||
libomp_append(ldflags_local -msse2 LIBOMP_HAVE_MSSE2_FLAG)
|
||||
elseif(${MIC})
|
||||
libomp_append(ldflags_local -mmic LIBOMP_HAVE_MMIC_FLAG)
|
||||
libomp_append(ldflags_local -Wl,-x LIBOMP_HAVE_X_FLAG)
|
||||
endif()
|
||||
set(ldflags_local ${ldflags_local} ${LIBOMP_LDFLAGS})
|
||||
libomp_setup_flags(ldflags_local)
|
||||
set(${ldflags} ${ldflags_local} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Library flags
|
||||
function(libomp_get_libflags libflags)
|
||||
set(libflags_local)
|
||||
libomp_append(libflags_local "${CMAKE_THREAD_LIBS_INIT}")
|
||||
libomp_append(libflags_local "${LIBOMP_HWLOC_LIBRARY}" LIBOMP_USE_HWLOC)
|
||||
if(${IA32})
|
||||
libomp_append(libflags_local -lirc_pic LIBOMP_HAVE_IRC_PIC_LIBRARY)
|
||||
endif()
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
||||
libomp_append(libflags_local -lm)
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
||||
set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS})
|
||||
libomp_setup_flags(libflags_local)
|
||||
set(${libflags} ${libflags_local} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Fortran flags
|
||||
function(libomp_get_fflags fflags)
|
||||
set(fflags_local)
|
||||
if(${IA32})
|
||||
libomp_append(fflags_local -m32 LIBOMP_HAVE_M32_FORTRAN_FLAG)
|
||||
endif()
|
||||
set(fflags_local ${fflags_local} ${LIBOMP_FFLAGS})
|
||||
libomp_setup_flags(fflags_local)
|
||||
set(${fflags} ${fflags_local} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Perl generate-defs.pl flags (For Windows only)
|
||||
function(libomp_get_gdflags gdflags)
|
||||
set(gdflags_local)
|
||||
if(${IA32})
|
||||
set(libomp_gdflag_arch arch_32)
|
||||
elseif(${INTEL64})
|
||||
set(libomp_gdflag_arch arch_32e)
|
||||
else()
|
||||
set(libomp_gdflag_arch arch_${LIBOMP_ARCH})
|
||||
endif()
|
||||
libomp_append(gdflags_local "-D ${libomp_gdflag_arch}")
|
||||
libomp_append(gdflags_local "-D msvc_compat")
|
||||
libomp_append(gdflags_local "-D norm" NORMAL_LIBRARY)
|
||||
libomp_append(gdflags_local "-D prof" PROFILE_LIBRARY)
|
||||
libomp_append(gdflags_local "-D stub" STUBS_LIBRARY)
|
||||
libomp_append(gdflags_local "-D HAVE_QUAD" LIBOMP_USE_QUAD_PRECISION)
|
||||
libomp_append(gdflags_local "-D USE_DEBUGGER" LIBOMP_USE_DEBUGGER)
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 45 OR ${LIBOMP_OMP_VERSION} EQUAL 45)
|
||||
libomp_append(gdflags_local "-D OMP_45")
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
|
||||
libomp_append(gdflags_local "-D OMP_40")
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 30 OR ${LIBOMP_OMP_VERSION} EQUAL 30)
|
||||
libomp_append(gdflags_local "-D OMP_30")
|
||||
endif()
|
||||
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
libomp_append(gdflags_local "-D KMP_DEBUG")
|
||||
endif()
|
||||
set(${gdflags} ${gdflags_local} PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,225 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# The following micro-tests are small tests to perform on the library just created.
|
||||
# There are currently five micro-tests:
|
||||
# (1) test-touch
|
||||
# - Compile and run a small program using newly created libomp library
|
||||
# - Fails if test-touch.c does not compile or if test-touch.c does not run after compilation
|
||||
# - Program dependencies: gcc or g++, grep, bourne shell
|
||||
# - Available for all Unix,Mac,Windows builds. Not available on Intel(R) MIC Architecture builds.
|
||||
# (2) test-relo
|
||||
# - Tests dynamic libraries for position-dependent code (can not have any position dependent code)
|
||||
# - Fails if TEXTREL is in output of readelf -d libomp.so command
|
||||
# - Program dependencies: readelf, grep, bourne shell
|
||||
# - Available for Unix, Intel(R) MIC Architecture dynamic library builds. Not available otherwise.
|
||||
# (3) test-execstack
|
||||
# - Tests if stack is executable
|
||||
# - Fails if stack is executable. Should only be readable and writable. Not exectuable.
|
||||
# - Program dependencies: perl, readelf
|
||||
# - Available for Unix dynamic library builds. Not available otherwise.
|
||||
# (4) test-instr (Intel(R) MIC Architecutre only)
|
||||
# - Tests Intel(R) MIC Architecture libraries for valid instruction set
|
||||
# - Fails if finds invalid instruction for Intel(R) MIC Architecture (wasn't compiled with correct flags)
|
||||
# - Program dependencies: perl, objdump
|
||||
# - Available for Intel(R) MIC Architecture and i386 builds. Not available otherwise.
|
||||
# (5) test-deps
|
||||
# - Tests newly created libomp for library dependencies
|
||||
# - Fails if sees a dependence not listed in td_exp variable below
|
||||
# - Program dependencies: perl, (unix)readelf, (mac)otool[64], (windows)link.exe
|
||||
# - Available for Unix,Mac,Windows, Intel(R) MIC Architecture dynamic builds and Windows
|
||||
# static builds. Not available otherwise.
|
||||
|
||||
# get library location
|
||||
if(WIN32)
|
||||
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp RUNTIME_OUTPUT_DIRECTORY)
|
||||
get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
|
||||
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
|
||||
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
else()
|
||||
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp LIBRARY_OUTPUT_DIRECTORY)
|
||||
endif()
|
||||
if(NOT LIBOMP_OUTPUT_DIRECTORY)
|
||||
set(LIBOMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
# test-touch
|
||||
find_program(LIBOMP_SHELL sh)
|
||||
if(WIN32)
|
||||
if(LIBOMP_SHELL)
|
||||
set(libomp_test_touch_targets test-touch-md/.success test-touch-mt/.success)
|
||||
endif()
|
||||
# pick test-touch compiler
|
||||
set(libomp_test_touch_compiler ${CMAKE_C_COMPILER})
|
||||
# test-touch compilation flags
|
||||
libomp_append(libomp_test_touch_cflags /nologo)
|
||||
libomp_append(libomp_test_touch_libs ${LIBOMPIMP_OUTPUT_DIRECTORY}/${LIBOMP_IMP_LIB_FILE})
|
||||
if(${IA32})
|
||||
libomp_append(libomp_test_touch_ldflags /safeseh)
|
||||
endif()
|
||||
else() # (Unix based systems, Intel(R) MIC Architecture, and Mac)
|
||||
if(LIBOMP_SHELL)
|
||||
set(libomp_test_touch_targets test-touch-rt/.success)
|
||||
endif()
|
||||
# pick test-touch compiler
|
||||
if(${LIBOMP_USE_STDCPPLIB})
|
||||
set(libomp_test_touch_compiler ${CMAKE_CXX_COMPILER})
|
||||
else()
|
||||
set(libomp_test_touch_compiler ${CMAKE_C_COMPILER})
|
||||
endif()
|
||||
# test-touch compilation flags
|
||||
libomp_append(libomp_test_touch_libs "${CMAKE_THREAD_LIBS_INIT}")
|
||||
if(${IA32})
|
||||
libomp_append(libomp_test_touch_cflags -m32 LIBOMP_HAVE_M32_FLAG)
|
||||
endif()
|
||||
libomp_append(libomp_test_touch_libs ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE})
|
||||
libomp_append(libomp_test_touch_libs "${LIBOMP_HWLOC_LIBRARY}" LIBOMP_USE_HWLOC)
|
||||
if(APPLE)
|
||||
set(libomp_test_touch_env "DYLD_LIBRARY_PATH=.:${LIBOMP_OUTPUT_DIRECTORY}:$ENV{DYLD_LIBRARY_PATH}")
|
||||
libomp_append(libomp_test_touch_ldflags "-Wl,-rpath,${LIBOMP_HWLOC_LIBRARY_DIR}" LIBOMP_USE_HWLOC)
|
||||
else()
|
||||
set(libomp_test_touch_env "LD_LIBRARY_PATH=.:${LIBOMP_OUTPUT_DIRECTORY}:$ENV{LD_LIBRARY_PATH}")
|
||||
libomp_append(libomp_test_touch_ldflags "-Wl,-rpath=${LIBOMP_HWLOC_LIBRARY_DIR}" LIBOMP_USE_HWLOC)
|
||||
endif()
|
||||
endif()
|
||||
macro(libomp_test_touch_recipe test_touch_dir)
|
||||
set(libomp_test_touch_dependencies ${LIBOMP_SRC_DIR}/test-touch.c omp)
|
||||
set(libomp_test_touch_exe ${test_touch_dir}/test-touch${CMAKE_EXECUTABLE_SUFFIX})
|
||||
set(libomp_test_touch_obj ${test_touch_dir}/test-touch${CMAKE_C_OUTPUT_EXTENSION})
|
||||
if(WIN32)
|
||||
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
if(${test_touch_dir} MATCHES "test-touch-mt")
|
||||
libomp_append(libomp_test_touch_cflags /MT)
|
||||
else()
|
||||
libomp_append(libomp_test_touch_cflags /MD)
|
||||
endif()
|
||||
else()
|
||||
if(${test_touch_dir} MATCHES "test-touch-mt")
|
||||
libomp_append(libomp_test_touch_cflags /MTd)
|
||||
else()
|
||||
libomp_append(libomp_test_touch_cflags /MDd)
|
||||
endif()
|
||||
endif()
|
||||
set(libomp_test_touch_out_flags -Fe${libomp_test_touch_exe} -Fo${libomp_test_touch_obj})
|
||||
list(APPEND libomp_test_touch_dependencies ompimp)
|
||||
else()
|
||||
set(libomp_test_touch_out_flags -o ${libomp_test_touch_exe})
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${test_touch_dir}/.success ${libomp_test_touch_exe} ${libomp_test_touch_obj}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${test_touch_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${test_touch_dir}/*
|
||||
COMMAND ${libomp_test_touch_compiler} ${libomp_test_touch_out_flags} ${libomp_test_touch_cflags}
|
||||
${LIBOMP_SRC_DIR}/test-touch.c ${libomp_test_touch_ldflags} ${libomp_test_touch_libs}
|
||||
COMMAND ${LIBOMP_SHELL} -c \"${libomp_test_touch_env} ${libomp_test_touch_exe}\"
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${test_touch_dir}/.success
|
||||
DEPENDS ${libomp_test_touch_dependencies}
|
||||
)
|
||||
endmacro()
|
||||
libomp_append(libomp_test_touch_env "KMP_VERSION=1")
|
||||
add_custom_target(libomp-test-touch DEPENDS ${libomp_test_touch_targets})
|
||||
if(WIN32)
|
||||
libomp_test_touch_recipe(test-touch-mt)
|
||||
libomp_test_touch_recipe(test-touch-md)
|
||||
else()
|
||||
libomp_test_touch_recipe(test-touch-rt)
|
||||
endif()
|
||||
|
||||
# test-relo
|
||||
add_custom_target(libomp-test-relo DEPENDS test-relo/.success)
|
||||
add_custom_command(
|
||||
OUTPUT test-relo/.success test-relo/readelf.log
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-relo
|
||||
COMMAND readelf -d ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE} > test-relo/readelf.log
|
||||
COMMAND grep -e TEXTREL test-relo/readelf.log \; test $$? -eq 1
|
||||
COMMAND ${CMAKE_COMMAND} -E touch test-relo/.success
|
||||
DEPENDS omp
|
||||
)
|
||||
|
||||
# test-execstack
|
||||
add_custom_target(libomp-test-execstack DEPENDS test-execstack/.success)
|
||||
add_custom_command(
|
||||
OUTPUT test-execstack/.success
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-execstack
|
||||
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-execstack.pl
|
||||
--arch=${LIBOMP_PERL_SCRIPT_ARCH} ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch test-execstack/.success
|
||||
DEPENDS omp
|
||||
)
|
||||
|
||||
# test-instr
|
||||
add_custom_target(libomp-test-instr DEPENDS test-instr/.success)
|
||||
add_custom_command(
|
||||
OUTPUT test-instr/.success
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-instr
|
||||
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-instruction-set.pl --os=${LIBOMP_PERL_SCRIPT_OS}
|
||||
--arch=${LIBOMP_PERL_SCRIPT_ARCH} --show --mic-arch=${LIBOMP_MIC_ARCH} ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch test-instr/.success
|
||||
DEPENDS omp ${LIBOMP_TOOLS_DIR}/check-instruction-set.pl
|
||||
)
|
||||
|
||||
# test-deps
|
||||
add_custom_target(libomp-test-deps DEPENDS test-deps/.success)
|
||||
set(libomp_expected_library_deps)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set(libomp_expected_library_deps libc.so.7 libthr.so.3)
|
||||
libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
||||
set(libomp_expected_library_deps libc.so.12 libpthread.so.1 libm.so.0)
|
||||
libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC)
|
||||
elseif(APPLE)
|
||||
set(libomp_expected_library_deps /usr/lib/libSystem.B.dylib)
|
||||
elseif(WIN32)
|
||||
set(libomp_expected_library_deps kernel32.dll)
|
||||
libomp_append(libomp_expected_library_deps psapi.dll LIBOMP_OMPT_SUPPORT)
|
||||
else()
|
||||
if(${MIC})
|
||||
set(libomp_expected_library_deps libc.so.6 libpthread.so.0 libdl.so.2)
|
||||
if("${LIBOMP_MIC_ARCH}" STREQUAL "knf")
|
||||
libomp_append(libomp_expected_library_deps ld-linux-l1om.so.2)
|
||||
libomp_append(libomp_expected_library_deps libgcc_s.so.1)
|
||||
elseif("${LIBOMP_MIC_ARCH}" STREQUAL "knc")
|
||||
libomp_append(libomp_expected_library_deps ld-linux-k1om.so.2)
|
||||
endif()
|
||||
else()
|
||||
set(libomp_expected_library_deps libdl.so.2 libgcc_s.so.1)
|
||||
if(${IA32})
|
||||
libomp_append(libomp_expected_library_deps libc.so.6)
|
||||
libomp_append(libomp_expected_library_deps ld-linux.so.2)
|
||||
elseif(${INTEL64})
|
||||
libomp_append(libomp_expected_library_deps libc.so.6)
|
||||
libomp_append(libomp_expected_library_deps ld-linux-x86-64.so.2)
|
||||
elseif(${ARM})
|
||||
libomp_append(libomp_expected_library_deps libc.so.6)
|
||||
libomp_append(libomp_expected_library_deps libffi.so.6)
|
||||
libomp_append(libomp_expected_library_deps libffi.so.5)
|
||||
libomp_append(libomp_expected_library_deps ld-linux-armhf.so.3)
|
||||
elseif(${PPC64})
|
||||
libomp_append(libomp_expected_library_deps libc.so.6)
|
||||
libomp_append(libomp_expected_library_deps ld64.so.1)
|
||||
endif()
|
||||
libomp_append(libomp_expected_library_deps libpthread.so.0 IF_FALSE STUBS_LIBRARY)
|
||||
libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC)
|
||||
endif()
|
||||
libomp_append(libomp_expected_library_deps libstdc++.so.6 LIBOMP_USE_STDCPPLIB)
|
||||
libomp_append(libomp_expected_library_deps libm.so.6 LIBOMP_STATS)
|
||||
endif()
|
||||
# Perl script expects comma separated list
|
||||
string(REPLACE ";" "," libomp_expected_library_deps "${libomp_expected_library_deps}")
|
||||
add_custom_command(
|
||||
OUTPUT test-deps/.success
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-deps
|
||||
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-depends.pl --os=${LIBOMP_PERL_SCRIPT_OS}
|
||||
--arch=${LIBOMP_PERL_SCRIPT_ARCH} --expected="${libomp_expected_library_deps}" ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch test-deps/.success
|
||||
DEPENDS omp ${LIBOMP_TOOLS_DIR}/check-depends.pl
|
||||
)
|
||||
@@ -0,0 +1,191 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# void libomp_say(string message_to_user);
|
||||
# - prints out message_to_user
|
||||
macro(libomp_say message_to_user)
|
||||
message(STATUS "LIBOMP: ${message_to_user}")
|
||||
endmacro()
|
||||
|
||||
# void libomp_warning_say(string message_to_user);
|
||||
# - prints out message_to_user with a warning
|
||||
macro(libomp_warning_say message_to_user)
|
||||
message(WARNING "LIBOMP: ${message_to_user}")
|
||||
endmacro()
|
||||
|
||||
# void libomp_error_say(string message_to_user);
|
||||
# - prints out message_to_user with an error and exits cmake
|
||||
macro(libomp_error_say message_to_user)
|
||||
message(FATAL_ERROR "LIBOMP: ${message_to_user}")
|
||||
endmacro()
|
||||
|
||||
# libomp_append(<flag> <flags_list> [(IF_TRUE | IF_FALSE | IF_TRUE_1_0 ) BOOLEAN])
|
||||
#
|
||||
# libomp_append(<flag> <flags_list>)
|
||||
# - unconditionally appends <flag> to the list of definitions
|
||||
#
|
||||
# libomp_append(<flag> <flags_list> <BOOLEAN>)
|
||||
# - appends <flag> to the list of definitions if BOOLEAN is true
|
||||
#
|
||||
# libomp_append(<flag> <flags_list> IF_TRUE <BOOLEAN>)
|
||||
# - appends <flag> to the list of definitions if BOOLEAN is true
|
||||
#
|
||||
# libomp_append(<flag> <flags_list> IF_FALSE <BOOLEAN>)
|
||||
# - appends <flag> to the list of definitions if BOOLEAN is false
|
||||
#
|
||||
# libomp_append(<flag> <flags_list> IF_DEFINED <VARIABLE>)
|
||||
# - appends <flag> to the list of definitions if VARIABLE is defined
|
||||
#
|
||||
# libomp_append(<flag> <flags_list> IF_TRUE_1_0 <BOOLEAN>)
|
||||
# - appends <flag>=1 to the list of definitions if <BOOLEAN> is true, <flag>=0 otherwise
|
||||
# e.g., libomp_append("-D USE_FEATURE" IF_TRUE_1_0 HAVE_FEATURE)
|
||||
# appends "-D USE_FEATURE=1" if HAVE_FEATURE is true
|
||||
# or "-D USE_FEATURE=0" if HAVE_FEATURE is false
|
||||
macro(libomp_append flags flag)
|
||||
if(NOT (${ARGC} EQUAL 2 OR ${ARGC} EQUAL 3 OR ${ARGC} EQUAL 4))
|
||||
libomp_error_say("libomp_append: takes 2, 3, or 4 arguments")
|
||||
endif()
|
||||
if(${ARGC} EQUAL 2)
|
||||
list(APPEND ${flags} "${flag}")
|
||||
elseif(${ARGC} EQUAL 3)
|
||||
if(${ARGV2})
|
||||
list(APPEND ${flags} "${flag}")
|
||||
endif()
|
||||
else()
|
||||
if(${ARGV2} STREQUAL "IF_TRUE")
|
||||
if(${ARGV3})
|
||||
list(APPEND ${flags} "${flag}")
|
||||
endif()
|
||||
elseif(${ARGV2} STREQUAL "IF_FALSE")
|
||||
if(NOT ${ARGV3})
|
||||
list(APPEND ${flags} "${flag}")
|
||||
endif()
|
||||
elseif(${ARGV2} STREQUAL "IF_DEFINED")
|
||||
if(DEFINED ${ARGV3})
|
||||
list(APPEND ${flags} "${flag}")
|
||||
endif()
|
||||
elseif(${ARGV2} STREQUAL "IF_TRUE_1_0")
|
||||
if(${ARGV3})
|
||||
list(APPEND ${flags} "${flag}=1")
|
||||
else()
|
||||
list(APPEND ${flags} "${flag}=0")
|
||||
endif()
|
||||
else()
|
||||
libomp_error_say("libomp_append: third argument must be one of IF_TRUE, IF_FALSE, IF_DEFINED, IF_TRUE_1_0")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# void libomp_get_legal_arch(string* return_arch_string);
|
||||
# - returns (through return_arch_string) the formal architecture
|
||||
# string or warns user of unknown architecture
|
||||
function(libomp_get_legal_arch return_arch_string)
|
||||
if(${IA32})
|
||||
set(${return_arch_string} "IA-32" PARENT_SCOPE)
|
||||
elseif(${INTEL64})
|
||||
set(${return_arch_string} "Intel(R) 64" PARENT_SCOPE)
|
||||
elseif(${MIC})
|
||||
set(${return_arch_string} "Intel(R) Many Integrated Core Architecture" PARENT_SCOPE)
|
||||
elseif(${ARM})
|
||||
set(${return_arch_string} "ARM" PARENT_SCOPE)
|
||||
elseif(${PPC64BE})
|
||||
set(${return_arch_string} "PPC64BE" PARENT_SCOPE)
|
||||
elseif(${PPC64LE})
|
||||
set(${return_arch_string} "PPC64LE" PARENT_SCOPE)
|
||||
elseif(${AARCH64})
|
||||
set(${return_arch_string} "AARCH64" PARENT_SCOPE)
|
||||
else()
|
||||
set(${return_arch_string} "${LIBOMP_ARCH}" PARENT_SCOPE)
|
||||
libomp_warning_say("libomp_get_legal_arch(): Warning: Unknown architecture: Using ${LIBOMP_ARCH}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# void libomp_check_variable(string var, ...);
|
||||
# - runs through all values checking if ${var} == value
|
||||
# - uppercase and lowercase do not matter
|
||||
# - if the var is found, then just print it out
|
||||
# - if the var is not found, then error out
|
||||
function(libomp_check_variable var)
|
||||
set(valid_flag 0)
|
||||
string(TOLOWER "${${var}}" var_lower)
|
||||
foreach(value IN LISTS ARGN)
|
||||
string(TOLOWER "${value}" value_lower)
|
||||
if("${var_lower}" STREQUAL "${value_lower}")
|
||||
set(valid_flag 1)
|
||||
set(the_value "${value}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(${valid_flag} EQUAL 0)
|
||||
libomp_error_say("libomp_check_variable(): ${var} = ${${var}} is unknown")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# void libomp_get_build_number(string src_dir, string* return_build_number);
|
||||
# - grab the eight digit build number (or 00000000) from kmp_version.c
|
||||
function(libomp_get_build_number src_dir return_build_number)
|
||||
# sets file_lines_list to a list of all lines in kmp_version.c
|
||||
file(STRINGS "${src_dir}/src/kmp_version.c" file_lines_list)
|
||||
|
||||
# runs through each line in kmp_version.c
|
||||
foreach(line IN LISTS file_lines_list)
|
||||
# if the line begins with "#define KMP_VERSION_BUILD" then we take not of the build number
|
||||
string(REGEX MATCH "^[ \t]*#define[ \t]+KMP_VERSION_BUILD" valid "${line}")
|
||||
if(NOT "${valid}" STREQUAL "") # if we matched "#define KMP_VERSION_BUILD", then grab the build number
|
||||
string(REGEX REPLACE "^[ \t]*#define[ \t]+KMP_VERSION_BUILD[ \t]+([0-9]+)" "\\1"
|
||||
build_number "${line}"
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
set(${return_build_number} "${build_number}" PARENT_SCOPE) # return build number
|
||||
endfunction()
|
||||
|
||||
# void libomp_get_legal_type(string* return_legal_type);
|
||||
# - set the legal type name Performance/Profiling/Stub
|
||||
function(libomp_get_legal_type return_legal_type)
|
||||
if(${NORMAL_LIBRARY})
|
||||
set(${return_legal_type} "Performance" PARENT_SCOPE)
|
||||
elseif(${PROFILE_LIBRARY})
|
||||
set(${return_legal_type} "Profiling" PARENT_SCOPE)
|
||||
elseif(${STUBS_LIBRARY})
|
||||
set(${return_legal_type} "Stub" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# void libomp_add_suffix(string suffix, list<string>* list_of_items);
|
||||
# - returns list_of_items with suffix appended to all items
|
||||
# - original list is modified
|
||||
function(libomp_add_suffix suffix list_of_items)
|
||||
set(local_list "")
|
||||
foreach(item IN LISTS "${list_of_items}")
|
||||
if(NOT "${item}" STREQUAL "")
|
||||
list(APPEND local_list "${item}${suffix}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(${list_of_items} "${local_list}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# void libomp_list_to_string(list<string> list_of_things, string* return_string);
|
||||
# - converts a list to a space separated string
|
||||
function(libomp_list_to_string list_of_things return_string)
|
||||
string(REPLACE ";" " " output_variable "${list_of_things}")
|
||||
set(${return_string} "${output_variable}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# void libomp_string_to_list(string str, list<string>* return_list);
|
||||
# - converts a string to a semicolon separated list
|
||||
# - what it really does is just string_replace all running whitespace to a semicolon
|
||||
# - in cmake, a list is strings separated by semicolons: i.e., list of four items, list = "item1;item2;item3;item4"
|
||||
function(libomp_string_to_list str return_list)
|
||||
set(outstr)
|
||||
string(REGEX REPLACE "[ \t]+" ";" outstr "${str}")
|
||||
set(${return_list} "${outstr}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds Microsoft Visual Studio dependent flags
|
||||
# The flag types are:
|
||||
# 1) Assembly flags
|
||||
|
||||
#########################################################
|
||||
# Assembly flags
|
||||
function(append_assembler_specific_asm_flags input_asm_flags)
|
||||
set(local_asm_flags)
|
||||
append_asm_flags("-nologo") # Turn off tool banner.
|
||||
if(${IA32})
|
||||
append_asm_flags("-safeseh") # Registers exception handlers for safe exception handling.
|
||||
append_asm_flags("-coff") # Generates common object file format (COFF) type of object module.
|
||||
# Generally required for Win32 assembly language development.
|
||||
append_asm_flags("-D _M_IA32")
|
||||
elseif(${INTEL64})
|
||||
append_asm_flags("-D _M_AMD64")
|
||||
endif()
|
||||
# CMake prefers the /MD flags when compiling Windows sources, but libomp needs to use /MT instead
|
||||
# So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE.
|
||||
# replace_md_with_mt() is in HelperFunctions.cmake
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG)
|
||||
set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -1,75 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This file holds Microsoft Visual Studio dependent flags
|
||||
# The flag types are:
|
||||
# 1) C/C++ Compiler flags
|
||||
# 2) Fortran Compiler flags
|
||||
|
||||
#########################################################
|
||||
# Visual Studio C/C++ Compiler flags
|
||||
function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags)
|
||||
set(local_c_flags)
|
||||
set(local_cxx_flags)
|
||||
append_c_flags("-TP") # Tells the compiler to process a file as a C++ source file.
|
||||
append_cxx_flags("-EHsc") # Enable C++ exception handling.
|
||||
append_c_and_cxx_flags("-W3") # Enables diagnostics for remarks, warnings, and errors.
|
||||
# Additional warnings are also enabled above level 2 warnings.
|
||||
append_c_and_cxx_flags("-GS") # Lets you control the threshold at which the stack checking routine is called or not called.
|
||||
if(${IA32})
|
||||
append_c_and_cxx_flags("-arch:ia32") # Tells the compiler which features it may target (ia32)
|
||||
append_c_and_cxx_flags("-Oy-") # equivalent to -fno-omit-frame-pointer
|
||||
endif()
|
||||
# CMake prefers the /MD flags when compiling Windows sources, but libomp needs to use /MT instead
|
||||
# So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE.
|
||||
# replace_md_with_mt() is in HelperFunctions.cmake
|
||||
replace_md_with_mt(CMAKE_C_FLAGS)
|
||||
replace_md_with_mt(CMAKE_C_FLAGS_RELEASE)
|
||||
replace_md_with_mt(CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
replace_md_with_mt(CMAKE_C_FLAGS_DEBUG)
|
||||
replace_md_with_mt(CMAKE_CXX_FLAGS)
|
||||
replace_md_with_mt(CMAKE_CXX_FLAGS_RELEASE)
|
||||
replace_md_with_mt(CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
replace_md_with_mt(CMAKE_CXX_FLAGS_DEBUG)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO)
|
||||
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG)
|
||||
set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE)
|
||||
set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#########################################################
|
||||
# Visual Studio Linker flags
|
||||
function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs)
|
||||
set(local_ld_flags)
|
||||
set(local_ld_flags_libs)
|
||||
append_linker_flags("-WX:NO")
|
||||
append_linker_flags("-version:${LIBOMP_VERSION}.0")
|
||||
append_linker_flags("-NXCompat")
|
||||
append_linker_flags("-DynamicBase") # This option modifies the header of an executable to indicate
|
||||
# whether the application should be randomly rebased at load time.
|
||||
if(${IA32})
|
||||
append_linker_flags("-machine:i386")
|
||||
append_linker_flags("-safeseh")
|
||||
elseif(${INTEL64})
|
||||
append_linker_flags("-machine:amd64")
|
||||
endif()
|
||||
if(NOT "${def_file}" STREQUAL "")
|
||||
append_linker_flags("-def:${def_file}")
|
||||
endif()
|
||||
# Have Visual Studio use link.exe directly
|
||||
#set(CMAKE_C_CREATE_SHARED_LIBRARY "link.exe /out:<TARGET> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>" PARENT_SCOPE)
|
||||
#set(CMAKE_SHARED_LINKER_FLAGS "$ENV{LDLFAGS}" CACHE STRING "Linker Flags" FORCE)
|
||||
set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE)
|
||||
set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
######################################################
|
||||
# MICRO TESTS
|
||||
# The following micro-tests are small tests to perform on
|
||||
# the library just created in ${CMAKE_CURRENT_BINARY_DIR}/, there are currently
|
||||
# five micro-tests:
|
||||
# (1) test-touch
|
||||
# - Compile and run a small program using newly created libomp library
|
||||
# - Fails if test-touch.c does not compile or if test-touch.c does not run after compilation
|
||||
# - Program dependencies: gcc or g++, grep, bourne shell
|
||||
# - Available for all Linux,Mac,Windows builds. Not available on Intel(R) MIC Architecture builds.
|
||||
# (2) test-relo
|
||||
# - Tests dynamic libraries for position-dependent code (can not have any position dependent code)
|
||||
# - Fails if TEXTREL is in output of readelf -d libomp.so command
|
||||
# - Program dependencies: readelf, grep, bourne shell
|
||||
# - Available for Linux, Intel(R) MIC Architecture dynamic library builds. Not available otherwise.
|
||||
# (3) test-execstack
|
||||
# - Tests if stack is executable
|
||||
# - Fails if stack is executable. Should only be readable and writable. Not exectuable.
|
||||
# - Program dependencies: perl, readelf
|
||||
# - Available for Linux dynamic library builds. Not available otherwise.
|
||||
# (4) test-instr (Intel(R) MIC Architecutre only)
|
||||
# - Tests Intel(R) MIC Architecture libraries for valid instruction set
|
||||
# - Fails if finds invalid instruction for Intel(R) MIC Architecture (wasn't compiled with correct flags)
|
||||
# - Program dependencies: perl, objdump
|
||||
# - Available for Intel(R) MIC Architecture builds. Not available otherwise.
|
||||
# (5) test-deps
|
||||
# - Tests newly created libomp for library dependencies
|
||||
# - Fails if sees a dependence not listed in td_exp variable below
|
||||
# - Program dependencies: perl, (linux)readelf, (mac)otool[64], (windows)link.exe
|
||||
# - Available for Linux,Mac,Windows, Intel(R) MIC Architecture dynamic builds and Windows static builds. Not available otherwise.
|
||||
#
|
||||
# All tests can be turned off by including -Dtests=off when calling cmake
|
||||
# An individual test can be turned off by issuing something like -Dtest_touch=off when calling cmake
|
||||
|
||||
# test-touch
|
||||
if(${WINDOWS})
|
||||
set(do_test_touch_mt TRUE)
|
||||
if(${do_test_touch_mt})
|
||||
set(test_touch_items ${test_touch_items} test-touch-md test-touch-mt)
|
||||
else()
|
||||
set(test_touch_items ${test_touch_items} test-touch-md)
|
||||
endif()
|
||||
else()
|
||||
set(test_touch_items ${test_touch_items} test-touch-rt)
|
||||
endif()
|
||||
set(regular_test_touch_items "${test_touch_items}")
|
||||
add_suffix("/.success" regular_test_touch_items)
|
||||
# test-touch : ${test_touch_items}/.success
|
||||
set(ldeps "${regular_test_touch_items}")
|
||||
add_custom_target(libomp-test-touch DEPENDS ${ldeps})
|
||||
|
||||
if(${WINDOWS})
|
||||
# pick test-touch compiler
|
||||
set(tt-c cl)
|
||||
# test-touch compilation flags
|
||||
list(APPEND tt-c-flags -nologo)
|
||||
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
list(APPEND tt-c-flags-mt -MT)
|
||||
list(APPEND tt-c-flags-md -MD)
|
||||
else()
|
||||
list(APPEND tt-c-flags-mt -MTd)
|
||||
list(APPEND tt-c-flags-md -MDd)
|
||||
endif()
|
||||
list(APPEND tt-libs ${CMAKE_CURRENT_BINARY_DIR}/${imp_file})
|
||||
list(APPEND tt-ld-flags -link -nodefaultlib:oldnames)
|
||||
if(${IA32})
|
||||
list(APPEND tt-ld-flags -safeseh)
|
||||
endif()
|
||||
list(APPEND tt-ld-flags-v -verbose)
|
||||
else() # (Unix based systems, Intel(R) MIC Architecture, and Mac)
|
||||
# pick test-touch compiler
|
||||
if(${STD_CPP_LIB})
|
||||
set(tt-c ${CMAKE_CXX_COMPILER})
|
||||
else()
|
||||
set(tt-c ${CMAKE_C_COMPILER})
|
||||
endif()
|
||||
# test-touch compilation flags
|
||||
if(${LINUX})
|
||||
list(APPEND tt-c-flags -pthread)
|
||||
endif()
|
||||
if(${IA32})
|
||||
list(APPEND tt-c-flags -m32)
|
||||
elseif(${INTEL64})
|
||||
list(APPEND tt-c-flags -m64)
|
||||
endif()
|
||||
list(APPEND tt-libs ${CMAKE_CURRENT_BINARY_DIR}/${lib_file})
|
||||
if(${MAC})
|
||||
list(APPEND tt-ld-flags-v -Wl,-t)
|
||||
set(tt-env "DYLD_LIBRARY_PATH=.:$ENV{DYLD_LIBRARY_PATH}")
|
||||
else()
|
||||
list(APPEND tt-ld-flags-v -Wl,--verbose)
|
||||
set(tt-env LD_LIBRARY_PATH=".:${CMAKE_CURRENT_BINARY_DIR}:$ENV{LD_LIBRARY_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND tt-c-flags "${tt-c-flags-rt}")
|
||||
list(APPEND tt-env "KMP_VERSION=1")
|
||||
|
||||
macro(test_touch_recipe test_touch_dir)
|
||||
set(ldeps ${src_dir}/test-touch.c omp)
|
||||
set(tt-exe-file ${test_touch_dir}/test-touch${exe})
|
||||
if(${WINDOWS})
|
||||
# ****** list(APPEND tt-c-flags -Fo$(dir $@)test-touch${obj} -Fe$(dir $@)test-touch${exe}) *******
|
||||
set(tt-c-flags-out -Fo${test_touch_dir}/test-touch${obj} -Fe${test_touch_dir}/test-touch${exe})
|
||||
list(APPEND ldeps ${CMAKE_CURRENT_BINARY_DIR}/${imp_file})
|
||||
else()
|
||||
# ****** list(APPEND tt-c-flags -o $(dir $@)test-touch${exe}) ********
|
||||
set(tt-c-flags-out -o ${test_touch_dir}/test-touch${exe})
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${test_touch_dir}/.success
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${test_touch_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${test_touch_dir}/*
|
||||
COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${tt-exe-file}
|
||||
COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags} ${tt-ld-flags-v} > ${test_touch_dir}/build.log 2>&1
|
||||
COMMAND ${tt-env} ${tt-exe-file}
|
||||
#COMMAND grep -i -e \"[^_]libirc\" ${test_touch_dir}/build.log > ${test_touch_dir}/libirc.log \; [ $$? -eq 1 ]
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${test_touch_dir}/.success
|
||||
DEPENDS ${ldeps}
|
||||
)
|
||||
endmacro()
|
||||
if(${WINDOWS})
|
||||
test_touch_recipe(test-touch-mt)
|
||||
test_touch_recipe(test-touch-md)
|
||||
else()
|
||||
test_touch_recipe(test-touch-rt)
|
||||
endif()
|
||||
|
||||
# test-relo
|
||||
add_custom_target(libomp-test-relo DEPENDS test-relo/.success)
|
||||
add_custom_command(
|
||||
OUTPUT test-relo/.success
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-relo
|
||||
COMMAND readelf -d ${CMAKE_CURRENT_BINARY_DIR}/${lib_file} > test-relo/readelf.log
|
||||
COMMAND grep -e TEXTREL test-relo/readelf.log \; [ $$? -eq 1 ]
|
||||
COMMAND ${CMAKE_COMMAND} -E touch test-relo/.success
|
||||
DEPENDS omp
|
||||
)
|
||||
|
||||
# test-execstack
|
||||
add_custom_target(libomp-test-execstack DEPENDS test-execstack/.success)
|
||||
add_custom_command(
|
||||
OUTPUT test-execstack/.success
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-execstack
|
||||
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-execstack.pl ${oa_opts} ${CMAKE_CURRENT_BINARY_DIR}/${lib_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch test-execstack/.success
|
||||
DEPENDS omp
|
||||
)
|
||||
|
||||
# test-instr
|
||||
add_custom_target(libomp-test-instr DEPENDS test-instr/.success)
|
||||
add_custom_command(
|
||||
OUTPUT test-instr/.success
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-instr
|
||||
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-instruction-set.pl ${oa_opts} --show --mic-arch=${LIBOMP_MIC_ARCH} ${CMAKE_CURRENT_BINARY_DIR}/${lib_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch test-instr/.success
|
||||
DEPENDS omp ${tools_dir}/check-instruction-set.pl
|
||||
)
|
||||
|
||||
# test-deps
|
||||
add_custom_target(libomp-test-deps DEPENDS test-deps/.success)
|
||||
set(td_exp)
|
||||
if(${FREEBSD})
|
||||
set(td_exp libc.so.7 libthr.so.3 libunwind.so.5)
|
||||
elseif(${MAC})
|
||||
set(td_exp /usr/lib/libSystem.B.dylib)
|
||||
elseif(${WINDOWS})
|
||||
set(td_exp kernel32.dll)
|
||||
elseif(${LINUX})
|
||||
if(${MIC})
|
||||
set(td_exp libc.so.6,libpthread.so.0,libdl.so.2)
|
||||
if(${STD_CPP_LIB})
|
||||
set(td_exp ${td_exp},libstdc++.so.6)
|
||||
endif()
|
||||
if("${LIBOMP_MIC_ARCH}" STREQUAL "knf")
|
||||
set(td_exp ${td_exp},ld-linux-l1om.so.2,libgcc_s.so.1)
|
||||
elseif("${LIBOMP_MIC_ARCH}" STREQUAL "knc")
|
||||
set(td_exp ${td_exp},ld-linux-k1om.so.2)
|
||||
endif()
|
||||
else()
|
||||
set(td_exp libdl.so.2,libgcc_s.so.1)
|
||||
if(${IA32})
|
||||
set(td_exp ${td_exp},libc.so.6,ld-linux.so.2)
|
||||
elseif(${INTEL64})
|
||||
set(td_exp ${td_exp},libc.so.6,ld-linux-x86-64.so.2)
|
||||
elseif(${ARM})
|
||||
set(td_exp ${td_exp},libffi.so.6,libffi.so.5,libc.so.6,ld-linux-armhf.so.3)
|
||||
elseif(${PPC64})
|
||||
set(td_exp ${td_exp},libc.so.6,ld64.so.1)
|
||||
endif()
|
||||
if(${STD_CPP_LIB})
|
||||
set(td_exp ${td_exp},libstdc++.so.6)
|
||||
endif()
|
||||
if(NOT ${STUBS_LIBRARY})
|
||||
set(td_exp ${td_exp},libpthread.so.0)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT test-deps/.success
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-deps
|
||||
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-depends.pl ${oa_opts} --expected="${td_exp}" ${CMAKE_CURRENT_BINARY_DIR}/${lib_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch test-deps/.success
|
||||
DEPENDS omp ${tools_dir}/check-depends.pl
|
||||
)
|
||||
# END OF TESTS
|
||||
######################################################
|
||||
@@ -1,93 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# void append_ev_flags(string new_flag);
|
||||
# - appends new_flag to ev_flags list
|
||||
macro(append_ev_flags new_flag)
|
||||
list(APPEND local_ev_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
# void append_gd_flags(string new_flag);
|
||||
# - appends new_flag to gd_flags list
|
||||
macro(append_gd_flags new_flag)
|
||||
list(APPEND local_gd_flags "${new_flag}")
|
||||
endmacro()
|
||||
|
||||
include(HelperFunctions) # for set_legal_type(), set_legal_arch()
|
||||
|
||||
# Perl expand-vars.pl flags
|
||||
function(set_ev_flags input_ev_flags)
|
||||
set(local_ev_flags)
|
||||
set_legal_type("${LIBOMP_LIB_TYPE}" legal_type)
|
||||
set_legal_arch("${LIBOMP_ARCH}" legal_arch)
|
||||
# need -D Revision="\$Revision" to show up
|
||||
append_ev_flags("-D Revision=\"\\\\$$Revision\"")
|
||||
append_ev_flags("-D Date=\"\\\\$$Date\"")
|
||||
append_ev_flags("-D KMP_TYPE=\"${legal_type}\"")
|
||||
append_ev_flags("-D KMP_ARCH=\"${legal_arch}\"")
|
||||
append_ev_flags("-D KMP_VERSION_MAJOR=${LIBOMP_VERSION}")
|
||||
append_ev_flags("-D KMP_VERSION_MINOR=0")
|
||||
append_ev_flags("-D KMP_VERSION_BUILD=${build_number}")
|
||||
append_ev_flags("-D KMP_BUILD_DATE=\"${date}\"")
|
||||
append_ev_flags("-D KMP_TARGET_COMPILER=12")
|
||||
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
append_ev_flags("-D KMP_DIAG=1")
|
||||
append_ev_flags("-D KMP_DEBUG_INFO=1")
|
||||
else()
|
||||
append_ev_flags("-D KMP_DIAG=0")
|
||||
append_ev_flags("-D KMP_DEBUG_INFO=0")
|
||||
endif()
|
||||
if(${LIBOMP_VERSION} EQUAL 40)
|
||||
append_ev_flags("-D OMP_VERSION=201307")
|
||||
elseif(${LIBOMP_VERSION} EQUAL 30)
|
||||
append_ev_flags("-D OMP_VERSION=201107")
|
||||
else()
|
||||
append_ev_flags("-D OMP_VERSION=200505")
|
||||
endif()
|
||||
set(${input_ev_flags} "${local_ev_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(set_gd_flags input_gd_flags)
|
||||
set(local_gd_flags)
|
||||
if(${IA32})
|
||||
append_gd_flags("-D arch_32")
|
||||
elseif(${INTEL64})
|
||||
append_gd_flags("-D arch_32e")
|
||||
else()
|
||||
append_gd_flags("-D arch_${LIBOMP_ARCH}")
|
||||
endif()
|
||||
if(${NORMAL_LIBRARY})
|
||||
append_gd_flags("-D norm")
|
||||
elseif(${PROFILE_LIBRARY})
|
||||
append_gd_flags("-D prof")
|
||||
elseif(${STUBS_LIBRARY})
|
||||
append_gd_flags("-D stub")
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 41 OR ${LIBOMP_OMP_VERSION} EQUAL 41)
|
||||
append_gd_flags("-D OMP_41")
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
|
||||
append_gd_flags("-D OMP_40")
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 30 OR ${LIBOMP_OMP_VERSION} EQUAL 30)
|
||||
append_gd_flags("-D OMP_30")
|
||||
endif()
|
||||
if(NOT "${LIBOMP_VERSION}" STREQUAL "4")
|
||||
append_gd_flags("-D msvc_compat")
|
||||
endif()
|
||||
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
append_gd_flags("-D KMP_DEBUG")
|
||||
endif()
|
||||
if(${LIBOMP_COMPILER_SUPPORTS_QUAD_PRECISION})
|
||||
append_gd_flags("-D HAVE_QUAD")
|
||||
endif()
|
||||
set(${input_gd_flags} "${local_gd_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -1,115 +0,0 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
macro(append_c_source_file new_c_file)
|
||||
list(APPEND local_c_source_files "${new_c_file}")
|
||||
endmacro()
|
||||
|
||||
macro(append_cpp_source_file new_cpp_file)
|
||||
list(APPEND local_cpp_source_files "${new_cpp_file}")
|
||||
endmacro()
|
||||
|
||||
macro(append_asm_source_file new_asm_file)
|
||||
list(APPEND local_asm_source_files "${new_asm_file}")
|
||||
endmacro()
|
||||
|
||||
macro(append_imp_c_source_file new_import_c_file)
|
||||
list(APPEND local_imp_c_files "${new_import_c_file}")
|
||||
endmacro()
|
||||
|
||||
# files are relative to the src directory
|
||||
|
||||
function(set_c_files input_c_source_files)
|
||||
set(local_c_source_files "")
|
||||
append_c_source_file("kmp_ftn_cdecl.c")
|
||||
append_c_source_file("kmp_ftn_extra.c")
|
||||
append_c_source_file("kmp_version.c")
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
append_c_source_file("ompt-general.c")
|
||||
endif()
|
||||
if(${STUBS_LIBRARY})
|
||||
append_c_source_file("kmp_stub.c")
|
||||
else()
|
||||
append_c_source_file("kmp_alloc.c")
|
||||
append_c_source_file("kmp_atomic.c")
|
||||
append_c_source_file("kmp_csupport.c")
|
||||
append_c_source_file("kmp_debug.c")
|
||||
append_c_source_file("kmp_debugger.c")
|
||||
append_c_source_file("kmp_itt.c")
|
||||
append_c_source_file("kmp_environment.c")
|
||||
append_c_source_file("kmp_error.c")
|
||||
append_c_source_file("kmp_global.c")
|
||||
append_c_source_file("kmp_i18n.c")
|
||||
append_c_source_file("kmp_io.c")
|
||||
append_c_source_file("kmp_runtime.c")
|
||||
append_c_source_file("kmp_settings.c")
|
||||
append_c_source_file("kmp_str.c")
|
||||
append_c_source_file("kmp_tasking.c")
|
||||
append_c_source_file("kmp_taskq.c")
|
||||
append_c_source_file("kmp_threadprivate.c")
|
||||
append_c_source_file("kmp_utility.c")
|
||||
if(${LIBOMP_USE_ITT_NOTIFY})
|
||||
append_c_source_file("thirdparty/ittnotify/ittnotify_static.c")
|
||||
endif()
|
||||
if(${WINDOWS})
|
||||
append_c_source_file("z_Windows_NT_util.c")
|
||||
append_c_source_file("z_Windows_NT-586_util.c")
|
||||
else()
|
||||
append_c_source_file("z_Linux_util.c")
|
||||
append_c_source_file("kmp_gsupport.c")
|
||||
endif()
|
||||
endif()
|
||||
set(${input_c_source_files} "${local_c_source_files}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(set_cpp_files input_cpp_source_files)
|
||||
set(local_cpp_source_files "")
|
||||
if(NOT ${STUBS_LIBRARY})
|
||||
append_cpp_source_file("kmp_barrier.cpp")
|
||||
append_cpp_source_file("kmp_wait_release.cpp")
|
||||
append_cpp_source_file("kmp_affinity.cpp")
|
||||
append_cpp_source_file("kmp_dispatch.cpp")
|
||||
append_cpp_source_file("kmp_lock.cpp")
|
||||
append_cpp_source_file("kmp_sched.cpp")
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
|
||||
append_cpp_source_file("kmp_taskdeps.cpp")
|
||||
append_cpp_source_file("kmp_cancel.cpp")
|
||||
endif()
|
||||
if(${LIBOMP_STATS})
|
||||
append_cpp_source_file("kmp_stats.cpp")
|
||||
append_cpp_source_file("kmp_stats_timing.cpp")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(${input_cpp_source_files} "${local_cpp_source_files}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(set_asm_files input_asm_source_files)
|
||||
set(local_asm_source_files "")
|
||||
if(NOT ${STUBS_LIBRARY})
|
||||
if(${WINDOWS})
|
||||
append_asm_source_file("z_Windows_NT-586_asm.asm")
|
||||
else()
|
||||
append_asm_source_file("z_Linux_asm.s")
|
||||
endif()
|
||||
endif()
|
||||
set(${input_asm_source_files} "${local_asm_source_files}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(set_imp_c_files input_imp_c_files)
|
||||
set(local_imp_c_files "")
|
||||
if(${WINDOWS})
|
||||
append_imp_c_source_file("kmp_import.c")
|
||||
endif()
|
||||
set(${input_imp_c_files} "${local_imp_c_files}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,267 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckLibraryExists)
|
||||
include(CheckIncludeFiles)
|
||||
include(LibompCheckLinkerFlag)
|
||||
include(LibompCheckFortranFlag)
|
||||
|
||||
# Check for versioned symbols
|
||||
function(libomp_check_version_symbols retval)
|
||||
set(source_code
|
||||
"#include <stdio.h>
|
||||
void func1() { printf(\"Hello\"); }
|
||||
void func2() { printf(\"World\"); }
|
||||
__asm__(\".symver func1, func@VER1\");
|
||||
__asm__(\".symver func2, func@VER2\");
|
||||
int main() {
|
||||
func1();
|
||||
func2();
|
||||
return 0;
|
||||
}")
|
||||
set(version_script_source "VER1 { }; VER2 { } VER1;")
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt "${version_script_source}")
|
||||
set(CMAKE_REQUIRED_FLAGS -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt)
|
||||
check_c_source_compiles("${source_code}" ${retval})
|
||||
set(${retval} ${${retval}} PARENT_SCOPE)
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt)
|
||||
endfunction()
|
||||
|
||||
# Includes the architecture flag in both compile and link phase
|
||||
function(libomp_check_architecture_flag flag retval)
|
||||
set(CMAKE_REQUIRED_FLAGS "${flag}")
|
||||
check_c_compiler_flag("${flag}" ${retval})
|
||||
set(${retval} ${${retval}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Checking C, CXX, Linker Flags
|
||||
check_cxx_compiler_flag(-std=c++11 LIBOMP_HAVE_STD_CPP11_FLAG)
|
||||
check_cxx_compiler_flag(-fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
|
||||
check_c_compiler_flag("-x c++" LIBOMP_HAVE_X_CPP_FLAG)
|
||||
check_c_compiler_flag(-Werror LIBOMP_HAVE_WERROR_FLAG)
|
||||
check_c_compiler_flag(-Wunused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
|
||||
check_c_compiler_flag(-Wunused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
|
||||
check_c_compiler_flag(-Wunused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)
|
||||
check_c_compiler_flag(-Wunused-variable LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG)
|
||||
check_c_compiler_flag(-Wswitch LIBOMP_HAVE_WNO_SWITCH_FLAG)
|
||||
check_c_compiler_flag(-Wcovered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG)
|
||||
check_c_compiler_flag(-Wdeprecated-register LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG)
|
||||
check_c_compiler_flag(-Wsign-compare LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG)
|
||||
check_c_compiler_flag(-Wgnu-anonymous-struct LIBOMP_HAVE_WNO_GNU_ANONYMOUS_STRUCT_FLAG)
|
||||
check_c_compiler_flag(-Wunknown-pragmas LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG)
|
||||
check_c_compiler_flag(-Wmissing-field-initializers LIBOMP_HAVE_WNO_MISSING_FIELD_INITIALIZERS_FLAG)
|
||||
check_c_compiler_flag(-Wmissing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG)
|
||||
check_c_compiler_flag(-Wcomment LIBOMP_HAVE_WNO_COMMENT_FLAG)
|
||||
check_c_compiler_flag(-Wself-assign LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG)
|
||||
check_c_compiler_flag(-Wvla-extension LIBOMP_HAVE_WNO_VLA_EXTENSION_FLAG)
|
||||
check_c_compiler_flag(-Wformat-pedantic LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_FLAG)
|
||||
check_c_compiler_flag(-msse2 LIBOMP_HAVE_MSSE2_FLAG)
|
||||
check_c_compiler_flag(-ftls-model=initial-exec LIBOMP_HAVE_FTLS_MODEL_FLAG)
|
||||
libomp_check_architecture_flag(-mmic LIBOMP_HAVE_MMIC_FLAG)
|
||||
libomp_check_architecture_flag(-m32 LIBOMP_HAVE_M32_FLAG)
|
||||
if(WIN32)
|
||||
# Check Windows MSVC style flags.
|
||||
check_c_compiler_flag(/TP LIBOMP_HAVE_TP_FLAG)
|
||||
check_cxx_compiler_flag(/EHsc LIBOMP_HAVE_EHSC_FLAG)
|
||||
check_cxx_compiler_flag(/GS LIBOMP_HAVE_GS_FLAG)
|
||||
check_cxx_compiler_flag(/Oy- LIBOMP_HAVE_Oy__FLAG)
|
||||
check_cxx_compiler_flag(/arch:SSE2 LIBOMP_HAVE_ARCH_SSE2_FLAG)
|
||||
check_cxx_compiler_flag(/Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG)
|
||||
# It is difficult to create a dummy masm assembly file
|
||||
# and then check the MASM assembler to see if these flags exist and work,
|
||||
# so we assume they do for Windows.
|
||||
set(LIBOMP_HAVE_SAFESEH_MASM_FLAG TRUE)
|
||||
set(LIBOMP_HAVE_COFF_MASM_FLAG TRUE)
|
||||
# Change Windows flags /MDx to /MTx
|
||||
foreach(libomp_lang IN ITEMS C CXX)
|
||||
foreach(libomp_btype IN ITEMS DEBUG RELWITHDEBINFO RELEASE MINSIZEREL)
|
||||
string(REPLACE "/MD" "/MT"
|
||||
CMAKE_${libomp_lang}_FLAGS_${libomp_btype}
|
||||
"${CMAKE_${libomp_lang}_FLAGS_${libomp_btype}}"
|
||||
)
|
||||
endforeach()
|
||||
endforeach()
|
||||
else()
|
||||
# It is difficult to create a dummy assembly file that compiles into an
|
||||
# exectuable for every architecture and then check the C compiler to
|
||||
# see if -x assembler-with-cpp exists and works, so we assume it does for non-Windows.
|
||||
set(LIBOMP_HAVE_X_ASSEMBLER_WITH_CPP_FLAG TRUE)
|
||||
endif()
|
||||
if(${LIBOMP_FORTRAN_MODULES})
|
||||
libomp_check_fortran_flag(-m32 LIBOMP_HAVE_M32_FORTRAN_FLAG)
|
||||
endif()
|
||||
|
||||
# Check linker flags
|
||||
if(WIN32)
|
||||
libomp_check_linker_flag(/SAFESEH LIBOMP_HAVE_SAFESEH_FLAG)
|
||||
elseif(NOT APPLE)
|
||||
libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG)
|
||||
libomp_check_linker_flag(-Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
|
||||
libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
|
||||
libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
|
||||
libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
|
||||
libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
|
||||
libomp_check_linker_flag(-Wl,-fini=__kmp_internal_end_fini LIBOMP_HAVE_FINI_FLAG)
|
||||
endif()
|
||||
|
||||
# Check Intel(R) C Compiler specific flags
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
check_cxx_compiler_flag(/Qlong_double LIBOMP_HAVE_LONG_DOUBLE_FLAG)
|
||||
check_cxx_compiler_flag(/Qdiag-disable:177 LIBOMP_HAVE_DIAG_DISABLE_177_FLAG)
|
||||
check_cxx_compiler_flag(/Qinline-min-size=1 LIBOMP_HAVE_INLINE_MIN_SIZE_FLAG)
|
||||
check_cxx_compiler_flag(-Qoption,cpp,--extended_float_types LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)
|
||||
check_cxx_compiler_flag(-falign-stack=maintain-16-byte LIBOMP_HAVE_FALIGN_STACK_FLAG)
|
||||
check_cxx_compiler_flag("-opt-streaming-stores never" LIBOMP_HAVE_OPT_STREAMING_STORES_FLAG)
|
||||
libomp_check_linker_flag(-static-intel LIBOMP_HAVE_STATIC_INTEL_FLAG)
|
||||
libomp_check_linker_flag(-no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)
|
||||
check_library_exists(irc_pic _intel_fast_memcpy "" LIBOMP_HAVE_IRC_PIC_LIBRARY)
|
||||
endif()
|
||||
|
||||
# Checking Threading requirements
|
||||
find_package(Threads REQUIRED)
|
||||
if(WIN32)
|
||||
if(NOT CMAKE_USE_WIN32_THREADS_INIT)
|
||||
libomp_error_say("Need Win32 thread interface on Windows.")
|
||||
endif()
|
||||
else()
|
||||
if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
libomp_error_say("Need pthread interface on Unix-like systems.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find perl executable
|
||||
# Perl is used to create omp.h (and other headers) along with kmp_i18n_id.inc and kmp_i18n_default.inc
|
||||
find_package(Perl REQUIRED)
|
||||
# The perl scripts take the --os=/--arch= flags which expect a certain format for operating systems and arch's.
|
||||
# Until the perl scripts are removed, the most portable way to handle this is to have all operating systems that
|
||||
# are neither Windows nor Mac (Most Unix flavors) be considered lin to the perl scripts. This is rooted
|
||||
# in that all the Perl scripts check the operating system and will fail if it isn't "valid". This
|
||||
# temporary solution lets us avoid trying to enumerate all the possible OS values inside the Perl modules.
|
||||
if(WIN32)
|
||||
set(LIBOMP_PERL_SCRIPT_OS win)
|
||||
elseif(APPLE)
|
||||
set(LIBOMP_PERL_SCRIPT_OS mac)
|
||||
else()
|
||||
set(LIBOMP_PERL_SCRIPT_OS lin)
|
||||
endif()
|
||||
if(IA32)
|
||||
set(LIBOMP_PERL_SCRIPT_ARCH 32)
|
||||
elseif(MIC)
|
||||
set(LIBOMP_PERL_SCRIPT_ARCH mic)
|
||||
elseif(INTEL64)
|
||||
set(LIBOMP_PERL_SCRIPT_ARCH 32e)
|
||||
else()
|
||||
set(LIBOMP_PERL_SCRIPT_ARCH ${LIBOMP_ARCH})
|
||||
endif()
|
||||
|
||||
# Checking features
|
||||
# Check if version symbol assembler directives are supported
|
||||
libomp_check_version_symbols(LIBOMP_HAVE_VERSION_SYMBOLS)
|
||||
|
||||
# Check if quad precision types are available
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(LIBOMP_HAVE_QUAD_PRECISION TRUE)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
if(LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)
|
||||
set(LIBOMP_HAVE_QUAD_PRECISION TRUE)
|
||||
else()
|
||||
set(LIBOMP_HAVE_QUAD_PRECISION TRUE)
|
||||
endif()
|
||||
else()
|
||||
set(LIBOMP_HAVE_QUAD_PRECISION FALSE)
|
||||
endif()
|
||||
|
||||
# Check if adaptive locks are available
|
||||
if((${IA32} OR ${INTEL64}) AND NOT MSVC)
|
||||
set(LIBOMP_HAVE_ADAPTIVE_LOCKS TRUE)
|
||||
else()
|
||||
set(LIBOMP_HAVE_ADAPTIVE_LOCKS FALSE)
|
||||
endif()
|
||||
|
||||
# Check if stats-gathering is available
|
||||
if(${LIBOMP_STATS})
|
||||
check_c_source_compiles(
|
||||
"__thread int x;
|
||||
int main(int argc, char** argv)
|
||||
{ x = argc; return x; }"
|
||||
LIBOMP_HAVE___THREAD)
|
||||
check_c_source_compiles(
|
||||
"int main(int argc, char** argv)
|
||||
{ unsigned long long t = __builtin_readcyclecounter(); return 0; }"
|
||||
LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER)
|
||||
if(NOT LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER)
|
||||
if(${IA32} OR ${INTEL64} OR ${MIC})
|
||||
check_include_file(x86intrin.h LIBOMP_HAVE_X86INTRIN_H)
|
||||
libomp_append(CMAKE_REQUIRED_DEFINITIONS -DLIBOMP_HAVE_X86INTRIN_H LIBOMP_HAVE_X86INTRIN_H)
|
||||
check_c_source_compiles(
|
||||
"#ifdef LIBOMP_HAVE_X86INTRIN_H
|
||||
# include <x86intrin.h>
|
||||
#endif
|
||||
int main(int argc, char** argv) { unsigned long long t = __rdtsc(); return 0; }" LIBOMP_HAVE___RDTSC)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS)
|
||||
endif()
|
||||
endif()
|
||||
if(LIBOMP_HAVE___THREAD AND (LIBOMP_HAVE___RDTSC OR LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER))
|
||||
set(LIBOMP_HAVE_STATS TRUE)
|
||||
else()
|
||||
set(LIBOMP_HAVE_STATS FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check if OMPT support is available
|
||||
# Currently, __builtin_frame_address() is required for OMPT
|
||||
# Weak attribute is required for Unices, LIBPSAPI is used for Windows
|
||||
check_c_source_compiles("int main(int argc, char** argv) {
|
||||
void* p = __builtin_frame_address(0);
|
||||
return 0;}" LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS)
|
||||
check_c_source_compiles("__attribute__ ((weak)) int foo(int a) { return a*a; }
|
||||
int main(int argc, char** argv) {
|
||||
return foo(argc);}" LIBOMP_HAVE_WEAK_ATTRIBUTE)
|
||||
check_include_files("windows.h;psapi.h" LIBOMP_HAVE_PSAPI_H)
|
||||
check_library_exists(psapi EnumProcessModules "" LIBOMP_HAVE_LIBPSAPI)
|
||||
if(LIBOMP_HAVE_PSAPI_H AND LIBOMP_HAVE_LIBPSAPI)
|
||||
set(LIBOMP_HAVE_PSAPI TRUE)
|
||||
endif()
|
||||
if(NOT LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS)
|
||||
set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)
|
||||
else()
|
||||
if(LIBOMP_HAVE_WEAK_ATTRIBUTE OR LIBOMP_HAVE_PSAPI)
|
||||
set(LIBOMP_HAVE_OMPT_SUPPORT TRUE)
|
||||
else()
|
||||
set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check if HWLOC support is available
|
||||
if(${LIBOMP_USE_HWLOC})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${LIBOMP_HWLOC_INSTALL_DIR}/include)
|
||||
check_include_file(hwloc.h LIBOMP_HAVE_HWLOC_H)
|
||||
set(CMAKE_REQUIRED_INCLUDES)
|
||||
find_library(LIBOMP_HWLOC_LIBRARY
|
||||
NAMES hwloc libhwloc
|
||||
HINTS ${LIBOMP_HWLOC_INSTALL_DIR}/lib)
|
||||
if(LIBOMP_HWLOC_LIBRARY)
|
||||
check_library_exists(${LIBOMP_HWLOC_LIBRARY} hwloc_topology_init
|
||||
${LIBOMP_HWLOC_INSTALL_DIR}/lib LIBOMP_HAVE_LIBHWLOC)
|
||||
get_filename_component(LIBOMP_HWLOC_LIBRARY_DIR ${LIBOMP_HWLOC_LIBRARY} PATH)
|
||||
endif()
|
||||
if(LIBOMP_HAVE_HWLOC_H AND LIBOMP_HAVE_LIBHWLOC AND LIBOMP_HWLOC_LIBRARY)
|
||||
set(LIBOMP_HAVE_HWLOC TRUE)
|
||||
else()
|
||||
set(LIBOMP_HAVE_HWLOC FALSE)
|
||||
libomp_say("Could not find hwloc")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+7406
-7078
File diff suppressed because it is too large
Load Diff
@@ -669,10 +669,10 @@ WARN_LOGFILE =
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = src doc/doxygen/libomp_interface.h
|
||||
INPUT = src doc/doxygen/libomp_interface.h
|
||||
# The ittnotify code also has doxygen documentation, but if we include it here
|
||||
# it takes over from us!
|
||||
# src/thirdparty/ittnotify
|
||||
# src/thirdparty/ittnotify
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||
@@ -690,7 +690,7 @@ INPUT_ENCODING = UTF-8
|
||||
# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
|
||||
# *.f90 *.f *.for *.vhd *.vhdl
|
||||
|
||||
FILE_PATTERNS = *.c *.h *.cpp
|
||||
FILE_PATTERNS = *.c *.h *.cpp
|
||||
# We may also want to include the asm files with appropriate ifdef to ensure
|
||||
# doxygen doesn't see the content, just the documentation...
|
||||
|
||||
@@ -1688,7 +1688,7 @@ UML_LOOK = NO
|
||||
# the class node. If there are many fields or methods and many nodes the
|
||||
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
|
||||
# threshold limits the number of items for each type to make the size more
|
||||
# managable. Set this to 0 for no limit. Note that the threshold may be
|
||||
# manageable. Set this to 0 for no limit. Note that the threshold may be
|
||||
# exceeded by 50% before the limit is enforced.
|
||||
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
|
||||
@@ -66,7 +66,7 @@ Intel, Xeon, and Intel Xeon Phi are trademarks of Intel Corporation in the U.S.
|
||||
|
||||
This document is Copyright \textcopyright~\the\year the LLVM Project. It is
|
||||
subject to the same license terms as the LLVM OpenMP runtime.
|
||||
|
||||
|
||||
\textsuperscript{*} Other names and brands may be claimed as the property of others.
|
||||
|
||||
\clearemptydoublepage
|
||||
|
||||
@@ -26,69 +26,32 @@ The aim here is to explain the interface from the compiler to the runtime.
|
||||
The overall design is described, and each function in the interface
|
||||
has its own description. (At least, that's the ambition, we may not be there yet).
|
||||
|
||||
@section sec_building Building the Runtime
|
||||
@section sec_building Quickly Building the Runtime
|
||||
For the impatient, we cover building the runtime as the first topic here.
|
||||
|
||||
A top-level Makefile is provided that attempts to derive a suitable
|
||||
configuration for the most commonly used environments. To see the
|
||||
default settings, type:
|
||||
CMake is used to build the OpenMP runtime. For details and a full list of options for the CMake build system,
|
||||
see <tt>Build_With_CMake.txt</tt> inside the <tt>runtime/</tt> subdirectory. These
|
||||
instructions will provide the most typical build.
|
||||
|
||||
In-LLVM-tree build:.
|
||||
@code
|
||||
% make info
|
||||
$ cd where-you-want-to-live
|
||||
Check out openmp into llvm/projects
|
||||
$ cd where-you-want-to-build
|
||||
$ mkdir build && cd build
|
||||
$ cmake path/to/llvm -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
|
||||
$ make omp
|
||||
@endcode
|
||||
|
||||
You can change the Makefile's behavior with the following options:
|
||||
|
||||
- <b>omp_root</b>: The path to the top-level directory containing the top-level
|
||||
Makefile. By default, this will take on the value of the
|
||||
current working directory.
|
||||
|
||||
- <b>omp_os</b>: Operating system. By default, the build will attempt to
|
||||
detect this. Currently supports "linux", "macos", and
|
||||
"windows".
|
||||
|
||||
- <b>arch</b>: Architecture. By default, the build will attempt to
|
||||
detect this if not specified by the user. Currently
|
||||
supported values are
|
||||
- "32" for IA-32 architecture
|
||||
- "32e" for Intel® 64 architecture
|
||||
- "mic" for Intel® Many Integrated Core Architecture (
|
||||
If "mic" is specified then "icc" will be used as the
|
||||
compiler, and appropriate k1om binutils will be used. The
|
||||
necessary packages must be installed on the build machine
|
||||
for this to be possible, but an
|
||||
Intel® Xeon Phi™
|
||||
coprocessor is not required to build the library).
|
||||
|
||||
- <b>compiler</b>: Which compiler to use for the build. Defaults to "icc"
|
||||
or "icl" depending on the value of omp_os. Also supports
|
||||
"gcc" when omp_os is "linux" for gcc\other versions
|
||||
4.6.2 and higher. For icc on OS X\other, OS X\other versions
|
||||
greater than 10.6 are not supported currently. Also, icc
|
||||
version 13.0 is not supported. The selected compiler should be
|
||||
installed and in the user's path. The corresponding
|
||||
Fortran compiler should also be in the path.
|
||||
|
||||
- <b>mode</b>: Library mode: default is "release". Also supports "debug".
|
||||
|
||||
To use any of the options above, simple add <option_name>=<value>. For
|
||||
example, if you want to build with gcc instead of icc, type:
|
||||
Out-of-LLVM-tree build:
|
||||
@code
|
||||
% make compiler=gcc
|
||||
$ cd where-you-want-to-live
|
||||
Check out openmp
|
||||
$ cd where-you-want-to-live/openmp/runtime
|
||||
$ mkdir build && cd build
|
||||
$ cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
|
||||
$ make
|
||||
@endcode
|
||||
|
||||
Underneath the hood of the top-level Makefile, the runtime is built by
|
||||
a perl script that in turn drives a detailed runtime system make. The
|
||||
script can be found at <tt>tools/build.pl</tt>, and will print
|
||||
information about all its flags and controls if invoked as
|
||||
@code
|
||||
% tools/build.pl --help
|
||||
@endcode
|
||||
|
||||
If invoked with no arguments, it will try to build a set of libraries
|
||||
that are appropriate for the machine on which the build is happening.
|
||||
There are many options for building out of tree, and configuring library
|
||||
features that can also be used. Consult the <tt>--help</tt> output for details.
|
||||
|
||||
@section sec_supported Supported RTL Build Configurations
|
||||
|
||||
The architectures supported are IA-32 architecture, Intel® 64, and
|
||||
@@ -96,17 +59,39 @@ Intel® Many Integrated Core Architecture. The build configurations
|
||||
supported are shown in the table below.
|
||||
|
||||
<table border=1>
|
||||
<tr><th> <th>icc/icl<th>gcc
|
||||
<tr><td>Linux\other OS<td>Yes(1,5)<td>Yes(2,4)
|
||||
<tr><td>OS X\other<td>Yes(1,3,4)<td>No
|
||||
<tr><td>Windows\other OS<td>Yes(1,4)<td>No
|
||||
<tr><th> <th>icc/icl<th>gcc<th>clang
|
||||
<tr><td>Linux\other OS<td>Yes(1,5)<td>Yes(2,4)<td>Yes(4,6,7)
|
||||
<tr><td>FreeBSD\other<td>Yes(1,5)<td>Yes(2,4)<td>Yes(4,6,7,8)
|
||||
<tr><td>OS X\other<td>Yes(1,3,4)<td>No<td>Yes(4,6,7)
|
||||
<tr><td>Windows\other OS<td>Yes(1,4)<td>No<td>No
|
||||
</table>
|
||||
(1) On IA-32 architecture and Intel® 64, icc/icl versions 12.x
|
||||
are supported (12.1 is recommended).<br>
|
||||
(2) gcc version 4.6.2 is supported.<br>
|
||||
(2) gcc version 4.7 is supported.<br>
|
||||
(3) For icc on OS X\other, OS X\other version 10.5.8 is supported.<br>
|
||||
(4) Intel® Many Integrated Core Architecture not supported.<br>
|
||||
(5) On Intel® Many Integrated Core Architecture, icc/icl versions 13.0 or later are required.
|
||||
(5) On Intel® Many Integrated Core Architecture, icc/icl versions 13.0 or later are required.<br>
|
||||
(6) Clang\other version 3.3 is supported.<br>
|
||||
(7) Clang\other currently does not offer a software-implemented 128 bit extended
|
||||
precision type. Thus, all entry points reliant on this type are removed
|
||||
from the library and cannot be called in the user program. The following
|
||||
functions are not available:
|
||||
@code
|
||||
__kmpc_atomic_cmplx16_*
|
||||
__kmpc_atomic_float16_*
|
||||
__kmpc_atomic_*_fp
|
||||
@endcode
|
||||
(8) Community contribution provided AS IS, not tested by Intel.
|
||||
|
||||
Supported Architectures: IBM(R) Power 7 and Power 8
|
||||
<table border=1>
|
||||
<tr><th> <th>gcc<th>clang
|
||||
<tr><td>Linux\other OS<td>Yes(1,2)<td>Yes(3,4)
|
||||
</table>
|
||||
(1) On Power 7, gcc version 4.8.2 is supported.<br>
|
||||
(2) On Power 8, gcc version 4.8.2 is supported.<br>
|
||||
(3) On Power 7, clang version 3.7 is supported.<br>
|
||||
(4) On Power 8, clang version 3.7 is supported.<br>
|
||||
|
||||
@section sec_frontend Front-end Compilers that work with this RTL
|
||||
|
||||
@@ -326,7 +311,7 @@ and then use the KMP_* macros to profile (through counts or clock ticks) libomp
|
||||
|
||||
@section sec_stats_env_vars Environment Variables
|
||||
|
||||
This section describes the environment variables relevent to stats-gathering in libomp
|
||||
This section describes the environment variables relevant to stats-gathering in libomp
|
||||
|
||||
@code
|
||||
KMP_STATS_FILE
|
||||
|
||||
+285
-292
@@ -9,331 +9,324 @@
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
####################
|
||||
# --- Create all ---
|
||||
add_custom_target(libomp-lib ALL DEPENDS omp)
|
||||
if(${LIBOMP_FORTRAN_MODULES})
|
||||
add_custom_target(libomp-mod ALL DEPENDS ${export_mod_files})
|
||||
# Configure omp.h, kmp_config.h and ompt.h if necessary
|
||||
configure_file(${LIBOMP_INC_DIR}/omp.h.var omp.h @ONLY)
|
||||
configure_file(kmp_config.h.cmake kmp_config.h @ONLY)
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
configure_file(${LIBOMP_INC_DIR}/ompt.h.var ompt.h @ONLY)
|
||||
endif()
|
||||
|
||||
#############################
|
||||
# --- Create Common Files ---
|
||||
add_custom_target(libomp-common ALL DEPENDS ${export_cmn_files})
|
||||
add_custom_target(libomp-clean-common COMMAND ${CMAKE_COMMAND} -E remove -f ${export_cmn_files})
|
||||
|
||||
# --- Put headers in convenient locations post build ---
|
||||
if(${LIBOMP_COPY_EXPORTS})
|
||||
add_custom_command(TARGET common POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_cmn_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp.h ${export_cmn_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.h ${export_cmn_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.f ${export_cmn_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.f90 ${export_cmn_dir}
|
||||
)
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
add_custom_command(TARGET common POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ompt.h ${export_cmn_dir}
|
||||
)
|
||||
endif()
|
||||
if(${LIBOMP_FORTRAN_MODULES})
|
||||
add_custom_command(TARGET mod POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_mod_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.mod ${export_mod_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy omp_lib_kinds.mod ${export_mod_dir}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
######################################################
|
||||
# --- Build the main library ---
|
||||
# $(lib_file) <== Main library file to create
|
||||
|
||||
# preprocessor flags (-D definitions and -I includes)
|
||||
# Grab environment variable CPPFLAGS and append those to definitions
|
||||
set(include_dirs ${CMAKE_CURRENT_BINARY_DIR} ${src_dir} ${src_dir}/i18n ${inc_dir} ${src_dir}/thirdparty/ittnotify)
|
||||
include_directories(${include_dirs})
|
||||
|
||||
# objects depend on : .inc files and omp.h
|
||||
# This way the *.inc and omp.h are generated before any compilations take place
|
||||
add_custom_target(libomp-needed-headers DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc omp.h)
|
||||
|
||||
# For Windows, there is a definitions file (.def) and resource file (.res) created using generate-def.pl and rc.exe respectively.
|
||||
if(${WINDOWS})
|
||||
add_custom_target(libomp-needed-windows-files DEPENDS ${def_file} ${CMAKE_CURRENT_BINARY_DIR}/libomp.rc)
|
||||
list(APPEND lib_src_files ${CMAKE_CURRENT_BINARY_DIR}/libomp.rc)
|
||||
endif()
|
||||
|
||||
# Remove any cmake-automatic linking of libraries by linker, This is so linux
|
||||
# and mac don't include libstdc++ just because we compile c++ files.
|
||||
if(${LIBOMP_USE_PREDEFINED_LINKER_FLAGS})
|
||||
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
|
||||
set(CMAKE_ASM_IMPLICIT_LINK_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
# --- ${lib_file} rule ---
|
||||
add_library(omp SHARED ${lib_src_files})
|
||||
set_target_properties(omp PROPERTIES
|
||||
PREFIX "" SUFFIX "" # Take control
|
||||
OUTPUT_NAME "${lib_file}" # of output name
|
||||
LINK_FLAGS "${LD_FLAGS}"
|
||||
LINKER_LANGUAGE C # use C Compiler for linking step
|
||||
SKIP_BUILD_RPATH true # have Mac linker -install_name just be "-install_name libomp.dylib"
|
||||
# Generate message catalog files: kmp_i18n_id.inc and kmp_i18n_default.inc
|
||||
add_custom_command(
|
||||
OUTPUT kmp_i18n_id.inc
|
||||
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/message-converter.pl --os=${LIBOMP_PERL_SCRIPT_OS}
|
||||
--prefix=kmp_i18n --enum=kmp_i18n_id.inc ${LIBOMP_SRC_DIR}/i18n/en_US.txt
|
||||
DEPENDS ${LIBOMP_SRC_DIR}/i18n/en_US.txt ${LIBOMP_TOOLS_DIR}/message-converter.pl
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT kmp_i18n_default.inc
|
||||
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/message-converter.pl --os=${LIBOMP_PERL_SCRIPT_OS}
|
||||
--prefix=kmp_i18n --default=kmp_i18n_default.inc ${LIBOMP_SRC_DIR}/i18n/en_US.txt
|
||||
DEPENDS ${LIBOMP_SRC_DIR}/i18n/en_US.txt ${LIBOMP_TOOLS_DIR}/message-converter.pl
|
||||
)
|
||||
|
||||
# --- Copy libomp into exports directory post build ---
|
||||
if(${WINDOWS})
|
||||
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp RUNTIME_OUTPUT_DIRECTORY)
|
||||
else()
|
||||
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp LIBRARY_OUTPUT_DIRECTORY)
|
||||
endif()
|
||||
if(NOT LIBOMP_OUTPUT_DIRECTORY)
|
||||
set(LIBOMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
if(${LIBOMP_COPY_EXPORTS})
|
||||
add_custom_command(TARGET omp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_lib_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMP_OUTPUT_DIRECTORY}/${lib_file} ${export_lib_dir}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Linking command will include libraries in LD_LIB_FLAGS
|
||||
target_link_libraries(omp ${LD_LIB_FLAGS} ${CMAKE_DL_LIBS})
|
||||
|
||||
# Create *.inc and omp.h before compiling any sources
|
||||
add_dependencies(omp libomp-needed-headers)
|
||||
if(${WINDOWS})
|
||||
# Create .def and .rc file before compiling any sources
|
||||
add_dependencies(omp libomp-needed-windows-files)
|
||||
endif()
|
||||
|
||||
# Set the compiler flags for each type of source
|
||||
set_source_files_properties(${lib_c_items}
|
||||
${imp_c_items} PROPERTIES COMPILE_FLAGS "${C_FLAGS}")
|
||||
set_source_files_properties(${lib_cxx_items} PROPERTIES COMPILE_FLAGS "${CXX_FLAGS}")
|
||||
if(${WINDOWS})
|
||||
# Windows operating system has to use MASM assembler
|
||||
set_source_files_properties(${lib_asm_items} PROPERTIES COMPILE_FLAGS "${ASM_FLAGS}")
|
||||
else()
|
||||
# Non-Windows operating systems can use compiler to assemble the assembly files
|
||||
set_source_files_properties(${lib_asm_items} PROPERTIES COMPILE_FLAGS "${ASM_FLAGS}" LANGUAGE C)
|
||||
endif()
|
||||
# Set the -D definitions for all sources
|
||||
add_definitions(${DEFINITIONS_FLAGS})
|
||||
# UNICODE and _UNICODE are set in LLVM's CMake system. They affect the
|
||||
# ittnotify code and should only be set when compiling ittnotify_static.c
|
||||
# on Windows (done below).
|
||||
# TODO: Fix the UNICODE usage in ittnotify code for Windows.
|
||||
remove_definitions(-DUNICODE -D_UNICODE)
|
||||
libomp_get_definitions_flags(LIBOMP_CONFIGURED_DEFINITIONS_FLAGS)
|
||||
add_definitions(${LIBOMP_CONFIGURED_DEFINITIONS_FLAGS})
|
||||
|
||||
# If creating a build that imitates build.pl's rules then set USE_BUILDPL_RULES to true
|
||||
if(${LIBOMP_USE_BUILDPL_RULES})
|
||||
include(BuildPLRules)
|
||||
# Set the -I includes for all sources
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${LIBOMP_SRC_DIR}
|
||||
${LIBOMP_SRC_DIR}/i18n
|
||||
${LIBOMP_INC_DIR}
|
||||
${LIBOMP_SRC_DIR}/thirdparty/ittnotify
|
||||
)
|
||||
if(${LIBOMP_USE_HWLOC})
|
||||
include_directories(${LIBOMP_HWLOC_INSTALL_DIR}/include)
|
||||
endif()
|
||||
|
||||
######################################################
|
||||
# --- Source file specific flags ---
|
||||
# kmp_version.o : -D _KMP_BUILD_TIME="\"$(date)}\""
|
||||
set_source_files_properties(kmp_version.c PROPERTIES COMPILE_DEFINITIONS "_KMP_BUILD_TIME=\"\\\"${date}\\\"\"")
|
||||
# Getting correct source files to build library
|
||||
set(LIBOMP_CFILES)
|
||||
set(LIBOMP_CXXFILES)
|
||||
set(LIBOMP_ASMFILES)
|
||||
if(${STUBS_LIBRARY})
|
||||
set(LIBOMP_CFILES kmp_stub.c)
|
||||
else()
|
||||
# Get C files
|
||||
set(LIBOMP_CFILES
|
||||
kmp_alloc.c
|
||||
kmp_atomic.c
|
||||
kmp_csupport.c
|
||||
kmp_debug.c
|
||||
kmp_itt.c
|
||||
kmp_environment.c
|
||||
kmp_error.c
|
||||
kmp_global.c
|
||||
kmp_i18n.c
|
||||
kmp_io.c
|
||||
kmp_runtime.c
|
||||
kmp_settings.c
|
||||
kmp_str.c
|
||||
kmp_tasking.c
|
||||
kmp_taskq.c
|
||||
kmp_threadprivate.c
|
||||
kmp_utility.c
|
||||
)
|
||||
if(WIN32)
|
||||
# Windows specific files
|
||||
libomp_append(LIBOMP_CFILES z_Windows_NT_util.c)
|
||||
libomp_append(LIBOMP_CFILES z_Windows_NT-586_util.c)
|
||||
libomp_append(LIBOMP_ASMFILES z_Windows_NT-586_asm.asm) # Windows assembly file
|
||||
else()
|
||||
# Unix specific files
|
||||
libomp_append(LIBOMP_CFILES z_Linux_util.c)
|
||||
libomp_append(LIBOMP_CFILES kmp_gsupport.c)
|
||||
libomp_append(LIBOMP_ASMFILES z_Linux_asm.s) # Unix assembly file
|
||||
endif()
|
||||
libomp_append(LIBOMP_CFILES thirdparty/ittnotify/ittnotify_static.c LIBOMP_USE_ITT_NOTIFY)
|
||||
libomp_append(LIBOMP_CFILES kmp_debugger.c LIBOMP_USE_DEBUGGER)
|
||||
# Get C++ files
|
||||
set(LIBOMP_CXXFILES
|
||||
kmp_barrier.cpp
|
||||
kmp_wait_release.cpp
|
||||
kmp_affinity.cpp
|
||||
kmp_dispatch.cpp
|
||||
kmp_lock.cpp
|
||||
kmp_sched.cpp
|
||||
)
|
||||
libomp_append(LIBOMP_CXXFILES kmp_stats.cpp LIBOMP_STATS)
|
||||
libomp_append(LIBOMP_CXXFILES kmp_stats_timing.cpp LIBOMP_STATS)
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
|
||||
libomp_append(LIBOMP_CXXFILES kmp_taskdeps.cpp)
|
||||
libomp_append(LIBOMP_CXXFILES kmp_cancel.cpp)
|
||||
endif()
|
||||
endif()
|
||||
# Files common to stubs and normal library
|
||||
libomp_append(LIBOMP_CFILES kmp_ftn_cdecl.c)
|
||||
libomp_append(LIBOMP_CFILES kmp_ftn_extra.c)
|
||||
libomp_append(LIBOMP_CFILES kmp_version.c)
|
||||
libomp_append(LIBOMP_CFILES ompt-general.c IF_TRUE LIBOMP_OMPT_SUPPORT)
|
||||
|
||||
if(${WINDOWS})
|
||||
set_source_files_properties(thirdparty/ittnotify/ittnotify_static.c PROPERTIES COMPILE_DEFINITIONS "UNICODE")
|
||||
set(LIBOMP_SOURCE_FILES ${LIBOMP_CFILES} ${LIBOMP_CXXFILES} ${LIBOMP_ASMFILES})
|
||||
# For Windows, there is a resource file (.rc -> .res) that is also compiled
|
||||
libomp_append(LIBOMP_SOURCE_FILES libomp.rc WIN32)
|
||||
|
||||
# Get compiler and assembler flags
|
||||
libomp_get_cflags(LIBOMP_CONFIGURED_CFLAGS)
|
||||
libomp_get_cxxflags(LIBOMP_CONFIGURED_CXXFLAGS)
|
||||
libomp_get_asmflags(LIBOMP_CONFIGURED_ASMFLAGS)
|
||||
# Set the compiler flags for each type of source
|
||||
set_source_files_properties(${LIBOMP_CFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CFLAGS}")
|
||||
set_source_files_properties(${LIBOMP_CXXFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS}")
|
||||
set_source_files_properties(${LIBOMP_ASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS}")
|
||||
# Let the compiler handle the assembly files on Unix-like systems
|
||||
if(NOT WIN32)
|
||||
set_source_files_properties(${LIBOMP_ASMFILES} PROPERTIES LANGUAGE C)
|
||||
endif()
|
||||
|
||||
######################################################
|
||||
# MAC specific build rules
|
||||
if(${MAC})
|
||||
# fat library rules
|
||||
if(${INTEL64})
|
||||
_export_lib_fat_dir("mac_32e" export_fat_mac_32e)
|
||||
_export_lib_dir("mac_32" export_mac_32)
|
||||
_export_lib_dir("mac_32e" export_mac_32e)
|
||||
add_custom_target(fat
|
||||
COMMAND ${CMAKE_COMMAND} -E echo Building 32 and 32e fat libraries from ${export_mac_32}/${lib_file} and ${export_mac_32e}/${lib_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E echo Will put fat library in ${export_fat_mac_32e} directory
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_fat_mac_32e}
|
||||
COMMAND lipo -create -output ${export_fat_mac_32e}/${lib_file} ${export_mac_32}/${lib_file} ${export_mac_32e}/${lib_file}
|
||||
)
|
||||
endif()
|
||||
# Remove any cmake-automatic linking of the standard C++ library.
|
||||
# We neither need (nor want) the standard C++ library dependency even though we compile c++ files.
|
||||
if(NOT ${LIBOMP_USE_STDCPPLIB})
|
||||
set(LIBOMP_LINKER_LANGUAGE C)
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
|
||||
else()
|
||||
set(LIBOMP_LINKER_LANGUAGE CXX)
|
||||
endif()
|
||||
|
||||
######################################################
|
||||
# Add the OpenMP library
|
||||
libomp_get_ldflags(LIBOMP_CONFIGURED_LDFLAGS)
|
||||
|
||||
add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES})
|
||||
|
||||
set_target_properties(omp PROPERTIES
|
||||
PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_LIB_FILE}"
|
||||
LINK_FLAGS "${LIBOMP_CONFIGURED_LDFLAGS}"
|
||||
LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
|
||||
)
|
||||
|
||||
# Get the library's location within the build tree for the unit tester
|
||||
if(NOT WIN32)
|
||||
get_target_property(LIBOMP_LIBRARY_DIR omp LIBRARY_OUTPUT_DIRECTORY)
|
||||
else()
|
||||
get_target_property(LIBOMP_LIBRARY_DIR omp RUNTIME_OUTPUT_DIRECTORY)
|
||||
endif()
|
||||
if(NOT LIBOMP_LIBRARY_DIR)
|
||||
set(LIBOMP_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(LIBOMP_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
|
||||
else()
|
||||
set(LIBOMP_LIBRARY_DIR ${LIBOMP_LIBRARY_DIR} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# Add symbolic links to libomp
|
||||
if(NOT WIN32)
|
||||
add_custom_command(TARGET omp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE}
|
||||
libgomp${LIBOMP_LIBRARY_SUFFIX}
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE}
|
||||
libiomp5${LIBOMP_LIBRARY_SUFFIX}
|
||||
WORKING_DIRECTORY ${LIBOMP_LIBRARY_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
|
||||
libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS)
|
||||
target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${CMAKE_DL_LIBS})
|
||||
|
||||
# Create *.inc before compiling any sources
|
||||
# objects depend on : .inc files
|
||||
add_custom_target(libomp-needed-headers DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc)
|
||||
add_dependencies(omp libomp-needed-headers)
|
||||
|
||||
# Windows specific build rules
|
||||
if(${WINDOWS})
|
||||
if(WIN32)
|
||||
configure_file(libomp.rc.var libomp.rc @ONLY)
|
||||
|
||||
# --- Create $(imp_file) ---
|
||||
# This file is first created in the unstripped/${lib_file} creation step.
|
||||
# It is then "re-linked" to include kmp_import.c which prevents linking of both Visual Studio OpenMP and newly built OpenMP
|
||||
if(NOT "${imp_file}" STREQUAL "")
|
||||
set(generated_import_file ${lib_file}${lib})
|
||||
add_library(ompimp STATIC ${generated_import_file} ${imp_src_files})
|
||||
set_source_files_properties(${generated_import_file} PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
|
||||
set_target_properties(ompimp PROPERTIES
|
||||
PREFIX "" SUFFIX ""
|
||||
OUTPUT_NAME "${imp_file}"
|
||||
STATIC_LIBRARY_FLAGS "${AR_FLAGS}"
|
||||
LINKER_LANGUAGE C
|
||||
SKIP_BUILD_RPATH true
|
||||
)
|
||||
add_custom_command(TARGET ompimp PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove -f ${imp_file})
|
||||
add_dependencies(ompimp omp)
|
||||
get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
|
||||
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
|
||||
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
if(${LIBOMP_COPY_EXPORTS})
|
||||
add_custom_command(TARGET ompimp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${export_lib_dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMPIMP_OUTPUT_DIRECTORY}/${imp_file} ${export_lib_dir}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
# Create .def and .rc file before compiling any sources
|
||||
add_custom_target(libomp-needed-windows-files DEPENDS ${LIBOMP_LIB_NAME}.def)
|
||||
add_dependencies(omp libomp-needed-windows-files)
|
||||
# z_Windows_NT-586_asm.asm requires definitions to be sent via command line
|
||||
# It only needs the architecutre macro and OMPT_SUPPORT=0|1
|
||||
libomp_append(LIBOMP_MASM_DEFINITIONS "-D_M_IA32" IF_TRUE IA32)
|
||||
libomp_append(LIBOMP_MASM_DEFINITIONS "-D_M_AMD64" IF_TRUE INTEL64)
|
||||
libomp_append(LIBOMP_MASM_DEFINITIONS "-DOMPT_SUPPORT" IF_TRUE_1_0 LIBOMP_OMPT_SUPPORT)
|
||||
libomp_list_to_string("${LIBOMP_MASM_DEFINITIONS}" LIBOMP_MASM_DEFINITIONS)
|
||||
set_property(SOURCE z_Windows_NT-586_asm.asm APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBOMP_MASM_DEFINITIONS}")
|
||||
set_source_files_properties(thirdparty/ittnotify/ittnotify_static.c PROPERTIES COMPILE_DEFINITIONS "UNICODE")
|
||||
|
||||
# --- Create $(def_file) ---
|
||||
if(NOT "${def_file}" STREQUAL "")
|
||||
string_to_list("${gd_flags}" gd_flags)
|
||||
add_custom_command(
|
||||
OUTPUT ${def_file}
|
||||
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/generate-def.pl ${gd_flags} -o ${def_file} ${CMAKE_CURRENT_SOURCE_DIR}/dllexports
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dllexports ${tools_dir}/generate-def.pl
|
||||
)
|
||||
endif()
|
||||
# Create Windows import library
|
||||
# the import library is "re-linked" to include kmp_import.c which prevents
|
||||
# linking of both Visual Studio OpenMP and newly built OpenMP
|
||||
set_source_files_properties(kmp_import.c PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CFLAGS}")
|
||||
set(LIBOMP_IMP_LIB_FILE ${LIBOMP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set(LIBOMP_GENERATED_IMP_LIB_FILENAME ${LIBOMP_LIB_FILE}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set_target_properties(omp PROPERTIES
|
||||
VERSION ${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR} # uses /version flag
|
||||
IMPORT_PREFIX "" IMPORT_SUFFIX "" # control generated import library name when building omp
|
||||
ARCHIVE_OUTPUT_NAME ${LIBOMP_GENERATED_IMP_LIB_FILENAME}
|
||||
)
|
||||
# Get generated import library from creating omp
|
||||
get_target_property(LIBOMP_IMPORT_LIB_DIRECTORY omp ARCHIVE_OUTPUT_DIRECTORY)
|
||||
if(LIBOMP_IMPORT_LIB_DIRECTORY)
|
||||
set(LIBOMP_GENERATED_IMP_LIB ${LIBOMP_IMPORT_LIB_DIRECTORY}/${LIBOMP_GENERATED_IMP_LIB_FILENAME})
|
||||
else()
|
||||
set(LIBOMP_GENERATED_IMP_LIB ${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_GENERATED_IMP_LIB_FILENAME})
|
||||
endif()
|
||||
set_source_files_properties(${LIBOMP_GENERATED_IMP_LIB} PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
|
||||
# Create new import library that is just the previously created one + kmp_import.c
|
||||
add_library(ompimp STATIC ${LIBOMP_GENERATED_IMP_LIB} kmp_import.c)
|
||||
set_target_properties(ompimp PROPERTIES
|
||||
PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}"
|
||||
LINKER_LANGUAGE C
|
||||
)
|
||||
add_dependencies(ompimp omp) # ensure generated import library is created first
|
||||
|
||||
# Create def file to designate exported functions
|
||||
libomp_get_gdflags(LIBOMP_GDFLAGS) # generate-def.pl flags (Windows only)
|
||||
libomp_string_to_list("${LIBOMP_GDFLAGS}" LIBOMP_GDFLAGS)
|
||||
add_custom_command(
|
||||
OUTPUT ${LIBOMP_LIB_NAME}.def
|
||||
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/generate-def.pl ${LIBOMP_GDFLAGS}
|
||||
-o ${LIBOMP_LIB_NAME}.def ${CMAKE_CURRENT_SOURCE_DIR}/dllexports
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dllexports ${LIBOMP_TOOLS_DIR}/generate-def.pl
|
||||
)
|
||||
endif()
|
||||
|
||||
######################################################
|
||||
# kmp_i18n_id.inc and kmp_i18n_default.inc
|
||||
set(perlcmd "${PERL_EXECUTABLE}" "${tools_dir}/message-converter.pl" "${oa_opts}" "--prefix=kmp_i18n" "--enum=kmp_i18n_id.inc" "${src_dir}/i18n/en_US.txt")
|
||||
add_custom_command(
|
||||
OUTPUT kmp_i18n_id.inc
|
||||
COMMAND ${perlcmd}
|
||||
DEPENDS ${src_dir}/i18n/en_US.txt ${tools_dir}/message-converter.pl
|
||||
)
|
||||
set(perlcmd "${PERL_EXECUTABLE}" "${tools_dir}/message-converter.pl" "${oa_opts}" "--prefix=kmp_i18n" "--default=kmp_i18n_default.inc" "${src_dir}/i18n/en_US.txt")
|
||||
add_custom_command(
|
||||
OUTPUT kmp_i18n_default.inc
|
||||
COMMAND ${perlcmd}
|
||||
DEPENDS ${src_dir}/i18n/en_US.txt ${tools_dir}/message-converter.pl
|
||||
)
|
||||
|
||||
######################################################
|
||||
# Micro test rules for after library has been built (cmake/MicroTests.cmake)
|
||||
# - Only perform if ${LIBOMP_MICRO_TESTS} == true (specify when invoking: cmake -Dtests=on ...)
|
||||
if(${LIBOMP_MICRO_TESTS})
|
||||
include(MicroTests)
|
||||
add_custom_target(libomp-micro-tests)
|
||||
if(NOT ${MIC} AND ${LIBOMP_TEST_TOUCH})
|
||||
add_dependencies(libomp-micro-tests libomp-test-touch)
|
||||
endif()
|
||||
if(${LINUX} AND ${LIBOMP_TEST_RELO})
|
||||
add_dependencies(libomp-micro-tests libomp-test-relo)
|
||||
endif()
|
||||
if(${LINUX} AND ${LIBOMP_TEST_EXECSTACK})
|
||||
add_dependencies(libomp-micro-tests libomp-test-execstack)
|
||||
endif()
|
||||
if(${MIC} AND ${LIBOMP_TEST_INSTR})
|
||||
add_dependencies(libomp-micro-tests libomp-test-instr)
|
||||
endif()
|
||||
if(${LIBOMP_TEST_DEPS})
|
||||
add_dependencies(libomp-micro-tests libomp-test-deps)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
######################################################
|
||||
# --- Create Fortran Files ---
|
||||
# omp_lib.mod
|
||||
# Building the Fortran module files
|
||||
# One compilation step creates both omp_lib.mod and omp_lib_kinds.mod
|
||||
if(${LIBOMP_FORTRAN_MODULES})
|
||||
# Grab fortran-compiler-dependent flags
|
||||
# Cmake will look for cmake/${CMAKE_Fortran_COMPILER_ID}/FortranFlags.cmake to append additional fortran flags.
|
||||
enable_language(Fortran)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_Fortran_COMPILER_ID} ${CMAKE_MODULE_PATH})
|
||||
find_file(fortran_specific_include_file_found FortranFlags.cmake ${CMAKE_MODULE_PATH})
|
||||
if(fortran_specific_include_file_found)
|
||||
include(FortranFlags)
|
||||
append_fortran_compiler_specific_fort_flags(F_FLAGS)
|
||||
else()
|
||||
warning_say("Could not find cmake/${CMAKE_Fortran_COMPILER_ID}/FortranFlags.cmake: will only use default flags in CommonFlags.cmake")
|
||||
endif()
|
||||
set(omp_lib_f "omp_lib.f90" )
|
||||
add_custom_command(
|
||||
OUTPUT "omp_lib.mod"
|
||||
COMMAND ${CMAKE_Fortran_COMPILER} -c ${F_FLAGS} ${omp_lib_f}
|
||||
DEPENDS ${omp_lib_f}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "omp_lib_kinds.mod"
|
||||
COMMAND ${CMAKE_Fortran_COMPILER} -c ${F_FLAGS} ${omp_lib_f}
|
||||
DEPENDS ${omp_lib_f}
|
||||
)
|
||||
# clean omp_lib.o from build directory when "make clean"
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES omp_lib${obj})
|
||||
configure_file(${LIBOMP_INC_DIR}/omp_lib.h.var omp_lib.h @ONLY)
|
||||
configure_file(${LIBOMP_INC_DIR}/omp_lib.f.var omp_lib.f @ONLY)
|
||||
configure_file(${LIBOMP_INC_DIR}/omp_lib.f90.var omp_lib.f90 @ONLY)
|
||||
add_custom_target(libomp-mod ALL DEPENDS omp_lib.mod omp_lib_kinds.mod)
|
||||
libomp_get_fflags(LIBOMP_CONFIGURED_FFLAGS)
|
||||
if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
|
||||
set(LIBOMP_FORTRAN_SOURCE_FILE omp_lib.f90)
|
||||
else()
|
||||
set(LIBOMP_FORTRAN_SOURCE_FILE omp_lib.f)
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT omp_lib.mod omp_lib_kinds.mod
|
||||
COMMAND ${CMAKE_Fortran_COMPILER} -c ${LIBOMP_CONFIGURED_FFLAGS} ${LIBOMP_FORTRAN_SOURCE_FILE}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_FORTRAN_SOURCE_FILE}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/omp_lib.h
|
||||
)
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES omp_lib${CMAKE_C_OUTPUT_EXTENSION})
|
||||
endif()
|
||||
|
||||
###############################################################
|
||||
# --- Using expand-vars.pl to generate files ---
|
||||
# - 'file' is generated using expand-vars.pl and 'file'.var
|
||||
# - Any .h .f .f90 .rc files should be created with this recipe
|
||||
macro(expand_vars_recipe file_dir filename)
|
||||
get_source_file_property(extra_ev_flags ${filename} EV_COMPILE_DEFINITIONS)
|
||||
if("${extra_ev_flags}" MATCHES "NOTFOUND")
|
||||
set(extra_ev_flags)
|
||||
else()
|
||||
string_to_list("${extra_ev_flags}" extra_ev_flags)
|
||||
endif()
|
||||
if(NOT "${filename}" STREQUAL "")
|
||||
add_custom_command(
|
||||
OUTPUT ${filename}
|
||||
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/expand-vars.pl --strict ${ev_flags} ${extra_ev_flags} ${file_dir}/${filename}.var ${filename}
|
||||
DEPENDS ${file_dir}/${filename}.var kmp_version.c ${tools_dir}/expand-vars.pl
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
string_to_list("${ev_flags}" ev_flags)
|
||||
# omp_lib.h : ev-flags += -D KMP_INT_PTR_KIND="int_ptr_kind()"
|
||||
set_source_files_properties(omp_lib.h PROPERTIES EV_COMPILE_DEFINITIONS "-D KMP_INT_PTR_KIND=\"int_ptr_kind()\"")
|
||||
# libomp.rc : ev-flags += -D KMP_FILE=$(lib_file)
|
||||
set_source_files_properties(libomp.rc PROPERTIES EV_COMPILE_DEFINITIONS "-D KMP_FILE=${lib_file}")
|
||||
expand_vars_recipe(${CMAKE_CURRENT_SOURCE_DIR}/include/${LIBOMP_OMP_VERSION} omp.h)
|
||||
expand_vars_recipe(${CMAKE_CURRENT_SOURCE_DIR}/include/${LIBOMP_OMP_VERSION} ompt.h)
|
||||
expand_vars_recipe(${CMAKE_CURRENT_SOURCE_DIR}/include/${LIBOMP_OMP_VERSION} omp_lib.h)
|
||||
expand_vars_recipe(${CMAKE_CURRENT_SOURCE_DIR}/include/${LIBOMP_OMP_VERSION} omp_lib.f)
|
||||
expand_vars_recipe(${CMAKE_CURRENT_SOURCE_DIR}/include/${LIBOMP_OMP_VERSION} omp_lib.f90)
|
||||
expand_vars_recipe(${CMAKE_CURRENT_SOURCE_DIR} libomp.rc)
|
||||
# Move files to exports/ directory if requested
|
||||
if(${LIBOMP_COPY_EXPORTS})
|
||||
include(LibompExports)
|
||||
endif()
|
||||
|
||||
# Micro test rules for after library has been built (cmake/LibompMicroTests.cmake)
|
||||
include(LibompMicroTests)
|
||||
add_custom_target(libomp-micro-tests)
|
||||
if(NOT ${MIC} AND NOT CMAKE_CROSSCOMPILING)
|
||||
add_dependencies(libomp-micro-tests libomp-test-touch)
|
||||
endif()
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
add_dependencies(libomp-micro-tests libomp-test-relo)
|
||||
endif()
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
add_dependencies(libomp-micro-tests libomp-test-execstack)
|
||||
endif()
|
||||
if(${MIC})
|
||||
add_dependencies(libomp-micro-tests libomp-test-instr)
|
||||
endif()
|
||||
add_dependencies(libomp-micro-tests libomp-test-deps)
|
||||
|
||||
####################################################################
|
||||
# Install rules
|
||||
# We want to install libomp in DESTDIR/CMAKE_INSTALL_PREFIX/lib
|
||||
# We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include
|
||||
if(${LIBOMP_STANDALONE_BUILD})
|
||||
set(LIBOMP_HEADERS_INSTALL_PATH include)
|
||||
set(LIBOMP_HEADERS_INSTALL_PATH include)
|
||||
else()
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
|
||||
set(LIBOMP_HEADERS_INSTALL_PATH lib${LIBOMP_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
|
||||
set(LIBOMP_HEADERS_INSTALL_PATH lib${LIBOMP_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||||
endif()
|
||||
if(${WINDOWS})
|
||||
install(TARGETS omp RUNTIME DESTINATION bin)
|
||||
if(NOT "${imp_file}" STREQUAL "")
|
||||
install(TARGETS ompimp ARCHIVE DESTINATION lib${LIBOMP_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
# Create aliases (regular copies) of the library for backwards compatibility
|
||||
set(LIBOMP_ALIASES "libiomp5md")
|
||||
foreach(alias IN LISTS LIBOMP_ALIASES)
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${lib_file}\" \"${alias}${dll}\"
|
||||
WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)")
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${imp_file}\" \"${alias}${lib}\"
|
||||
WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})")
|
||||
endforeach()
|
||||
if(WIN32)
|
||||
install(TARGETS omp RUNTIME DESTINATION bin)
|
||||
install(TARGETS ompimp ARCHIVE DESTINATION lib${LIBOMP_LIBDIR_SUFFIX})
|
||||
# Create aliases (regular copies) of the library for backwards compatibility
|
||||
set(LIBOMP_ALIASES "libiomp5md")
|
||||
foreach(alias IN LISTS LIBOMP_ALIASES)
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\"
|
||||
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)")
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\"
|
||||
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})")
|
||||
endforeach()
|
||||
else()
|
||||
install(TARGETS omp LIBRARY DESTINATION lib${LIBOMP_LIBDIR_SUFFIX})
|
||||
# Create aliases (symlinks) of the library for backwards compatibility
|
||||
set(LIBOMP_ALIASES "libgomp;libiomp5")
|
||||
foreach(alias IN LISTS LIBOMP_ALIASES)
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${lib_file}\" \"${alias}${dll}\"
|
||||
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})")
|
||||
endforeach()
|
||||
|
||||
install(TARGETS omp ${LIBOMP_INSTALL_KIND} DESTINATION lib${LIBOMP_LIBDIR_SUFFIX})
|
||||
|
||||
# Create aliases (symlinks) of the library for backwards compatibility
|
||||
set(LIBOMP_ALIASES "libgomp;libiomp5")
|
||||
foreach(alias IN LISTS LIBOMP_ALIASES)
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_FILE}\"
|
||||
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})")
|
||||
endforeach()
|
||||
endif()
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/omp.h
|
||||
DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH}
|
||||
FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/omp.h
|
||||
DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH}
|
||||
)
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ompt.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ompt.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH})
|
||||
endif()
|
||||
if(${LIBOMP_FORTRAN_MODULES})
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/omp_lib.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/omp_lib.mod
|
||||
${CMAKE_CURRENT_BINARY_DIR}/omp_lib_kinds.mod
|
||||
DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
# defs.mk
|
||||
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// The LLVM Compiler Infrastructure
|
||||
#//
|
||||
#// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
#// Source Licenses. See LICENSE.txt for details.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# This file contains definitions common for OpenMP RTL and DSL makefiles.
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
|
||||
# Include really common definitions.
|
||||
include $(LIBOMP_WORK)tools/src/common-defs.mk
|
||||
|
||||
#
|
||||
# Directories.
|
||||
#
|
||||
|
||||
# Check and normalize LIBOMP_EXPORTS.
|
||||
ifeq "$(LIBOMP_EXPORTS)" ""
|
||||
$(error LIBOMP_EXPORTS environment variable must be set)
|
||||
endif
|
||||
ifneq "$(words $(LIBOMP_EXPORTS))" "1"
|
||||
$(error LIBOMP_EXPORTS must not contain spaces)
|
||||
endif
|
||||
override LIBOMP_EXPORTS := $(subst \,/,$(LIBOMP_EXPORTS))
|
||||
ifeq "$(filter %/,$(LIBOMP_EXPORTS))" ""
|
||||
override LIBOMP_EXPORTS := $(LIBOMP_EXPORTS)/
|
||||
endif
|
||||
# Output directories.
|
||||
out_dir = $(LIBOMP_EXPORTS)
|
||||
out_cmn_dir = $(out_dir)common$(suffix)/
|
||||
out_ptf_dir = $(out_dir)$(platform)$(suffix)/
|
||||
_out_lib_dir = $(out_dir)$(1)$(suffix)/lib$(if $(filter mac_%,$(1)),.thin)/
|
||||
out_lib_dir = $(call _out_lib_dir,$(platform))
|
||||
ifneq "$(arch)" "mic"
|
||||
out_l10n_dir = $(out_lib_dir)$(if $(filter lin mac,$(os)),locale/)
|
||||
else
|
||||
out_l10n_dir = $(out_lib_dir)
|
||||
endif
|
||||
ifeq "$(os)" "mac"
|
||||
_out_lib_fat_dir = $(out_dir)$(1)$(suffix)/lib/
|
||||
out_lib_fat_dir = $(call _out_lib_fat_dir,$(platform))
|
||||
out_l10n_fat_dir = $(out_lib_fat_dir)locale/
|
||||
endif
|
||||
|
||||
#
|
||||
# Retrieve build number,
|
||||
#
|
||||
|
||||
ifeq "$(clean)" ""
|
||||
# Parse kmp_version.c file, look for "#define KMP_VERSION_BUILD yyyymmdd" string,
|
||||
# leave only "yyyymmdd". Note: Space after $$1 is important, it helps to detect possible errors.
|
||||
build := $(strip $(shell $(perl) -p -e '$$_ =~ s{^(?:\s*\#define\s+KMP_VERSION_BUILD\s+([0-9]{8})|.*)\s*\n}{$$1 }' $(LIBOMP_WORK)src/kmp_version.c))
|
||||
ifneq "$(words $(build))" "1"
|
||||
$(error Failed to pase "kmp_version.c", cannot extract build number)
|
||||
endif
|
||||
$(call say,Build : $(build)$(if $(filter 00000000,$(build)), (development)))
|
||||
endif
|
||||
|
||||
# end of file #
|
||||
+53
-19
@@ -160,7 +160,6 @@
|
||||
|
||||
# Regular entry points
|
||||
__kmp_wait_yield_4
|
||||
__kmp_wait_yield_8
|
||||
__kmp_fork_call
|
||||
__kmp_invoke_microtask
|
||||
__kmp_launch_monitor
|
||||
@@ -182,24 +181,20 @@
|
||||
%endif
|
||||
|
||||
|
||||
#if USE_DEBUGGER
|
||||
%ifdef USE_DEBUGGER
|
||||
__kmp_debugging DATA
|
||||
__kmp_omp_debug_struct_info DATA
|
||||
#endif /* USE_DEBUGGER */
|
||||
%endif
|
||||
|
||||
# Symbols for MS mutual detection:
|
||||
_You_must_link_with_exactly_one_OpenMP_library DATA
|
||||
_You_must_link_with_Intel_OpenMP_library DATA
|
||||
%ifdef msvc_compat
|
||||
_You_must_link_with_Microsoft_OpenMP_library DATA
|
||||
%endif
|
||||
# Symbols for MS mutual detection:
|
||||
_You_must_link_with_exactly_one_OpenMP_library DATA
|
||||
_You_must_link_with_Intel_OpenMP_library DATA
|
||||
%ifdef msvc_compat
|
||||
_You_must_link_with_Microsoft_OpenMP_library DATA
|
||||
%endif
|
||||
|
||||
__kmp_wait_32
|
||||
__kmp_wait_64
|
||||
__kmp_wait_oncore
|
||||
__kmp_release_32
|
||||
__kmp_release_64
|
||||
__kmp_release_oncore
|
||||
__kmp_wait_64
|
||||
__kmp_release_64
|
||||
|
||||
|
||||
# VT_getthid 1
|
||||
@@ -385,13 +380,20 @@ kmpc_set_defaults 224
|
||||
%endif # OMP_40
|
||||
%endif
|
||||
|
||||
# OpenMP 4.1 entry points
|
||||
# OpenMP 4.5 entry points
|
||||
%ifndef stub
|
||||
%ifdef OMP_41
|
||||
__kmpc_proxy_task_completed 259
|
||||
__kmpc_proxy_task_completed_ooo 260
|
||||
%ifdef OMP_45
|
||||
__kmpc_proxy_task_completed 259
|
||||
__kmpc_proxy_task_completed_ooo 260
|
||||
__kmpc_doacross_init 261
|
||||
__kmpc_doacross_wait 262
|
||||
__kmpc_doacross_post 263
|
||||
__kmpc_doacross_fini 264
|
||||
__kmpc_taskloop 266
|
||||
%endif
|
||||
%endif
|
||||
kmpc_aligned_malloc 265
|
||||
kmpc_set_disp_num_buffers 267
|
||||
|
||||
# User API entry points that have both lower- and upper- case versions for Fortran.
|
||||
# Number for lowercase version is indicated. Number for uppercase is obtained by adding 1000.
|
||||
@@ -444,6 +446,7 @@ kmp_get_num_known_threads 743
|
||||
kmp_set_stacksize_s 744
|
||||
kmp_get_stacksize_s 745
|
||||
kmp_set_defaults 746
|
||||
kmp_aligned_malloc 747
|
||||
kmp_set_warnings_on 779
|
||||
kmp_set_warnings_off 780
|
||||
|
||||
@@ -491,8 +494,39 @@ kmp_set_warnings_off 780
|
||||
omp_get_cancellation 867
|
||||
kmp_get_cancellation_status 868
|
||||
omp_is_initial_device 869
|
||||
%ifdef stub
|
||||
omp_set_default_device 879
|
||||
omp_get_default_device 880
|
||||
omp_get_num_devices 881
|
||||
%endif
|
||||
%endif # OMP_40
|
||||
|
||||
# OpenMP 45
|
||||
|
||||
%ifdef OMP_45
|
||||
omp_init_lock_with_hint 870
|
||||
omp_init_nest_lock_with_hint 871
|
||||
omp_get_max_task_priority 872
|
||||
omp_get_num_places 873
|
||||
omp_get_place_num_procs 874
|
||||
omp_get_place_proc_ids 875
|
||||
omp_get_place_num 876
|
||||
omp_get_partition_num_places 877
|
||||
omp_get_partition_place_nums 878
|
||||
%ifdef stub
|
||||
omp_get_initial_device 882
|
||||
omp_target_alloc 883
|
||||
omp_target_free 884
|
||||
omp_target_is_present 885
|
||||
omp_target_memcpy 886
|
||||
omp_target_memcpy_rect 887
|
||||
omp_target_associate_ptr 888
|
||||
omp_target_disassociate_ptr 889
|
||||
%endif
|
||||
%endif # OMP_45
|
||||
|
||||
kmp_set_disp_num_buffers 890
|
||||
|
||||
%ifndef stub
|
||||
# Ordinals between 900 and 999 are reserved
|
||||
|
||||
|
||||
@@ -21,9 +21,13 @@ VERSION {
|
||||
# "Normal" symbols.
|
||||
#
|
||||
omp_*; # Standard OpenMP functions.
|
||||
ompt_initialize; # OMPT initialization interface
|
||||
|
||||
#
|
||||
# OMPT API
|
||||
#
|
||||
ompt_tool; # OMPT initialization interface
|
||||
ompt_control; # OMPT control interface
|
||||
|
||||
|
||||
#
|
||||
# OMPT state placeholders
|
||||
#
|
||||
@@ -85,14 +89,9 @@ VERSION {
|
||||
__kmp_launch_worker;
|
||||
__kmp_reap_monitor;
|
||||
__kmp_reap_worker;
|
||||
__kmp_release_32;
|
||||
__kmp_release_64;
|
||||
__kmp_release_oncore;
|
||||
__kmp_wait_32;
|
||||
__kmp_wait_64;
|
||||
__kmp_wait_oncore;
|
||||
__kmp_wait_yield_4;
|
||||
__kmp_wait_yield_8;
|
||||
|
||||
# ittnotify symbols to be used by debugger
|
||||
__kmp_itt_fini_ittlib;
|
||||
|
||||
@@ -38,7 +38,7 @@ Language "English"
|
||||
Country "USA"
|
||||
LangId "1033"
|
||||
Version "2"
|
||||
Revision "20140827"
|
||||
Revision "20160405"
|
||||
|
||||
|
||||
|
||||
@@ -388,9 +388,10 @@ OBSOLETE "%1$s: granularity=core will be used."
|
||||
EnvLockWarn "%1$s must be set prior to first OMP lock call or critical section; ignored."
|
||||
FutexNotSupported "futex system call not supported; %1$s=%2$s ignored."
|
||||
AffGranUsing "%1$s: granularity=%2$s will be used."
|
||||
AffThrPlaceInvalid "%1$s: invalid value \"%2$s\", valid format is \"nC,mT[,kO]\"."
|
||||
AffThrPlaceUnsupported "KMP_PLACE_THREADS ignored: unsupported architecture."
|
||||
AffThrPlaceManyCores "KMP_PLACE_THREADS ignored: too many cores requested."
|
||||
AffHWSubsetInvalid "%1$s: invalid value \"%2$s\", valid format is \"Ns[@N],Nc[@N],Nt "
|
||||
"(nSockets@offset, nCores@offset, nTthreads per core)\"."
|
||||
AffHWSubsetUnsupported "KMP_HW_SUBSET ignored: unsupported architecture."
|
||||
AffHWSubsetManyCores "KMP_HW_SUBSET ignored: too many cores requested."
|
||||
SyntaxErrorUsing "%1$s: syntax error, using %2$s."
|
||||
AdaptiveNotSupported "%1$s: Adaptive locks are not supported; using queuing."
|
||||
EnvSyntaxError "%1$s: Invalid symbols found. Check the value \"%2$s\"."
|
||||
@@ -398,10 +399,17 @@ EnvSpacesNotAllowed "%1$s: Spaces between digits are not allowed \"%2$s
|
||||
BoundToOSProcSet "%1$s: pid %2$d thread %3$d bound to OS proc set %4$s"
|
||||
CnsLoopIncrIllegal "%1$s error: parallel loop increment and condition are inconsistent."
|
||||
NoGompCancellation "libgomp cancellation is not currently supported."
|
||||
AffThrPlaceNonUniform "KMP_PLACE_THREADS ignored: non-uniform topology."
|
||||
AffThrPlaceNonThreeLevel "KMP_PLACE_THREADS ignored: only three-level topology is supported."
|
||||
AffHWSubsetNonUniform "KMP_HW_SUBSET ignored: non-uniform topology."
|
||||
AffHWSubsetNonThreeLevel "KMP_HW_SUBSET ignored: only three-level topology is supported."
|
||||
AffGranTopGroup "%1$s: granularity=%2$s is not supported with KMP_TOPOLOGY_METHOD=group. Using \"granularity=fine\"."
|
||||
AffGranGroupType "%1$s: granularity=group is not supported with KMP_AFFINITY=%2$s. Using \"granularity=core\"."
|
||||
AffHWSubsetManySockets "KMP_HW_SUBSET ignored: too many sockets requested."
|
||||
AffHWSubsetDeprecated "KMP_HW_SUBSET \"o\" offset designator deprecated, please use @ prefix for offset value."
|
||||
AffUsingHwloc "%1$s: Affinity capable, using hwloc."
|
||||
AffIgnoringHwloc "%1$s: Ignoring hwloc mechanism."
|
||||
AffHwlocErrorOccurred "%1$s: Hwloc failed in %2$s. Relying on internal affinity mechanisms."
|
||||
EnvSerialWarn "%1$s must be set prior to OpenMP runtime library initialization; ignored."
|
||||
EnvVarDeprecated "%1$s variable deprecated, please use %2$s instead."
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* include/30/iomp.h.var
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.txt for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#ifndef __IOMP_H
|
||||
# define __IOMP_H
|
||||
|
||||
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
|
||||
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
|
||||
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
|
||||
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define kmp_set_stacksize kmpc_set_stacksize
|
||||
# define kmp_set_stacksize_s kmpc_set_stacksize_s
|
||||
# define kmp_set_blocktime kmpc_set_blocktime
|
||||
# define kmp_set_library kmpc_set_library
|
||||
# define kmp_set_defaults kmpc_set_defaults
|
||||
# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc
|
||||
# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc
|
||||
# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc
|
||||
|
||||
# define kmp_malloc kmpc_malloc
|
||||
# define kmp_calloc kmpc_calloc
|
||||
# define kmp_realloc kmpc_realloc
|
||||
# define kmp_free kmpc_free
|
||||
|
||||
# if defined(_WIN32)
|
||||
# define __KAI_KMPC_CONVENTION __cdecl
|
||||
# else
|
||||
# define __KAI_KMPC_CONVENTION
|
||||
# endif
|
||||
|
||||
# include <stdlib.h>
|
||||
/* kmp API functions */
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
|
||||
extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
|
||||
|
||||
/* affinity API functions */
|
||||
typedef void * kmp_affinity_mask_t;
|
||||
|
||||
extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
|
||||
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
|
||||
|
||||
# undef __KAI_KMPC_CONVENTION
|
||||
|
||||
/* Warning:
|
||||
The following typedefs are not standard, deprecated and will be removed in a future release.
|
||||
*/
|
||||
typedef int omp_int_t;
|
||||
typedef double omp_wtime_t;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif /* __IOMP_H */
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
! include/30/iomp_lib.h.var
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!//
|
||||
!// The LLVM Compiler Infrastructure
|
||||
!//
|
||||
!// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
!// Source Licenses. See LICENSE.txt for details.
|
||||
!//
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!
|
||||
|
||||
!***
|
||||
!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and
|
||||
!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f).
|
||||
!*** omp_real_kind is not predefined, however.
|
||||
!***
|
||||
|
||||
integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
|
||||
integer, parameter :: omp_real_kind = 4
|
||||
|
||||
!***
|
||||
!*** kmp_* type extensions
|
||||
!***
|
||||
|
||||
integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND
|
||||
integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND
|
||||
integer, parameter :: kmp_affinity_mask_kind = $KMP_INT_PTR_KIND
|
||||
|
||||
!***
|
||||
!*** kmp_* entry points
|
||||
!***
|
||||
|
||||
external kmp_set_stacksize
|
||||
external kmp_set_stacksize_s
|
||||
external kmp_set_blocktime
|
||||
external kmp_set_library_serial
|
||||
external kmp_set_library_turnaround
|
||||
external kmp_set_library_throughput
|
||||
external kmp_set_library
|
||||
external kmp_set_defaults
|
||||
external kmp_get_stacksize
|
||||
integer kmp_get_stacksize
|
||||
external kmp_get_stacksize_s
|
||||
integer (kind = kmp_size_t_kind) kmp_get_stacksize_s
|
||||
external kmp_get_blocktime
|
||||
integer kmp_get_blocktime
|
||||
external kmp_get_library
|
||||
integer kmp_get_library
|
||||
external kmp_set_affinity
|
||||
integer kmp_set_affinity
|
||||
external kmp_get_affinity
|
||||
integer kmp_get_affinity
|
||||
external kmp_get_affinity_max_proc
|
||||
integer kmp_get_affinity_max_proc
|
||||
external kmp_create_affinity_mask
|
||||
external kmp_destroy_affinity_mask
|
||||
external kmp_set_affinity_mask_proc
|
||||
integer kmp_set_affinity_mask_proc
|
||||
external kmp_unset_affinity_mask_proc
|
||||
integer kmp_unset_affinity_mask_proc
|
||||
external kmp_get_affinity_mask_proc
|
||||
integer kmp_get_affinity_mask_proc
|
||||
external kmp_malloc
|
||||
integer (kind = kmp_pointer_kind) kmp_malloc
|
||||
external kmp_calloc
|
||||
integer (kind = kmp_pointer_kind) kmp_calloc
|
||||
external kmp_realloc
|
||||
integer (kind = kmp_pointer_kind) kmp_realloc
|
||||
external kmp_free
|
||||
|
||||
external kmp_set_warnings_on
|
||||
external kmp_set_warnings_off
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
#ifndef __OMP_H
|
||||
# define __OMP_H
|
||||
|
||||
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
|
||||
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
|
||||
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
|
||||
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
|
||||
# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
|
||||
# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
|
||||
# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
|
||||
# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -141,6 +141,7 @@
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
|
||||
|
||||
@@ -36,11 +36,11 @@
|
||||
|
||||
use omp_lib_kinds
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
character(*), parameter :: kmp_build_date = '$KMP_BUILD_DATE'
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
@@ -323,6 +323,13 @@
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
integer (kind=kmp_size_t_kind) alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
@@ -416,6 +423,7 @@
|
||||
!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'KMP_FREE'::kmp_free
|
||||
@@ -482,6 +490,7 @@
|
||||
!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'_KMP_FREE'::kmp_free
|
||||
@@ -551,6 +560,7 @@
|
||||
!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'kmp_free_'::kmp_free
|
||||
@@ -620,6 +630,7 @@
|
||||
!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'_kmp_free_'::kmp_free
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
|
||||
use omp_lib_kinds
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
@@ -328,6 +328,13 @@
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
integer (kind=kmp_size_t_kind), value :: alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
|
||||
interface
|
||||
|
||||
@@ -321,6 +321,13 @@
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
integer (kind=kmp_size_t_kind) alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
@@ -416,6 +423,7 @@
|
||||
!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'KMP_FREE'::kmp_free
|
||||
@@ -484,6 +492,7 @@
|
||||
!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'_KMP_FREE'::kmp_free
|
||||
@@ -555,6 +564,7 @@
|
||||
!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'kmp_free_'::kmp_free
|
||||
@@ -626,6 +636,7 @@
|
||||
!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'_kmp_free_'::kmp_free
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
\
|
||||
/*--- Mandatory Events ---*/ \
|
||||
macro (ompt_event_parallel_begin, ompt_new_parallel_callback_t, 1) /* parallel begin */ \
|
||||
macro (ompt_event_parallel_end, ompt_parallel_callback_t, 2) /* parallel end */ \
|
||||
macro (ompt_event_parallel_end, ompt_end_parallel_callback_t, 2) /* parallel end */ \
|
||||
\
|
||||
macro (ompt_event_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
|
||||
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
|
||||
@@ -121,7 +121,7 @@
|
||||
macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \
|
||||
macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \
|
||||
\
|
||||
macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \
|
||||
macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \
|
||||
\
|
||||
macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \
|
||||
macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \
|
||||
@@ -267,6 +267,11 @@ typedef enum {
|
||||
ompt_thread_other = 3
|
||||
} ompt_thread_type_t;
|
||||
|
||||
typedef enum {
|
||||
ompt_invoker_program = 0, /* program invokes master task */
|
||||
ompt_invoker_runtime = 1 /* runtime invokes master task */
|
||||
} ompt_invoker_t;
|
||||
|
||||
typedef void (*ompt_thread_type_callback_t) (
|
||||
ompt_thread_type_t thread_type, /* type of thread */
|
||||
ompt_thread_id_t thread_id /* ID of thread */
|
||||
@@ -293,7 +298,14 @@ typedef void (*ompt_new_parallel_callback_t) (
|
||||
ompt_frame_t *parent_task_frame, /* frame data of parent task */
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
uint32_t requested_team_size, /* number of threads in team */
|
||||
void *parallel_function /* pointer to outlined function */
|
||||
void *parallel_function, /* pointer to outlined function */
|
||||
ompt_invoker_t invoker /* who invokes master task? */
|
||||
);
|
||||
|
||||
typedef void (*ompt_end_parallel_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t task_id, /* id of task */
|
||||
ompt_invoker_t invoker /* who invokes master task? */
|
||||
);
|
||||
|
||||
/* tasks */
|
||||
@@ -301,9 +313,9 @@ typedef void (*ompt_task_callback_t) (
|
||||
ompt_task_id_t task_id /* id of task */
|
||||
);
|
||||
|
||||
typedef void (*ompt_task_switch_callback_t) (
|
||||
ompt_task_id_t suspended_task_id, /* tool data for suspended task */
|
||||
ompt_task_id_t resumed_task_id /* tool data for resumed task */
|
||||
typedef void (*ompt_task_pair_callback_t) (
|
||||
ompt_task_id_t first_task_id,
|
||||
ompt_task_id_t second_task_id
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_task_callback_t) (
|
||||
@@ -406,12 +418,15 @@ OMPT_API_FUNCTION(void, ompt_mutex_wait, (
|
||||
* INITIALIZATION FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
int ompt_initialize(
|
||||
OMPT_API_FUNCTION(void, ompt_initialize, (
|
||||
ompt_function_lookup_t ompt_fn_lookup,
|
||||
const char *runtime_version,
|
||||
unsigned int ompt_version
|
||||
);
|
||||
));
|
||||
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
ompt_initialize_t ompt_tool(void);
|
||||
|
||||
typedef enum opt_init_mode_e {
|
||||
ompt_init_mode_never = 0,
|
||||
@@ -446,14 +461,15 @@ OMPT_API_FUNCTION(int, ompt_get_callback, (
|
||||
***************************************************************************/
|
||||
|
||||
/* control */
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
// FIXME: remove workaround for clang
|
||||
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp declare target
|
||||
#endif
|
||||
void ompt_control(
|
||||
uint64_t command,
|
||||
uint64_t modifier
|
||||
);
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp end declare target
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* include/40/iomp.h.var
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.txt for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#ifndef __IOMP_H
|
||||
# define __IOMP_H
|
||||
|
||||
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
|
||||
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
|
||||
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
|
||||
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define kmp_set_stacksize kmpc_set_stacksize
|
||||
# define kmp_set_stacksize_s kmpc_set_stacksize_s
|
||||
# define kmp_set_blocktime kmpc_set_blocktime
|
||||
# define kmp_set_library kmpc_set_library
|
||||
# define kmp_set_defaults kmpc_set_defaults
|
||||
# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc
|
||||
# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc
|
||||
# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc
|
||||
|
||||
# define kmp_malloc kmpc_malloc
|
||||
# define kmp_calloc kmpc_calloc
|
||||
# define kmp_realloc kmpc_realloc
|
||||
# define kmp_free kmpc_free
|
||||
|
||||
# if defined(_WIN32)
|
||||
# define __KAI_KMPC_CONVENTION __cdecl
|
||||
# else
|
||||
# define __KAI_KMPC_CONVENTION
|
||||
# endif
|
||||
|
||||
# include <stdlib.h>
|
||||
/* kmp API functions */
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
|
||||
extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
|
||||
|
||||
/* affinity API functions */
|
||||
typedef void * kmp_affinity_mask_t;
|
||||
|
||||
extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
|
||||
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
|
||||
|
||||
/* schedule kind constants */
|
||||
typedef enum kmp_cancel_kind_t {
|
||||
kmp_cancel_parallel = 1,
|
||||
kmp_cancel_loop = 2,
|
||||
kmp_cancel_sections = 3,
|
||||
kmp_cancel_taskgroup = 4
|
||||
} kmp_cancel_kind_t;
|
||||
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_cancellation_status(kmp_cancel_kind_t);
|
||||
|
||||
# undef __KAI_KMPC_CONVENTION
|
||||
|
||||
/* Warning:
|
||||
The following typedefs are not standard, deprecated and will be removed in a future release.
|
||||
*/
|
||||
typedef int omp_int_t;
|
||||
typedef double omp_wtime_t;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif /* __IOMP_H */
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
! include/40/iomp_lib.h.var
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!//
|
||||
!// The LLVM Compiler Infrastructure
|
||||
!//
|
||||
!// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
!// Source Licenses. See LICENSE.txt for details.
|
||||
!//
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!
|
||||
|
||||
!***
|
||||
!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and
|
||||
!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f).
|
||||
!*** omp_real_kind is not predefined, however.
|
||||
!***
|
||||
|
||||
integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
|
||||
integer, parameter :: omp_real_kind = 4
|
||||
|
||||
!***
|
||||
!*** kmp_* type extensions
|
||||
!***
|
||||
|
||||
integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND
|
||||
integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND
|
||||
integer, parameter :: kmp_affinity_mask_kind = $KMP_INT_PTR_KIND
|
||||
|
||||
!***
|
||||
!*** kmp_* entry points
|
||||
!***
|
||||
|
||||
external kmp_set_stacksize
|
||||
external kmp_set_stacksize_s
|
||||
external kmp_set_blocktime
|
||||
external kmp_set_library_serial
|
||||
external kmp_set_library_turnaround
|
||||
external kmp_set_library_throughput
|
||||
external kmp_set_library
|
||||
external kmp_set_defaults
|
||||
external kmp_get_stacksize
|
||||
integer kmp_get_stacksize
|
||||
external kmp_get_stacksize_s
|
||||
integer (kind = kmp_size_t_kind) kmp_get_stacksize_s
|
||||
external kmp_get_blocktime
|
||||
integer kmp_get_blocktime
|
||||
external kmp_get_library
|
||||
integer kmp_get_library
|
||||
external kmp_set_affinity
|
||||
integer kmp_set_affinity
|
||||
external kmp_get_affinity
|
||||
integer kmp_get_affinity
|
||||
external kmp_get_affinity_max_proc
|
||||
integer kmp_get_affinity_max_proc
|
||||
external kmp_create_affinity_mask
|
||||
external kmp_destroy_affinity_mask
|
||||
external kmp_set_affinity_mask_proc
|
||||
integer kmp_set_affinity_mask_proc
|
||||
external kmp_unset_affinity_mask_proc
|
||||
integer kmp_unset_affinity_mask_proc
|
||||
external kmp_get_affinity_mask_proc
|
||||
integer kmp_get_affinity_mask_proc
|
||||
external kmp_malloc
|
||||
integer (kind = kmp_pointer_kind) kmp_malloc
|
||||
external kmp_calloc
|
||||
integer (kind = kmp_pointer_kind) kmp_calloc
|
||||
external kmp_realloc
|
||||
integer (kind = kmp_pointer_kind) kmp_realloc
|
||||
external kmp_free
|
||||
|
||||
external kmp_set_warnings_on
|
||||
external kmp_set_warnings_off
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
#ifndef __OMP_H
|
||||
# define __OMP_H
|
||||
|
||||
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
|
||||
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
|
||||
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
|
||||
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
|
||||
# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
|
||||
# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
|
||||
# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
|
||||
# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -85,20 +85,6 @@
|
||||
extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *);
|
||||
extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *);
|
||||
|
||||
/* lock hint type for dynamic user lock */
|
||||
typedef enum kmp_lock_hint_t {
|
||||
kmp_lock_hint_none = 0,
|
||||
kmp_lock_hint_contended,
|
||||
kmp_lock_hint_uncontended,
|
||||
kmp_lock_hint_nonspeculative,
|
||||
kmp_lock_hint_speculative,
|
||||
kmp_lock_hint_adaptive,
|
||||
} kmp_lock_hint_t;
|
||||
|
||||
/* hinted lock initializers */
|
||||
extern void __KAI_KMPC_CONVENTION kmp_init_lock_hinted(omp_lock_t *, kmp_lock_hint_t);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_init_nest_lock_hinted(omp_nest_lock_t *, kmp_lock_hint_t);
|
||||
|
||||
/* time API functions */
|
||||
extern double __KAI_KMPC_CONVENTION omp_get_wtime (void);
|
||||
extern double __KAI_KMPC_CONVENTION omp_get_wtick (void);
|
||||
@@ -151,6 +137,7 @@
|
||||
extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void);
|
||||
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
integer, parameter :: kmp_size_t_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_cancel_kind = omp_integer_kind
|
||||
integer, parameter :: kmp_lock_hint_kind = omp_integer_kind
|
||||
|
||||
end module omp_lib_kinds
|
||||
|
||||
@@ -39,11 +38,11 @@
|
||||
|
||||
use omp_lib_kinds
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
character(*), parameter :: kmp_build_date = '$KMP_BUILD_DATE'
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
@@ -61,13 +60,6 @@
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
|
||||
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_none = 0
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_uncontended = 1
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_contended = 2
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_nonspeculative = 3
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_speculative = 4
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 5
|
||||
|
||||
interface
|
||||
|
||||
! ***
|
||||
@@ -414,6 +406,13 @@
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
integer (kind=kmp_size_t_kind) alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
@@ -445,18 +444,6 @@
|
||||
logical (kind=omp_logical_kind) kmp_get_cancellation_status
|
||||
end function kmp_get_cancellation_status
|
||||
|
||||
subroutine kmp_init_lock_hinted(lockvar, lockhint)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind) lockhint
|
||||
end subroutine kmp_init_lock_hinted
|
||||
|
||||
subroutine kmp_init_nest_lock_hinted(lockvar, lockhint)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind) lockhint
|
||||
end subroutine kmp_init_nest_lock_hinted
|
||||
|
||||
end interface
|
||||
|
||||
!dec$ if defined(_WIN32)
|
||||
@@ -533,6 +520,7 @@
|
||||
!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'KMP_FREE'::kmp_free
|
||||
@@ -542,9 +530,6 @@
|
||||
|
||||
!dec$ attributes alias:'KMP_GET_CANCELLATION_STATUS' :: kmp_get_cancellation_status
|
||||
|
||||
!dec$ attributes alias:'KMP_INIT_LOCK_HINTED'::kmp_init_lock_hinted
|
||||
!dec$ attributes alias:'KMP_INIT_NEST_LOCK_HINTED'::kmp_init_nest_lock_hinted
|
||||
|
||||
!dec$ else
|
||||
|
||||
!***
|
||||
@@ -612,6 +597,7 @@
|
||||
!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'_KMP_FREE'::kmp_free
|
||||
@@ -621,9 +607,6 @@
|
||||
|
||||
!dec$ attributes alias:'_KMP_GET_CANCELLATION_STATUS' :: kmp_get_cancellation_status
|
||||
|
||||
!dec$ attributes alias:'_KMP_INIT_LOCK_HINTED'::kmp_init_lock_hinted
|
||||
!dec$ attributes alias:'_KMP_INIT_NEST_LOCK_HINTED'::kmp_init_nest_lock_hinted
|
||||
|
||||
!dec$ endif
|
||||
!dec$ endif
|
||||
|
||||
@@ -694,6 +677,7 @@
|
||||
!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'kmp_free_'::kmp_free
|
||||
@@ -702,9 +686,6 @@
|
||||
!dec$ attributes alias:'kmp_set_warnings_off_'::kmp_set_warnings_off
|
||||
!dec$ attributes alias:'kmp_get_cancellation_status_'::kmp_get_cancellation_status
|
||||
|
||||
!dec$ attributes alias:'kmp_init_lock_hinted_'::kmp_init_lock_hinted
|
||||
!dec$ attributes alias:'kmp_init_nest_lock_hinted_'::kmp_init_nest_lock_hinted
|
||||
|
||||
!dec$ endif
|
||||
|
||||
!dec$ if defined(__APPLE__)
|
||||
@@ -772,6 +753,7 @@
|
||||
!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'_kmp_free_'::kmp_free
|
||||
@@ -781,9 +763,6 @@
|
||||
|
||||
!dec$ attributes alias:'_kmp_get_cancellation_status_'::kmp_get_cancellation_status
|
||||
|
||||
!dec$ attributes alias:'_kmp_init_lock_hinted_'::kmp_init_lock_hinted
|
||||
!dec$ attributes alias:'_kmp_init_nest_lock_hinted_'::kmp_init_nest_lock_hinted
|
||||
|
||||
!dec$ endif
|
||||
|
||||
end module omp_lib
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
integer, parameter :: kmp_size_t_kind = c_size_t
|
||||
integer, parameter :: kmp_affinity_mask_kind = c_intptr_t
|
||||
integer, parameter :: kmp_cancel_kind = omp_integer_kind
|
||||
integer, parameter :: kmp_lock_hint_kind = omp_integer_kind
|
||||
|
||||
end module omp_lib_kinds
|
||||
|
||||
@@ -35,12 +34,12 @@
|
||||
|
||||
use omp_lib_kinds
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
@@ -59,13 +58,6 @@
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
|
||||
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_none = 0
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_uncontended = 1
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_contended = 2
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_nonspeculative = 3
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_speculative = 4
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 5
|
||||
|
||||
interface
|
||||
|
||||
! ***
|
||||
@@ -420,6 +412,13 @@
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
integer (kind=kmp_size_t_kind), value :: alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
@@ -451,18 +450,6 @@
|
||||
logical (kind=omp_logical_kind) kmp_get_cancellation_status
|
||||
end function kmp_get_cancellation_status
|
||||
|
||||
subroutine kmp_init_lock_hinted(lockvar, lockhint) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind), value :: lockhint
|
||||
end subroutine kmp_init_lock_hinted
|
||||
|
||||
subroutine kmp_init_nest_lock_hinted(lockvar, lockhint) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind), value :: lockhint
|
||||
end subroutine kmp_init_nest_lock_hinted
|
||||
|
||||
end interface
|
||||
|
||||
end module omp_lib
|
||||
|
||||
@@ -28,14 +28,13 @@
|
||||
integer, parameter :: kmp_pointer_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_size_t_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_lock_hint_kind = omp_integer_kind
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
@@ -48,13 +47,6 @@
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_close = 3
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_spread = 4
|
||||
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_none = 0
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_uncontended = 1
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_contended = 2
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_nonspeculative = 3
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_speculative = 4
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 5
|
||||
|
||||
interface
|
||||
|
||||
! ***
|
||||
@@ -401,6 +393,13 @@
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
integer (kind=kmp_size_t_kind), value :: alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
@@ -426,18 +425,6 @@
|
||||
subroutine kmp_set_warnings_off() bind(c)
|
||||
end subroutine kmp_set_warnings_off
|
||||
|
||||
subroutine kmp_init_lock_hinted(lockvar, lockhint) bind(c)
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind), value :: lockhint
|
||||
end subroutine kmp_init_lock_hinted
|
||||
|
||||
subroutine kmp_init_nest_lock_hinted(lockvar, lockhint) bind(c)
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind), value :: lockhint
|
||||
end subroutine kmp_init_nest_lock_hinted
|
||||
|
||||
end interface
|
||||
|
||||
!DIR$ IF DEFINED (__INTEL_OFFLOAD)
|
||||
@@ -501,13 +488,12 @@
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_unset_affinity_mask_proc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_mask_proc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_malloc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_aligned_malloc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_calloc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_realloc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_free
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_on
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_off
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_init_lock_hinted
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_init_nest_lock_hinted
|
||||
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!$omp declare target(omp_set_num_threads )
|
||||
@@ -570,13 +556,12 @@
|
||||
!$omp declare target(kmp_unset_affinity_mask_proc )
|
||||
!$omp declare target(kmp_get_affinity_mask_proc )
|
||||
!$omp declare target(kmp_malloc )
|
||||
!$omp declare target(kmp_aligned_malloc )
|
||||
!$omp declare target(kmp_calloc )
|
||||
!$omp declare target(kmp_realloc )
|
||||
!$omp declare target(kmp_free )
|
||||
!$omp declare target(kmp_set_warnings_on )
|
||||
!$omp declare target(kmp_set_warnings_off )
|
||||
!$omp declare target(kmp_init_lock_hinted )
|
||||
!$omp declare target(kmp_init_nest_lock_hinted )
|
||||
!DIR$ ENDIF
|
||||
!DIR$ ENDIF
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
\
|
||||
/*--- Mandatory Events ---*/ \
|
||||
macro (ompt_event_parallel_begin, ompt_new_parallel_callback_t, 1) /* parallel begin */ \
|
||||
macro (ompt_event_parallel_end, ompt_parallel_callback_t, 2) /* parallel end */ \
|
||||
macro (ompt_event_parallel_end, ompt_end_parallel_callback_t, 2) /* parallel end */ \
|
||||
\
|
||||
macro (ompt_event_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
|
||||
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
|
||||
@@ -121,7 +121,7 @@
|
||||
macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \
|
||||
macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \
|
||||
\
|
||||
macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \
|
||||
macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \
|
||||
\
|
||||
macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \
|
||||
macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \
|
||||
@@ -171,7 +171,10 @@
|
||||
macro (ompt_event_destroy_lock, ompt_wait_callback_t, 59) /* lock destruction */ \
|
||||
macro (ompt_event_destroy_nest_lock, ompt_wait_callback_t, 60) /* nest lock destruction */ \
|
||||
\
|
||||
macro (ompt_event_flush, ompt_callback_t, 61) /* after executing flush */
|
||||
macro (ompt_event_flush, ompt_callback_t, 61) /* after executing flush */ \
|
||||
\
|
||||
macro (ompt_event_task_dependences, ompt_task_dependences_callback_t, 69) /* report task dependences */\
|
||||
macro (ompt_event_task_dependence_pair, ompt_task_pair_callback_t, 70) /* report task dependence pair */
|
||||
|
||||
|
||||
|
||||
@@ -206,6 +209,23 @@ typedef struct ompt_frame_s {
|
||||
} ompt_frame_t;
|
||||
|
||||
|
||||
/*---------------------
|
||||
* dependences types
|
||||
*---------------------*/
|
||||
|
||||
typedef enum ompt_task_dependence_flag_e {
|
||||
// a two bit field for the dependence type
|
||||
ompt_task_dependence_type_out = 1,
|
||||
ompt_task_dependence_type_in = 2,
|
||||
ompt_task_dependence_type_inout = 3,
|
||||
} ompt_task_dependence_flag_t;
|
||||
|
||||
typedef struct ompt_task_dependence_s {
|
||||
void *variable_addr;
|
||||
uint32_t dependence_flags;
|
||||
} ompt_task_dependence_t;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* enumerations for thread states and runtime events
|
||||
*****************************************************************************/
|
||||
@@ -267,6 +287,11 @@ typedef enum {
|
||||
ompt_thread_other = 3
|
||||
} ompt_thread_type_t;
|
||||
|
||||
typedef enum {
|
||||
ompt_invoker_program = 0, /* program invokes master task */
|
||||
ompt_invoker_runtime = 1 /* runtime invokes master task */
|
||||
} ompt_invoker_t;
|
||||
|
||||
typedef void (*ompt_thread_type_callback_t) (
|
||||
ompt_thread_type_t thread_type, /* type of thread */
|
||||
ompt_thread_id_t thread_id /* ID of thread */
|
||||
@@ -293,7 +318,14 @@ typedef void (*ompt_new_parallel_callback_t) (
|
||||
ompt_frame_t *parent_task_frame, /* frame data of parent task */
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
uint32_t requested_team_size, /* number of threads in team */
|
||||
void *parallel_function /* pointer to outlined function */
|
||||
void *parallel_function, /* pointer to outlined function */
|
||||
ompt_invoker_t invoker /* who invokes master task? */
|
||||
);
|
||||
|
||||
typedef void (*ompt_end_parallel_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t task_id, /* id of task */
|
||||
ompt_invoker_t invoker /* who invokes master task? */
|
||||
);
|
||||
|
||||
/* tasks */
|
||||
@@ -301,9 +333,9 @@ typedef void (*ompt_task_callback_t) (
|
||||
ompt_task_id_t task_id /* id of task */
|
||||
);
|
||||
|
||||
typedef void (*ompt_task_switch_callback_t) (
|
||||
ompt_task_id_t suspended_task_id, /* tool data for suspended task */
|
||||
ompt_task_id_t resumed_task_id /* tool data for resumed task */
|
||||
typedef void (*ompt_task_pair_callback_t) (
|
||||
ompt_task_id_t first_task_id,
|
||||
ompt_task_id_t second_task_id
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_task_callback_t) (
|
||||
@@ -313,6 +345,13 @@ typedef void (*ompt_new_task_callback_t) (
|
||||
void *task_function /* pointer to outlined function */
|
||||
);
|
||||
|
||||
/* task dependences */
|
||||
typedef void (*ompt_task_dependences_callback_t) (
|
||||
ompt_task_id_t task_id, /* ID of task with dependences */
|
||||
const ompt_task_dependence_t *deps,/* vector of task dependences */
|
||||
int ndeps /* number of dependences */
|
||||
);
|
||||
|
||||
/* program */
|
||||
typedef void (*ompt_control_callback_t) (
|
||||
uint64_t command, /* command of control call */
|
||||
@@ -406,12 +445,15 @@ OMPT_API_FUNCTION(void, ompt_mutex_wait, (
|
||||
* INITIALIZATION FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
int ompt_initialize(
|
||||
OMPT_API_FUNCTION(void, ompt_initialize, (
|
||||
ompt_function_lookup_t ompt_fn_lookup,
|
||||
const char *runtime_version,
|
||||
unsigned int ompt_version
|
||||
);
|
||||
));
|
||||
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
ompt_initialize_t ompt_tool(void);
|
||||
|
||||
typedef enum opt_init_mode_e {
|
||||
ompt_init_mode_never = 0,
|
||||
@@ -446,14 +488,15 @@ OMPT_API_FUNCTION(int, ompt_get_callback, (
|
||||
***************************************************************************/
|
||||
|
||||
/* control */
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
// FIXME: remove workaround for clang
|
||||
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp declare target
|
||||
#endif
|
||||
void ompt_control(
|
||||
uint64_t command,
|
||||
uint64_t modifier
|
||||
);
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp end declare target
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* include/41/iomp.h.var
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.txt for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#ifndef __IOMP_H
|
||||
# define __IOMP_H
|
||||
|
||||
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
|
||||
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
|
||||
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
|
||||
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define kmp_set_stacksize kmpc_set_stacksize
|
||||
# define kmp_set_stacksize_s kmpc_set_stacksize_s
|
||||
# define kmp_set_blocktime kmpc_set_blocktime
|
||||
# define kmp_set_library kmpc_set_library
|
||||
# define kmp_set_defaults kmpc_set_defaults
|
||||
# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc
|
||||
# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc
|
||||
# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc
|
||||
|
||||
# define kmp_malloc kmpc_malloc
|
||||
# define kmp_calloc kmpc_calloc
|
||||
# define kmp_realloc kmpc_realloc
|
||||
# define kmp_free kmpc_free
|
||||
|
||||
# if defined(_WIN32)
|
||||
# define __KAI_KMPC_CONVENTION __cdecl
|
||||
# else
|
||||
# define __KAI_KMPC_CONVENTION
|
||||
# endif
|
||||
|
||||
# include <stdlib.h>
|
||||
/* kmp API functions */
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
|
||||
extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
|
||||
|
||||
/* affinity API functions */
|
||||
typedef void * kmp_affinity_mask_t;
|
||||
|
||||
extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
|
||||
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
|
||||
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
|
||||
|
||||
/* schedule kind constants */
|
||||
typedef enum kmp_cancel_kind_t {
|
||||
kmp_cancel_parallel = 1,
|
||||
kmp_cancel_loop = 2,
|
||||
kmp_cancel_sections = 3,
|
||||
kmp_cancel_taskgroup = 4
|
||||
} kmp_cancel_kind_t;
|
||||
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_cancellation_status(kmp_cancel_kind_t);
|
||||
|
||||
# undef __KAI_KMPC_CONVENTION
|
||||
|
||||
/* Warning:
|
||||
The following typedefs are not standard, deprecated and will be removed in a future release.
|
||||
*/
|
||||
typedef int omp_int_t;
|
||||
typedef double omp_wtime_t;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif /* __IOMP_H */
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
! include/41/iomp_lib.h.var
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!//
|
||||
!// The LLVM Compiler Infrastructure
|
||||
!//
|
||||
!// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
!// Source Licenses. See LICENSE.txt for details.
|
||||
!//
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!
|
||||
|
||||
!***
|
||||
!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and
|
||||
!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f).
|
||||
!*** omp_real_kind is not predefined, however.
|
||||
!***
|
||||
|
||||
integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
|
||||
integer, parameter :: omp_real_kind = 4
|
||||
|
||||
!***
|
||||
!*** kmp_* type extensions
|
||||
!***
|
||||
|
||||
integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND
|
||||
integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND
|
||||
integer, parameter :: kmp_affinity_mask_kind = $KMP_INT_PTR_KIND
|
||||
|
||||
!***
|
||||
!*** kmp_* entry points
|
||||
!***
|
||||
|
||||
external kmp_set_stacksize
|
||||
external kmp_set_stacksize_s
|
||||
external kmp_set_blocktime
|
||||
external kmp_set_library_serial
|
||||
external kmp_set_library_turnaround
|
||||
external kmp_set_library_throughput
|
||||
external kmp_set_library
|
||||
external kmp_set_defaults
|
||||
external kmp_get_stacksize
|
||||
integer kmp_get_stacksize
|
||||
external kmp_get_stacksize_s
|
||||
integer (kind = kmp_size_t_kind) kmp_get_stacksize_s
|
||||
external kmp_get_blocktime
|
||||
integer kmp_get_blocktime
|
||||
external kmp_get_library
|
||||
integer kmp_get_library
|
||||
external kmp_set_affinity
|
||||
integer kmp_set_affinity
|
||||
external kmp_get_affinity
|
||||
integer kmp_get_affinity
|
||||
external kmp_get_affinity_max_proc
|
||||
integer kmp_get_affinity_max_proc
|
||||
external kmp_create_affinity_mask
|
||||
external kmp_destroy_affinity_mask
|
||||
external kmp_set_affinity_mask_proc
|
||||
integer kmp_set_affinity_mask_proc
|
||||
external kmp_unset_affinity_mask_proc
|
||||
integer kmp_unset_affinity_mask_proc
|
||||
external kmp_get_affinity_mask_proc
|
||||
integer kmp_get_affinity_mask_proc
|
||||
external kmp_malloc
|
||||
integer (kind = kmp_pointer_kind) kmp_malloc
|
||||
external kmp_calloc
|
||||
integer (kind = kmp_pointer_kind) kmp_calloc
|
||||
external kmp_realloc
|
||||
integer (kind = kmp_pointer_kind) kmp_realloc
|
||||
external kmp_free
|
||||
|
||||
external kmp_set_warnings_on
|
||||
external kmp_set_warnings_off
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* include/41/omp.h.var
|
||||
* include/45/omp.h.var
|
||||
*/
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
#ifndef __OMP_H
|
||||
# define __OMP_H
|
||||
|
||||
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
|
||||
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
|
||||
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
|
||||
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
|
||||
# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
|
||||
# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
|
||||
# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
|
||||
# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -62,6 +62,7 @@
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void);
|
||||
extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void);
|
||||
|
||||
/* lock API functions */
|
||||
typedef struct omp_lock_t {
|
||||
@@ -86,18 +87,20 @@
|
||||
extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *);
|
||||
|
||||
/* lock hint type for dynamic user lock */
|
||||
typedef enum kmp_lock_hint_t {
|
||||
kmp_lock_hint_none = 0,
|
||||
kmp_lock_hint_contended,
|
||||
kmp_lock_hint_uncontended,
|
||||
kmp_lock_hint_nonspeculative,
|
||||
kmp_lock_hint_speculative,
|
||||
kmp_lock_hint_adaptive,
|
||||
} kmp_lock_hint_t;
|
||||
typedef enum omp_lock_hint_t {
|
||||
omp_lock_hint_none = 0,
|
||||
omp_lock_hint_uncontended = 1,
|
||||
omp_lock_hint_contended = (1<<1 ),
|
||||
omp_lock_hint_nonspeculative = (1<<2 ),
|
||||
omp_lock_hint_speculative = (1<<3 ),
|
||||
kmp_lock_hint_hle = (1<<16),
|
||||
kmp_lock_hint_rtm = (1<<17),
|
||||
kmp_lock_hint_adaptive = (1<<18)
|
||||
} omp_lock_hint_t;
|
||||
|
||||
/* hinted lock initializers */
|
||||
extern void __KAI_KMPC_CONVENTION kmp_init_lock_hinted(omp_lock_t *, kmp_lock_hint_t);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_init_nest_lock_hinted(omp_nest_lock_t *, kmp_lock_hint_t);
|
||||
extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t);
|
||||
extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t);
|
||||
|
||||
/* time API functions */
|
||||
extern double __KAI_KMPC_CONVENTION omp_get_wtime (void);
|
||||
@@ -113,6 +116,17 @@
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void);
|
||||
|
||||
# include <stdlib.h>
|
||||
/* OpenMP 4.5 */
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void);
|
||||
extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int);
|
||||
extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int);
|
||||
extern int __KAI_KMPC_CONVENTION omp_target_is_present(void *, int);
|
||||
extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, void *, size_t, size_t, size_t, int, int);
|
||||
extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, void *, size_t, int, const size_t *,
|
||||
const size_t *, const size_t *, const size_t *, const size_t *, int, int);
|
||||
extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(void *, void *, size_t, size_t, int);
|
||||
extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(void *, int);
|
||||
|
||||
/* kmp API functions */
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
|
||||
@@ -126,6 +140,7 @@
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int);
|
||||
|
||||
/* Intel affinity API */
|
||||
typedef void * kmp_affinity_mask_t;
|
||||
@@ -150,7 +165,16 @@
|
||||
|
||||
extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void);
|
||||
|
||||
/* OpenMP 4.5 affinity API */
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_places (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int);
|
||||
extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_place_num (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void);
|
||||
extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *);
|
||||
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
|
||||
@@ -1,4 +1,4 @@
|
||||
! include/41/omp_lib.f.var
|
||||
! include/45/omp_lib.f.var
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -31,7 +31,7 @@
|
||||
integer, parameter :: kmp_size_t_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_cancel_kind = omp_integer_kind
|
||||
integer, parameter :: kmp_lock_hint_kind = omp_integer_kind
|
||||
integer, parameter :: omp_lock_hint_kind = omp_integer_kind
|
||||
|
||||
end module omp_lib_kinds
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
|
||||
use omp_lib_kinds
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
character(*), parameter :: kmp_build_date = '$KMP_BUILD_DATE'
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
@@ -61,12 +61,14 @@
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
|
||||
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_none = 0
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_uncontended = 1
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_contended = 2
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_nonspeculative = 3
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_speculative = 4
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 5
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
|
||||
|
||||
interface
|
||||
|
||||
@@ -178,6 +180,38 @@
|
||||
integer (kind=omp_proc_bind_kind) omp_get_proc_bind
|
||||
end function omp_get_proc_bind
|
||||
|
||||
function omp_get_num_places()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_places
|
||||
end function omp_get_num_places
|
||||
|
||||
function omp_get_place_num_procs(place_num)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) place_num
|
||||
integer (kind=omp_integer_kind) omp_get_place_num_procs
|
||||
end function omp_get_place_num_procs
|
||||
|
||||
subroutine omp_get_place_proc_ids(place_num, ids)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) place_num
|
||||
integer (kind=kmp_pointer_kind) ids
|
||||
end subroutine omp_get_place_proc_ids
|
||||
|
||||
function omp_get_place_num()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_place_num
|
||||
end function omp_get_place_num
|
||||
|
||||
function omp_get_partition_num_places()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_partition_num_places
|
||||
end function omp_get_partition_num_places
|
||||
|
||||
subroutine omp_get_partition_place_nums(place_nums)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) place_nums
|
||||
end subroutine omp_get_partition_place_nums
|
||||
|
||||
function omp_get_wtime()
|
||||
double precision omp_get_wtime
|
||||
end function omp_get_wtime
|
||||
@@ -303,6 +337,11 @@
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end function omp_test_nest_lock
|
||||
|
||||
function omp_get_max_task_priority()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_max_task_priority
|
||||
end function omp_get_max_task_priority
|
||||
|
||||
! ***
|
||||
! *** kmp_* entry points
|
||||
! ***
|
||||
@@ -414,6 +453,13 @@
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
integer (kind=kmp_size_t_kind) alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
@@ -445,17 +491,17 @@
|
||||
logical (kind=omp_logical_kind) kmp_get_cancellation_status
|
||||
end function kmp_get_cancellation_status
|
||||
|
||||
subroutine kmp_init_lock_hinted(lockvar, lockhint)
|
||||
subroutine kmp_init_lock_with_hint(lockvar, lockhint)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind) lockhint
|
||||
end subroutine kmp_init_lock_hinted
|
||||
integer (kind=omp_lock_hint_kind) lockhint
|
||||
end subroutine kmp_init_lock_with_hint
|
||||
|
||||
subroutine kmp_init_nest_lock_hinted(lockvar, lockhint)
|
||||
subroutine kmp_init_nest_lock_with_hint(lockvar, lockhint)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind) lockhint
|
||||
end subroutine kmp_init_nest_lock_hinted
|
||||
integer (kind=omp_lock_hint_kind) lockhint
|
||||
end subroutine kmp_init_nest_lock_with_hint
|
||||
|
||||
end interface
|
||||
|
||||
@@ -501,13 +547,16 @@
|
||||
!dec$ attributes alias:'OMP_GET_TEAM_NUM' :: omp_get_team_num
|
||||
!dec$ attributes alias:'OMP_GET_CANCELLATION' :: omp_get_cancellation
|
||||
!dec$ attributes alias:'OMP_IS_INITIAL_DEVICE' :: omp_is_initial_device
|
||||
!dec$ attributes alias:'OMP_GET_MAX_TASK_PRIORITY' :: omp_get_max_task_priority
|
||||
|
||||
!dec$ attributes alias:'omp_init_lock' :: omp_init_lock
|
||||
!dec$ attributes alias:'omp_init_lock_with_hint' :: omp_init_lock_with_hint
|
||||
!dec$ attributes alias:'omp_destroy_lock' :: omp_destroy_lock
|
||||
!dec$ attributes alias:'omp_set_lock' :: omp_set_lock
|
||||
!dec$ attributes alias:'omp_unset_lock' :: omp_unset_lock
|
||||
!dec$ attributes alias:'omp_test_lock' :: omp_test_lock
|
||||
!dec$ attributes alias:'omp_init_nest_lock' :: omp_init_nest_lock
|
||||
!dec$ attributes alias:'omp_init_nest_lock_with_hint' :: omp_init_nest_lock_with_hint
|
||||
!dec$ attributes alias:'omp_destroy_nest_lock' :: omp_destroy_nest_lock
|
||||
!dec$ attributes alias:'omp_set_nest_lock' :: omp_set_nest_lock
|
||||
!dec$ attributes alias:'omp_unset_nest_lock' :: omp_unset_nest_lock
|
||||
@@ -533,6 +582,7 @@
|
||||
!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'KMP_FREE'::kmp_free
|
||||
@@ -542,9 +592,6 @@
|
||||
|
||||
!dec$ attributes alias:'KMP_GET_CANCELLATION_STATUS' :: kmp_get_cancellation_status
|
||||
|
||||
!dec$ attributes alias:'KMP_INIT_LOCK_HINTED'::kmp_init_lock_hinted
|
||||
!dec$ attributes alias:'KMP_INIT_NEST_LOCK_HINTED'::kmp_init_nest_lock_hinted
|
||||
|
||||
!dec$ else
|
||||
|
||||
!***
|
||||
@@ -580,13 +627,16 @@
|
||||
!dec$ attributes alias:'_OMP_GET_TEAM_NUM' :: omp_get_team_num
|
||||
!dec$ attributes alias:'_OMP_GET_CANCELLATION' :: omp_get_cancellation
|
||||
!dec$ attributes alias:'_OMP_IS_INITIAL_DEVICE' :: omp_is_initial_device
|
||||
!dec$ attributes alias:'_OMP_GET_MAX_TASK_PRIORTY' :: omp_get_max_task_priority
|
||||
|
||||
!dec$ attributes alias:'_omp_init_lock' :: omp_init_lock
|
||||
!dec$ attributes alias:'_omp_init_lock_with_hint' :: omp_init_lock_with_hint
|
||||
!dec$ attributes alias:'_omp_destroy_lock' :: omp_destroy_lock
|
||||
!dec$ attributes alias:'_omp_set_lock' :: omp_set_lock
|
||||
!dec$ attributes alias:'_omp_unset_lock' :: omp_unset_lock
|
||||
!dec$ attributes alias:'_omp_test_lock' :: omp_test_lock
|
||||
!dec$ attributes alias:'_omp_init_nest_lock' :: omp_init_nest_lock
|
||||
!dec$ attributes alias:'_omp_init_nest_lock_with_hint' :: omp_init_nest_lock_with_hint
|
||||
!dec$ attributes alias:'_omp_destroy_nest_lock' :: omp_destroy_nest_lock
|
||||
!dec$ attributes alias:'_omp_set_nest_lock' :: omp_set_nest_lock
|
||||
!dec$ attributes alias:'_omp_unset_nest_lock' :: omp_unset_nest_lock
|
||||
@@ -612,6 +662,7 @@
|
||||
!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'_KMP_FREE'::kmp_free
|
||||
@@ -621,9 +672,6 @@
|
||||
|
||||
!dec$ attributes alias:'_KMP_GET_CANCELLATION_STATUS' :: kmp_get_cancellation_status
|
||||
|
||||
!dec$ attributes alias:'_KMP_INIT_LOCK_HINTED'::kmp_init_lock_hinted
|
||||
!dec$ attributes alias:'_KMP_INIT_NEST_LOCK_HINTED'::kmp_init_nest_lock_hinted
|
||||
|
||||
!dec$ endif
|
||||
!dec$ endif
|
||||
|
||||
@@ -662,13 +710,16 @@
|
||||
!dec$ attributes alias:'omp_get_team_num_'::omp_get_team_num
|
||||
!dec$ attributes alias:'omp_get_cancellation_'::omp_get_cancellation
|
||||
!dec$ attributes alias:'omp_is_initial_device_'::omp_is_initial_device
|
||||
!dec$ attributes alias:'omp_get_max_task_priority_'::omp_get_max_task_priority
|
||||
|
||||
!dec$ attributes alias:'omp_init_lock_'::omp_init_lock
|
||||
!dec$ attributes alias:'omp_init_lock_with_hint_'::omp_init_lock_with_hint
|
||||
!dec$ attributes alias:'omp_destroy_lock_'::omp_destroy_lock
|
||||
!dec$ attributes alias:'omp_set_lock_'::omp_set_lock
|
||||
!dec$ attributes alias:'omp_unset_lock_'::omp_unset_lock
|
||||
!dec$ attributes alias:'omp_test_lock_'::omp_test_lock
|
||||
!dec$ attributes alias:'omp_init_nest_lock_'::omp_init_nest_lock
|
||||
!dec$ attributes alias:'omp_init_nest_lock_with_hint_'::omp_init_nest_lock_with_hint
|
||||
!dec$ attributes alias:'omp_destroy_nest_lock_'::omp_destroy_nest_lock
|
||||
!dec$ attributes alias:'omp_set_nest_lock_'::omp_set_nest_lock
|
||||
!dec$ attributes alias:'omp_unset_nest_lock_'::omp_unset_nest_lock
|
||||
@@ -694,6 +745,7 @@
|
||||
!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'kmp_free_'::kmp_free
|
||||
@@ -702,9 +754,6 @@
|
||||
!dec$ attributes alias:'kmp_set_warnings_off_'::kmp_set_warnings_off
|
||||
!dec$ attributes alias:'kmp_get_cancellation_status_'::kmp_get_cancellation_status
|
||||
|
||||
!dec$ attributes alias:'kmp_init_lock_hinted_'::kmp_init_lock_hinted
|
||||
!dec$ attributes alias:'kmp_init_nest_lock_hinted_'::kmp_init_nest_lock_hinted
|
||||
|
||||
!dec$ endif
|
||||
|
||||
!dec$ if defined(__APPLE__)
|
||||
@@ -740,13 +789,16 @@
|
||||
!dec$ attributes alias:'_omp_get_team_num_'::omp_get_team_num
|
||||
!dec$ attributes alias:'_omp_get_cancellation_'::omp_get_cancellation
|
||||
!dec$ attributes alias:'_omp_is_initial_device_'::omp_is_initial_device
|
||||
!dec$ attributes alias:'_omp_get_max_task_priorty_'::omp_get_max_task_priority
|
||||
|
||||
!dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
|
||||
!dec$ attributes alias:'_omp_init_lock_with_hint_'::omp_init_lock_with_hint
|
||||
!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
|
||||
!dec$ attributes alias:'_omp_set_lock_'::omp_set_lock
|
||||
!dec$ attributes alias:'_omp_unset_lock_'::omp_unset_lock
|
||||
!dec$ attributes alias:'_omp_test_lock_'::omp_test_lock
|
||||
!dec$ attributes alias:'_omp_init_nest_lock_'::omp_init_nest_lock
|
||||
!dec$ attributes alias:'_omp_init_nest_lock_with_hint_'::omp_init_nest_lock_with_hint
|
||||
!dec$ attributes alias:'_omp_destroy_nest_lock_'::omp_destroy_nest_lock
|
||||
!dec$ attributes alias:'_omp_set_nest_lock_'::omp_set_nest_lock
|
||||
!dec$ attributes alias:'_omp_unset_nest_lock_'::omp_unset_nest_lock
|
||||
@@ -772,6 +824,7 @@
|
||||
!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
|
||||
!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
|
||||
!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
|
||||
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'_kmp_free_'::kmp_free
|
||||
@@ -781,9 +834,6 @@
|
||||
|
||||
!dec$ attributes alias:'_kmp_get_cancellation_status_'::kmp_get_cancellation_status
|
||||
|
||||
!dec$ attributes alias:'_kmp_init_lock_hinted_'::kmp_init_lock_hinted
|
||||
!dec$ attributes alias:'_kmp_init_nest_lock_hinted_'::kmp_init_nest_lock_hinted
|
||||
|
||||
!dec$ endif
|
||||
|
||||
end module omp_lib
|
||||
@@ -1,4 +1,4 @@
|
||||
! include/41/omp_lib.f90.var
|
||||
! include/45/omp_lib.f90.var
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -27,7 +27,7 @@
|
||||
integer, parameter :: kmp_size_t_kind = c_size_t
|
||||
integer, parameter :: kmp_affinity_mask_kind = c_intptr_t
|
||||
integer, parameter :: kmp_cancel_kind = omp_integer_kind
|
||||
integer, parameter :: kmp_lock_hint_kind = omp_integer_kind
|
||||
integer, parameter :: omp_lock_hint_kind = omp_integer_kind
|
||||
|
||||
end module omp_lib_kinds
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
|
||||
use omp_lib_kinds
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
@@ -59,12 +59,14 @@
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
|
||||
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_none = 0
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_uncontended = 1
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_contended = 2
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_nonspeculative = 3
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_speculative = 4
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 5
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
|
||||
|
||||
interface
|
||||
|
||||
@@ -72,19 +74,19 @@
|
||||
! *** omp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine omp_set_num_threads(nthreads) bind(c)
|
||||
subroutine omp_set_num_threads(num_threads) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: nthreads
|
||||
integer (kind=omp_integer_kind), value :: num_threads
|
||||
end subroutine omp_set_num_threads
|
||||
|
||||
subroutine omp_set_dynamic(enable) bind(c)
|
||||
subroutine omp_set_dynamic(dynamic_threads) bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
logical (kind=omp_logical_kind), value :: dynamic_threads
|
||||
end subroutine omp_set_dynamic
|
||||
|
||||
subroutine omp_set_nested(enable) bind(c)
|
||||
subroutine omp_set_nested(nested) bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
logical (kind=omp_logical_kind), value :: nested
|
||||
end subroutine omp_set_nested
|
||||
|
||||
function omp_get_num_threads() bind(c)
|
||||
@@ -164,16 +166,16 @@
|
||||
integer (kind=omp_integer_kind), value :: level
|
||||
end function omp_get_team_size
|
||||
|
||||
subroutine omp_set_schedule(kind, modifier) bind(c)
|
||||
subroutine omp_set_schedule(kind, chunk_size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_sched_kind), value :: kind
|
||||
integer (kind=omp_integer_kind), value :: modifier
|
||||
integer (kind=omp_integer_kind), value :: chunk_size
|
||||
end subroutine omp_set_schedule
|
||||
|
||||
subroutine omp_get_schedule(kind, modifier) bind(c)
|
||||
subroutine omp_get_schedule(kind, chunk_size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_sched_kind) kind
|
||||
integer (kind=omp_integer_kind) modifier
|
||||
integer (kind=omp_integer_kind) chunk_size
|
||||
end subroutine omp_get_schedule
|
||||
|
||||
function omp_get_proc_bind() bind(c)
|
||||
@@ -181,6 +183,38 @@
|
||||
integer (kind=omp_proc_bind_kind) omp_get_proc_bind
|
||||
end function omp_get_proc_bind
|
||||
|
||||
function omp_get_num_places() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_places
|
||||
end function omp_get_num_places
|
||||
|
||||
function omp_get_place_num_procs(place_num) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: place_num
|
||||
integer (kind=omp_integer_kind) omp_get_place_num_procs
|
||||
end function omp_get_place_num_procs
|
||||
|
||||
subroutine omp_get_place_proc_ids(place_num, ids) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: place_num
|
||||
integer (kind=kmp_pointer_kind) ids(*)
|
||||
end subroutine omp_get_place_proc_ids
|
||||
|
||||
function omp_get_place_num() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_place_num
|
||||
end function omp_get_place_num
|
||||
|
||||
function omp_get_partition_num_places() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_partition_num_places
|
||||
end function omp_get_partition_num_places
|
||||
|
||||
subroutine omp_get_partition_place_nums(place_nums) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) place_nums(*)
|
||||
end subroutine omp_get_partition_place_nums
|
||||
|
||||
function omp_get_wtime() bind(c)
|
||||
use omp_lib_kinds
|
||||
real (kind=kmp_double_kind) omp_get_wtime
|
||||
@@ -196,9 +230,9 @@
|
||||
integer (kind=omp_integer_kind) omp_get_default_device
|
||||
end function omp_get_default_device
|
||||
|
||||
subroutine omp_set_default_device(dflt_device) bind(c)
|
||||
subroutine omp_set_default_device(device_num) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: dflt_device
|
||||
integer (kind=omp_integer_kind), value :: device_num
|
||||
end subroutine omp_set_default_device
|
||||
|
||||
function omp_get_num_devices() bind(c)
|
||||
@@ -226,88 +260,98 @@
|
||||
logical (kind=omp_logical_kind) omp_is_initial_device
|
||||
end function omp_is_initial_device
|
||||
|
||||
subroutine omp_init_lock(lockvar) bind(c)
|
||||
function omp_get_initial_device() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_initial_device
|
||||
end function omp_get_initial_device
|
||||
|
||||
subroutine omp_init_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_init_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end subroutine omp_init_lock
|
||||
|
||||
subroutine omp_destroy_lock(lockvar) bind(c)
|
||||
subroutine omp_destroy_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_destroy_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end subroutine omp_destroy_lock
|
||||
|
||||
subroutine omp_set_lock(lockvar) bind(c)
|
||||
subroutine omp_set_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_set_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end subroutine omp_set_lock
|
||||
|
||||
subroutine omp_unset_lock(lockvar) bind(c)
|
||||
subroutine omp_unset_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_unset_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end subroutine omp_unset_lock
|
||||
|
||||
function omp_test_lock(lockvar) bind(c)
|
||||
function omp_test_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_test_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_test_lock
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end function omp_test_lock
|
||||
|
||||
subroutine omp_init_nest_lock(lockvar) bind(c)
|
||||
subroutine omp_init_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_init_nest_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end subroutine omp_init_nest_lock
|
||||
|
||||
subroutine omp_destroy_nest_lock(lockvar) bind(c)
|
||||
subroutine omp_destroy_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end subroutine omp_destroy_nest_lock
|
||||
|
||||
subroutine omp_set_nest_lock(lockvar) bind(c)
|
||||
subroutine omp_set_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_set_nest_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end subroutine omp_set_nest_lock
|
||||
|
||||
subroutine omp_unset_nest_lock(lockvar) bind(c)
|
||||
subroutine omp_unset_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end subroutine omp_unset_nest_lock
|
||||
|
||||
function omp_test_nest_lock(lockvar) bind(c)
|
||||
function omp_test_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_test_nest_lock
|
||||
!DIR$ ENDIF
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_test_nest_lock
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end function omp_test_nest_lock
|
||||
|
||||
function omp_get_max_task_priority() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_max_task_priority
|
||||
end function omp_get_max_task_priority
|
||||
|
||||
! ***
|
||||
! *** kmp_* entry points
|
||||
! ***
|
||||
@@ -366,6 +410,11 @@
|
||||
integer (kind=omp_integer_kind) kmp_get_library
|
||||
end function kmp_get_library
|
||||
|
||||
subroutine kmp_set_disp_num_buffers(num) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: num
|
||||
end subroutine kmp_set_disp_num_buffers
|
||||
|
||||
function kmp_set_affinity(mask) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_set_affinity
|
||||
@@ -420,6 +469,13 @@
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
integer (kind=kmp_size_t_kind), value :: alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
@@ -451,17 +507,17 @@
|
||||
logical (kind=omp_logical_kind) kmp_get_cancellation_status
|
||||
end function kmp_get_cancellation_status
|
||||
|
||||
subroutine kmp_init_lock_hinted(lockvar, lockhint) bind(c)
|
||||
subroutine omp_init_lock_with_hint(svar, hint) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind), value :: lockhint
|
||||
end subroutine kmp_init_lock_hinted
|
||||
integer (kind=omp_lock_kind) svar
|
||||
integer (kind=omp_lock_hint_kind), value :: hint
|
||||
end subroutine omp_init_lock_with_hint
|
||||
|
||||
subroutine kmp_init_nest_lock_hinted(lockvar, lockhint) bind(c)
|
||||
subroutine omp_init_nest_lock_with_hint(nvar, hint) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind), value :: lockhint
|
||||
end subroutine kmp_init_nest_lock_hinted
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
integer (kind=omp_lock_hint_kind), value :: hint
|
||||
end subroutine omp_init_nest_lock_with_hint
|
||||
|
||||
end interface
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
! include/41/omp_lib.h.var
|
||||
! include/45/omp_lib.h.var
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -28,14 +28,14 @@
|
||||
integer, parameter :: kmp_pointer_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_size_t_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_lock_hint_kind = omp_integer_kind
|
||||
integer, parameter :: omp_lock_hint_kind = omp_integer_kind
|
||||
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
|
||||
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
@@ -48,12 +48,14 @@
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_close = 3
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_spread = 4
|
||||
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_none = 0
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_uncontended = 1
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_contended = 2
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_nonspeculative = 3
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_speculative = 4
|
||||
integer (kind=kmp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 5
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
|
||||
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
|
||||
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
|
||||
|
||||
interface
|
||||
|
||||
@@ -61,19 +63,19 @@
|
||||
! *** omp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine omp_set_num_threads(nthreads) bind(c)
|
||||
subroutine omp_set_num_threads(num_threads) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: nthreads
|
||||
integer (kind=omp_integer_kind), value :: num_threads
|
||||
end subroutine omp_set_num_threads
|
||||
|
||||
subroutine omp_set_dynamic(enable) bind(c)
|
||||
subroutine omp_set_dynamic(dynamic_threads) bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
logical (kind=omp_logical_kind), value :: dynamic_threads
|
||||
end subroutine omp_set_dynamic
|
||||
|
||||
subroutine omp_set_nested(enable) bind(c)
|
||||
subroutine omp_set_nested(nested) bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
logical (kind=omp_logical_kind), value :: nested
|
||||
end subroutine omp_set_nested
|
||||
|
||||
function omp_get_num_threads() bind(c)
|
||||
@@ -153,16 +155,16 @@
|
||||
integer (kind=omp_integer_kind), value :: level
|
||||
end function omp_get_team_size
|
||||
|
||||
subroutine omp_set_schedule(kind, modifier) bind(c)
|
||||
subroutine omp_set_schedule(kind, chunk_size) bind(c)
|
||||
import
|
||||
integer (kind=omp_sched_kind), value :: kind
|
||||
integer (kind=omp_integer_kind), value :: modifier
|
||||
integer (kind=omp_integer_kind), value :: chunk_size
|
||||
end subroutine omp_set_schedule
|
||||
|
||||
subroutine omp_get_schedule(kind, modifier) bind(c)
|
||||
subroutine omp_get_schedule(kind, chunk_size) bind(c)
|
||||
import
|
||||
integer (kind=omp_sched_kind) kind
|
||||
integer (kind=omp_integer_kind) modifier
|
||||
integer (kind=omp_integer_kind) chunk_size
|
||||
end subroutine omp_get_schedule
|
||||
|
||||
function omp_get_proc_bind() bind(c)
|
||||
@@ -170,6 +172,38 @@
|
||||
integer (kind=omp_proc_bind_kind) omp_get_proc_bind
|
||||
end function omp_get_proc_bind
|
||||
|
||||
function omp_get_num_places() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_num_places
|
||||
end function omp_get_num_places
|
||||
|
||||
function omp_get_place_num_procs(place_num) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: place_num
|
||||
integer (kind=omp_integer_kind) omp_get_place_num_procs
|
||||
end function omp_get_place_num_procs
|
||||
|
||||
subroutine omp_get_place_proc_ids(place_num, ids) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: place_num
|
||||
integer (kind=kmp_pointer_kind) ids(*)
|
||||
end subroutine omp_get_place_proc_ids
|
||||
|
||||
function omp_get_place_num() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_place_num
|
||||
end function omp_get_place_num
|
||||
|
||||
function omp_get_partition_num_places() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_partition_num_places
|
||||
end function omp_get_partition_num_places
|
||||
|
||||
subroutine omp_get_partition_place_nums(place_nums) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) place_nums(*)
|
||||
end subroutine omp_get_partition_place_nums
|
||||
|
||||
function omp_get_wtime() bind(c)
|
||||
double precision omp_get_wtime
|
||||
end function omp_get_wtime
|
||||
@@ -183,9 +217,9 @@
|
||||
integer (kind=omp_integer_kind) omp_get_default_device
|
||||
end function omp_get_default_device
|
||||
|
||||
subroutine omp_set_default_device(dflt_device) bind(c)
|
||||
subroutine omp_set_default_device(device_num) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: dflt_device
|
||||
integer (kind=omp_integer_kind), value :: device_num
|
||||
end subroutine omp_set_default_device
|
||||
|
||||
function omp_get_num_devices() bind(c)
|
||||
@@ -208,88 +242,98 @@
|
||||
logical (kind=omp_logical_kind) omp_is_initial_device
|
||||
end function omp_is_initial_device
|
||||
|
||||
subroutine omp_init_lock(lockvar) bind(c)
|
||||
function omp_get_initial_device() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_initial_device
|
||||
end function omp_get_initial_device
|
||||
|
||||
subroutine omp_init_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_init_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end subroutine omp_init_lock
|
||||
|
||||
subroutine omp_destroy_lock(lockvar) bind(c)
|
||||
subroutine omp_destroy_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_destroy_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end subroutine omp_destroy_lock
|
||||
|
||||
subroutine omp_set_lock(lockvar) bind(c)
|
||||
subroutine omp_set_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_set_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end subroutine omp_set_lock
|
||||
|
||||
subroutine omp_unset_lock(lockvar) bind(c)
|
||||
subroutine omp_unset_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_unset_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end subroutine omp_unset_lock
|
||||
|
||||
function omp_test_lock(lockvar) bind(c)
|
||||
function omp_test_lock(svar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_test_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_test_lock
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=omp_lock_kind) svar
|
||||
end function omp_test_lock
|
||||
|
||||
subroutine omp_init_nest_lock(lockvar) bind(c)
|
||||
subroutine omp_init_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_init_nest_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end subroutine omp_init_nest_lock
|
||||
|
||||
subroutine omp_destroy_nest_lock(lockvar) bind(c)
|
||||
subroutine omp_destroy_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end subroutine omp_destroy_nest_lock
|
||||
|
||||
subroutine omp_set_nest_lock(lockvar) bind(c)
|
||||
subroutine omp_set_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_set_nest_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end subroutine omp_set_nest_lock
|
||||
|
||||
subroutine omp_unset_nest_lock(lockvar) bind(c)
|
||||
subroutine omp_unset_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end subroutine omp_unset_nest_lock
|
||||
|
||||
function omp_test_nest_lock(lockvar) bind(c)
|
||||
function omp_test_nest_lock(nvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_test_nest_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_test_nest_lock
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
end function omp_test_nest_lock
|
||||
|
||||
function omp_get_max_task_priority() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_max_task_priority
|
||||
end function omp_get_max_task_priority
|
||||
|
||||
! ***
|
||||
! *** kmp_* entry points
|
||||
! ***
|
||||
@@ -347,6 +391,11 @@
|
||||
integer (kind=omp_integer_kind) kmp_get_library
|
||||
end function kmp_get_library
|
||||
|
||||
subroutine kmp_set_disp_num_buffers(num) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: num
|
||||
end subroutine kmp_set_disp_num_buffers
|
||||
|
||||
function kmp_set_affinity(mask) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_set_affinity
|
||||
@@ -401,6 +450,13 @@
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_aligned_malloc(size, alignment) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
integer (kind=kmp_size_t_kind), value :: alignment
|
||||
end function kmp_aligned_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
@@ -426,17 +482,17 @@
|
||||
subroutine kmp_set_warnings_off() bind(c)
|
||||
end subroutine kmp_set_warnings_off
|
||||
|
||||
subroutine kmp_init_lock_hinted(lockvar, lockhint) bind(c)
|
||||
subroutine omp_init_lock_with_hint(svar, hint) bind(c)
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind), value :: lockhint
|
||||
end subroutine kmp_init_lock_hinted
|
||||
integer (kind=omp_lock_kind) svar
|
||||
integer (kind=omp_lock_hint_kind), value :: hint
|
||||
end subroutine omp_init_lock_with_hint
|
||||
|
||||
subroutine kmp_init_nest_lock_hinted(lockvar, lockhint) bind(c)
|
||||
subroutine omp_init_nest_lock_with_hint(nvar, hint) bind(c)
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
integer (kind=kmp_lock_hint_kind), value :: lockhint
|
||||
end subroutine kmp_init_nest_lock_hinted
|
||||
integer (kind=omp_nest_lock_kind) nvar
|
||||
integer (kind=omp_lock_hint_kind), value :: hint
|
||||
end subroutine omp_init_nest_lock_with_hint
|
||||
|
||||
end interface
|
||||
|
||||
@@ -480,6 +536,7 @@
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_nest_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_unset_nest_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_test_nest_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_max_task_priority
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize_s
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_blocktime
|
||||
@@ -492,6 +549,7 @@
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_stacksize_s
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_blocktime
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_library
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_disp_num_buffers
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_affinity
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_max_proc
|
||||
@@ -501,13 +559,14 @@
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_unset_affinity_mask_proc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_mask_proc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_malloc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_aligned_malloc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_calloc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_realloc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_free
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_on
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_off
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_init_lock_hinted
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_init_nest_lock_hinted
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_lock_with_hint
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_nest_lock_with_hint
|
||||
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!$omp declare target(omp_set_num_threads )
|
||||
@@ -549,6 +608,7 @@
|
||||
!$omp declare target(omp_set_nest_lock )
|
||||
!$omp declare target(omp_unset_nest_lock )
|
||||
!$omp declare target(omp_test_nest_lock )
|
||||
!$omp declare target(omp_get_max_task_priority )
|
||||
!$omp declare target(kmp_set_stacksize )
|
||||
!$omp declare target(kmp_set_stacksize_s )
|
||||
!$omp declare target(kmp_set_blocktime )
|
||||
@@ -561,6 +621,7 @@
|
||||
!$omp declare target(kmp_get_stacksize_s )
|
||||
!$omp declare target(kmp_get_blocktime )
|
||||
!$omp declare target(kmp_get_library )
|
||||
!$omp declare target(kmp_set_disp_num_buffers )
|
||||
!$omp declare target(kmp_set_affinity )
|
||||
!$omp declare target(kmp_get_affinity )
|
||||
!$omp declare target(kmp_get_affinity_max_proc )
|
||||
@@ -570,13 +631,14 @@
|
||||
!$omp declare target(kmp_unset_affinity_mask_proc )
|
||||
!$omp declare target(kmp_get_affinity_mask_proc )
|
||||
!$omp declare target(kmp_malloc )
|
||||
!$omp declare target(kmp_aligned_malloc )
|
||||
!$omp declare target(kmp_calloc )
|
||||
!$omp declare target(kmp_realloc )
|
||||
!$omp declare target(kmp_free )
|
||||
!$omp declare target(kmp_set_warnings_on )
|
||||
!$omp declare target(kmp_set_warnings_off )
|
||||
!$omp declare target(kmp_init_lock_hinted )
|
||||
!$omp declare target(kmp_init_nest_lock_hinted )
|
||||
!$omp declare target(omp_init_lock_with_hint )
|
||||
!$omp declare target(omp_init_nest_lock_with_hint )
|
||||
!DIR$ ENDIF
|
||||
!DIR$ ENDIF
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* include/41/ompt.h.var
|
||||
* include/45/ompt.h.var
|
||||
*/
|
||||
|
||||
#ifndef __OMPT__
|
||||
@@ -81,7 +81,7 @@
|
||||
\
|
||||
/*--- Mandatory Events ---*/ \
|
||||
macro (ompt_event_parallel_begin, ompt_new_parallel_callback_t, 1) /* parallel begin */ \
|
||||
macro (ompt_event_parallel_end, ompt_parallel_callback_t, 2) /* parallel end */ \
|
||||
macro (ompt_event_parallel_end, ompt_end_parallel_callback_t, 2) /* parallel end */ \
|
||||
\
|
||||
macro (ompt_event_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
|
||||
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
|
||||
@@ -121,7 +121,7 @@
|
||||
macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \
|
||||
macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \
|
||||
\
|
||||
macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \
|
||||
macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \
|
||||
\
|
||||
macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \
|
||||
macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \
|
||||
@@ -171,7 +171,10 @@
|
||||
macro (ompt_event_destroy_lock, ompt_wait_callback_t, 59) /* lock destruction */ \
|
||||
macro (ompt_event_destroy_nest_lock, ompt_wait_callback_t, 60) /* nest lock destruction */ \
|
||||
\
|
||||
macro (ompt_event_flush, ompt_callback_t, 61) /* after executing flush */
|
||||
macro (ompt_event_flush, ompt_callback_t, 61) /* after executing flush */ \
|
||||
\
|
||||
macro (ompt_event_task_dependences, ompt_task_dependences_callback_t, 69) /* report task dependences */\
|
||||
macro (ompt_event_task_dependence_pair, ompt_task_pair_callback_t, 70) /* report task dependence pair */
|
||||
|
||||
|
||||
|
||||
@@ -206,6 +209,23 @@ typedef struct ompt_frame_s {
|
||||
} ompt_frame_t;
|
||||
|
||||
|
||||
/*---------------------
|
||||
* dependences types
|
||||
*---------------------*/
|
||||
|
||||
typedef enum ompt_task_dependence_flag_e {
|
||||
// a two bit field for the dependence type
|
||||
ompt_task_dependence_type_out = 1,
|
||||
ompt_task_dependence_type_in = 2,
|
||||
ompt_task_dependence_type_inout = 3,
|
||||
} ompt_task_dependence_flag_t;
|
||||
|
||||
typedef struct ompt_task_dependence_s {
|
||||
void *variable_addr;
|
||||
uint32_t dependence_flags;
|
||||
} ompt_task_dependence_t;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* enumerations for thread states and runtime events
|
||||
*****************************************************************************/
|
||||
@@ -267,6 +287,11 @@ typedef enum {
|
||||
ompt_thread_other = 3
|
||||
} ompt_thread_type_t;
|
||||
|
||||
typedef enum {
|
||||
ompt_invoker_program = 0, /* program invokes master task */
|
||||
ompt_invoker_runtime = 1 /* runtime invokes master task */
|
||||
} ompt_invoker_t;
|
||||
|
||||
typedef void (*ompt_thread_type_callback_t) (
|
||||
ompt_thread_type_t thread_type, /* type of thread */
|
||||
ompt_thread_id_t thread_id /* ID of thread */
|
||||
@@ -293,7 +318,14 @@ typedef void (*ompt_new_parallel_callback_t) (
|
||||
ompt_frame_t *parent_task_frame, /* frame data of parent task */
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
uint32_t requested_team_size, /* number of threads in team */
|
||||
void *parallel_function /* pointer to outlined function */
|
||||
void *parallel_function, /* pointer to outlined function */
|
||||
ompt_invoker_t invoker /* who invokes master task? */
|
||||
);
|
||||
|
||||
typedef void (*ompt_end_parallel_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t task_id, /* id of task */
|
||||
ompt_invoker_t invoker /* who invokes master task? */
|
||||
);
|
||||
|
||||
/* tasks */
|
||||
@@ -301,9 +333,9 @@ typedef void (*ompt_task_callback_t) (
|
||||
ompt_task_id_t task_id /* id of task */
|
||||
);
|
||||
|
||||
typedef void (*ompt_task_switch_callback_t) (
|
||||
ompt_task_id_t suspended_task_id, /* tool data for suspended task */
|
||||
ompt_task_id_t resumed_task_id /* tool data for resumed task */
|
||||
typedef void (*ompt_task_pair_callback_t) (
|
||||
ompt_task_id_t first_task_id,
|
||||
ompt_task_id_t second_task_id
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_task_callback_t) (
|
||||
@@ -313,6 +345,13 @@ typedef void (*ompt_new_task_callback_t) (
|
||||
void *task_function /* pointer to outlined function */
|
||||
);
|
||||
|
||||
/* task dependences */
|
||||
typedef void (*ompt_task_dependences_callback_t) (
|
||||
ompt_task_id_t task_id, /* ID of task with dependences */
|
||||
const ompt_task_dependence_t *deps,/* vector of task dependences */
|
||||
int ndeps /* number of dependences */
|
||||
);
|
||||
|
||||
/* program */
|
||||
typedef void (*ompt_control_callback_t) (
|
||||
uint64_t command, /* command of control call */
|
||||
@@ -406,12 +445,15 @@ OMPT_API_FUNCTION(void, ompt_mutex_wait, (
|
||||
* INITIALIZATION FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
int ompt_initialize(
|
||||
OMPT_API_FUNCTION(void, ompt_initialize, (
|
||||
ompt_function_lookup_t ompt_fn_lookup,
|
||||
const char *runtime_version,
|
||||
unsigned int ompt_version
|
||||
);
|
||||
));
|
||||
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
ompt_initialize_t ompt_tool(void);
|
||||
|
||||
typedef enum opt_init_mode_e {
|
||||
ompt_init_mode_never = 0,
|
||||
@@ -446,14 +488,15 @@ OMPT_API_FUNCTION(int, ompt_get_callback, (
|
||||
***************************************************************************/
|
||||
|
||||
/* control */
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
// FIXME: remove workaround for clang
|
||||
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp declare target
|
||||
#endif
|
||||
void ompt_control(
|
||||
uint64_t command,
|
||||
uint64_t modifier
|
||||
);
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp end declare target
|
||||
#endif
|
||||
|
||||
+337
-129
@@ -17,6 +17,8 @@
|
||||
#ifndef KMP_H
|
||||
#define KMP_H
|
||||
|
||||
#include "kmp_config.h"
|
||||
|
||||
/* #define BUILD_PARALLEL_ORDERED 1 */
|
||||
|
||||
/* This fix replaces gettimeofday with clock_gettime for better scalability on
|
||||
@@ -33,10 +35,6 @@
|
||||
#define TASK_CURRENT_NOT_QUEUED 0
|
||||
#define TASK_CURRENT_QUEUED 1
|
||||
|
||||
#define TASK_DEQUE_BITS 8 // Used solely to define TASK_DEQUE_SIZE and TASK_DEQUE_MASK.
|
||||
#define TASK_DEQUE_SIZE ( 1 << TASK_DEQUE_BITS )
|
||||
#define TASK_DEQUE_MASK ( TASK_DEQUE_SIZE - 1 )
|
||||
|
||||
#ifdef BUILD_TIED_TASK_STACK
|
||||
#define TASK_STACK_EMPTY 0 // entries when the stack is empty
|
||||
|
||||
@@ -75,10 +73,16 @@
|
||||
|
||||
#include "kmp_os.h"
|
||||
|
||||
#include "kmp_safe_c_api.h"
|
||||
|
||||
#if KMP_STATS_ENABLED
|
||||
class kmp_stats_list;
|
||||
#endif
|
||||
|
||||
#if KMP_USE_HWLOC && KMP_AFFINITY_SUPPORTED
|
||||
# include "hwloc.h"
|
||||
#endif
|
||||
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
@@ -91,15 +95,7 @@ class kmp_stats_list;
|
||||
#endif
|
||||
#include "kmp_i18n.h"
|
||||
|
||||
#define KMP_HANDLE_SIGNALS (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN)
|
||||
|
||||
#ifdef KMP_SETVERSION
|
||||
/* from factory/Include, to get VERSION_STRING embedded for 'what' */
|
||||
#include "kaiconfig.h"
|
||||
#include "eye.h"
|
||||
#include "own.h"
|
||||
#include "setversion.h"
|
||||
#endif
|
||||
#define KMP_HANDLE_SIGNALS (KMP_OS_UNIX || KMP_OS_WINDOWS)
|
||||
|
||||
#include "kmp_wrapper_malloc.h"
|
||||
#if KMP_OS_UNIX
|
||||
@@ -222,7 +218,6 @@ typedef union kmp_team kmp_team_p;
|
||||
typedef union kmp_info kmp_info_p;
|
||||
typedef union kmp_root kmp_root_p;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -316,8 +311,12 @@ enum sched_type {
|
||||
|
||||
kmp_sch_static_steal = 44, /**< accessible only through KMP_SCHEDULE environment variable */
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
kmp_sch_static_balanced_chunked = 45, /**< static with chunk adjustment (e.g., simd) */
|
||||
#endif
|
||||
|
||||
/* accessible only through KMP_SCHEDULE environment variable */
|
||||
kmp_sch_upper = 45, /**< upper bound for unordered values */
|
||||
kmp_sch_upper = 46, /**< upper bound for unordered values */
|
||||
|
||||
kmp_ord_lower = 64, /**< lower bound for ordered values, must be power of 2 */
|
||||
kmp_ord_static_chunked = 65,
|
||||
@@ -368,6 +367,39 @@ enum sched_type {
|
||||
kmp_nm_ord_trapezoidal = 199,
|
||||
kmp_nm_upper = 200, /**< upper bound for nomerge values */
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
/* Support for OpenMP 4.5 monotonic and nonmonotonic schedule modifiers.
|
||||
* Since we need to distinguish the three possible cases (no modifier, monotonic modifier,
|
||||
* nonmonotonic modifier), we need separate bits for each modifier.
|
||||
* The absence of monotonic does not imply nonmonotonic, especially since 4.5 says
|
||||
* that the behaviour of the "no modifier" case is implementation defined in 4.5,
|
||||
* but will become "nonmonotonic" in 5.0.
|
||||
*
|
||||
* Since we're passing a full 32 bit value, we can use a couple of high bits for these
|
||||
* flags; out of paranoia we avoid the sign bit.
|
||||
*
|
||||
* These modifiers can be or-ed into non-static schedules by the compiler to pass
|
||||
* the additional information.
|
||||
* They will be stripped early in the processing in __kmp_dispatch_init when setting up schedules, so
|
||||
* most of the code won't ever see schedules with these bits set.
|
||||
*/
|
||||
kmp_sch_modifier_monotonic = (1<<29), /**< Set if the monotonic schedule modifier was present */
|
||||
kmp_sch_modifier_nonmonotonic = (1<<30), /**< Set if the nonmonotonic schedule modifier was present */
|
||||
|
||||
# define SCHEDULE_WITHOUT_MODIFIERS(s) (enum sched_type)((s) & ~ (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic))
|
||||
# define SCHEDULE_HAS_MONOTONIC(s) (((s) & kmp_sch_modifier_monotonic) != 0)
|
||||
# define SCHEDULE_HAS_NONMONOTONIC(s) (((s) & kmp_sch_modifier_nonmonotonic) != 0)
|
||||
# define SCHEDULE_HAS_NO_MODIFIERS(s) (((s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)) == 0)
|
||||
#else
|
||||
/* By doing this we hope to avoid multiple tests on OMP_45_ENABLED. Compilers can now eliminate tests on compile time
|
||||
* constants and dead code that results from them, so we can leave code guarded by such an if in place.
|
||||
*/
|
||||
# define SCHEDULE_WITHOUT_MODIFIERS(s) (s)
|
||||
# define SCHEDULE_HAS_MONOTONIC(s) false
|
||||
# define SCHEDULE_HAS_NONMONOTONIC(s) false
|
||||
# define SCHEDULE_HAS_NO_MODIFIERS(s) true
|
||||
#endif
|
||||
|
||||
kmp_sch_default = kmp_sch_static /**< default scheduling algorithm */
|
||||
};
|
||||
|
||||
@@ -488,12 +520,113 @@ typedef int PACKED_REDUCTION_METHOD_T;
|
||||
*/
|
||||
#if KMP_AFFINITY_SUPPORTED
|
||||
|
||||
# if KMP_GROUP_AFFINITY
|
||||
// GROUP_AFFINITY is already defined for _MSC_VER>=1600 (VS2010 and later).
|
||||
# if _MSC_VER < 1600
|
||||
typedef struct GROUP_AFFINITY {
|
||||
KAFFINITY Mask;
|
||||
WORD Group;
|
||||
WORD Reserved[3];
|
||||
} GROUP_AFFINITY;
|
||||
# endif /* _MSC_VER < 1600 */
|
||||
extern int __kmp_num_proc_groups;
|
||||
typedef DWORD (*kmp_GetActiveProcessorCount_t)(WORD);
|
||||
extern kmp_GetActiveProcessorCount_t __kmp_GetActiveProcessorCount;
|
||||
|
||||
typedef WORD (*kmp_GetActiveProcessorGroupCount_t)(void);
|
||||
extern kmp_GetActiveProcessorGroupCount_t __kmp_GetActiveProcessorGroupCount;
|
||||
|
||||
typedef BOOL (*kmp_GetThreadGroupAffinity_t)(HANDLE, GROUP_AFFINITY *);
|
||||
extern kmp_GetThreadGroupAffinity_t __kmp_GetThreadGroupAffinity;
|
||||
|
||||
typedef BOOL (*kmp_SetThreadGroupAffinity_t)(HANDLE, const GROUP_AFFINITY *, GROUP_AFFINITY *);
|
||||
extern kmp_SetThreadGroupAffinity_t __kmp_SetThreadGroupAffinity;
|
||||
# endif /* KMP_GROUP_AFFINITY */
|
||||
|
||||
extern size_t __kmp_affin_mask_size;
|
||||
# define KMP_AFFINITY_CAPABLE() (__kmp_affin_mask_size > 0)
|
||||
# define KMP_AFFINITY_DISABLE() (__kmp_affin_mask_size = 0)
|
||||
# define KMP_AFFINITY_ENABLE(mask_size) (__kmp_affin_mask_size = mask_size)
|
||||
# define KMP_CPU_SETSIZE (__kmp_affin_mask_size * CHAR_BIT)
|
||||
# if !KMP_USE_HWLOC
|
||||
# define KMP_CPU_SETSIZE (__kmp_affin_mask_size * CHAR_BIT)
|
||||
# define KMP_CPU_SET_ITERATE(i,mask) \
|
||||
for(i = 0; (size_t)i < KMP_CPU_SETSIZE; ++i)
|
||||
# endif
|
||||
|
||||
#if KMP_USE_HWLOC
|
||||
|
||||
extern hwloc_topology_t __kmp_hwloc_topology;
|
||||
extern int __kmp_hwloc_error;
|
||||
typedef hwloc_cpuset_t kmp_affin_mask_t;
|
||||
# define KMP_CPU_SET(i,mask) hwloc_bitmap_set((hwloc_cpuset_t)mask, (unsigned)i)
|
||||
# define KMP_CPU_ISSET(i,mask) hwloc_bitmap_isset((hwloc_cpuset_t)mask, (unsigned)i)
|
||||
# define KMP_CPU_CLR(i,mask) hwloc_bitmap_clr((hwloc_cpuset_t)mask, (unsigned)i)
|
||||
# define KMP_CPU_ZERO(mask) hwloc_bitmap_zero((hwloc_cpuset_t)mask)
|
||||
# define KMP_CPU_COPY(dest, src) hwloc_bitmap_copy((hwloc_cpuset_t)dest, (hwloc_cpuset_t)src)
|
||||
# define KMP_CPU_AND(dest, src) hwloc_bitmap_and((hwloc_cpuset_t)dest, (hwloc_cpuset_t)dest, (hwloc_cpuset_t)src)
|
||||
# define KMP_CPU_COMPLEMENT(max_bit_number, mask) \
|
||||
{ \
|
||||
unsigned i; \
|
||||
for(i=0;i<(unsigned)max_bit_number+1;i++) { \
|
||||
if(hwloc_bitmap_isset((hwloc_cpuset_t)mask, i)) { \
|
||||
hwloc_bitmap_clr((hwloc_cpuset_t)mask, i); \
|
||||
} else { \
|
||||
hwloc_bitmap_set((hwloc_cpuset_t)mask, i); \
|
||||
} \
|
||||
} \
|
||||
hwloc_bitmap_and((hwloc_cpuset_t)mask, (hwloc_cpuset_t)mask, \
|
||||
(hwloc_cpuset_t)__kmp_affin_fullMask); \
|
||||
} \
|
||||
|
||||
# define KMP_CPU_UNION(dest, src) hwloc_bitmap_or((hwloc_cpuset_t)dest, (hwloc_cpuset_t)dest, (hwloc_cpuset_t)src)
|
||||
# define KMP_CPU_SET_ITERATE(i,mask) \
|
||||
for(i = hwloc_bitmap_first((hwloc_cpuset_t)mask); (int)i != -1; i = hwloc_bitmap_next((hwloc_cpuset_t)mask, i))
|
||||
|
||||
# define KMP_CPU_ALLOC(ptr) ptr = (kmp_affin_mask_t*)hwloc_bitmap_alloc()
|
||||
# define KMP_CPU_FREE(ptr) hwloc_bitmap_free((hwloc_bitmap_t)ptr);
|
||||
# define KMP_CPU_ALLOC_ON_STACK(ptr) KMP_CPU_ALLOC(ptr)
|
||||
# define KMP_CPU_FREE_FROM_STACK(ptr) KMP_CPU_FREE(ptr)
|
||||
# define KMP_CPU_INTERNAL_ALLOC(ptr) KMP_CPU_ALLOC(ptr)
|
||||
# define KMP_CPU_INTERNAL_FREE(ptr) KMP_CPU_FREE(ptr)
|
||||
|
||||
//
|
||||
// The following macro should be used to index an array of masks.
|
||||
// The array should be declared as "kmp_affinity_t *" and allocated with
|
||||
// size "__kmp_affinity_mask_size * len". The macro takes care of the fact
|
||||
// that on Windows* OS, sizeof(kmp_affin_t) is really the size of the mask, but
|
||||
// on Linux* OS, sizeof(kmp_affin_t) is 1.
|
||||
//
|
||||
# define KMP_CPU_INDEX(array,i) ((kmp_affin_mask_t*)(array[i]))
|
||||
# define KMP_CPU_ALLOC_ARRAY(arr, n) { \
|
||||
arr = (kmp_affin_mask_t *)__kmp_allocate(n*sizeof(kmp_affin_mask_t)); \
|
||||
unsigned i; \
|
||||
for(i=0;i<(unsigned)n;i++) { \
|
||||
arr[i] = hwloc_bitmap_alloc(); \
|
||||
} \
|
||||
}
|
||||
# define KMP_CPU_FREE_ARRAY(arr, n) { \
|
||||
unsigned i; \
|
||||
for(i=0;i<(unsigned)n;i++) { \
|
||||
hwloc_bitmap_free(arr[i]); \
|
||||
} \
|
||||
__kmp_free(arr); \
|
||||
}
|
||||
# define KMP_CPU_INTERNAL_ALLOC_ARRAY(arr, n) { \
|
||||
arr = (kmp_affin_mask_t *)KMP_INTERNAL_MALLOC(n*sizeof(kmp_affin_mask_t)); \
|
||||
unsigned i; \
|
||||
for(i=0;i<(unsigned)n;i++) { \
|
||||
arr[i] = hwloc_bitmap_alloc(); \
|
||||
} \
|
||||
}
|
||||
# define KMP_CPU_INTERNAL_FREE_ARRAY(arr, n) { \
|
||||
unsigned i; \
|
||||
for(i=0;i<(unsigned)n;i++) { \
|
||||
hwloc_bitmap_free(arr[i]); \
|
||||
} \
|
||||
KMP_INTERNAL_FREE(arr); \
|
||||
}
|
||||
|
||||
#else /* KMP_USE_HWLOC */
|
||||
# if KMP_OS_LINUX
|
||||
//
|
||||
// On Linux* OS, the mask is actually a vector of length __kmp_affin_mask_size
|
||||
@@ -532,13 +665,23 @@ typedef unsigned char kmp_affin_mask_t;
|
||||
} \
|
||||
}
|
||||
|
||||
# define KMP_CPU_COMPLEMENT(mask) \
|
||||
# define KMP_CPU_AND(dest, src) \
|
||||
{ \
|
||||
size_t __i; \
|
||||
for (__i = 0; __i < __kmp_affin_mask_size; __i++) { \
|
||||
((kmp_affin_mask_t *)(dest))[__i] \
|
||||
&= ((kmp_affin_mask_t *)(src))[__i]; \
|
||||
} \
|
||||
}
|
||||
|
||||
# define KMP_CPU_COMPLEMENT(max_bit_number, mask) \
|
||||
{ \
|
||||
size_t __i; \
|
||||
for (__i = 0; __i < __kmp_affin_mask_size; __i++) { \
|
||||
((kmp_affin_mask_t *)(mask))[__i] \
|
||||
= ~((kmp_affin_mask_t *)(mask))[__i]; \
|
||||
} \
|
||||
KMP_CPU_AND(mask, __kmp_affin_fullMask); \
|
||||
}
|
||||
|
||||
# define KMP_CPU_UNION(dest, src) \
|
||||
@@ -559,20 +702,8 @@ typedef unsigned char kmp_affin_mask_t;
|
||||
//
|
||||
|
||||
# if KMP_GROUP_AFFINITY
|
||||
|
||||
// GROUP_AFFINITY is already defined for _MSC_VER>=1600 (VS2010 and later).
|
||||
# if _MSC_VER < 1600
|
||||
typedef struct GROUP_AFFINITY {
|
||||
KAFFINITY Mask;
|
||||
WORD Group;
|
||||
WORD Reserved[3];
|
||||
} GROUP_AFFINITY;
|
||||
# endif
|
||||
|
||||
typedef DWORD_PTR kmp_affin_mask_t;
|
||||
|
||||
extern int __kmp_num_proc_groups;
|
||||
|
||||
# define _KMP_CPU_SET(i,mask) \
|
||||
(mask[i/(CHAR_BIT * sizeof(kmp_affin_mask_t))] |= \
|
||||
(((kmp_affin_mask_t)1) << (i % (CHAR_BIT * sizeof(kmp_affin_mask_t)))))
|
||||
@@ -611,13 +742,23 @@ extern int __kmp_num_proc_groups;
|
||||
} \
|
||||
}
|
||||
|
||||
# define KMP_CPU_COMPLEMENT(mask) \
|
||||
# define KMP_CPU_AND(dest, src) \
|
||||
{ \
|
||||
int __i; \
|
||||
for (__i = 0; __i < __kmp_num_proc_groups; __i++) { \
|
||||
((kmp_affin_mask_t *)(dest))[__i] \
|
||||
&= ((kmp_affin_mask_t *)(src))[__i]; \
|
||||
} \
|
||||
}
|
||||
|
||||
# define KMP_CPU_COMPLEMENT(max_bit_number, mask) \
|
||||
{ \
|
||||
int __i; \
|
||||
for (__i = 0; __i < __kmp_num_proc_groups; __i++) { \
|
||||
((kmp_affin_mask_t *)(mask))[__i] \
|
||||
= ~((kmp_affin_mask_t *)(mask))[__i]; \
|
||||
} \
|
||||
KMP_CPU_AND(mask, __kmp_affin_fullMask); \
|
||||
}
|
||||
|
||||
# define KMP_CPU_UNION(dest, src) \
|
||||
@@ -629,21 +770,8 @@ extern int __kmp_num_proc_groups;
|
||||
} \
|
||||
}
|
||||
|
||||
typedef DWORD (*kmp_GetActiveProcessorCount_t)(WORD);
|
||||
extern kmp_GetActiveProcessorCount_t __kmp_GetActiveProcessorCount;
|
||||
|
||||
typedef WORD (*kmp_GetActiveProcessorGroupCount_t)(void);
|
||||
extern kmp_GetActiveProcessorGroupCount_t __kmp_GetActiveProcessorGroupCount;
|
||||
|
||||
typedef BOOL (*kmp_GetThreadGroupAffinity_t)(HANDLE, GROUP_AFFINITY *);
|
||||
extern kmp_GetThreadGroupAffinity_t __kmp_GetThreadGroupAffinity;
|
||||
|
||||
typedef BOOL (*kmp_SetThreadGroupAffinity_t)(HANDLE, const GROUP_AFFINITY *, GROUP_AFFINITY *);
|
||||
extern kmp_SetThreadGroupAffinity_t __kmp_SetThreadGroupAffinity;
|
||||
|
||||
extern int __kmp_get_proc_group(kmp_affin_mask_t const *mask);
|
||||
|
||||
# else
|
||||
# else /* KMP_GROUP_AFFINITY */
|
||||
|
||||
typedef DWORD kmp_affin_mask_t; /* for compatibility with older winbase.h */
|
||||
|
||||
@@ -652,7 +780,8 @@ typedef DWORD kmp_affin_mask_t; /* for compatibility with older winbase.h */
|
||||
# define KMP_CPU_CLR(i,mask) (*(mask) &= ~(((kmp_affin_mask_t)1) << (i)))
|
||||
# define KMP_CPU_ZERO(mask) (*(mask) = 0)
|
||||
# define KMP_CPU_COPY(dest, src) (*(dest) = *(src))
|
||||
# define KMP_CPU_COMPLEMENT(mask) (*(mask) = ~*(mask))
|
||||
# define KMP_CPU_AND(dest, src) (*(dest) &= *(src))
|
||||
# define KMP_CPU_COMPLEMENT(max_bit_number, mask) (*(mask) = ~*(mask)); KMP_CPU_AND(mask, __kmp_affin_fullMask)
|
||||
# define KMP_CPU_UNION(dest, src) (*(dest) |= *(src))
|
||||
|
||||
# endif /* KMP_GROUP_AFFINITY */
|
||||
@@ -666,6 +795,10 @@ typedef DWORD kmp_affin_mask_t; /* for compatibility with older winbase.h */
|
||||
# define KMP_CPU_ALLOC(ptr) \
|
||||
(ptr = ((kmp_affin_mask_t *)__kmp_allocate(__kmp_affin_mask_size)))
|
||||
# define KMP_CPU_FREE(ptr) __kmp_free(ptr)
|
||||
# define KMP_CPU_ALLOC_ON_STACK(ptr) (ptr = ((kmp_affin_mask_t *)KMP_ALLOCA(__kmp_affin_mask_size)))
|
||||
# define KMP_CPU_FREE_FROM_STACK(ptr) /* Nothing */
|
||||
# define KMP_CPU_INTERNAL_ALLOC(ptr) (ptr = ((kmp_affin_mask_t *)KMP_INTERNAL_MALLOC(__kmp_affin_mask_size)))
|
||||
# define KMP_CPU_INTERNAL_FREE(ptr) KMP_INTERNAL_FREE(ptr)
|
||||
|
||||
//
|
||||
// The following macro should be used to index an array of masks.
|
||||
@@ -676,6 +809,17 @@ typedef DWORD kmp_affin_mask_t; /* for compatibility with older winbase.h */
|
||||
//
|
||||
# define KMP_CPU_INDEX(array,i) \
|
||||
((kmp_affin_mask_t *)(((char *)(array)) + (i) * __kmp_affin_mask_size))
|
||||
# define KMP_CPU_ALLOC_ARRAY(arr, n) arr = (kmp_affin_mask_t *)__kmp_allocate(n * __kmp_affin_mask_size)
|
||||
# define KMP_CPU_FREE_ARRAY(arr, n) __kmp_free(arr);
|
||||
# define KMP_CPU_INTERNAL_ALLOC_ARRAY(arr, n) arr = (kmp_affin_mask_t *)KMP_INTERNAL_MALLOC(n * __kmp_affin_mask_size)
|
||||
# define KMP_CPU_INTERNAL_FREE_ARRAY(arr, n) KMP_INTERNAL_FREE(arr);
|
||||
|
||||
#endif /* KMP_USE_HWLOC */
|
||||
|
||||
// prototype after typedef of kmp_affin_mask_t
|
||||
#if KMP_GROUP_AFFINITY
|
||||
extern int __kmp_get_proc_group(kmp_affin_mask_t const *mask);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Declare local char buffers with this size for printing debug and info
|
||||
@@ -722,6 +866,9 @@ enum affinity_top_method {
|
||||
affinity_top_method_group,
|
||||
#endif /* KMP_GROUP_AFFINITY */
|
||||
affinity_top_method_flat,
|
||||
#if KMP_USE_HWLOC
|
||||
affinity_top_method_hwloc,
|
||||
#endif
|
||||
affinity_top_method_default
|
||||
};
|
||||
|
||||
@@ -744,9 +891,7 @@ extern int __kmp_get_system_affinity(kmp_affin_mask_t *mask, int abort_on_error)
|
||||
extern int __kmp_set_system_affinity(kmp_affin_mask_t const *mask, int abort_on_error);
|
||||
extern void __kmp_affinity_bind_thread(int which);
|
||||
|
||||
# if KMP_OS_LINUX
|
||||
extern kmp_affin_mask_t *__kmp_affinity_get_fullMask();
|
||||
# endif /* KMP_OS_LINUX */
|
||||
extern kmp_affin_mask_t *__kmp_affin_fullMask;
|
||||
extern char const * __kmp_cpuinfo_file;
|
||||
|
||||
#endif /* KMP_AFFINITY_SUPPORTED */
|
||||
@@ -794,9 +939,11 @@ typedef enum kmp_cancel_kind_t {
|
||||
} kmp_cancel_kind_t;
|
||||
#endif // OMP_40_ENABLED
|
||||
|
||||
extern int __kmp_place_num_sockets;
|
||||
extern int __kmp_place_socket_offset;
|
||||
extern int __kmp_place_num_cores;
|
||||
extern int __kmp_place_num_threads_per_core;
|
||||
extern int __kmp_place_core_offset;
|
||||
extern int __kmp_place_num_threads_per_core;
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -849,10 +996,10 @@ extern int __kmp_place_core_offset;
|
||||
#define KMP_MIN_NTH 1
|
||||
|
||||
#ifndef KMP_MAX_NTH
|
||||
# ifdef PTHREAD_THREADS_MAX
|
||||
# if defined(PTHREAD_THREADS_MAX) && PTHREAD_THREADS_MAX < INT_MAX
|
||||
# define KMP_MAX_NTH PTHREAD_THREADS_MAX
|
||||
# else
|
||||
# define KMP_MAX_NTH (32 * 1024)
|
||||
# define KMP_MAX_NTH INT_MAX
|
||||
# endif
|
||||
#endif /* KMP_MAX_NTH */
|
||||
|
||||
@@ -929,8 +1076,7 @@ extern int __kmp_place_core_offset;
|
||||
#define KMP_MAX_NEXT_WAIT (INT_MAX/2)
|
||||
#define KMP_DEFAULT_NEXT_WAIT 1024U
|
||||
|
||||
// max possible dynamic loops in concurrent execution per team
|
||||
#define KMP_MAX_DISP_BUF 7
|
||||
#define KMP_DFLT_DISP_NUM_BUFF 7
|
||||
#define KMP_MAX_ORDERED 8
|
||||
|
||||
#define KMP_MAX_FIELDS 32
|
||||
@@ -939,6 +1085,8 @@ extern int __kmp_place_core_offset;
|
||||
|
||||
#define KMP_MAX_ACTIVE_LEVELS_LIMIT INT_MAX
|
||||
|
||||
#define KMP_MAX_TASK_PRIORITY_LIMIT INT_MAX
|
||||
|
||||
/* Minimum number of threads before switch to TLS gtid (experimentally determined) */
|
||||
/* josh TODO: what about OS X* tuning? */
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
@@ -985,6 +1133,10 @@ extern int __kmp_place_core_offset;
|
||||
/* TODO: tune for KMP_OS_FREEBSD */
|
||||
# define KMP_INIT_WAIT 1024U /* initial number of spin-tests */
|
||||
# define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */
|
||||
#elif KMP_OS_NETBSD
|
||||
/* TODO: tune for KMP_OS_NETBSD */
|
||||
# define KMP_INIT_WAIT 1024U /* initial number of spin-tests */
|
||||
# define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */
|
||||
#endif
|
||||
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
@@ -998,9 +1150,9 @@ extern void __kmp_x86_cpuid( int mode, int mode2, struct kmp_cpuid *p );
|
||||
# if KMP_ARCH_X86
|
||||
extern void __kmp_x86_pause( void );
|
||||
# elif KMP_MIC
|
||||
static void __kmp_x86_pause( void ) { _mm_delay_32( 100 ); };
|
||||
static void __kmp_x86_pause( void ) { _mm_delay_32( 100 ); }
|
||||
# else
|
||||
static void __kmp_x86_pause( void ) { _mm_pause(); };
|
||||
static void __kmp_x86_pause( void ) { _mm_pause(); }
|
||||
# endif
|
||||
# define KMP_CPU_PAUSE() __kmp_x86_pause()
|
||||
#elif KMP_ARCH_PPC64
|
||||
@@ -1101,6 +1253,7 @@ typedef struct kmp_sys_info {
|
||||
long nivcsw; /* the number of times a context switch was forced */
|
||||
} kmp_sys_info_t;
|
||||
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
typedef struct kmp_cpuinfo {
|
||||
int initialized; // If 0, other fields are not initialized.
|
||||
int signature; // CPUID(1).EAX
|
||||
@@ -1114,8 +1267,9 @@ typedef struct kmp_cpuinfo {
|
||||
int physical_id;
|
||||
int logical_id;
|
||||
kmp_uint64 frequency; // Nominal CPU frequency in Hz.
|
||||
char name [3*sizeof (kmp_cpuid_t)]; // CPUID(0x80000002,0x80000003,0x80000004)
|
||||
} kmp_cpuinfo_t;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_TV
|
||||
|
||||
@@ -1399,7 +1553,7 @@ struct shared_table {
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#ifdef KMP_STATIC_STEAL_ENABLED
|
||||
#if KMP_STATIC_STEAL_ENABLED
|
||||
typedef struct KMP_ALIGN_CACHE dispatch_private_info32 {
|
||||
kmp_int32 count;
|
||||
kmp_int32 ub;
|
||||
@@ -1538,7 +1692,7 @@ typedef struct dispatch_shared_info64 {
|
||||
volatile kmp_uint64 iteration;
|
||||
volatile kmp_uint64 num_done;
|
||||
volatile kmp_uint64 ordered_iteration;
|
||||
kmp_int64 ordered_dummy[KMP_MAX_ORDERED-1]; // to retain the structure size after making ordered_iteration scalar
|
||||
kmp_int64 ordered_dummy[KMP_MAX_ORDERED-3]; // to retain the structure size after making ordered_iteration scalar
|
||||
} dispatch_shared_info64_t;
|
||||
|
||||
typedef struct dispatch_shared_info {
|
||||
@@ -1546,8 +1700,18 @@ typedef struct dispatch_shared_info {
|
||||
dispatch_shared_info32_t s32;
|
||||
dispatch_shared_info64_t s64;
|
||||
} u;
|
||||
/* volatile kmp_int32 dispatch_abort; depricated */
|
||||
volatile kmp_uint32 buffer_index;
|
||||
#if OMP_45_ENABLED
|
||||
volatile kmp_int32 doacross_buf_idx; // teamwise index
|
||||
volatile kmp_uint32 *doacross_flags; // shared array of iteration flags (0/1)
|
||||
kmp_int32 doacross_num_done; // count finished threads
|
||||
#endif
|
||||
#if KMP_USE_HWLOC
|
||||
// When linking with libhwloc, the ORDERED EPCC test slows down on big
|
||||
// machines (> 48 cores). Performance analysis showed that a cache thrash
|
||||
// was occurring and this padding helps alleviate the problem.
|
||||
char padding[64];
|
||||
#endif
|
||||
} dispatch_shared_info_t;
|
||||
|
||||
typedef struct kmp_disp {
|
||||
@@ -1561,7 +1725,16 @@ typedef struct kmp_disp {
|
||||
|
||||
dispatch_private_info_t *th_disp_buffer;
|
||||
kmp_int32 th_disp_index;
|
||||
#if OMP_45_ENABLED
|
||||
kmp_int32 th_doacross_buf_idx; // thread's doacross buffer index
|
||||
volatile kmp_uint32 *th_doacross_flags; // pointer to shared array of flags
|
||||
union { // we can use union here because doacross cannot be used in nonmonotonic loops
|
||||
kmp_int64 *th_doacross_info; // info on loop bounds
|
||||
kmp_lock_t *th_steal_lock; // lock used for chunk stealing (8-byte variable)
|
||||
};
|
||||
#else
|
||||
void* dummy_padding[2]; // make it 64 bytes on Intel(R) 64
|
||||
#endif
|
||||
#if KMP_USE_INTERNODE_ALIGNMENT
|
||||
char more_padding[INTERNODE_CACHE_LINE];
|
||||
#endif
|
||||
@@ -1578,9 +1751,9 @@ typedef struct kmp_disp {
|
||||
#define KMP_BARRIER_UNUSED_BIT 1 /* bit that must never be set for valid state */
|
||||
#define KMP_BARRIER_BUMP_BIT 2 /* lsb used for bump of go/arrived state */
|
||||
|
||||
#define KMP_BARRIER_SLEEP_STATE ((kmp_uint) (1 << KMP_BARRIER_SLEEP_BIT))
|
||||
#define KMP_BARRIER_UNUSED_STATE ((kmp_uint) (1 << KMP_BARRIER_UNUSED_BIT))
|
||||
#define KMP_BARRIER_STATE_BUMP ((kmp_uint) (1 << KMP_BARRIER_BUMP_BIT))
|
||||
#define KMP_BARRIER_SLEEP_STATE (1 << KMP_BARRIER_SLEEP_BIT)
|
||||
#define KMP_BARRIER_UNUSED_STATE (1 << KMP_BARRIER_UNUSED_BIT)
|
||||
#define KMP_BARRIER_STATE_BUMP (1 << KMP_BARRIER_BUMP_BIT)
|
||||
|
||||
#if (KMP_BARRIER_SLEEP_BIT >= KMP_BARRIER_BUMP_BIT)
|
||||
# error "Barrier sleep bit must be smaller than barrier bump bit"
|
||||
@@ -1686,7 +1859,7 @@ union KMP_ALIGN_CACHE kmp_barrier_team_union {
|
||||
double b_align; /* use worst case alignment */
|
||||
char b_pad[ CACHE_LINE ];
|
||||
struct {
|
||||
kmp_uint b_arrived; /* STATE => task reached synch point. */
|
||||
kmp_uint64 b_arrived; /* STATE => task reached synch point. */
|
||||
#if USE_DEBUGGER
|
||||
// The following two fields are indended for the debugger solely. Only master of the team accesses
|
||||
// these fields: the first one is increased by 1 when master arrives to a barrier, the
|
||||
@@ -1812,6 +1985,9 @@ typedef struct kmp_local {
|
||||
|
||||
} kmp_local_t;
|
||||
|
||||
#define KMP_CHECK_UPDATE(a, b) if ((a) != (b)) (a) = (b)
|
||||
#define KMP_CHECK_UPDATE_SYNC(a, b) if ((a) != (b)) TCW_SYNC_PTR((a), (b))
|
||||
|
||||
#define get__blocktime( xteam, xtid ) ((xteam)->t.t_threads[(xtid)]->th.th_current_task->td_icvs.blocktime)
|
||||
#define get__bt_set( xteam, xtid ) ((xteam)->t.t_threads[(xtid)]->th.th_current_task->td_icvs.bt_set)
|
||||
#define get__bt_intervals( xteam, xtid ) ((xteam)->t.t_threads[(xtid)]->th.th_current_task->td_icvs.bt_intervals)
|
||||
@@ -1873,6 +2049,9 @@ typedef enum kmp_tasking_mode {
|
||||
|
||||
extern kmp_tasking_mode_t __kmp_tasking_mode; /* determines how/when to execute tasks */
|
||||
extern kmp_int32 __kmp_task_stealing_constraint;
|
||||
#if OMP_45_ENABLED
|
||||
extern kmp_int32 __kmp_max_task_priority; // Set via OMP_MAX_TASK_PRIORITY if specified, defaults to 0 otherwise
|
||||
#endif
|
||||
|
||||
/* NOTE: kmp_taskdata_t and kmp_task_t structures allocated in single block with taskdata first */
|
||||
#define KMP_TASK_TO_TASKDATA(task) (((kmp_taskdata_t *) task) - 1)
|
||||
@@ -1891,6 +2070,18 @@ extern kmp_int32 __kmp_task_stealing_constraint;
|
||||
*/
|
||||
typedef kmp_int32 (* kmp_routine_entry_t)( kmp_int32, void * );
|
||||
|
||||
#if OMP_40_ENABLED || OMP_45_ENABLED
|
||||
typedef union kmp_cmplrdata {
|
||||
#if OMP_45_ENABLED
|
||||
kmp_int32 priority; /**< priority specified by user for the task */
|
||||
#endif // OMP_45_ENABLED
|
||||
#if OMP_40_ENABLED
|
||||
kmp_routine_entry_t destructors; /* pointer to function to invoke deconstructors of firstprivate C++ objects */
|
||||
#endif // OMP_40_ENABLED
|
||||
/* future data */
|
||||
} kmp_cmplrdata_t;
|
||||
#endif
|
||||
|
||||
/* sizeof_kmp_task_t passed as arg to kmpc_omp_task call */
|
||||
/*!
|
||||
*/
|
||||
@@ -1898,9 +2089,11 @@ typedef struct kmp_task { /* GEH: Shouldn't this be aligned so
|
||||
void * shareds; /**< pointer to block of pointers to shared vars */
|
||||
kmp_routine_entry_t routine; /**< pointer to routine to call for executing task */
|
||||
kmp_int32 part_id; /**< part id for the task */
|
||||
#if OMP_40_ENABLED
|
||||
kmp_routine_entry_t destructors; /* pointer to function to invoke deconstructors of firstprivate C++ objects */
|
||||
#endif // OMP_40_ENABLED
|
||||
#if OMP_40_ENABLED || OMP_45_ENABLED
|
||||
kmp_cmplrdata_t data1; /* Two known optional additions: destructors and priority */
|
||||
kmp_cmplrdata_t data2; /* Process destructors first, priority second */
|
||||
/* future data */
|
||||
#endif
|
||||
/* private vars */
|
||||
} kmp_task_t;
|
||||
|
||||
@@ -1964,6 +2157,7 @@ struct kmp_dephash_entry {
|
||||
|
||||
typedef struct kmp_dephash {
|
||||
kmp_dephash_entry_t ** buckets;
|
||||
size_t size;
|
||||
#ifdef KMP_DEBUG
|
||||
kmp_uint32 nelements;
|
||||
kmp_uint32 nconflicts;
|
||||
@@ -1996,9 +2190,10 @@ typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 b
|
||||
unsigned merged_if0 : 1; /* no __kmpc_task_{begin/complete}_if0 calls in if0 code path */
|
||||
#if OMP_40_ENABLED
|
||||
unsigned destructors_thunk : 1; /* set if the compiler creates a thunk to invoke destructors from the runtime */
|
||||
#if OMP_41_ENABLED
|
||||
#if OMP_45_ENABLED
|
||||
unsigned proxy : 1; /* task is a proxy task (it will be executed outside the context of the RTL) */
|
||||
unsigned reserved : 11; /* reserved for compiler use */
|
||||
unsigned priority_specified :1; /* set if the compiler provides priority setting for the task */
|
||||
unsigned reserved : 10; /* reserved for compiler use */
|
||||
#else
|
||||
unsigned reserved : 12; /* reserved for compiler use */
|
||||
#endif
|
||||
@@ -2031,13 +2226,14 @@ struct kmp_taskdata { /* aligned during dynamic
|
||||
/* Currently not used except for perhaps IDB */
|
||||
kmp_taskdata_t * td_parent; /* parent task */
|
||||
kmp_int32 td_level; /* task nesting level */
|
||||
kmp_int32 td_untied_count; /* untied task active parts counter */
|
||||
ident_t * td_ident; /* task identifier */
|
||||
// Taskwait data.
|
||||
ident_t * td_taskwait_ident;
|
||||
kmp_uint32 td_taskwait_counter;
|
||||
kmp_int32 td_taskwait_thread; /* gtid + 1 of thread encountered taskwait */
|
||||
KMP_ALIGN_CACHE kmp_internal_control_t td_icvs; /* Internal control variables for the task */
|
||||
volatile kmp_uint32 td_allocated_child_tasks; /* Child tasks (+ current task) not yet deallocated */
|
||||
KMP_ALIGN_CACHE volatile kmp_uint32 td_allocated_child_tasks; /* Child tasks (+ current task) not yet deallocated */
|
||||
volatile kmp_uint32 td_incomplete_child_tasks; /* Child tasks not yet complete */
|
||||
#if OMP_40_ENABLED
|
||||
kmp_taskgroup_t * td_taskgroup; // Each task keeps pointer to its current taskgroup
|
||||
@@ -2047,10 +2243,9 @@ struct kmp_taskdata { /* aligned during dynamic
|
||||
#if OMPT_SUPPORT
|
||||
ompt_task_info_t ompt_task_info;
|
||||
#endif
|
||||
#if KMP_HAVE_QUAD
|
||||
_Quad td_dummy; // Align structure 16-byte size since allocated just before kmp_task_t
|
||||
#else
|
||||
kmp_uint32 td_dummy[2];
|
||||
#if OMP_45_ENABLED
|
||||
kmp_task_team_t * td_task_team;
|
||||
kmp_int32 td_size_alloc; // The size of task structure, including shareds etc.
|
||||
#endif
|
||||
}; // struct kmp_taskdata
|
||||
|
||||
@@ -2063,6 +2258,7 @@ typedef struct kmp_base_thread_data {
|
||||
// Used only in __kmp_execute_tasks_template, maybe not avail until task is queued?
|
||||
kmp_bootstrap_lock_t td_deque_lock; // Lock for accessing deque
|
||||
kmp_taskdata_t ** td_deque; // Deque of tasks encountered by td_thr, dynamically allocated
|
||||
kmp_int32 td_deque_size; // Size of deck
|
||||
kmp_uint32 td_deque_head; // Head of deque (will wrap)
|
||||
kmp_uint32 td_deque_tail; // Tail of deque (will wrap)
|
||||
kmp_int32 td_deque_ntasks; // Number of tasks in deque
|
||||
@@ -2073,6 +2269,12 @@ typedef struct kmp_base_thread_data {
|
||||
#endif // BUILD_TIED_TASK_STACK
|
||||
} kmp_base_thread_data_t;
|
||||
|
||||
#define TASK_DEQUE_BITS 8 // Used solely to define INITIAL_TASK_DEQUE_SIZE
|
||||
#define INITIAL_TASK_DEQUE_SIZE ( 1 << TASK_DEQUE_BITS )
|
||||
|
||||
#define TASK_DEQUE_SIZE(td) ((td).td_deque_size)
|
||||
#define TASK_DEQUE_MASK(td) ((td).td_deque_size - 1)
|
||||
|
||||
typedef union KMP_ALIGN_CACHE kmp_thread_data {
|
||||
kmp_base_thread_data_t td;
|
||||
double td_align; /* use worst case alignment */
|
||||
@@ -2091,7 +2293,7 @@ typedef struct kmp_base_task_team {
|
||||
/* TRUE means tt_threads_data is set up and initialized */
|
||||
kmp_int32 tt_nproc; /* #threads in team */
|
||||
kmp_int32 tt_max_threads; /* number of entries allocated for threads_data array */
|
||||
#if OMP_41_ENABLED
|
||||
#if OMP_45_ENABLED
|
||||
kmp_int32 tt_found_proxy_tasks; /* Have we found proxy tasks since last barrier */
|
||||
#endif
|
||||
|
||||
@@ -2100,14 +2302,6 @@ typedef struct kmp_base_task_team {
|
||||
|
||||
KMP_ALIGN_CACHE
|
||||
volatile kmp_uint32 tt_active; /* is the team still actively executing tasks */
|
||||
|
||||
KMP_ALIGN_CACHE
|
||||
#if KMP_USE_INTERNODE_ALIGNMENT
|
||||
kmp_int32 tt_padme[INTERNODE_CACHE_LINE/sizeof(kmp_int32)];
|
||||
#endif
|
||||
|
||||
volatile kmp_uint32 tt_ref_ct; /* #threads accessing struct */
|
||||
/* (not incl. master) */
|
||||
} kmp_base_task_team_t;
|
||||
|
||||
union KMP_ALIGN_CACHE kmp_task_team {
|
||||
@@ -2201,7 +2395,6 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
|
||||
kmp_uint64 th_bar_arrive_time; /* arrival to barrier timestamp */
|
||||
kmp_uint64 th_bar_min_time; /* minimum arrival time at the barrier */
|
||||
kmp_uint64 th_frame_time; /* frame timestamp */
|
||||
kmp_uint64 th_frame_time_serialized; /* frame timestamp in serialized parallel */
|
||||
#endif /* USE_ITT_BUILD */
|
||||
kmp_local_t th_local;
|
||||
struct private_common *th_pri_head;
|
||||
@@ -2248,7 +2441,6 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
|
||||
int th_active; // ! sleeping
|
||||
// 32 bits for TCR/TCW
|
||||
|
||||
|
||||
struct cons_header * th_cons; // used for consistency check
|
||||
|
||||
/*
|
||||
@@ -2367,12 +2559,14 @@ typedef struct KMP_ALIGN_CACHE kmp_base_team {
|
||||
void *t_inline_argv[ KMP_INLINE_ARGV_ENTRIES ];
|
||||
|
||||
KMP_ALIGN_CACHE kmp_info_t **t_threads;
|
||||
int t_max_argc;
|
||||
kmp_taskdata_t *t_implicit_task_taskdata; // Taskdata for the thread's implicit task
|
||||
int t_level; // nested parallel level
|
||||
|
||||
KMP_ALIGN_CACHE int t_max_argc;
|
||||
int t_max_nproc; // maximum threads this team can handle (dynamicly expandable)
|
||||
int t_serialized; // levels deep of serialized teams
|
||||
dispatch_shared_info_t *t_disp_buffer; // buffers for dispatch system
|
||||
int t_id; // team's id, assigned by debugger.
|
||||
int t_level; // nested parallel level
|
||||
int t_active_level; // nested active parallel level
|
||||
kmp_r_sched_t t_sched; // run-time schedule for the team
|
||||
#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
|
||||
@@ -2382,14 +2576,13 @@ typedef struct KMP_ALIGN_CACHE kmp_base_team {
|
||||
int t_size_changed; // team size was changed?: 0: no, 1: yes, -1: changed via omp_set_num_threads() call
|
||||
|
||||
// Read/write by workers as well -----------------------------------------------------------------------
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
#if (KMP_ARCH_X86 || KMP_ARCH_X86_64) && !KMP_USE_HWLOC
|
||||
// Using CACHE_LINE=64 reduces memory footprint, but causes a big perf regression of epcc 'parallel'
|
||||
// and 'barrier' on fxe256lin01. This extra padding serves to fix the performance of epcc 'parallel'
|
||||
// and 'barrier' when CACHE_LINE=64. TODO: investigate more and get rid if this padding.
|
||||
char dummy_padding[1024];
|
||||
#endif
|
||||
KMP_ALIGN_CACHE kmp_taskdata_t *t_implicit_task_taskdata; // Taskdata for the thread's implicit task
|
||||
kmp_internal_control_t *t_control_stack_top; // internal control stack for additional nested teams.
|
||||
KMP_ALIGN_CACHE kmp_internal_control_t *t_control_stack_top; // internal control stack for additional nested teams.
|
||||
// for SERIALIZED teams nested 2 or more levels deep
|
||||
#if OMP_40_ENABLED
|
||||
kmp_int32 t_cancel_request; // typed flag to store request state of cancellation
|
||||
@@ -2426,7 +2619,6 @@ typedef struct kmp_base_global {
|
||||
|
||||
int g_dynamic;
|
||||
enum dynamic_mode g_dynamic_mode;
|
||||
|
||||
} kmp_base_global_t;
|
||||
|
||||
typedef union KMP_ALIGN_CACHE kmp_global {
|
||||
@@ -2520,7 +2712,9 @@ extern int __kmp_storage_map; /* True means print storage map for t
|
||||
extern int __kmp_storage_map_verbose; /* True means storage map includes placement info */
|
||||
extern int __kmp_storage_map_verbose_specified;
|
||||
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
extern kmp_cpuinfo_t __kmp_cpuinfo;
|
||||
#endif
|
||||
|
||||
extern volatile int __kmp_init_serial;
|
||||
extern volatile int __kmp_init_gtid;
|
||||
@@ -2601,7 +2795,6 @@ extern kmp_uint32 __kmp_yield_cycle;
|
||||
extern kmp_int32 __kmp_yield_on_count;
|
||||
extern kmp_int32 __kmp_yield_off_count;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
extern int __kmp_allThreadsSpecified;
|
||||
|
||||
@@ -2654,6 +2847,7 @@ extern kmp_uint32 __kmp_init_mxcsr; /* init thread's mxscr */
|
||||
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
|
||||
|
||||
extern int __kmp_dflt_max_active_levels; /* max_active_levels for nested parallelism enabled by default a la OMP_MAX_ACTIVE_LEVELS */
|
||||
extern int __kmp_dispatch_num_buffers; /* max possible dynamic loops in concurrent execution per team */
|
||||
#if KMP_NESTED_HOT_TEAMS
|
||||
extern int __kmp_hot_teams_mode;
|
||||
extern int __kmp_hot_teams_max_level;
|
||||
@@ -2782,7 +2976,6 @@ extern void __kmp_exit_single( int gtid );
|
||||
extern void __kmp_parallel_deo( int *gtid_ref, int *cid_ref, ident_t *loc_ref );
|
||||
extern void __kmp_parallel_dxo( int *gtid_ref, int *cid_ref, ident_t *loc_ref );
|
||||
|
||||
|
||||
#ifdef USE_LOAD_BALANCE
|
||||
extern int __kmp_get_load_balance( int );
|
||||
#endif
|
||||
@@ -2916,37 +3109,18 @@ extern kmp_uint32 __kmp_neq_4( kmp_uint32 value, kmp_uint32 checker );
|
||||
extern kmp_uint32 __kmp_lt_4( kmp_uint32 value, kmp_uint32 checker );
|
||||
extern kmp_uint32 __kmp_ge_4( kmp_uint32 value, kmp_uint32 checker );
|
||||
extern kmp_uint32 __kmp_le_4( kmp_uint32 value, kmp_uint32 checker );
|
||||
|
||||
extern kmp_uint32 __kmp_eq_8( kmp_uint64 value, kmp_uint64 checker );
|
||||
extern kmp_uint32 __kmp_neq_8( kmp_uint64 value, kmp_uint64 checker );
|
||||
extern kmp_uint32 __kmp_lt_8( kmp_uint64 value, kmp_uint64 checker );
|
||||
extern kmp_uint32 __kmp_ge_8( kmp_uint64 value, kmp_uint64 checker );
|
||||
extern kmp_uint32 __kmp_le_8( kmp_uint64 value, kmp_uint64 checker );
|
||||
|
||||
extern kmp_uint32 __kmp_wait_yield_4( kmp_uint32 volatile * spinner, kmp_uint32 checker, kmp_uint32 (*pred) (kmp_uint32, kmp_uint32), void * obj );
|
||||
extern kmp_uint64 __kmp_wait_yield_8( kmp_uint64 volatile * spinner, kmp_uint64 checker, kmp_uint32 (*pred) (kmp_uint64, kmp_uint64), void * obj );
|
||||
extern void __kmp_wait_yield_4_ptr( void * spinner, kmp_uint32 checker, kmp_uint32 (* pred)( void *, kmp_uint32 ), void * obj );
|
||||
|
||||
class kmp_flag_32;
|
||||
class kmp_flag_64;
|
||||
class kmp_flag_oncore;
|
||||
extern void __kmp_wait_32(kmp_info_t *this_thr, kmp_flag_32 *flag, int final_spin
|
||||
#if USE_ITT_BUILD
|
||||
, void * itt_sync_obj
|
||||
#endif
|
||||
);
|
||||
extern void __kmp_release_32(kmp_flag_32 *flag);
|
||||
extern void __kmp_wait_64(kmp_info_t *this_thr, kmp_flag_64 *flag, int final_spin
|
||||
#if USE_ITT_BUILD
|
||||
, void * itt_sync_obj
|
||||
#endif
|
||||
);
|
||||
extern void __kmp_release_64(kmp_flag_64 *flag);
|
||||
extern void __kmp_wait_oncore(kmp_info_t *this_thr, kmp_flag_oncore *flag, int final_spin
|
||||
#if USE_ITT_BUILD
|
||||
, void * itt_sync_obj
|
||||
#endif
|
||||
);
|
||||
extern void __kmp_release_oncore(kmp_flag_oncore *flag);
|
||||
|
||||
extern void __kmp_infinite_loop( void );
|
||||
|
||||
@@ -2990,13 +3164,14 @@ extern int __kmp_aux_get_affinity_mask_proc(int proc, void **mask);
|
||||
extern void __kmp_balanced_affinity( int tid, int team_size );
|
||||
#endif /* KMP_AFFINITY_SUPPORTED */
|
||||
|
||||
extern void __kmp_cleanup_hierarchy();
|
||||
extern void __kmp_get_hierarchy(kmp_uint32 nproc, kmp_bstate_t *thr_bar);
|
||||
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
#if KMP_USE_FUTEX
|
||||
|
||||
extern int __kmp_futex_determine_capable( void );
|
||||
|
||||
#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
#endif // KMP_USE_FUTEX
|
||||
|
||||
extern void __kmp_gtid_set_specific( int gtid );
|
||||
extern int __kmp_gtid_get_specific( void );
|
||||
@@ -3074,6 +3249,7 @@ extern void __kmp_initialize_bget( kmp_info_t *th );
|
||||
extern void __kmp_finalize_bget( kmp_info_t *th );
|
||||
|
||||
KMP_EXPORT void *kmpc_malloc( size_t size );
|
||||
KMP_EXPORT void *kmpc_aligned_malloc( size_t size, size_t alignment );
|
||||
KMP_EXPORT void *kmpc_calloc( size_t nelem, size_t elsize );
|
||||
KMP_EXPORT void *kmpc_realloc( void *ptr, size_t size );
|
||||
KMP_EXPORT void kmpc_free( void *ptr );
|
||||
@@ -3109,6 +3285,9 @@ extern int __kmp_fork_call( ident_t *loc, int gtid, enum fork_context_e fork_con
|
||||
);
|
||||
|
||||
extern void __kmp_join_call( ident_t *loc, int gtid
|
||||
#if OMPT_SUPPORT
|
||||
, enum fork_context_e fork_context
|
||||
#endif
|
||||
#if OMP_40_ENABLED
|
||||
, int exit_teams = 0
|
||||
#endif
|
||||
@@ -3146,11 +3325,10 @@ extern void __kmp_pop_current_task_from_thread( kmp_info_t *this_thr );
|
||||
extern kmp_task_t* __kmp_task_alloc( ident_t *loc_ref, kmp_int32 gtid,
|
||||
kmp_tasking_flags_t *flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds,
|
||||
kmp_routine_entry_t task_entry );
|
||||
#if OMPT_SUPPORT
|
||||
extern void __kmp_task_init_ompt( kmp_taskdata_t * task, int tid );
|
||||
#endif
|
||||
extern void __kmp_init_implicit_task( ident_t *loc_ref, kmp_info_t *this_thr,
|
||||
kmp_team_t *team, int tid, int set_curr_task );
|
||||
extern void __kmp_finish_implicit_task(kmp_info_t *this_thr);
|
||||
extern void __kmp_free_implicit_task(kmp_info_t *this_thr);
|
||||
|
||||
int __kmp_execute_tasks_32(kmp_info_t *thread, kmp_int32 gtid, kmp_flag_32 *flag, int final_spin,
|
||||
int *thread_finished,
|
||||
@@ -3171,15 +3349,16 @@ int __kmp_execute_tasks_oncore(kmp_info_t *thread, kmp_int32 gtid, kmp_flag_onco
|
||||
#endif /* USE_ITT_BUILD */
|
||||
kmp_int32 is_constrained);
|
||||
|
||||
extern void __kmp_free_task_team( kmp_info_t *thread, kmp_task_team_t *task_team );
|
||||
extern void __kmp_reap_task_teams( void );
|
||||
extern void __kmp_unref_task_team( kmp_task_team_t *task_team, kmp_info_t *thread );
|
||||
extern void __kmp_wait_to_unref_task_teams( void );
|
||||
extern void __kmp_task_team_setup ( kmp_info_t *this_thr, kmp_team_t *team, int both, int always );
|
||||
extern void __kmp_task_team_setup ( kmp_info_t *this_thr, kmp_team_t *team, int always );
|
||||
extern void __kmp_task_team_sync ( kmp_info_t *this_thr, kmp_team_t *team );
|
||||
extern void __kmp_task_team_wait ( kmp_info_t *this_thr, kmp_team_t *team
|
||||
#if USE_ITT_BUILD
|
||||
, void * itt_sync_obj
|
||||
#endif /* USE_ITT_BUILD */
|
||||
, int wait=1
|
||||
);
|
||||
extern void __kmp_tasking_barrier( kmp_team_t *team, kmp_info_t *thread, int gtid );
|
||||
|
||||
@@ -3246,6 +3425,10 @@ KMP_EXPORT void __kmpc_end_ordered ( ident_t *, kmp_int32 global_tid );
|
||||
KMP_EXPORT void __kmpc_critical ( ident_t *, kmp_int32 global_tid, kmp_critical_name * );
|
||||
KMP_EXPORT void __kmpc_end_critical ( ident_t *, kmp_int32 global_tid, kmp_critical_name * );
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
KMP_EXPORT void __kmpc_critical_with_hint ( ident_t *, kmp_int32 global_tid, kmp_critical_name *, uintptr_t hint );
|
||||
#endif
|
||||
|
||||
KMP_EXPORT kmp_int32 __kmpc_barrier_master ( ident_t *, kmp_int32 global_tid );
|
||||
KMP_EXPORT void __kmpc_end_barrier_master ( ident_t *, kmp_int32 global_tid );
|
||||
|
||||
@@ -3315,12 +3498,18 @@ void __kmpc_omp_task_complete( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t *tas
|
||||
KMP_EXPORT void __kmpc_taskgroup( ident_t * loc, int gtid );
|
||||
KMP_EXPORT void __kmpc_end_taskgroup( ident_t * loc, int gtid );
|
||||
|
||||
KMP_EXPORT kmp_int32 __kmpc_omp_task_with_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_task,
|
||||
kmp_int32 ndeps, kmp_depend_info_t *dep_list,
|
||||
kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list );
|
||||
KMP_EXPORT void __kmpc_omp_wait_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps, kmp_depend_info_t *dep_list,
|
||||
kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list );
|
||||
extern void __kmp_release_deps ( kmp_int32 gtid, kmp_taskdata_t *task );
|
||||
KMP_EXPORT kmp_int32 __kmpc_omp_task_with_deps(
|
||||
ident_t *loc_ref, kmp_int32 gtid, kmp_task_t *new_task, kmp_int32 ndeps,
|
||||
kmp_depend_info_t *dep_list, kmp_int32 ndeps_noalias,
|
||||
kmp_depend_info_t *noalias_dep_list);
|
||||
KMP_EXPORT void __kmpc_omp_wait_deps(ident_t *loc_ref, kmp_int32 gtid,
|
||||
kmp_int32 ndeps,
|
||||
kmp_depend_info_t *dep_list,
|
||||
kmp_int32 ndeps_noalias,
|
||||
kmp_depend_info_t *noalias_dep_list);
|
||||
extern void __kmp_release_deps(kmp_int32 gtid, kmp_taskdata_t *task);
|
||||
extern void __kmp_dephash_free_entries(kmp_info_t *thread, kmp_dephash_t *h);
|
||||
extern void __kmp_dephash_free(kmp_info_t *thread, kmp_dephash_t *h);
|
||||
|
||||
extern kmp_int32 __kmp_omp_task( kmp_int32 gtid, kmp_task_t * new_task, bool serialize_immediate );
|
||||
|
||||
@@ -3329,11 +3518,13 @@ KMP_EXPORT kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid,
|
||||
KMP_EXPORT kmp_int32 __kmpc_cancel_barrier(ident_t* loc_ref, kmp_int32 gtid);
|
||||
KMP_EXPORT int __kmp_get_cancellation_status(int cancel_kind);
|
||||
|
||||
#if OMP_41_ENABLED
|
||||
#if OMP_45_ENABLED
|
||||
|
||||
KMP_EXPORT void __kmpc_proxy_task_completed( kmp_int32 gtid, kmp_task_t *ptask );
|
||||
KMP_EXPORT void __kmpc_proxy_task_completed_ooo ( kmp_task_t *ptask );
|
||||
|
||||
KMP_EXPORT void __kmpc_taskloop(ident_t *loc, kmp_int32 gtid, kmp_task_t *task, kmp_int32 if_val,
|
||||
kmp_uint64 *lb, kmp_uint64 *ub, kmp_int64 st,
|
||||
kmp_int32 nogroup, kmp_int32 sched, kmp_uint64 grainsize, void * task_dup );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -3353,6 +3544,11 @@ KMP_EXPORT void __kmpc_unset_nest_lock( ident_t *loc, kmp_int32 gtid, void **use
|
||||
KMP_EXPORT int __kmpc_test_lock( ident_t *loc, kmp_int32 gtid, void **user_lock );
|
||||
KMP_EXPORT int __kmpc_test_nest_lock( ident_t *loc, kmp_int32 gtid, void **user_lock );
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
KMP_EXPORT void __kmpc_init_lock_with_hint( ident_t *loc, kmp_int32 gtid, void **user_lock, uintptr_t hint );
|
||||
KMP_EXPORT void __kmpc_init_nest_lock_with_hint( ident_t *loc, kmp_int32 gtid, void **user_lock, uintptr_t hint );
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
@@ -3386,7 +3582,8 @@ KMP_EXPORT kmp_int32 __kmp_get_reduce_method( void );
|
||||
KMP_EXPORT kmp_uint64 __kmpc_get_taskid();
|
||||
KMP_EXPORT kmp_uint64 __kmpc_get_parent_taskid();
|
||||
|
||||
KMP_EXPORT void __kmpc_place_threads(int,int,int);
|
||||
// this function exported for testing of KMP_PLACE_THREADS functionality
|
||||
KMP_EXPORT void __kmpc_place_threads(int,int,int,int,int);
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -3402,7 +3599,17 @@ KMP_EXPORT void __kmpc_push_num_threads( ident_t *loc, kmp_int32 global_tid, kmp
|
||||
KMP_EXPORT void __kmpc_push_proc_bind( ident_t *loc, kmp_int32 global_tid, int proc_bind );
|
||||
KMP_EXPORT void __kmpc_push_num_teams( ident_t *loc, kmp_int32 global_tid, kmp_int32 num_teams, kmp_int32 num_threads );
|
||||
KMP_EXPORT void __kmpc_fork_teams(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, ...);
|
||||
|
||||
#endif
|
||||
#if OMP_45_ENABLED
|
||||
struct kmp_dim { // loop bounds info casted to kmp_int64
|
||||
kmp_int64 lo; // lower
|
||||
kmp_int64 up; // upper
|
||||
kmp_int64 st; // stride
|
||||
};
|
||||
KMP_EXPORT void __kmpc_doacross_init(ident_t *loc, kmp_int32 gtid, kmp_int32 num_dims, struct kmp_dim * dims);
|
||||
KMP_EXPORT void __kmpc_doacross_wait(ident_t *loc, kmp_int32 gtid, kmp_int64 *vec);
|
||||
KMP_EXPORT void __kmpc_doacross_post(ident_t *loc, kmp_int32 gtid, kmp_int64 *vec);
|
||||
KMP_EXPORT void __kmpc_doacross_fini(ident_t *loc, kmp_int32 gtid);
|
||||
#endif
|
||||
|
||||
KMP_EXPORT void*
|
||||
@@ -3455,6 +3662,7 @@ KMP_EXPORT void KMPC_CONVENTION kmpc_set_stacksize(int);
|
||||
KMP_EXPORT void KMPC_CONVENTION kmpc_set_stacksize_s(size_t);
|
||||
KMP_EXPORT void KMPC_CONVENTION kmpc_set_library(int);
|
||||
KMP_EXPORT void KMPC_CONVENTION kmpc_set_defaults(char const *);
|
||||
KMP_EXPORT void KMPC_CONVENTION kmpc_set_disp_num_buffers(int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+756
-685
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,319 @@
|
||||
/*
|
||||
* kmp_affinity.h -- header for affinity management
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.txt for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef KMP_AFFINITY_H
|
||||
#define KMP_AFFINITY_H
|
||||
|
||||
extern int __kmp_affinity_compact; /* Affinity 'compact' value */
|
||||
|
||||
class Address {
|
||||
public:
|
||||
static const unsigned maxDepth = 32;
|
||||
unsigned labels[maxDepth];
|
||||
unsigned childNums[maxDepth];
|
||||
unsigned depth;
|
||||
unsigned leader;
|
||||
Address(unsigned _depth)
|
||||
: depth(_depth), leader(FALSE) {
|
||||
}
|
||||
Address &operator=(const Address &b) {
|
||||
depth = b.depth;
|
||||
for (unsigned i = 0; i < depth; i++) {
|
||||
labels[i] = b.labels[i];
|
||||
childNums[i] = b.childNums[i];
|
||||
}
|
||||
leader = FALSE;
|
||||
return *this;
|
||||
}
|
||||
bool operator==(const Address &b) const {
|
||||
if (depth != b.depth)
|
||||
return false;
|
||||
for (unsigned i = 0; i < depth; i++)
|
||||
if(labels[i] != b.labels[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
bool isClose(const Address &b, int level) const {
|
||||
if (depth != b.depth)
|
||||
return false;
|
||||
if ((unsigned)level >= depth)
|
||||
return true;
|
||||
for (unsigned i = 0; i < (depth - level); i++)
|
||||
if(labels[i] != b.labels[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
bool operator!=(const Address &b) const {
|
||||
return !operator==(b);
|
||||
}
|
||||
void print() const {
|
||||
unsigned i;
|
||||
printf("Depth: %u --- ", depth);
|
||||
for(i=0;i<depth;i++) {
|
||||
printf("%u ", labels[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class AddrUnsPair {
|
||||
public:
|
||||
Address first;
|
||||
unsigned second;
|
||||
AddrUnsPair(Address _first, unsigned _second)
|
||||
: first(_first), second(_second) {
|
||||
}
|
||||
AddrUnsPair &operator=(const AddrUnsPair &b)
|
||||
{
|
||||
first = b.first;
|
||||
second = b.second;
|
||||
return *this;
|
||||
}
|
||||
void print() const {
|
||||
printf("first = "); first.print();
|
||||
printf(" --- second = %u", second);
|
||||
}
|
||||
bool operator==(const AddrUnsPair &b) const {
|
||||
if(first != b.first) return false;
|
||||
if(second != b.second) return false;
|
||||
return true;
|
||||
}
|
||||
bool operator!=(const AddrUnsPair &b) const {
|
||||
return !operator==(b);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
__kmp_affinity_cmp_Address_labels(const void *a, const void *b)
|
||||
{
|
||||
const Address *aa = (const Address *)&(((AddrUnsPair *)a)
|
||||
->first);
|
||||
const Address *bb = (const Address *)&(((AddrUnsPair *)b)
|
||||
->first);
|
||||
unsigned depth = aa->depth;
|
||||
unsigned i;
|
||||
KMP_DEBUG_ASSERT(depth == bb->depth);
|
||||
for (i = 0; i < depth; i++) {
|
||||
if (aa->labels[i] < bb->labels[i]) return -1;
|
||||
if (aa->labels[i] > bb->labels[i]) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
__kmp_affinity_cmp_Address_child_num(const void *a, const void *b)
|
||||
{
|
||||
const Address *aa = (const Address *)&(((AddrUnsPair *)a)
|
||||
->first);
|
||||
const Address *bb = (const Address *)&(((AddrUnsPair *)b)
|
||||
->first);
|
||||
unsigned depth = aa->depth;
|
||||
unsigned i;
|
||||
KMP_DEBUG_ASSERT(depth == bb->depth);
|
||||
KMP_DEBUG_ASSERT((unsigned)__kmp_affinity_compact <= depth);
|
||||
KMP_DEBUG_ASSERT(__kmp_affinity_compact >= 0);
|
||||
for (i = 0; i < (unsigned)__kmp_affinity_compact; i++) {
|
||||
int j = depth - i - 1;
|
||||
if (aa->childNums[j] < bb->childNums[j]) return -1;
|
||||
if (aa->childNums[j] > bb->childNums[j]) return 1;
|
||||
}
|
||||
for (; i < depth; i++) {
|
||||
int j = i - __kmp_affinity_compact;
|
||||
if (aa->childNums[j] < bb->childNums[j]) return -1;
|
||||
if (aa->childNums[j] > bb->childNums[j]) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/** A structure for holding machine-specific hierarchy info to be computed once at init.
|
||||
This structure represents a mapping of threads to the actual machine hierarchy, or to
|
||||
our best guess at what the hierarchy might be, for the purpose of performing an
|
||||
efficient barrier. In the worst case, when there is no machine hierarchy information,
|
||||
it produces a tree suitable for a barrier, similar to the tree used in the hyper barrier. */
|
||||
class hierarchy_info {
|
||||
public:
|
||||
/** Good default values for number of leaves and branching factor, given no affinity information.
|
||||
Behaves a bit like hyper barrier. */
|
||||
static const kmp_uint32 maxLeaves=4;
|
||||
static const kmp_uint32 minBranch=4;
|
||||
/** Number of levels in the hierarchy. Typical levels are threads/core, cores/package
|
||||
or socket, packages/node, nodes/machine, etc. We don't want to get specific with
|
||||
nomenclature. When the machine is oversubscribed we add levels to duplicate the
|
||||
hierarchy, doubling the thread capacity of the hierarchy each time we add a level. */
|
||||
kmp_uint32 maxLevels;
|
||||
|
||||
/** This is specifically the depth of the machine configuration hierarchy, in terms of the
|
||||
number of levels along the longest path from root to any leaf. It corresponds to the
|
||||
number of entries in numPerLevel if we exclude all but one trailing 1. */
|
||||
kmp_uint32 depth;
|
||||
kmp_uint32 base_num_threads;
|
||||
enum init_status { initialized=0, not_initialized=1, initializing=2 };
|
||||
volatile kmp_int8 uninitialized; // 0=initialized, 1=not initialized, 2=initialization in progress
|
||||
volatile kmp_int8 resizing; // 0=not resizing, 1=resizing
|
||||
|
||||
/** Level 0 corresponds to leaves. numPerLevel[i] is the number of children the parent of a
|
||||
node at level i has. For example, if we have a machine with 4 packages, 4 cores/package
|
||||
and 2 HT per core, then numPerLevel = {2, 4, 4, 1, 1}. All empty levels are set to 1. */
|
||||
kmp_uint32 *numPerLevel;
|
||||
kmp_uint32 *skipPerLevel;
|
||||
|
||||
void deriveLevels(AddrUnsPair *adr2os, int num_addrs) {
|
||||
int hier_depth = adr2os[0].first.depth;
|
||||
int level = 0;
|
||||
for (int i=hier_depth-1; i>=0; --i) {
|
||||
int max = -1;
|
||||
for (int j=0; j<num_addrs; ++j) {
|
||||
int next = adr2os[j].first.childNums[i];
|
||||
if (next > max) max = next;
|
||||
}
|
||||
numPerLevel[level] = max+1;
|
||||
++level;
|
||||
}
|
||||
}
|
||||
|
||||
hierarchy_info() : maxLevels(7), depth(1), uninitialized(not_initialized), resizing(0) {}
|
||||
|
||||
void fini() { if (!uninitialized && numPerLevel) __kmp_free(numPerLevel); }
|
||||
|
||||
void init(AddrUnsPair *adr2os, int num_addrs)
|
||||
{
|
||||
kmp_int8 bool_result = KMP_COMPARE_AND_STORE_ACQ8(&uninitialized, not_initialized, initializing);
|
||||
if (bool_result == 0) { // Wait for initialization
|
||||
while (TCR_1(uninitialized) != initialized) KMP_CPU_PAUSE();
|
||||
return;
|
||||
}
|
||||
KMP_DEBUG_ASSERT(bool_result==1);
|
||||
|
||||
/* Added explicit initialization of the data fields here to prevent usage of dirty value
|
||||
observed when static library is re-initialized multiple times (e.g. when
|
||||
non-OpenMP thread repeatedly launches/joins thread that uses OpenMP). */
|
||||
depth = 1;
|
||||
resizing = 0;
|
||||
maxLevels = 7;
|
||||
numPerLevel = (kmp_uint32 *)__kmp_allocate(maxLevels*2*sizeof(kmp_uint32));
|
||||
skipPerLevel = &(numPerLevel[maxLevels]);
|
||||
for (kmp_uint32 i=0; i<maxLevels; ++i) { // init numPerLevel[*] to 1 item per level
|
||||
numPerLevel[i] = 1;
|
||||
skipPerLevel[i] = 1;
|
||||
}
|
||||
|
||||
// Sort table by physical ID
|
||||
if (adr2os) {
|
||||
qsort(adr2os, num_addrs, sizeof(*adr2os), __kmp_affinity_cmp_Address_labels);
|
||||
deriveLevels(adr2os, num_addrs);
|
||||
}
|
||||
else {
|
||||
numPerLevel[0] = maxLeaves;
|
||||
numPerLevel[1] = num_addrs/maxLeaves;
|
||||
if (num_addrs%maxLeaves) numPerLevel[1]++;
|
||||
}
|
||||
|
||||
base_num_threads = num_addrs;
|
||||
for (int i=maxLevels-1; i>=0; --i) // count non-empty levels to get depth
|
||||
if (numPerLevel[i] != 1 || depth > 1) // only count one top-level '1'
|
||||
depth++;
|
||||
|
||||
kmp_uint32 branch = minBranch;
|
||||
if (numPerLevel[0] == 1) branch = num_addrs/maxLeaves;
|
||||
if (branch<minBranch) branch=minBranch;
|
||||
for (kmp_uint32 d=0; d<depth-1; ++d) { // optimize hierarchy width
|
||||
while (numPerLevel[d] > branch || (d==0 && numPerLevel[d]>maxLeaves)) { // max 4 on level 0!
|
||||
if (numPerLevel[d] & 1) numPerLevel[d]++;
|
||||
numPerLevel[d] = numPerLevel[d] >> 1;
|
||||
if (numPerLevel[d+1] == 1) depth++;
|
||||
numPerLevel[d+1] = numPerLevel[d+1] << 1;
|
||||
}
|
||||
if(numPerLevel[0] == 1) {
|
||||
branch = branch >> 1;
|
||||
if (branch<4) branch = minBranch;
|
||||
}
|
||||
}
|
||||
|
||||
for (kmp_uint32 i=1; i<depth; ++i)
|
||||
skipPerLevel[i] = numPerLevel[i-1] * skipPerLevel[i-1];
|
||||
// Fill in hierarchy in the case of oversubscription
|
||||
for (kmp_uint32 i=depth; i<maxLevels; ++i)
|
||||
skipPerLevel[i] = 2*skipPerLevel[i-1];
|
||||
|
||||
uninitialized = initialized; // One writer
|
||||
|
||||
}
|
||||
|
||||
// Resize the hierarchy if nproc changes to something larger than before
|
||||
void resize(kmp_uint32 nproc)
|
||||
{
|
||||
kmp_int8 bool_result = KMP_COMPARE_AND_STORE_ACQ8(&resizing, 0, 1);
|
||||
while (bool_result == 0) { // someone else is trying to resize
|
||||
KMP_CPU_PAUSE();
|
||||
if (nproc <= base_num_threads) // happy with other thread's resize
|
||||
return;
|
||||
else // try to resize
|
||||
bool_result = KMP_COMPARE_AND_STORE_ACQ8(&resizing, 0, 1);
|
||||
}
|
||||
KMP_DEBUG_ASSERT(bool_result!=0);
|
||||
if (nproc <= base_num_threads) return; // happy with other thread's resize
|
||||
|
||||
// Calculate new maxLevels
|
||||
kmp_uint32 old_sz = skipPerLevel[depth-1];
|
||||
kmp_uint32 incs = 0, old_maxLevels = maxLevels;
|
||||
// First see if old maxLevels is enough to contain new size
|
||||
for (kmp_uint32 i=depth; i<maxLevels && nproc>old_sz; ++i) {
|
||||
skipPerLevel[i] = 2*skipPerLevel[i-1];
|
||||
numPerLevel[i-1] *= 2;
|
||||
old_sz *= 2;
|
||||
depth++;
|
||||
}
|
||||
if (nproc > old_sz) { // Not enough space, need to expand hierarchy
|
||||
while (nproc > old_sz) {
|
||||
old_sz *=2;
|
||||
incs++;
|
||||
depth++;
|
||||
}
|
||||
maxLevels += incs;
|
||||
|
||||
// Resize arrays
|
||||
kmp_uint32 *old_numPerLevel = numPerLevel;
|
||||
kmp_uint32 *old_skipPerLevel = skipPerLevel;
|
||||
numPerLevel = skipPerLevel = NULL;
|
||||
numPerLevel = (kmp_uint32 *)__kmp_allocate(maxLevels*2*sizeof(kmp_uint32));
|
||||
skipPerLevel = &(numPerLevel[maxLevels]);
|
||||
|
||||
// Copy old elements from old arrays
|
||||
for (kmp_uint32 i=0; i<old_maxLevels; ++i) { // init numPerLevel[*] to 1 item per level
|
||||
numPerLevel[i] = old_numPerLevel[i];
|
||||
skipPerLevel[i] = old_skipPerLevel[i];
|
||||
}
|
||||
|
||||
// Init new elements in arrays to 1
|
||||
for (kmp_uint32 i=old_maxLevels; i<maxLevels; ++i) { // init numPerLevel[*] to 1 item per level
|
||||
numPerLevel[i] = 1;
|
||||
skipPerLevel[i] = 1;
|
||||
}
|
||||
|
||||
// Free old arrays
|
||||
__kmp_free(old_numPerLevel);
|
||||
}
|
||||
|
||||
// Fill in oversubscription levels of hierarchy
|
||||
for (kmp_uint32 i=old_maxLevels; i<maxLevels; ++i)
|
||||
skipPerLevel[i] = 2*skipPerLevel[i-1];
|
||||
|
||||
base_num_threads = nproc;
|
||||
resizing = 0; // One writer
|
||||
|
||||
}
|
||||
};
|
||||
#endif // KMP_AFFINITY_H
|
||||
+108
-73
@@ -1178,7 +1178,7 @@ bufdump( kmp_info_t *th, void *buf )
|
||||
}
|
||||
|
||||
for (i = 0; i < l; i++) {
|
||||
(void) KMP_SNPRINTF(bhex + i * 3, sizeof(bhex), "%02X ", bdump[i]);
|
||||
(void) KMP_SNPRINTF(bhex + i * 3, sizeof(bhex) - i * 3, "%02X ", bdump[i]);
|
||||
if (bdump[i] > 0x20 && bdump[i] < 0x7F)
|
||||
bascii[ i ] = bdump[ i ];
|
||||
else
|
||||
@@ -1427,8 +1427,37 @@ void *
|
||||
kmpc_malloc( size_t size )
|
||||
{
|
||||
void * ptr;
|
||||
ptr = bget( __kmp_entry_thread(), (bufsize) size );
|
||||
ptr = bget( __kmp_entry_thread(), (bufsize)(size + sizeof(ptr)) );
|
||||
if( ptr != NULL ) {
|
||||
// save allocated pointer just before one returned to user
|
||||
*(void**)ptr = ptr;
|
||||
ptr = (void**)ptr + 1;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define IS_POWER_OF_TWO(n) (((n)&((n)-1))==0)
|
||||
|
||||
void *
|
||||
kmpc_aligned_malloc( size_t size, size_t alignment )
|
||||
{
|
||||
void * ptr;
|
||||
void * ptr_allocated;
|
||||
KMP_DEBUG_ASSERT( alignment < 32 * 1024 ); // Alignment should not be too big
|
||||
if( !IS_POWER_OF_TWO(alignment) ) {
|
||||
// AC: do we need to issue a warning here?
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
size = size + sizeof( void* ) + alignment;
|
||||
ptr_allocated = bget( __kmp_entry_thread(), (bufsize)size );
|
||||
if( ptr_allocated != NULL ) {
|
||||
// save allocated pointer just before one returned to user
|
||||
ptr = (void*)(((kmp_uintptr_t)ptr_allocated + sizeof( void* ) + alignment) & ~(alignment - 1));
|
||||
*((void**)ptr - 1) = ptr_allocated;
|
||||
} else {
|
||||
ptr = NULL;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -1436,8 +1465,12 @@ void *
|
||||
kmpc_calloc( size_t nelem, size_t elsize )
|
||||
{
|
||||
void * ptr;
|
||||
ptr = bgetz( __kmp_entry_thread(), (bufsize) (nelem * elsize) );
|
||||
|
||||
ptr = bgetz( __kmp_entry_thread(), (bufsize) (nelem * elsize + sizeof(ptr)) );
|
||||
if( ptr != NULL ) {
|
||||
// save allocated pointer just before one returned to user
|
||||
*(void**)ptr = ptr;
|
||||
ptr = (void**)ptr + 1;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -1445,19 +1478,27 @@ void *
|
||||
kmpc_realloc( void * ptr, size_t size )
|
||||
{
|
||||
void * result = NULL;
|
||||
|
||||
if ( ptr == NULL ) {
|
||||
// If pointer is NULL, realloc behaves like malloc.
|
||||
result = bget( __kmp_entry_thread(), (bufsize) size );
|
||||
} else if ( size == 0 ) {
|
||||
// If size is 0, realloc behaves like free.
|
||||
// The thread must be registered by the call to kmpc_malloc() or kmpc_calloc() before.
|
||||
// So it should be safe to call __kmp_get_thread(), not __kmp_entry_thread().
|
||||
brel( __kmp_get_thread(), ptr );
|
||||
} else {
|
||||
result = bgetr( __kmp_entry_thread(), ptr, (bufsize) size );
|
||||
}; // if
|
||||
|
||||
if ( ptr == NULL ) {
|
||||
// If pointer is NULL, realloc behaves like malloc.
|
||||
result = bget( __kmp_entry_thread(), (bufsize)(size + sizeof(ptr)) );
|
||||
// save allocated pointer just before one returned to user
|
||||
if( result != NULL ) {
|
||||
*(void**)result = result;
|
||||
result = (void**)result + 1;
|
||||
}
|
||||
} else if ( size == 0 ) {
|
||||
// If size is 0, realloc behaves like free.
|
||||
// The thread must be registered by the call to kmpc_malloc() or kmpc_calloc() before.
|
||||
// So it should be safe to call __kmp_get_thread(), not __kmp_entry_thread().
|
||||
KMP_ASSERT(*((void**)ptr - 1));
|
||||
brel( __kmp_get_thread(), *((void**)ptr - 1) );
|
||||
} else {
|
||||
result = bgetr( __kmp_entry_thread(), *((void**)ptr - 1), (bufsize)(size + sizeof(ptr)) );
|
||||
if( result != NULL ) {
|
||||
*(void**)result = result;
|
||||
result = (void**)result + 1;
|
||||
}
|
||||
}; // if
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1470,9 +1511,11 @@ kmpc_free( void * ptr )
|
||||
return;
|
||||
}; // if
|
||||
if ( ptr != NULL ) {
|
||||
kmp_info_t *th = __kmp_get_thread();
|
||||
__kmp_bget_dequeue( th ); /* Release any queued buffers */
|
||||
brel( th, ptr );
|
||||
kmp_info_t *th = __kmp_get_thread();
|
||||
__kmp_bget_dequeue( th ); /* Release any queued buffers */
|
||||
// extract allocated pointer and free it
|
||||
KMP_ASSERT(*((void**)ptr - 1));
|
||||
brel( th, *((void**)ptr - 1) );
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1489,7 +1532,7 @@ ___kmp_thread_malloc( kmp_info_t *th, size_t size KMP_SRC_LOC_DECL )
|
||||
(int) size
|
||||
KMP_SRC_LOC_PARM
|
||||
) );
|
||||
ptr = bget( th, (bufsize) size );
|
||||
ptr = bget( th, (bufsize) size );
|
||||
KE_TRACE( 30, ( "<- __kmp_thread_malloc() returns %p\n", ptr ) );
|
||||
return ptr;
|
||||
}
|
||||
@@ -1505,7 +1548,7 @@ ___kmp_thread_calloc( kmp_info_t *th, size_t nelem, size_t elsize KMP_SRC_LOC_DE
|
||||
(int) elsize
|
||||
KMP_SRC_LOC_PARM
|
||||
) );
|
||||
ptr = bgetz( th, (bufsize) (nelem * elsize) );
|
||||
ptr = bgetz( th, (bufsize) (nelem * elsize) );
|
||||
KE_TRACE( 30, ( "<- __kmp_thread_calloc() returns %p\n", ptr ) );
|
||||
return ptr;
|
||||
}
|
||||
@@ -1520,7 +1563,7 @@ ___kmp_thread_realloc( kmp_info_t *th, void *ptr, size_t size KMP_SRC_LOC_DECL )
|
||||
(int) size
|
||||
KMP_SRC_LOC_PARM
|
||||
) );
|
||||
ptr = bgetr( th, ptr, (bufsize) size );
|
||||
ptr = bgetr( th, ptr, (bufsize) size );
|
||||
KE_TRACE( 30, ( "<- __kmp_thread_realloc() returns %p\n", ptr ) );
|
||||
return ptr;
|
||||
}
|
||||
@@ -1535,8 +1578,8 @@ ___kmp_thread_free( kmp_info_t *th, void *ptr KMP_SRC_LOC_DECL )
|
||||
KMP_SRC_LOC_PARM
|
||||
) );
|
||||
if ( ptr != NULL ) {
|
||||
__kmp_bget_dequeue( th ); /* Release any queued buffers */
|
||||
brel( th, ptr );
|
||||
__kmp_bget_dequeue( th ); /* Release any queued buffers */
|
||||
brel( th, ptr );
|
||||
}
|
||||
KE_TRACE( 30, ( "<- __kmp_thread_free()\n" ) );
|
||||
}
|
||||
@@ -1602,11 +1645,11 @@ ___kmp_allocate_align( size_t size, size_t alignment KMP_SRC_LOC_DECL )
|
||||
descr.size_aligned = size;
|
||||
descr.size_allocated = descr.size_aligned + sizeof( kmp_mem_descr_t ) + alignment;
|
||||
|
||||
#if KMP_DEBUG
|
||||
descr.ptr_allocated = _malloc_src_loc( descr.size_allocated, _file_, _line_ );
|
||||
#else
|
||||
#if KMP_DEBUG
|
||||
descr.ptr_allocated = _malloc_src_loc( descr.size_allocated, _file_, _line_ );
|
||||
#else
|
||||
descr.ptr_allocated = malloc_src_loc( descr.size_allocated KMP_SRC_LOC_PARM );
|
||||
#endif
|
||||
#endif
|
||||
KE_TRACE( 10, (
|
||||
" malloc( %d ) returned %p\n",
|
||||
(int) descr.size_allocated,
|
||||
@@ -1638,11 +1681,10 @@ ___kmp_allocate_align( size_t size, size_t alignment KMP_SRC_LOC_DECL )
|
||||
KMP_DEBUG_ASSERT( addr_descr + sizeof( kmp_mem_descr_t ) == addr_aligned );
|
||||
KMP_DEBUG_ASSERT( addr_aligned + descr.size_aligned <= addr_allocated + descr.size_allocated );
|
||||
KMP_DEBUG_ASSERT( addr_aligned % alignment == 0 );
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
memset( descr.ptr_allocated, 0xEF, descr.size_allocated );
|
||||
// Fill allocated memory block with 0xEF.
|
||||
#endif
|
||||
#ifdef KMP_DEBUG
|
||||
memset( descr.ptr_allocated, 0xEF, descr.size_allocated );
|
||||
// Fill allocated memory block with 0xEF.
|
||||
#endif
|
||||
memset( descr.ptr_aligned, 0x00, descr.size_aligned );
|
||||
// Fill the aligned memory block (which is intended for using by caller) with 0x00. Do not
|
||||
// put this filling under KMP_DEBUG condition! Many callers expect zeroed memory. (Padding
|
||||
@@ -1653,7 +1695,6 @@ ___kmp_allocate_align( size_t size, size_t alignment KMP_SRC_LOC_DECL )
|
||||
|
||||
KE_TRACE( 25, ( "<- ___kmp_allocate_align() returns %p\n", descr.ptr_aligned ) );
|
||||
return descr.ptr_aligned;
|
||||
|
||||
} // func ___kmp_allocate_align
|
||||
|
||||
|
||||
@@ -1666,13 +1707,11 @@ ___kmp_allocate_align( size_t size, size_t alignment KMP_SRC_LOC_DECL )
|
||||
void *
|
||||
___kmp_allocate( size_t size KMP_SRC_LOC_DECL )
|
||||
{
|
||||
|
||||
void * ptr;
|
||||
KE_TRACE( 25, ( "-> __kmp_allocate( %d ) called from %s:%d\n", (int) size KMP_SRC_LOC_PARM ) );
|
||||
ptr = ___kmp_allocate_align( size, __kmp_align_alloc KMP_SRC_LOC_PARM );
|
||||
ptr = ___kmp_allocate_align( size, __kmp_align_alloc KMP_SRC_LOC_PARM );
|
||||
KE_TRACE( 25, ( "<- __kmp_allocate() returns %p\n", ptr ) );
|
||||
return ptr;
|
||||
|
||||
} // func ___kmp_allocate
|
||||
|
||||
#if (BUILD_MEMORY==FIRST_TOUCH)
|
||||
@@ -1726,7 +1765,7 @@ ___kmp_page_allocate( size_t size KMP_SRC_LOC_DECL )
|
||||
(int) size
|
||||
KMP_SRC_LOC_PARM
|
||||
) );
|
||||
ptr = ___kmp_allocate_align( size, page_size KMP_SRC_LOC_PARM );
|
||||
ptr = ___kmp_allocate_align( size, page_size KMP_SRC_LOC_PARM );
|
||||
KE_TRACE( 25, ( "<- __kmp_page_allocate( %d ) returns %p\n", (int) size, ptr ) );
|
||||
return ptr;
|
||||
} // ___kmp_page_allocate
|
||||
@@ -1738,49 +1777,45 @@ ___kmp_page_allocate( size_t size KMP_SRC_LOC_DECL )
|
||||
void
|
||||
___kmp_free( void * ptr KMP_SRC_LOC_DECL )
|
||||
{
|
||||
kmp_mem_descr_t descr;
|
||||
kmp_uintptr_t addr_allocated; // Address returned by malloc().
|
||||
kmp_uintptr_t addr_aligned; // Aligned address passed by caller.
|
||||
|
||||
kmp_mem_descr_t descr;
|
||||
kmp_uintptr_t addr_allocated; // Address returned by malloc().
|
||||
kmp_uintptr_t addr_aligned; // Aligned address passed by caller.
|
||||
KE_TRACE( 25, ( "-> __kmp_free( %p ) called from %s:%d\n", ptr KMP_SRC_LOC_PARM ) );
|
||||
KMP_ASSERT( ptr != NULL );
|
||||
|
||||
KE_TRACE( 25, ( "-> __kmp_free( %p ) called from %s:%d\n", ptr KMP_SRC_LOC_PARM ) );
|
||||
KMP_ASSERT( ptr != NULL );
|
||||
descr = * ( kmp_mem_descr_t *) ( (kmp_uintptr_t) ptr - sizeof( kmp_mem_descr_t ) );
|
||||
|
||||
descr = * ( kmp_mem_descr_t *) ( (kmp_uintptr_t) ptr - sizeof( kmp_mem_descr_t ) );
|
||||
KE_TRACE( 26, ( " __kmp_free: "
|
||||
"ptr_allocated=%p, size_allocated=%d, "
|
||||
"ptr_aligned=%p, size_aligned=%d\n",
|
||||
descr.ptr_allocated, (int) descr.size_allocated,
|
||||
descr.ptr_aligned, (int) descr.size_aligned ));
|
||||
|
||||
KE_TRACE( 26, ( " __kmp_free: "
|
||||
"ptr_allocated=%p, size_allocated=%d, "
|
||||
"ptr_aligned=%p, size_aligned=%d\n",
|
||||
descr.ptr_allocated, (int) descr.size_allocated,
|
||||
descr.ptr_aligned, (int) descr.size_aligned ));
|
||||
addr_allocated = (kmp_uintptr_t) descr.ptr_allocated;
|
||||
addr_aligned = (kmp_uintptr_t) descr.ptr_aligned;
|
||||
|
||||
addr_allocated = (kmp_uintptr_t) descr.ptr_allocated;
|
||||
addr_aligned = (kmp_uintptr_t) descr.ptr_aligned;
|
||||
KMP_DEBUG_ASSERT( addr_aligned % CACHE_LINE == 0 );
|
||||
KMP_DEBUG_ASSERT( descr.ptr_aligned == ptr );
|
||||
KMP_DEBUG_ASSERT( addr_allocated + sizeof( kmp_mem_descr_t ) <= addr_aligned );
|
||||
KMP_DEBUG_ASSERT( descr.size_aligned < descr.size_allocated );
|
||||
KMP_DEBUG_ASSERT( addr_aligned + descr.size_aligned <= addr_allocated + descr.size_allocated );
|
||||
|
||||
KMP_DEBUG_ASSERT( addr_aligned % CACHE_LINE == 0 );
|
||||
KMP_DEBUG_ASSERT( descr.ptr_aligned == ptr );
|
||||
KMP_DEBUG_ASSERT( addr_allocated + sizeof( kmp_mem_descr_t ) <= addr_aligned );
|
||||
KMP_DEBUG_ASSERT( descr.size_aligned < descr.size_allocated );
|
||||
KMP_DEBUG_ASSERT( addr_aligned + descr.size_aligned <= addr_allocated + descr.size_allocated );
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
memset( descr.ptr_allocated, 0xEF, descr.size_allocated );
|
||||
// Fill memory block with 0xEF, it helps catch using freed memory.
|
||||
#endif
|
||||
|
||||
#ifndef LEAK_MEMORY
|
||||
KE_TRACE( 10, ( " free( %p )\n", descr.ptr_allocated ) );
|
||||
# ifdef KMP_DEBUG
|
||||
_free_src_loc( descr.ptr_allocated, _file_, _line_ );
|
||||
# else
|
||||
free_src_loc( descr.ptr_allocated KMP_SRC_LOC_PARM );
|
||||
# endif
|
||||
#endif
|
||||
#ifdef KMP_DEBUG
|
||||
memset( descr.ptr_allocated, 0xEF, descr.size_allocated );
|
||||
// Fill memory block with 0xEF, it helps catch using freed memory.
|
||||
#endif
|
||||
|
||||
#ifndef LEAK_MEMORY
|
||||
KE_TRACE( 10, ( " free( %p )\n", descr.ptr_allocated ) );
|
||||
# ifdef KMP_DEBUG
|
||||
_free_src_loc( descr.ptr_allocated, _file_, _line_ );
|
||||
# else
|
||||
free_src_loc( descr.ptr_allocated KMP_SRC_LOC_PARM );
|
||||
# endif
|
||||
#endif
|
||||
KMP_MB();
|
||||
|
||||
KE_TRACE( 25, ( "<- __kmp_free() returns\n" ) );
|
||||
|
||||
} // func ___kmp_free
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
@@ -35,6 +35,13 @@
|
||||
#if defined( __cplusplus ) && ( KMP_OS_WINDOWS )
|
||||
// create shortcuts for c99 complex types
|
||||
|
||||
// Visual Studio cannot have function parameters that have the
|
||||
// align __declspec attribute, so we must remove it. (Compiler Error C2719)
|
||||
#if KMP_COMPILER_MSVC
|
||||
# undef KMP_DO_ALIGN
|
||||
# define KMP_DO_ALIGN(alignment) /* Nothing */
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER < 1600) && defined(_DEBUG)
|
||||
// Workaround for the problem of _DebugHeapTag unresolved external.
|
||||
// This problem prevented to use our static debug library for C tests
|
||||
@@ -211,7 +218,7 @@
|
||||
|
||||
// Compiler 12.0 changed alignment of 16 and 32-byte arguments (like _Quad
|
||||
// and kmp_cmplx128) on IA-32 architecture. The following aligned structures
|
||||
// are implemented to support the old alignment in 10.1, 11.0, 11.1 and
|
||||
// are implemented to support the old alignment in 10.1, 11.0, 11.1 and
|
||||
// introduce the new alignment in 12.0. See CQ88405.
|
||||
#if KMP_ARCH_X86 && KMP_HAVE_QUAD
|
||||
|
||||
@@ -219,7 +226,7 @@
|
||||
|
||||
#pragma pack( push, 4 )
|
||||
|
||||
|
||||
|
||||
struct KMP_DO_ALIGN( 4 ) Quad_a4_t {
|
||||
_Quad q;
|
||||
|
||||
@@ -371,7 +378,7 @@ static inline void
|
||||
__kmp_acquire_atomic_lock( kmp_atomic_lock_t *lck, kmp_int32 gtid )
|
||||
{
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_wait_atomic)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_wait_atomic)(
|
||||
(ompt_wait_id_t) lck);
|
||||
@@ -381,7 +388,7 @@ __kmp_acquire_atomic_lock( kmp_atomic_lock_t *lck, kmp_int32 gtid )
|
||||
__kmp_acquire_queuing_lock( lck, gtid );
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_acquired_atomic)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_acquired_atomic)(
|
||||
(ompt_wait_id_t) lck);
|
||||
@@ -400,7 +407,7 @@ __kmp_release_atomic_lock( kmp_atomic_lock_t *lck, kmp_int32 gtid )
|
||||
{
|
||||
__kmp_release_queuing_lock( lck, gtid );
|
||||
#if OMPT_SUPPORT && OMPT_BLAME
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_release_atomic)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_release_atomic)(
|
||||
(ompt_wait_id_t) lck);
|
||||
|
||||
+126
-101
@@ -17,6 +17,8 @@
|
||||
#include "kmp_wait_release.h"
|
||||
#include "kmp_stats.h"
|
||||
#include "kmp_itt.h"
|
||||
#include "kmp_os.h"
|
||||
|
||||
|
||||
#if KMP_MIC
|
||||
#include <immintrin.h>
|
||||
@@ -46,7 +48,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
|
||||
void (*reduce)(void *, void *)
|
||||
USE_ITT_BUILD_ARG(void * itt_sync_obj) )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_linear_gather);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_linear_gather);
|
||||
register kmp_team_t *team = this_thr->th.th_team;
|
||||
register kmp_bstate_t *thr_bar = & this_thr->th.th_bar[bt].bb;
|
||||
register kmp_info_t **other_threads = team->t.t_threads;
|
||||
@@ -64,7 +66,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
|
||||
// We now perform a linear reduction to signal that all of the threads have arrived.
|
||||
if (!KMP_MASTER_TID(tid)) {
|
||||
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) releasing T#%d(%d:%d)"
|
||||
"arrived(%p): %u => %u\n", gtid, team->t.t_id, tid,
|
||||
"arrived(%p): %llu => %llu\n", gtid, team->t.t_id, tid,
|
||||
__kmp_gtid_from_tid(0, team), team->t.t_id, 0, &thr_bar->b_arrived,
|
||||
thr_bar->b_arrived, thr_bar->b_arrived + KMP_BARRIER_STATE_BUMP));
|
||||
// Mark arrival to master thread
|
||||
@@ -77,7 +79,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
|
||||
register int nproc = this_thr->th.th_team_nproc;
|
||||
register int i;
|
||||
// Don't have to worry about sleep bit here or atomic since team setting
|
||||
register kmp_uint new_state = team_bar->b_arrived + KMP_BARRIER_STATE_BUMP;
|
||||
register kmp_uint64 new_state = team_bar->b_arrived + KMP_BARRIER_STATE_BUMP;
|
||||
|
||||
// Collect all the worker team member threads.
|
||||
for (i=1; i<nproc; ++i) {
|
||||
@@ -87,7 +89,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
|
||||
KMP_CACHE_PREFETCH(&other_threads[i+1]->th.th_bar[bt].bb.b_arrived);
|
||||
#endif /* KMP_CACHE_MANAGE */
|
||||
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%d) "
|
||||
"arrived(%p) == %u\n", gtid, team->t.t_id, tid,
|
||||
"arrived(%p) == %llu\n", gtid, team->t.t_id, tid,
|
||||
__kmp_gtid_from_tid(i, team), team->t.t_id, i,
|
||||
&other_threads[i]->th.th_bar[bt].bb.b_arrived, new_state));
|
||||
|
||||
@@ -111,7 +113,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
|
||||
}
|
||||
// Don't have to worry about sleep bit here or atomic since team setting
|
||||
team_bar->b_arrived = new_state;
|
||||
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n",
|
||||
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %llu\n",
|
||||
gtid, team->t.t_id, tid, team->t.t_id, &team_bar->b_arrived, new_state));
|
||||
}
|
||||
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) exit for barrier type %d\n",
|
||||
@@ -123,7 +125,7 @@ __kmp_linear_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gti
|
||||
int propagate_icvs
|
||||
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_linear_release);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_linear_release);
|
||||
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
|
||||
register kmp_team_t *team;
|
||||
|
||||
@@ -141,17 +143,18 @@ __kmp_linear_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gti
|
||||
|
||||
if (nproc > 1) {
|
||||
#if KMP_BARRIER_ICV_PUSH
|
||||
KMP_START_EXPLICIT_TIMER(USER_icv_copy);
|
||||
if (propagate_icvs) {
|
||||
ngo_load(&team->t.t_implicit_task_taskdata[0].td_icvs);
|
||||
for (i=1; i<nproc; ++i) {
|
||||
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[i], team, i, FALSE);
|
||||
ngo_store_icvs(&team->t.t_implicit_task_taskdata[i].td_icvs,
|
||||
&team->t.t_implicit_task_taskdata[0].td_icvs);
|
||||
{
|
||||
KMP_TIME_DEVELOPER_BLOCK(USER_icv_copy);
|
||||
if (propagate_icvs) {
|
||||
ngo_load(&team->t.t_implicit_task_taskdata[0].td_icvs);
|
||||
for (i=1; i<nproc; ++i) {
|
||||
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[i], team, i, FALSE);
|
||||
ngo_store_icvs(&team->t.t_implicit_task_taskdata[i].td_icvs,
|
||||
&team->t.t_implicit_task_taskdata[0].td_icvs);
|
||||
}
|
||||
ngo_sync();
|
||||
}
|
||||
ngo_sync();
|
||||
}
|
||||
KMP_STOP_EXPLICIT_TIMER(USER_icv_copy);
|
||||
#endif // KMP_BARRIER_ICV_PUSH
|
||||
|
||||
// Now, release all of the worker threads
|
||||
@@ -217,7 +220,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
void (*reduce)(void *, void *)
|
||||
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_tree_gather);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_tree_gather);
|
||||
register kmp_team_t *team = this_thr->th.th_team;
|
||||
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
|
||||
register kmp_info_t **other_threads = team->t.t_threads;
|
||||
@@ -226,7 +229,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
register kmp_uint32 branch_factor = 1 << branch_bits;
|
||||
register kmp_uint32 child;
|
||||
register kmp_uint32 child_tid;
|
||||
register kmp_uint new_state;
|
||||
register kmp_uint64 new_state;
|
||||
|
||||
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) enter for barrier type %d\n",
|
||||
gtid, team->t.t_id, tid, bt));
|
||||
@@ -253,7 +256,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
KMP_CACHE_PREFETCH(&other_threads[child_tid+1]->th.th_bar[bt].bb.b_arrived);
|
||||
#endif /* KMP_CACHE_MANAGE */
|
||||
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%u) "
|
||||
"arrived(%p) == %u\n", gtid, team->t.t_id, tid,
|
||||
"arrived(%p) == %llu\n", gtid, team->t.t_id, tid,
|
||||
__kmp_gtid_from_tid(child_tid, team), team->t.t_id, child_tid,
|
||||
&child_bar->b_arrived, new_state));
|
||||
// Wait for child to arrive
|
||||
@@ -283,7 +286,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
register kmp_int32 parent_tid = (tid - 1) >> branch_bits;
|
||||
|
||||
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) releasing T#%d(%d:%d) "
|
||||
"arrived(%p): %u => %u\n", gtid, team->t.t_id, tid,
|
||||
"arrived(%p): %llu => %llu\n", gtid, team->t.t_id, tid,
|
||||
__kmp_gtid_from_tid(parent_tid, team), team->t.t_id, parent_tid,
|
||||
&thr_bar->b_arrived, thr_bar->b_arrived,
|
||||
thr_bar->b_arrived + KMP_BARRIER_STATE_BUMP));
|
||||
@@ -299,7 +302,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
team->t.t_bar[bt].b_arrived = new_state;
|
||||
else
|
||||
team->t.t_bar[bt].b_arrived += KMP_BARRIER_STATE_BUMP;
|
||||
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n",
|
||||
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %llu\n",
|
||||
gtid, team->t.t_id, tid, team->t.t_id,
|
||||
&team->t.t_bar[bt].b_arrived, team->t.t_bar[bt].b_arrived));
|
||||
}
|
||||
@@ -312,7 +315,7 @@ __kmp_tree_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
int propagate_icvs
|
||||
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_tree_release);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_tree_release);
|
||||
register kmp_team_t *team;
|
||||
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
|
||||
register kmp_uint32 nproc;
|
||||
@@ -381,14 +384,15 @@ __kmp_tree_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
#endif /* KMP_CACHE_MANAGE */
|
||||
|
||||
#if KMP_BARRIER_ICV_PUSH
|
||||
KMP_START_EXPLICIT_TIMER(USER_icv_copy);
|
||||
if (propagate_icvs) {
|
||||
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[child_tid],
|
||||
team, child_tid, FALSE);
|
||||
copy_icvs(&team->t.t_implicit_task_taskdata[child_tid].td_icvs,
|
||||
&team->t.t_implicit_task_taskdata[0].td_icvs);
|
||||
{
|
||||
KMP_TIME_DEVELOPER_BLOCK(USER_icv_copy);
|
||||
if (propagate_icvs) {
|
||||
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[child_tid],
|
||||
team, child_tid, FALSE);
|
||||
copy_icvs(&team->t.t_implicit_task_taskdata[child_tid].td_icvs,
|
||||
&team->t.t_implicit_task_taskdata[0].td_icvs);
|
||||
}
|
||||
}
|
||||
KMP_STOP_EXPLICIT_TIMER(USER_icv_copy);
|
||||
#endif // KMP_BARRIER_ICV_PUSH
|
||||
KA_TRACE(20, ("__kmp_tree_barrier_release: T#%d(%d:%d) releasing T#%d(%d:%u)"
|
||||
"go(%p): %u => %u\n", gtid, team->t.t_id, tid,
|
||||
@@ -414,11 +418,11 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
void (*reduce)(void *, void *)
|
||||
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_hyper_gather);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_hyper_gather);
|
||||
register kmp_team_t *team = this_thr->th.th_team;
|
||||
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
|
||||
register kmp_info_t **other_threads = team->t.t_threads;
|
||||
register kmp_uint new_state = KMP_BARRIER_UNUSED_STATE;
|
||||
register kmp_uint64 new_state = KMP_BARRIER_UNUSED_STATE;
|
||||
register kmp_uint32 num_threads = this_thr->th.th_team_nproc;
|
||||
register kmp_uint32 branch_bits = __kmp_barrier_gather_branch_bits[bt];
|
||||
register kmp_uint32 branch_factor = 1 << branch_bits;
|
||||
@@ -448,7 +452,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
register kmp_int32 parent_tid = tid & ~((1 << (level + branch_bits)) -1);
|
||||
|
||||
KA_TRACE(20, ("__kmp_hyper_barrier_gather: T#%d(%d:%d) releasing T#%d(%d:%d) "
|
||||
"arrived(%p): %u => %u\n", gtid, team->t.t_id, tid,
|
||||
"arrived(%p): %llu => %llu\n", gtid, team->t.t_id, tid,
|
||||
__kmp_gtid_from_tid(parent_tid, team), team->t.t_id, parent_tid,
|
||||
&thr_bar->b_arrived, thr_bar->b_arrived,
|
||||
thr_bar->b_arrived + KMP_BARRIER_STATE_BUMP));
|
||||
@@ -457,7 +461,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
a worker thread may not assume that the team is valid any more - it could be
|
||||
deallocated by the master thread at any time. */
|
||||
p_flag.set_waiter(other_threads[parent_tid]);
|
||||
p_flag.release();
|
||||
p_flag.release();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -476,7 +480,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
KMP_CACHE_PREFETCH(&other_threads[next_child_tid]->th.th_bar[bt].bb.b_arrived);
|
||||
#endif /* KMP_CACHE_MANAGE */
|
||||
KA_TRACE(20, ("__kmp_hyper_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%u) "
|
||||
"arrived(%p) == %u\n", gtid, team->t.t_id, tid,
|
||||
"arrived(%p) == %llu\n", gtid, team->t.t_id, tid,
|
||||
__kmp_gtid_from_tid(child_tid, team), team->t.t_id, child_tid,
|
||||
&child_bar->b_arrived, new_state));
|
||||
// Wait for child to arrive
|
||||
@@ -505,7 +509,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
|
||||
team->t.t_bar[bt].b_arrived += KMP_BARRIER_STATE_BUMP;
|
||||
else
|
||||
team->t.t_bar[bt].b_arrived = new_state;
|
||||
KA_TRACE(20, ("__kmp_hyper_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n",
|
||||
KA_TRACE(20, ("__kmp_hyper_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %llu\n",
|
||||
gtid, team->t.t_id, tid, team->t.t_id,
|
||||
&team->t.t_bar[bt].b_arrived, team->t.t_bar[bt].b_arrived));
|
||||
}
|
||||
@@ -520,7 +524,7 @@ __kmp_hyper_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gtid
|
||||
int propagate_icvs
|
||||
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_hyper_release);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_hyper_release);
|
||||
register kmp_team_t *team;
|
||||
register kmp_bstate_t *thr_bar = & this_thr -> th.th_bar[ bt ].bb;
|
||||
register kmp_info_t **other_threads;
|
||||
@@ -702,6 +706,8 @@ __kmp_init_hierarchical_barrier_thread(enum barrier_type bt, kmp_bstate_t *thr_b
|
||||
thr_bar->offset = 7-(tid-thr_bar->parent_tid-1);
|
||||
thr_bar->old_tid = tid;
|
||||
thr_bar->wait_flag = KMP_BARRIER_NOT_WAITING;
|
||||
thr_bar->team = team;
|
||||
thr_bar->parent_bar = &team->t.t_threads[thr_bar->parent_tid]->th.th_bar[bt].bb;
|
||||
}
|
||||
if (uninitialized || team_changed || tid_changed) {
|
||||
thr_bar->team = team;
|
||||
@@ -725,7 +731,7 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
|
||||
int gtid, int tid, void (*reduce) (void *, void *)
|
||||
USE_ITT_BUILD_ARG(void * itt_sync_obj) )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_hier_gather);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_hier_gather);
|
||||
register kmp_team_t *team = this_thr->th.th_team;
|
||||
register kmp_bstate_t *thr_bar = & this_thr->th.th_bar[bt].bb;
|
||||
register kmp_uint32 nproc = this_thr->th.th_team_nproc;
|
||||
@@ -733,9 +739,11 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
|
||||
register kmp_uint64 new_state;
|
||||
|
||||
int level = team->t.t_level;
|
||||
#if OMP_40_ENABLED
|
||||
if (other_threads[0]->th.th_teams_microtask) // are we inside the teams construct?
|
||||
if (this_thr->th.th_teams_size.nteams > 1)
|
||||
++level; // level was not increased in teams construct for team_of_masters
|
||||
#endif
|
||||
if (level == 1) thr_bar->use_oncore_barrier = 1;
|
||||
else thr_bar->use_oncore_barrier = 0; // Do not use oncore barrier when nested
|
||||
|
||||
@@ -757,7 +765,9 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
|
||||
new_state = (kmp_uint64)team->t.t_bar[bt].b_arrived + KMP_BARRIER_STATE_BUMP;
|
||||
if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME && thr_bar->use_oncore_barrier) {
|
||||
if (thr_bar->leaf_kids) { // First, wait for leaf children to check-in on my b_arrived flag
|
||||
kmp_uint64 leaf_state = KMP_MASTER_TID(tid) ? thr_bar->b_arrived | thr_bar->leaf_state : (kmp_uint64)team->t.t_bar[bt].b_arrived | thr_bar->leaf_state;
|
||||
kmp_uint64 leaf_state = KMP_MASTER_TID(tid) ? thr_bar->b_arrived | thr_bar->leaf_state : team->t.t_bar[bt].b_arrived | thr_bar->leaf_state;
|
||||
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) waiting for leaf kids\n",
|
||||
gtid, team->t.t_id, tid));
|
||||
kmp_flag_64 flag(&thr_bar->b_arrived, leaf_state);
|
||||
flag.wait(this_thr, FALSE
|
||||
USE_ITT_BUILD_ARG(itt_sync_obj) );
|
||||
@@ -779,7 +789,7 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
|
||||
register kmp_info_t *child_thr = other_threads[child_tid];
|
||||
register kmp_bstate_t *child_bar = &child_thr->th.th_bar[bt].bb;
|
||||
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%d) "
|
||||
"arrived(%p) == %u\n",
|
||||
"arrived(%p) == %llu\n",
|
||||
gtid, team->t.t_id, tid, __kmp_gtid_from_tid(child_tid, team),
|
||||
team->t.t_id, child_tid, &child_bar->b_arrived, new_state));
|
||||
kmp_flag_64 flag(&child_bar->b_arrived, new_state);
|
||||
@@ -802,7 +812,7 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
|
||||
register kmp_info_t *child_thr = other_threads[child_tid];
|
||||
register kmp_bstate_t *child_bar = &child_thr->th.th_bar[bt].bb;
|
||||
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%d) "
|
||||
"arrived(%p) == %u\n",
|
||||
"arrived(%p) == %llu\n",
|
||||
gtid, team->t.t_id, tid, __kmp_gtid_from_tid(child_tid, team),
|
||||
team->t.t_id, child_tid, &child_bar->b_arrived, new_state));
|
||||
kmp_flag_64 flag(&child_bar->b_arrived, new_state);
|
||||
@@ -822,7 +832,7 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
|
||||
|
||||
if (!KMP_MASTER_TID(tid)) { // worker threads release parent in hierarchy
|
||||
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) releasing T#%d(%d:%d) "
|
||||
"arrived(%p): %u => %u\n", gtid, team->t.t_id, tid,
|
||||
"arrived(%p): %llu => %llu\n", gtid, team->t.t_id, tid,
|
||||
__kmp_gtid_from_tid(thr_bar->parent_tid, team), team->t.t_id, thr_bar->parent_tid,
|
||||
&thr_bar->b_arrived, thr_bar->b_arrived, thr_bar->b_arrived+KMP_BARRIER_STATE_BUMP));
|
||||
/* Mark arrival to parent: After performing this write, a worker thread may not assume that
|
||||
@@ -833,14 +843,14 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
|
||||
flag.release();
|
||||
}
|
||||
else { // Leaf does special release on the "offset" bits of parent's b_arrived flag
|
||||
thr_bar->b_arrived = (kmp_uint64)team->t.t_bar[bt].b_arrived + KMP_BARRIER_STATE_BUMP;
|
||||
thr_bar->b_arrived = team->t.t_bar[bt].b_arrived + KMP_BARRIER_STATE_BUMP;
|
||||
kmp_flag_oncore flag(&thr_bar->parent_bar->b_arrived, thr_bar->offset);
|
||||
flag.set_waiter(other_threads[thr_bar->parent_tid]);
|
||||
flag.release();
|
||||
}
|
||||
} else { // Master thread needs to update the team's b_arrived value
|
||||
team->t.t_bar[bt].b_arrived = (kmp_uint32)new_state;
|
||||
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n",
|
||||
team->t.t_bar[bt].b_arrived = new_state;
|
||||
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %llu\n",
|
||||
gtid, team->t.t_id, tid, team->t.t_id, &team->t.t_bar[bt].b_arrived, team->t.t_bar[bt].b_arrived));
|
||||
}
|
||||
// Is the team access below unsafe or just technically invalid?
|
||||
@@ -853,7 +863,7 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i
|
||||
int propagate_icvs
|
||||
USE_ITT_BUILD_ARG(void * itt_sync_obj) )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_hier_release);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_hier_release);
|
||||
register kmp_team_t *team;
|
||||
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
|
||||
register kmp_uint32 nproc;
|
||||
@@ -882,8 +892,7 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i
|
||||
kmp_flag_oncore flag(&thr_bar->parent_bar->b_go, KMP_BARRIER_STATE_BUMP, thr_bar->offset,
|
||||
bt, this_thr
|
||||
USE_ITT_BUILD_ARG(itt_sync_obj) );
|
||||
flag.wait(this_thr, TRUE
|
||||
USE_ITT_BUILD_ARG(itt_sync_obj) );
|
||||
flag.wait(this_thr, TRUE);
|
||||
if (thr_bar->wait_flag == KMP_BARRIER_SWITCHING) { // Thread was switched to own b_go
|
||||
TCW_8(thr_bar->b_go, KMP_INIT_BARRIER_STATE); // Reset my b_go flag for next time
|
||||
}
|
||||
@@ -905,16 +914,18 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i
|
||||
KMP_MB(); // Flush all pending memory write invalidates.
|
||||
}
|
||||
|
||||
nproc = this_thr->th.th_team_nproc;
|
||||
int level = team->t.t_level;
|
||||
#if OMP_40_ENABLED
|
||||
if (team->t.t_threads[0]->th.th_teams_microtask ) { // are we inside the teams construct?
|
||||
if (team->t.t_pkfn != (microtask_t)__kmp_teams_master && this_thr->th.th_teams_level == level)
|
||||
++level; // level was not increased in teams construct for team_of_workers
|
||||
if( this_thr->th.th_teams_size.nteams > 1 )
|
||||
++level; // level was not increased in teams construct for team_of_masters
|
||||
}
|
||||
#endif
|
||||
if (level == 1) thr_bar->use_oncore_barrier = 1;
|
||||
else thr_bar->use_oncore_barrier = 0; // Do not use oncore barrier when nested
|
||||
nproc = this_thr->th.th_team_nproc;
|
||||
|
||||
// If the team size has increased, we still communicate with old leaves via oncore barrier.
|
||||
unsigned short int old_leaf_kids = thr_bar->leaf_kids;
|
||||
@@ -925,6 +936,7 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i
|
||||
|
||||
#if KMP_BARRIER_ICV_PUSH
|
||||
if (propagate_icvs) {
|
||||
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[tid], team, tid, FALSE);
|
||||
if (KMP_MASTER_TID(tid)) { // master already has copy in final destination; copy
|
||||
copy_icvs(&thr_bar->th_fixed_icvs, &team->t.t_implicit_task_taskdata[tid].td_icvs);
|
||||
}
|
||||
@@ -1035,7 +1047,9 @@ int
|
||||
__kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
void *reduce_data, void (*reduce)(void *, void *))
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_barrier);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_barrier);
|
||||
KMP_SET_THREAD_STATE_BLOCK(PLAIN_BARRIER);
|
||||
KMP_TIME_PARTITIONED_BLOCK(OMP_plain_barrier);
|
||||
register int tid = __kmp_tid_from_gtid(gtid);
|
||||
register kmp_info_t *this_thr = __kmp_threads[gtid];
|
||||
register kmp_team_t *team = this_thr->th.th_team;
|
||||
@@ -1050,25 +1064,23 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
gtid, __kmp_team_from_gtid(gtid)->t.t_id, __kmp_tid_from_gtid(gtid)));
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
#if OMPT_BLAME
|
||||
if (ompt_status == ompt_status_track_callback) {
|
||||
my_task_id = team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id;
|
||||
my_parallel_id = team->t.ompt_team_info.parallel_id;
|
||||
my_task_id = team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id;
|
||||
my_parallel_id = team->t.ompt_team_info.parallel_id;
|
||||
|
||||
#if OMPT_TRACE
|
||||
if (this_thr->th.ompt_thread_info.state == ompt_state_wait_single) {
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_single_others_end)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_single_others_end)(
|
||||
my_parallel_id, my_task_id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_barrier_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_barrier_begin)(
|
||||
if (this_thr->th.ompt_thread_info.state == ompt_state_wait_single) {
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_single_others_end)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_single_others_end)(
|
||||
my_parallel_id, my_task_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_barrier_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_barrier_begin)(
|
||||
my_parallel_id, my_task_id);
|
||||
}
|
||||
#endif
|
||||
// It is OK to report the barrier state after the barrier begin callback.
|
||||
// According to the OMPT specification, a compliant implementation may
|
||||
@@ -1116,6 +1128,10 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
//KMP_DEBUG_ASSERT( is_split == TRUE ); // #C69956
|
||||
this_thr->th.th_local.reduce_data = reduce_data;
|
||||
}
|
||||
|
||||
if (KMP_MASTER_TID(tid) && __kmp_tasking_mode != tskm_immediate_exec)
|
||||
__kmp_task_team_setup(this_thr, team, 0); // use 0 to only setup the current team if nthreads > 1
|
||||
|
||||
switch (__kmp_barrier_gather_pattern[bt]) {
|
||||
case bp_hyper_bar: {
|
||||
KMP_ASSERT(__kmp_barrier_gather_branch_bits[bt]); // don't set branch bits to 0; use linear
|
||||
@@ -1147,7 +1163,6 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
if (__kmp_tasking_mode != tskm_immediate_exec) {
|
||||
__kmp_task_team_wait(this_thr, team
|
||||
USE_ITT_BUILD_ARG(itt_sync_obj) );
|
||||
__kmp_task_team_setup(this_thr, team, 0, 0); // use 0,0 to only setup the current team if nthreads > 1
|
||||
}
|
||||
#if USE_DEBUGGER
|
||||
// Let the debugger know: All threads are arrived and starting leaving the barrier.
|
||||
@@ -1185,8 +1200,11 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
if( __itt_metadata_add_ptr ) {
|
||||
// Initialize with master's wait time
|
||||
kmp_uint64 delta = cur_time - this_thr->th.th_bar_arrive_time;
|
||||
// Set arrive time to zero to be able to check it in __kmp_invoke_task(); the same is done inside the loop below
|
||||
this_thr->th.th_bar_arrive_time = 0;
|
||||
for (i=1; i<nproc; ++i) {
|
||||
delta += ( cur_time - other_threads[i]->th.th_bar_arrive_time );
|
||||
other_threads[i]->th.th_bar_arrive_time = 0;
|
||||
}
|
||||
__kmp_itt_metadata_imbalance(gtid, this_thr->th.th_frame_time, cur_time, delta, (kmp_uint64)( reduce != NULL));
|
||||
}
|
||||
@@ -1242,7 +1260,7 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
} else { // Team is serialized.
|
||||
status = 0;
|
||||
if (__kmp_tasking_mode != tskm_immediate_exec) {
|
||||
#if OMP_41_ENABLED
|
||||
#if OMP_45_ENABLED
|
||||
if ( this_thr->th.th_task_team != NULL ) {
|
||||
void *itt_sync_obj = NULL;
|
||||
#if USE_ITT_NOTIFY
|
||||
@@ -1252,12 +1270,10 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
}
|
||||
#endif
|
||||
|
||||
kmp_task_team_t * task_team;
|
||||
task_team = this_thr->th.th_task_team;
|
||||
KMP_DEBUG_ASSERT(task_team->tt.tt_found_proxy_tasks == TRUE);
|
||||
KMP_DEBUG_ASSERT(this_thr->th.th_task_team->tt.tt_found_proxy_tasks == TRUE);
|
||||
__kmp_task_team_wait(this_thr, team
|
||||
USE_ITT_BUILD_ARG(itt_sync_obj));
|
||||
__kmp_task_team_setup(this_thr, team, 0, 0);
|
||||
__kmp_task_team_setup(this_thr, team, 0);
|
||||
|
||||
#if USE_ITT_BUILD
|
||||
if (__itt_sync_create_ptr || KMP_ITT_DEBUG)
|
||||
@@ -1275,10 +1291,9 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
gtid, __kmp_team_from_gtid(gtid)->t.t_id, __kmp_tid_from_gtid(gtid), status));
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
#if OMPT_BLAME
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_barrier_end)) {
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_barrier_end)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_barrier_end)(
|
||||
my_parallel_id, my_task_id);
|
||||
}
|
||||
@@ -1294,7 +1309,7 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
|
||||
void
|
||||
__kmp_end_split_barrier(enum barrier_type bt, int gtid)
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_end_split_barrier);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_end_split_barrier);
|
||||
int tid = __kmp_tid_from_gtid(gtid);
|
||||
kmp_info_t *this_thr = __kmp_threads[gtid];
|
||||
kmp_team_t *team = this_thr->th.th_team;
|
||||
@@ -1335,7 +1350,9 @@ __kmp_end_split_barrier(enum barrier_type bt, int gtid)
|
||||
void
|
||||
__kmp_join_barrier(int gtid)
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_join_barrier);
|
||||
KMP_TIME_PARTITIONED_BLOCK(OMP_fork_join_barrier);
|
||||
KMP_SET_THREAD_STATE_BLOCK(FORK_JOIN_BARRIER);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_join_barrier);
|
||||
register kmp_info_t *this_thr = __kmp_threads[gtid];
|
||||
register kmp_team_t *team;
|
||||
register kmp_uint nproc;
|
||||
@@ -1378,9 +1395,9 @@ __kmp_join_barrier(int gtid)
|
||||
KMP_DEBUG_ASSERT(this_thr == team->t.t_threads[tid]);
|
||||
KA_TRACE(10, ("__kmp_join_barrier: T#%d(%d:%d) arrived at join barrier\n", gtid, team_id, tid));
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
#if OMPT_SUPPORT
|
||||
#if OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_barrier_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_barrier_begin)(
|
||||
team->t.ompt_team_info.parallel_id,
|
||||
@@ -1447,11 +1464,21 @@ __kmp_join_barrier(int gtid)
|
||||
the kmp_task_team_t structs. */
|
||||
if (KMP_MASTER_TID(tid)) {
|
||||
if (__kmp_tasking_mode != tskm_immediate_exec) {
|
||||
// Master shouldn't call decrease_load(). // TODO: enable master threads.
|
||||
// Master should have th_may_decrease_load == 0. // TODO: enable master threads.
|
||||
__kmp_task_team_wait(this_thr, team
|
||||
USE_ITT_BUILD_ARG(itt_sync_obj) );
|
||||
}
|
||||
#if KMP_STATS_ENABLED
|
||||
// Have master thread flag the workers to indicate they are now waiting for
|
||||
// next parallel region, Also wake them up so they switch their timers to idle.
|
||||
for (int i=0; i<team->t.t_nproc; ++i) {
|
||||
kmp_info_t* team_thread = team->t.t_threads[i];
|
||||
if (team_thread == this_thr)
|
||||
continue;
|
||||
team_thread->th.th_stats->setIdleFlag();
|
||||
if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME && team_thread->th.th_sleep_loc != NULL)
|
||||
__kmp_null_resume_wrapper(__kmp_gtid_from_thread(team_thread), team_thread->th.th_sleep_loc);
|
||||
}
|
||||
#endif
|
||||
#if USE_ITT_BUILD
|
||||
if (__itt_sync_create_ptr || KMP_ITT_DEBUG)
|
||||
__kmp_itt_barrier_middle(gtid, itt_sync_obj);
|
||||
@@ -1481,8 +1508,11 @@ __kmp_join_barrier(int gtid)
|
||||
if( __itt_metadata_add_ptr ) {
|
||||
// Initialize with master's wait time
|
||||
kmp_uint64 delta = cur_time - this_thr->th.th_bar_arrive_time;
|
||||
// Set arrive time to zero to be able to check it in __kmp_invoke_task(); the same is done inside the loop below
|
||||
this_thr->th.th_bar_arrive_time = 0;
|
||||
for (i=1; i<nproc; ++i) {
|
||||
delta += ( cur_time - other_threads[i]->th.th_bar_arrive_time );
|
||||
other_threads[i]->th.th_bar_arrive_time = 0;
|
||||
}
|
||||
__kmp_itt_metadata_imbalance(gtid, this_thr->th.th_frame_time, cur_time, delta, 0);
|
||||
}
|
||||
@@ -1512,14 +1542,13 @@ __kmp_join_barrier(int gtid)
|
||||
KA_TRACE(10, ("__kmp_join_barrier: T#%d(%d:%d) leaving\n", gtid, team_id, tid));
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
#if OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_barrier_end)) {
|
||||
if (ompt_enabled) {
|
||||
#if OMPT_BLAME
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_barrier_end)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_barrier_end)(
|
||||
team->t.ompt_team_info.parallel_id,
|
||||
team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// return to default state
|
||||
@@ -1533,7 +1562,9 @@ __kmp_join_barrier(int gtid)
|
||||
void
|
||||
__kmp_fork_barrier(int gtid, int tid)
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_fork_barrier);
|
||||
KMP_TIME_PARTITIONED_BLOCK(OMP_fork_join_barrier);
|
||||
KMP_SET_THREAD_STATE_BLOCK(FORK_JOIN_BARRIER);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_fork_barrier);
|
||||
kmp_info_t *this_thr = __kmp_threads[gtid];
|
||||
kmp_team_t *team = (tid == 0) ? this_thr->th.th_team : NULL;
|
||||
#if USE_ITT_BUILD
|
||||
@@ -1573,7 +1604,7 @@ __kmp_fork_barrier(int gtid, int tid)
|
||||
#endif
|
||||
|
||||
if (__kmp_tasking_mode != tskm_immediate_exec) {
|
||||
__kmp_task_team_setup(this_thr, team, 1, 0); // 1,0 indicates setup both task teams if nthreads > 1
|
||||
__kmp_task_team_setup(this_thr, team, 0); // 0 indicates setup current task team if nthreads > 1
|
||||
}
|
||||
|
||||
/* The master thread may have changed its blocktime between the join barrier and the
|
||||
@@ -1612,14 +1643,7 @@ __kmp_fork_barrier(int gtid, int tid)
|
||||
|
||||
// Early exit for reaping threads releasing forkjoin barrier
|
||||
if (TCR_4(__kmp_global.g.g_done)) {
|
||||
if (this_thr->th.th_task_team != NULL) {
|
||||
if (KMP_MASTER_TID(tid)) {
|
||||
TCW_PTR(this_thr->th.th_task_team, NULL);
|
||||
}
|
||||
else {
|
||||
__kmp_unref_task_team(this_thr->th.th_task_team, this_thr);
|
||||
}
|
||||
}
|
||||
this_thr->th.th_task_team = NULL;
|
||||
|
||||
#if USE_ITT_BUILD && USE_ITT_NOTIFY
|
||||
if (__itt_sync_create_ptr || KMP_ITT_DEBUG) {
|
||||
@@ -1648,15 +1672,16 @@ __kmp_fork_barrier(int gtid, int tid)
|
||||
this data before this function is called. We cannot modify __kmp_fork_call() to look at
|
||||
the fixed ICVs in the master's thread struct, because it is not always the case that the
|
||||
threads arrays have been allocated when __kmp_fork_call() is executed. */
|
||||
KMP_START_EXPLICIT_TIMER(USER_icv_copy);
|
||||
if (!KMP_MASTER_TID(tid)) { // master thread already has ICVs
|
||||
// Copy the initial ICVs from the master's thread struct to the implicit task for this tid.
|
||||
KA_TRACE(10, ("__kmp_fork_barrier: T#%d(%d) is PULLing ICVs\n", gtid, tid));
|
||||
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[tid], team, tid, FALSE);
|
||||
copy_icvs(&team->t.t_implicit_task_taskdata[tid].td_icvs,
|
||||
&team->t.t_threads[0]->th.th_bar[bs_forkjoin_barrier].bb.th_fixed_icvs);
|
||||
{
|
||||
KMP_TIME_DEVELOPER_BLOCK(USER_icv_copy);
|
||||
if (!KMP_MASTER_TID(tid)) { // master thread already has ICVs
|
||||
// Copy the initial ICVs from the master's thread struct to the implicit task for this tid.
|
||||
KA_TRACE(10, ("__kmp_fork_barrier: T#%d(%d) is PULLing ICVs\n", gtid, tid));
|
||||
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[tid], team, tid, FALSE);
|
||||
copy_icvs(&team->t.t_implicit_task_taskdata[tid].td_icvs,
|
||||
&team->t.t_threads[0]->th.th_bar[bs_forkjoin_barrier].bb.th_fixed_icvs);
|
||||
}
|
||||
}
|
||||
KMP_STOP_EXPLICIT_TIMER(USER_icv_copy);
|
||||
#endif // KMP_BARRIER_ICV_PULL
|
||||
|
||||
if (__kmp_tasking_mode != tskm_immediate_exec) {
|
||||
@@ -1702,7 +1727,7 @@ __kmp_fork_barrier(int gtid, int tid)
|
||||
void
|
||||
__kmp_setup_icv_copy(kmp_team_t *team, int new_nproc, kmp_internal_control_t *new_icvs, ident_t *loc )
|
||||
{
|
||||
KMP_TIME_BLOCK(KMP_setup_icv_copy);
|
||||
KMP_TIME_DEVELOPER_BLOCK(KMP_setup_icv_copy);
|
||||
|
||||
KMP_DEBUG_ASSERT(team && new_nproc && new_icvs);
|
||||
KMP_DEBUG_ASSERT((!TCR_4(__kmp_init_parallel)) || new_icvs->nproc);
|
||||
|
||||
+25
-25
@@ -29,12 +29,12 @@ Request cancellation of the binding OpenMP region.
|
||||
*/
|
||||
kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
||||
kmp_info_t *this_thr = __kmp_threads [ gtid ];
|
||||
|
||||
|
||||
KC_TRACE( 10, ("__kmpc_cancel: T#%d request %d OMP_CANCELLATION=%d\n", gtid, cncl_kind, __kmp_omp_cancellation) );
|
||||
|
||||
KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
|
||||
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
|
||||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
|
||||
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
|
||||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
|
||||
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
|
||||
|
||||
if (__kmp_omp_cancellation) {
|
||||
@@ -49,7 +49,7 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
||||
KMP_DEBUG_ASSERT(this_team);
|
||||
kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(&(this_team->t.t_cancel_request), cancel_noreq, cncl_kind);
|
||||
if (old == cancel_noreq || old == cncl_kind) {
|
||||
//printf("__kmpc_cancel: this_team->t.t_cancel_request=%d @ %p\n",
|
||||
//printf("__kmpc_cancel: this_team->t.t_cancel_request=%d @ %p\n",
|
||||
// this_team->t.t_cancel_request, &(this_team->t.t_cancel_request));
|
||||
// we do not have a cancellation request in this team or we do have one
|
||||
// that matches the current request -> cancel
|
||||
@@ -58,15 +58,15 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
||||
break;
|
||||
}
|
||||
case cancel_taskgroup:
|
||||
// cancellation requests for parallel and worksharing constructs
|
||||
// cancellation requests for a task group
|
||||
// are handled through the taskgroup structure
|
||||
{
|
||||
kmp_taskdata_t* task;
|
||||
kmp_taskdata_t* task;
|
||||
kmp_taskgroup_t* taskgroup;
|
||||
|
||||
|
||||
task = this_thr->th.th_current_task;
|
||||
KMP_DEBUG_ASSERT( task );
|
||||
|
||||
|
||||
taskgroup = task->td_taskgroup;
|
||||
if (taskgroup) {
|
||||
kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(&(taskgroup->cancel_request), cancel_noreq, cncl_kind);
|
||||
@@ -100,7 +100,7 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
||||
@param gtid Global thread ID of encountering thread
|
||||
@param cncl_kind Cancellation kind (parallel, for, sections, taskgroup)
|
||||
|
||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
||||
encountering thread has to cancel..
|
||||
|
||||
Cancellation point for the encountering thread.
|
||||
@@ -111,8 +111,8 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
|
||||
KC_TRACE( 10, ("__kmpc_cancellationpoint: T#%d request %d OMP_CANCELLATION=%d\n", gtid, cncl_kind, __kmp_omp_cancellation) );
|
||||
|
||||
KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
|
||||
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
|
||||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
|
||||
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
|
||||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
|
||||
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
|
||||
|
||||
if (__kmp_omp_cancellation) {
|
||||
@@ -141,18 +141,18 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
|
||||
break;
|
||||
}
|
||||
case cancel_taskgroup:
|
||||
// cancellation requests for parallel and worksharing constructs
|
||||
// cancellation requests for a task group
|
||||
// are handled through the taskgroup structure
|
||||
{
|
||||
kmp_taskdata_t* task;
|
||||
kmp_taskdata_t* task;
|
||||
kmp_taskgroup_t* taskgroup;
|
||||
|
||||
|
||||
task = this_thr->th.th_current_task;
|
||||
KMP_DEBUG_ASSERT( task );
|
||||
|
||||
|
||||
taskgroup = task->td_taskgroup;
|
||||
if (taskgroup) {
|
||||
// return the current status of cancellation for the
|
||||
// return the current status of cancellation for the
|
||||
// taskgroup
|
||||
return !!taskgroup->cancel_request;
|
||||
}
|
||||
@@ -178,11 +178,11 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
|
||||
@param loc_ref location of the original task directive
|
||||
@param gtid Global thread ID of encountering thread
|
||||
|
||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
||||
encountering thread has to cancel..
|
||||
|
||||
Barrier with cancellation point to send threads from the barrier to the
|
||||
end of the parallel region. Needs a special code pattern as documented
|
||||
end of the parallel region. Needs a special code pattern as documented
|
||||
in the design document for the cancellation feature.
|
||||
*/
|
||||
kmp_int32
|
||||
@@ -208,7 +208,7 @@ __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
|
||||
__kmpc_barrier(loc, gtid);
|
||||
this_team->t.t_cancel_request = cancel_noreq;
|
||||
// the next barrier is the fork/join barrier, which
|
||||
// synchronizes the threads leaving here
|
||||
// synchronizes the threads leaving here
|
||||
break;
|
||||
case cancel_loop:
|
||||
case cancel_sections:
|
||||
@@ -233,7 +233,7 @@ __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
|
||||
KMP_ASSERT ( 0 /* false */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -242,21 +242,21 @@ __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
|
||||
@param loc_ref location of the original task directive
|
||||
@param gtid Global thread ID of encountering thread
|
||||
|
||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
||||
encountering thread has to cancel..
|
||||
|
||||
Query function to query the current status of cancellation requests.
|
||||
Can be used to implement the following pattern:
|
||||
|
||||
|
||||
if (kmp_get_cancellation_status(kmp_cancel_parallel)) {
|
||||
perform_cleanup();
|
||||
#pragma omp cancellation point parallel
|
||||
#pragma omp cancellation point parallel
|
||||
}
|
||||
*/
|
||||
int __kmp_get_cancellation_status(int cancel_kind) {
|
||||
if (__kmp_omp_cancellation) {
|
||||
kmp_info_t *this_thr = __kmp_entry_thread();
|
||||
|
||||
|
||||
switch (cancel_kind) {
|
||||
case cancel_parallel:
|
||||
case cancel_loop:
|
||||
@@ -267,7 +267,7 @@ int __kmp_get_cancellation_status(int cancel_kind) {
|
||||
}
|
||||
case cancel_taskgroup:
|
||||
{
|
||||
kmp_taskdata_t* task;
|
||||
kmp_taskdata_t* task;
|
||||
kmp_taskgroup_t* taskgroup;
|
||||
task = this_thr->th.th_current_task;
|
||||
taskgroup = task->td_taskgroup;
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* kmp_config.h -- Feature macros
|
||||
*/
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.txt for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef KMP_CONFIG_H
|
||||
#define KMP_CONFIG_H
|
||||
|
||||
#include "kmp_platform.h"
|
||||
|
||||
// cmakedefine01 MACRO will define MACRO as either 0 or 1
|
||||
// cmakedefine MACRO 1 will define MACRO as 1 or leave undefined
|
||||
#cmakedefine01 DEBUG_BUILD
|
||||
#cmakedefine01 RELWITHDEBINFO_BUILD
|
||||
#cmakedefine01 LIBOMP_USE_ITT_NOTIFY
|
||||
#define USE_ITT_NOTIFY LIBOMP_USE_ITT_NOTIFY
|
||||
#if ! LIBOMP_USE_ITT_NOTIFY
|
||||
# define INTEL_NO_ITTNOTIFY_API
|
||||
#endif
|
||||
#cmakedefine01 LIBOMP_USE_VERSION_SYMBOLS
|
||||
#if LIBOMP_USE_VERSION_SYMBOLS
|
||||
# define KMP_USE_VERSION_SYMBOLS
|
||||
#endif
|
||||
#cmakedefine01 LIBOMP_HAVE_WEAK_ATTRIBUTE
|
||||
#define KMP_HAVE_WEAK_ATTRIBUTE LIBOMP_HAVE_WEAK_ATTRIBUTE
|
||||
#cmakedefine01 LIBOMP_HAVE_PSAPI
|
||||
#define KMP_HAVE_PSAPI LIBOMP_HAVE_PSAPI
|
||||
#cmakedefine01 LIBOMP_STATS
|
||||
#define KMP_STATS_ENABLED LIBOMP_STATS
|
||||
#cmakedefine01 LIBOMP_HAVE_X86INTRIN_H
|
||||
#define KMP_HAVE_X86INTRIN_H LIBOMP_HAVE_X86INTRIN_H
|
||||
#cmakedefine01 LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER
|
||||
#define KMP_HAVE___BUILTIN_READCYCLECOUNTER LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER
|
||||
#cmakedefine01 LIBOMP_HAVE___RDTSC
|
||||
#define KMP_HAVE___RDTSC LIBOMP_HAVE___RDTSC
|
||||
#cmakedefine01 LIBOMP_USE_DEBUGGER
|
||||
#define USE_DEBUGGER LIBOMP_USE_DEBUGGER
|
||||
#cmakedefine01 LIBOMP_OMPT_DEBUG
|
||||
#define OMPT_DEBUG LIBOMP_OMPT_DEBUG
|
||||
#cmakedefine01 LIBOMP_OMPT_SUPPORT
|
||||
#define OMPT_SUPPORT LIBOMP_OMPT_SUPPORT
|
||||
#cmakedefine01 LIBOMP_OMPT_BLAME
|
||||
#define OMPT_BLAME LIBOMP_OMPT_BLAME
|
||||
#cmakedefine01 LIBOMP_OMPT_TRACE
|
||||
#define OMPT_TRACE LIBOMP_OMPT_TRACE
|
||||
#cmakedefine01 LIBOMP_USE_ADAPTIVE_LOCKS
|
||||
#define KMP_USE_ADAPTIVE_LOCKS LIBOMP_USE_ADAPTIVE_LOCKS
|
||||
#define KMP_DEBUG_ADAPTIVE_LOCKS 0
|
||||
#cmakedefine01 LIBOMP_USE_INTERNODE_ALIGNMENT
|
||||
#define KMP_USE_INTERNODE_ALIGNMENT LIBOMP_USE_INTERNODE_ALIGNMENT
|
||||
#cmakedefine01 LIBOMP_ENABLE_ASSERTIONS
|
||||
#define KMP_USE_ASSERT LIBOMP_ENABLE_ASSERTIONS
|
||||
#cmakedefine01 STUBS_LIBRARY
|
||||
#cmakedefine01 LIBOMP_USE_HWLOC
|
||||
#define KMP_USE_HWLOC LIBOMP_USE_HWLOC
|
||||
#define KMP_ARCH_STR "@LIBOMP_LEGAL_ARCH@"
|
||||
#define KMP_LIBRARY_FILE "@LIBOMP_LIB_FILE@"
|
||||
#define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
|
||||
#define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
|
||||
#define LIBOMP_OMP_VERSION @LIBOMP_OMP_VERSION@
|
||||
#define OMP_50_ENABLED (LIBOMP_OMP_VERSION >= 50)
|
||||
#define OMP_45_ENABLED (LIBOMP_OMP_VERSION >= 45)
|
||||
#define OMP_40_ENABLED (LIBOMP_OMP_VERSION >= 40)
|
||||
#define OMP_30_ENABLED (LIBOMP_OMP_VERSION >= 30)
|
||||
|
||||
// Configured cache line based on architecture
|
||||
#if KMP_ARCH_PPC64
|
||||
# define CACHE_LINE 128
|
||||
#else
|
||||
# define CACHE_LINE 64
|
||||
#endif
|
||||
|
||||
#if ! KMP_32_BIT_ARCH
|
||||
# define BUILD_I8 1
|
||||
#endif
|
||||
|
||||
#define KMP_DYNAMIC_LIB 1
|
||||
#define KMP_NESTED_HOT_TEAMS 1
|
||||
#define KMP_ADJUST_BLOCKTIME 1
|
||||
#define BUILD_PARALLEL_ORDERED 1
|
||||
#define KMP_ASM_INTRINS 1
|
||||
#define USE_ITT_BUILD LIBOMP_USE_ITT_NOTIFY
|
||||
#define INTEL_ITTNOTIFY_PREFIX __kmp_itt_
|
||||
#if ! KMP_MIC
|
||||
# define USE_LOAD_BALANCE 1
|
||||
#endif
|
||||
#if ! (KMP_OS_WINDOWS || KMP_OS_DARWIN)
|
||||
# define KMP_TDATA_GTID 1
|
||||
#endif
|
||||
#if STUBS_LIBRARY
|
||||
# define KMP_STUB 1
|
||||
#endif
|
||||
#if DEBUG_BUILD || RELWITHDEBINFO_BUILD
|
||||
# define KMP_DEBUG 1
|
||||
#endif
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
# define KMP_WIN_CDECL
|
||||
#else
|
||||
# define BUILD_TV
|
||||
# define KMP_GOMP_COMPAT
|
||||
#endif
|
||||
|
||||
#endif // KMP_CONFIG_H
|
||||
+769
-261
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@
|
||||
|
||||
#define __KMP_BUILD_ASSERT( expr, suffix ) typedef char __kmp_build_check_##suffix[ (expr) ? 1 : -1 ]
|
||||
#define _KMP_BUILD_ASSERT( expr, suffix ) __KMP_BUILD_ASSERT( (expr), suffix )
|
||||
#ifdef KMP_USE_ASSERT
|
||||
#ifdef KMP_USE_ASSERT
|
||||
#define KMP_BUILD_ASSERT( expr ) _KMP_BUILD_ASSERT( (expr), __LINE__ )
|
||||
#else
|
||||
#define KMP_BUILD_ASSERT( expr ) /* nothing to do */
|
||||
|
||||
@@ -93,7 +93,7 @@ __kmp_omp_debug_struct_info = {
|
||||
sizeof( void * ),
|
||||
OMP_LOCK_T_SIZE < sizeof(void *),
|
||||
bs_last_barrier,
|
||||
TASK_DEQUE_SIZE,
|
||||
INITIAL_TASK_DEQUE_SIZE,
|
||||
|
||||
// thread structure information
|
||||
sizeof( kmp_base_info_t ),
|
||||
@@ -110,11 +110,13 @@ __kmp_omp_debug_struct_info = {
|
||||
offset_and_size_of( kmp_base_info_t, th_bar ),
|
||||
offset_and_size_of( kmp_bstate_t, b_worker_arrived ),
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
// teams information
|
||||
offset_and_size_of( kmp_base_info_t, th_teams_microtask),
|
||||
offset_and_size_of( kmp_base_info_t, th_teams_level),
|
||||
offset_and_size_of( kmp_teams_size_t, nteams ),
|
||||
offset_and_size_of( kmp_teams_size_t, nth ),
|
||||
#endif
|
||||
|
||||
// kmp_desc structure (for info field above)
|
||||
sizeof( kmp_desc_base_t ),
|
||||
@@ -140,7 +142,9 @@ __kmp_omp_debug_struct_info = {
|
||||
offset_and_size_of( kmp_base_team_t, t_pkfn ),
|
||||
offset_and_size_of( kmp_base_team_t, t_task_team ),
|
||||
offset_and_size_of( kmp_base_team_t, t_implicit_task_taskdata ),
|
||||
#if OMP_40_ENABLED
|
||||
offset_and_size_of( kmp_base_team_t, t_cancel_request ),
|
||||
#endif
|
||||
offset_and_size_of( kmp_base_team_t, t_bar ),
|
||||
offset_and_size_of( kmp_balign_team_t, b_master_arrived ),
|
||||
offset_and_size_of( kmp_balign_team_t, b_team_arrived ),
|
||||
@@ -200,6 +204,7 @@ __kmp_omp_debug_struct_info = {
|
||||
offset_and_size_of( kmp_taskdata_t, td_taskwait_counter ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_taskwait_thread ),
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
offset_and_size_of( kmp_taskdata_t, td_taskgroup ),
|
||||
offset_and_size_of( kmp_taskgroup_t, count ),
|
||||
offset_and_size_of( kmp_taskgroup_t, cancel_request ),
|
||||
@@ -211,11 +216,13 @@ __kmp_omp_debug_struct_info = {
|
||||
offset_and_size_of( kmp_base_depnode_t, task ),
|
||||
offset_and_size_of( kmp_base_depnode_t, npredecessors ),
|
||||
offset_and_size_of( kmp_base_depnode_t, nrefs ),
|
||||
#endif
|
||||
offset_and_size_of( kmp_task_t, routine ),
|
||||
|
||||
// thread_data_t.
|
||||
sizeof( kmp_thread_data_t ),
|
||||
offset_and_size_of( kmp_base_thread_data_t, td_deque ),
|
||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_size ),
|
||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_head ),
|
||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_tail ),
|
||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_ntasks ),
|
||||
|
||||
@@ -23,19 +23,19 @@
|
||||
|
||||
/* * This external variable can be set by any debugger to flag to the runtime that we
|
||||
are currently executing inside a debugger. This will allow the debugger to override
|
||||
the number of threads spawned in a parallel region by using __kmp_omp_num_threads() (below).
|
||||
* When __kmp_debugging is TRUE, each team and each task gets a unique integer identifier
|
||||
the number of threads spawned in a parallel region by using __kmp_omp_num_threads() (below).
|
||||
* When __kmp_debugging is TRUE, each team and each task gets a unique integer identifier
|
||||
that can be used by debugger to conveniently identify teams and tasks.
|
||||
* The debugger has access to __kmp_omp_debug_struct_info which contains information
|
||||
about the OpenMP library's important internal structures. This access will allow the debugger
|
||||
about the OpenMP library's important internal structures. This access will allow the debugger
|
||||
to read detailed information from the typical OpenMP constructs (teams, threads, tasking, etc. )
|
||||
during a debugging session and offer detailed and useful information which the user can probe
|
||||
about the OpenMP portion of their code.
|
||||
*/
|
||||
extern int __kmp_debugging; /* Boolean whether currently debugging OpenMP RTL */
|
||||
// Return number of threads specified by the debugger for given parallel region.
|
||||
/* The ident field, which represents a source file location, is used to check if the
|
||||
debugger has changed the number of threads for the parallel region at source file
|
||||
/* The ident field, which represents a source file location, is used to check if the
|
||||
debugger has changed the number of threads for the parallel region at source file
|
||||
location ident. This way, specific parallel regions' number of threads can be changed
|
||||
at the debugger's request.
|
||||
*/
|
||||
|
||||
+271
-161
@@ -25,6 +25,12 @@
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
// Need to raise Win version from XP to Vista here for support of InterlockedExchange64
|
||||
#if defined(_WIN32_WINNT) && defined(_M_IX86)
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#endif
|
||||
|
||||
#include "kmp.h"
|
||||
#include "kmp_i18n.h"
|
||||
#include "kmp_itt.h"
|
||||
@@ -71,7 +77,7 @@ struct i_maxmin< unsigned long long > {
|
||||
};
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifdef KMP_STATIC_STEAL_ENABLED
|
||||
#if KMP_STATIC_STEAL_ENABLED
|
||||
|
||||
// replaces dispatch_private_info{32,64} structures and dispatch_private_info{32,64}_t types
|
||||
template< typename T >
|
||||
@@ -163,7 +169,7 @@ struct dispatch_shared_infoXX_template {
|
||||
volatile UT iteration;
|
||||
volatile UT num_done;
|
||||
volatile UT ordered_iteration;
|
||||
UT ordered_dummy[KMP_MAX_ORDERED-1]; // to retain the structure size making ordered_iteration scalar
|
||||
UT ordered_dummy[KMP_MAX_ORDERED-3]; // to retain the structure size making ordered_iteration scalar
|
||||
};
|
||||
|
||||
// replaces dispatch_shared_info structure and dispatch_shared_info_t type
|
||||
@@ -175,6 +181,17 @@ struct dispatch_shared_info_template {
|
||||
dispatch_shared_info64_t s64;
|
||||
} u;
|
||||
volatile kmp_uint32 buffer_index;
|
||||
#if OMP_45_ENABLED
|
||||
volatile kmp_int32 doacross_buf_idx; // teamwise index
|
||||
kmp_uint32 *doacross_flags; // array of iteration flags (0/1)
|
||||
kmp_int32 doacross_num_done; // count finished threads
|
||||
#endif
|
||||
#if KMP_USE_HWLOC
|
||||
// When linking with libhwloc, the ORDERED EPCC test slowsdown on big
|
||||
// machines (> 48 cores). Performance analysis showed that a cache thrash
|
||||
// was occurring and this padding helps alleviate the problem.
|
||||
char padding[64];
|
||||
#endif
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -185,7 +202,7 @@ struct dispatch_shared_info_template {
|
||||
// test_then_add template (general template should NOT be used)
|
||||
template< typename T >
|
||||
static __forceinline T
|
||||
test_then_add( volatile T *p, T d ) { KMP_ASSERT(0); };
|
||||
test_then_add( volatile T *p, T d );
|
||||
|
||||
template<>
|
||||
__forceinline kmp_int32
|
||||
@@ -208,7 +225,7 @@ test_then_add< kmp_int64 >( volatile kmp_int64 *p, kmp_int64 d )
|
||||
// test_then_inc_acq template (general template should NOT be used)
|
||||
template< typename T >
|
||||
static __forceinline T
|
||||
test_then_inc_acq( volatile T *p ) { KMP_ASSERT(0); };
|
||||
test_then_inc_acq( volatile T *p );
|
||||
|
||||
template<>
|
||||
__forceinline kmp_int32
|
||||
@@ -231,7 +248,7 @@ test_then_inc_acq< kmp_int64 >( volatile kmp_int64 *p )
|
||||
// test_then_inc template (general template should NOT be used)
|
||||
template< typename T >
|
||||
static __forceinline T
|
||||
test_then_inc( volatile T *p ) { KMP_ASSERT(0); };
|
||||
test_then_inc( volatile T *p );
|
||||
|
||||
template<>
|
||||
__forceinline kmp_int32
|
||||
@@ -254,7 +271,7 @@ test_then_inc< kmp_int64 >( volatile kmp_int64 *p )
|
||||
// compare_and_swap template (general template should NOT be used)
|
||||
template< typename T >
|
||||
static __forceinline kmp_int32
|
||||
compare_and_swap( volatile T *p, T c, T s ) { KMP_ASSERT(0); };
|
||||
compare_and_swap( volatile T *p, T c, T s );
|
||||
|
||||
template<>
|
||||
__forceinline kmp_int32
|
||||
@@ -651,11 +668,19 @@ __kmp_dispatch_init(
|
||||
|
||||
/* What happens when number of threads changes, need to resize buffer? */
|
||||
pr = reinterpret_cast< dispatch_private_info_template< T > * >
|
||||
( &th -> th.th_dispatch -> th_disp_buffer[ my_buffer_index % KMP_MAX_DISP_BUF ] );
|
||||
( &th -> th.th_dispatch -> th_disp_buffer[ my_buffer_index % __kmp_dispatch_num_buffers ] );
|
||||
sh = reinterpret_cast< dispatch_shared_info_template< UT > volatile * >
|
||||
( &team -> t.t_disp_buffer[ my_buffer_index % KMP_MAX_DISP_BUF ] );
|
||||
( &team -> t.t_disp_buffer[ my_buffer_index % __kmp_dispatch_num_buffers ] );
|
||||
}
|
||||
|
||||
#if ( KMP_STATIC_STEAL_ENABLED )
|
||||
if ( SCHEDULE_HAS_NONMONOTONIC(schedule) )
|
||||
// AC: we now have only one implementation of stealing, so use it
|
||||
schedule = kmp_sch_static_steal;
|
||||
else
|
||||
#endif
|
||||
schedule = SCHEDULE_WITHOUT_MODIFIERS(schedule);
|
||||
|
||||
/* Pick up the nomerge/ordered bits from the scheduling type */
|
||||
if ( (schedule >= kmp_nm_lower) && (schedule < kmp_nm_upper) ) {
|
||||
pr->nomerge = TRUE;
|
||||
@@ -670,6 +695,7 @@ __kmp_dispatch_init(
|
||||
} else {
|
||||
pr->ordered = FALSE;
|
||||
}
|
||||
|
||||
if ( schedule == kmp_sch_static ) {
|
||||
schedule = __kmp_static;
|
||||
} else {
|
||||
@@ -684,7 +710,9 @@ __kmp_dispatch_init(
|
||||
}
|
||||
// Use the chunk size specified by OMP_SCHEDULE (or default if not specified)
|
||||
chunk = team -> t.t_sched.chunk;
|
||||
|
||||
#if USE_ITT_BUILD
|
||||
cur_chunk = chunk;
|
||||
#endif
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
@@ -722,7 +750,7 @@ __kmp_dispatch_init(
|
||||
}
|
||||
|
||||
/* guided analytical not safe for too many threads */
|
||||
if ( team->t.t_nproc > 1<<20 && schedule == kmp_sch_guided_analytical_chunked ) {
|
||||
if ( schedule == kmp_sch_guided_analytical_chunked && th->th.th_team_nproc > 1<<20 ) {
|
||||
schedule = kmp_sch_guided_iterative_chunked;
|
||||
KMP_WARNING( DispatchManyThreads );
|
||||
}
|
||||
@@ -741,24 +769,42 @@ __kmp_dispatch_init(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
tc = ( ub - lb + st );
|
||||
if ( st != 1 ) {
|
||||
if ( st < 0 ) {
|
||||
if ( lb < ub ) {
|
||||
tc = 0; // zero-trip
|
||||
} else { // lb >= ub
|
||||
tc = (ST)tc / st; // convert to signed division
|
||||
}
|
||||
} else { // st > 0
|
||||
if ( ub < lb ) {
|
||||
tc = 0; // zero-trip
|
||||
} else { // lb >= ub
|
||||
tc /= st;
|
||||
}
|
||||
// compute trip count
|
||||
if ( st == 1 ) { // most common case
|
||||
if ( ub >= lb ) {
|
||||
tc = ub - lb + 1;
|
||||
} else { // ub < lb
|
||||
tc = 0; // zero-trip
|
||||
}
|
||||
} else if ( ub < lb ) { // st == 1
|
||||
tc = 0; // zero-trip
|
||||
} else if ( st < 0 ) {
|
||||
if ( lb >= ub ) {
|
||||
// AC: cast to unsigned is needed for loops like (i=2B; i>-2B; i-=1B),
|
||||
// where the division needs to be unsigned regardless of the result type
|
||||
tc = (UT)(lb - ub) / (-st) + 1;
|
||||
} else { // lb < ub
|
||||
tc = 0; // zero-trip
|
||||
}
|
||||
} else { // st > 0
|
||||
if ( ub >= lb ) {
|
||||
// AC: cast to unsigned is needed for loops like (i=-2B; i<2B; i+=1B),
|
||||
// where the division needs to be unsigned regardless of the result type
|
||||
tc = (UT)(ub - lb) / st + 1;
|
||||
} else { // ub < lb
|
||||
tc = 0; // zero-trip
|
||||
}
|
||||
}
|
||||
|
||||
// Any half-decent optimizer will remove this test when the blocks are empty since the macros expand to nothing
|
||||
// when statistics are disabled.
|
||||
if (schedule == __kmp_static)
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_static);
|
||||
KMP_COUNT_VALUE(FOR_static_iterations, tc);
|
||||
}
|
||||
else
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_COUNT_VALUE(FOR_dynamic_iterations, tc);
|
||||
}
|
||||
|
||||
pr->u.p.lb = lb;
|
||||
@@ -799,10 +845,10 @@ __kmp_dispatch_init(
|
||||
}
|
||||
|
||||
switch ( schedule ) {
|
||||
#if ( KMP_STATIC_STEAL_ENABLED && KMP_ARCH_X86_64 )
|
||||
#if ( KMP_STATIC_STEAL_ENABLED )
|
||||
case kmp_sch_static_steal:
|
||||
{
|
||||
T nproc = team->t.t_nproc;
|
||||
T nproc = th->th.th_team_nproc;
|
||||
T ntc, init;
|
||||
|
||||
KD_TRACE(100, ("__kmp_dispatch_init: T#%d kmp_sch_static_steal case\n", gtid ) );
|
||||
@@ -821,8 +867,19 @@ __kmp_dispatch_init(
|
||||
|
||||
pr->u.p.parm2 = lb;
|
||||
//pr->pfields.parm3 = 0; // it's not used in static_steal
|
||||
pr->u.p.parm4 = id;
|
||||
pr->u.p.parm4 = (id + 1) % nproc; // remember neighbour tid
|
||||
pr->u.p.st = st;
|
||||
if ( ___kmp_size_type > 4 ) {
|
||||
// AC: TODO: check if 16-byte CAS available and use it to
|
||||
// improve performance (probably wait for explicit request
|
||||
// before spending time on this).
|
||||
// For now use dynamically allocated per-thread lock,
|
||||
// free memory in __kmp_dispatch_next when status==0.
|
||||
KMP_DEBUG_ASSERT(th->th.th_dispatch->th_steal_lock == NULL);
|
||||
th->th.th_dispatch->th_steal_lock =
|
||||
(kmp_lock_t*)__kmp_allocate(sizeof(kmp_lock_t));
|
||||
__kmp_init_lock(th->th.th_dispatch->th_steal_lock);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
KD_TRACE(100, ("__kmp_dispatch_init: T#%d falling-through to kmp_sch_static_balanced\n",
|
||||
@@ -835,7 +892,7 @@ __kmp_dispatch_init(
|
||||
#endif
|
||||
case kmp_sch_static_balanced:
|
||||
{
|
||||
T nproc = team->t.t_nproc;
|
||||
T nproc = th->th.th_team_nproc;
|
||||
T init, limit;
|
||||
|
||||
KD_TRACE(100, ("__kmp_dispatch_init: T#%d kmp_sch_static_balanced case\n",
|
||||
@@ -899,7 +956,7 @@ __kmp_dispatch_init(
|
||||
} // case
|
||||
case kmp_sch_guided_iterative_chunked :
|
||||
{
|
||||
T nproc = team->t.t_nproc;
|
||||
T nproc = th->th.th_team_nproc;
|
||||
KD_TRACE(100,("__kmp_dispatch_init: T#%d kmp_sch_guided_iterative_chunked case\n",gtid));
|
||||
|
||||
if ( nproc > 1 ) {
|
||||
@@ -922,7 +979,7 @@ __kmp_dispatch_init(
|
||||
break;
|
||||
case kmp_sch_guided_analytical_chunked:
|
||||
{
|
||||
T nproc = team->t.t_nproc;
|
||||
T nproc = th->th.th_team_nproc;
|
||||
KD_TRACE(100, ("__kmp_dispatch_init: T#%d kmp_sch_guided_analytical_chunked case\n", gtid));
|
||||
|
||||
if ( nproc > 1 ) {
|
||||
@@ -1040,12 +1097,15 @@ __kmp_dispatch_init(
|
||||
break;
|
||||
case kmp_sch_static_greedy:
|
||||
KD_TRACE(100,("__kmp_dispatch_init: T#%d kmp_sch_static_greedy case\n",gtid));
|
||||
pr->u.p.parm1 = ( team -> t.t_nproc > 1 ) ?
|
||||
( tc + team->t.t_nproc - 1 ) / team->t.t_nproc :
|
||||
pr->u.p.parm1 = ( th->th.th_team_nproc > 1 ) ?
|
||||
( tc + th->th.th_team_nproc - 1 ) / th->th.th_team_nproc :
|
||||
tc;
|
||||
break;
|
||||
case kmp_sch_static_chunked :
|
||||
case kmp_sch_dynamic_chunked :
|
||||
if ( pr->u.p.parm1 <= 0 ) {
|
||||
pr->u.p.parm1 = KMP_DEFAULT_CHUNK;
|
||||
}
|
||||
KD_TRACE(100,("__kmp_dispatch_init: T#%d kmp_sch_static_chunked/kmp_sch_dynamic_chunked cases\n", gtid));
|
||||
break;
|
||||
case kmp_sch_trapezoidal :
|
||||
@@ -1058,7 +1118,7 @@ __kmp_dispatch_init(
|
||||
parm1 = chunk;
|
||||
|
||||
/* F : size of the first cycle */
|
||||
parm2 = ( tc / (2 * team->t.t_nproc) );
|
||||
parm2 = ( tc / (2 * th->th.th_team_nproc) );
|
||||
|
||||
if ( parm2 < 1 ) {
|
||||
parm2 = 1;
|
||||
@@ -1179,7 +1239,6 @@ __kmp_dispatch_init(
|
||||
}
|
||||
#endif
|
||||
#if ( KMP_STATIC_STEAL_ENABLED )
|
||||
if ( ___kmp_size_type < 8 ) {
|
||||
// It cannot be guaranteed that after execution of a loop with some other schedule kind
|
||||
// all the parm3 variables will contain the same value.
|
||||
// Even if all parm3 will be the same, it still exists a bad case like using 0 and 1
|
||||
@@ -1191,11 +1250,10 @@ __kmp_dispatch_init(
|
||||
volatile T * p = &pr->u.p.static_steal_counter;
|
||||
*p = *p + 1;
|
||||
}
|
||||
}
|
||||
#endif // ( KMP_STATIC_STEAL_ENABLED && USE_STEALING )
|
||||
#endif // ( KMP_STATIC_STEAL_ENABLED )
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)) {
|
||||
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
@@ -1359,7 +1417,7 @@ __kmp_dispatch_finish_chunk( int gtid, ident_t *loc )
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
#define OMPT_LOOP_END \
|
||||
if (status == 0) { \
|
||||
if ((ompt_status == ompt_status_track_callback) && \
|
||||
if (ompt_enabled && \
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_end)) { \
|
||||
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL); \
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0); \
|
||||
@@ -1380,10 +1438,15 @@ __kmp_dispatch_next(
|
||||
typedef typename traits_t< T >::unsigned_t UT;
|
||||
typedef typename traits_t< T >::signed_t ST;
|
||||
typedef typename traits_t< T >::floating_t DBL;
|
||||
#if ( KMP_STATIC_STEAL_ENABLED && KMP_ARCH_X86_64 )
|
||||
#if ( KMP_STATIC_STEAL_ENABLED )
|
||||
static const int ___kmp_size_type = sizeof( UT );
|
||||
#endif
|
||||
|
||||
// This is potentially slightly misleading, schedule(runtime) will appear here even if the actual runtme schedule
|
||||
// is static. (Which points out a disadavantage of schedule(runtime): even when static scheduling is used it costs
|
||||
// more than a compile time choice to use static scheduling would.)
|
||||
KMP_TIME_PARTITIONED_BLOCK(FOR_dynamic_scheduling);
|
||||
|
||||
int status;
|
||||
dispatch_private_info_template< T > * pr;
|
||||
kmp_info_t * th = __kmp_threads[ gtid ];
|
||||
@@ -1534,21 +1597,97 @@ __kmp_dispatch_next(
|
||||
status = 0;
|
||||
} else {
|
||||
switch (pr->schedule) {
|
||||
#if ( KMP_STATIC_STEAL_ENABLED && KMP_ARCH_X86_64 )
|
||||
#if ( KMP_STATIC_STEAL_ENABLED )
|
||||
case kmp_sch_static_steal:
|
||||
{
|
||||
T chunk = pr->u.p.parm1;
|
||||
int nproc = th->th.th_team_nproc;
|
||||
|
||||
KD_TRACE(100, ("__kmp_dispatch_next: T#%d kmp_sch_static_steal case\n", gtid) );
|
||||
|
||||
trip = pr->u.p.tc - 1;
|
||||
|
||||
if ( ___kmp_size_type > 4 ) {
|
||||
// Other threads do not look into the data of this thread,
|
||||
// so it's not necessary to make volatile casting.
|
||||
init = ( pr->u.p.count )++;
|
||||
status = ( init < (UT)pr->u.p.ub );
|
||||
// use lock for 8-byte and CAS for 4-byte induction
|
||||
// variable. TODO (optional): check and use 16-byte CAS
|
||||
kmp_lock_t * lck = th->th.th_dispatch->th_steal_lock;
|
||||
KMP_DEBUG_ASSERT(lck != NULL);
|
||||
if( pr->u.p.count < (UT)pr->u.p.ub ) {
|
||||
__kmp_acquire_lock(lck, gtid);
|
||||
// try to get own chunk of iterations
|
||||
init = ( pr->u.p.count )++;
|
||||
status = ( init < (UT)pr->u.p.ub );
|
||||
__kmp_release_lock(lck, gtid);
|
||||
} else {
|
||||
status = 0; // no own chunks
|
||||
}
|
||||
if( !status ) { // try to steal
|
||||
kmp_info_t **other_threads = team->t.t_threads;
|
||||
int while_limit = nproc; // nproc attempts to find a victim
|
||||
int while_index = 0;
|
||||
// TODO: algorithm of searching for a victim
|
||||
// should be cleaned up and measured
|
||||
while ( ( !status ) && ( while_limit != ++while_index ) ) {
|
||||
T remaining;
|
||||
T victimIdx = pr->u.p.parm4;
|
||||
T oldVictimIdx = victimIdx ? victimIdx - 1 : nproc - 1;
|
||||
dispatch_private_info_template< T > * victim =
|
||||
reinterpret_cast< dispatch_private_info_template< T >* >
|
||||
(other_threads[victimIdx]->th.th_dispatch->th_dispatch_pr_current);
|
||||
while( ( victim == NULL || victim == pr ||
|
||||
( *(volatile T*)&victim->u.p.static_steal_counter !=
|
||||
*(volatile T*)&pr->u.p.static_steal_counter ) ) &&
|
||||
oldVictimIdx != victimIdx )
|
||||
{
|
||||
victimIdx = (victimIdx + 1) % nproc;
|
||||
victim = reinterpret_cast< dispatch_private_info_template< T >* >
|
||||
(other_threads[victimIdx]->th.th_dispatch->th_dispatch_pr_current);
|
||||
};
|
||||
if( !victim ||
|
||||
( *(volatile T *)&victim->u.p.static_steal_counter !=
|
||||
*(volatile T *)&pr->u.p.static_steal_counter ) )
|
||||
{
|
||||
continue; // try once more (nproc attempts in total)
|
||||
// no victim is ready yet to participate in stealing
|
||||
// because all victims are still in kmp_init_dispatch
|
||||
}
|
||||
if( victim->u.p.count + 2 > (UT)victim->u.p.ub ) {
|
||||
pr->u.p.parm4 = (victimIdx + 1) % nproc; // shift start tid
|
||||
continue; // not enough chunks to steal, goto next victim
|
||||
}
|
||||
|
||||
lck = other_threads[victimIdx]->th.th_dispatch->th_steal_lock;
|
||||
KMP_ASSERT(lck != NULL);
|
||||
__kmp_acquire_lock(lck, gtid);
|
||||
limit = victim->u.p.ub; // keep initial ub
|
||||
if( victim->u.p.count >= limit ||
|
||||
(remaining = limit - victim->u.p.count) < 2 )
|
||||
{
|
||||
__kmp_release_lock(lck, gtid);
|
||||
pr->u.p.parm4 = (victimIdx + 1) % nproc; // next victim
|
||||
continue; // not enough chunks to steal
|
||||
}
|
||||
// stealing succeded, reduce victim's ub by 1/4 of undone chunks or by 1
|
||||
if( remaining > 3 ) {
|
||||
init = ( victim->u.p.ub -= (remaining>>2) ); // steal 1/4 of remaining
|
||||
} else {
|
||||
init = ( victim->u.p.ub -= 1 ); // steal 1 chunk of 2 or 3 remaining
|
||||
}
|
||||
__kmp_release_lock(lck, gtid);
|
||||
|
||||
KMP_DEBUG_ASSERT(init + 1 <= limit);
|
||||
pr->u.p.parm4 = victimIdx; // remember victim to steal from
|
||||
status = 1;
|
||||
while_index = 0;
|
||||
// now update own count and ub with stolen range but init chunk
|
||||
__kmp_acquire_lock(th->th.th_dispatch->th_steal_lock, gtid);
|
||||
pr->u.p.count = init + 1;
|
||||
pr->u.p.ub = limit;
|
||||
__kmp_release_lock(th->th.th_dispatch->th_steal_lock, gtid);
|
||||
} // while (search for victim)
|
||||
} // if (try to find victim and steal)
|
||||
} else {
|
||||
// 4-byte induction variable, use 8-byte CAS for pair (count, ub)
|
||||
typedef union {
|
||||
struct {
|
||||
UT count;
|
||||
@@ -1557,7 +1696,6 @@ __kmp_dispatch_next(
|
||||
kmp_int64 b;
|
||||
} union_i4;
|
||||
// All operations on 'count' or 'ub' must be combined atomically together.
|
||||
// stealing implemented only for 4-byte indexes
|
||||
{
|
||||
union_i4 vold, vnew;
|
||||
vold.b = *( volatile kmp_int64 * )(&pr->u.p.count);
|
||||
@@ -1579,86 +1717,77 @@ __kmp_dispatch_next(
|
||||
|
||||
if( !status ) {
|
||||
kmp_info_t **other_threads = team->t.t_threads;
|
||||
int while_limit = 10;
|
||||
int while_limit = nproc; // nproc attempts to find a victim
|
||||
int while_index = 0;
|
||||
|
||||
// TODO: algorithm of searching for a victim
|
||||
// should be cleaned up and measured
|
||||
while ( ( !status ) && ( while_limit != ++while_index ) ) {
|
||||
union_i4 vold, vnew;
|
||||
kmp_int32 remaining; // kmp_int32 because KMP_I4 only
|
||||
kmp_int32 remaining;
|
||||
T victimIdx = pr->u.p.parm4;
|
||||
T oldVictimIdx = victimIdx;
|
||||
dispatch_private_info_template< T > * victim;
|
||||
|
||||
do {
|
||||
if( !victimIdx ) {
|
||||
victimIdx = team->t.t_nproc - 1;
|
||||
} else {
|
||||
--victimIdx;
|
||||
}
|
||||
T oldVictimIdx = victimIdx ? victimIdx - 1 : nproc - 1;
|
||||
dispatch_private_info_template< T > * victim =
|
||||
reinterpret_cast< dispatch_private_info_template< T >* >
|
||||
(other_threads[victimIdx]->th.th_dispatch->th_dispatch_pr_current);
|
||||
while( (victim == NULL || victim == pr ||
|
||||
(*(volatile T*)&victim->u.p.static_steal_counter !=
|
||||
*(volatile T*)&pr->u.p.static_steal_counter)) &&
|
||||
oldVictimIdx != victimIdx )
|
||||
{
|
||||
victimIdx = (victimIdx + 1) % nproc;
|
||||
victim = reinterpret_cast< dispatch_private_info_template< T >* >
|
||||
( other_threads[victimIdx]->th.th_dispatch->th_dispatch_pr_current );
|
||||
} while ( (victim == NULL || victim == pr) && oldVictimIdx != victimIdx );
|
||||
// TODO: think about a proper place of this test
|
||||
if ( ( !victim ) ||
|
||||
( (*( volatile T * )&victim->u.p.static_steal_counter) !=
|
||||
(*( volatile T * )&pr->u.p.static_steal_counter) ) ) {
|
||||
// TODO: delay would be nice
|
||||
continue;
|
||||
// the victim is not ready yet to participate in stealing
|
||||
// because the victim is still in kmp_init_dispatch
|
||||
};
|
||||
if( !victim ||
|
||||
( *(volatile T *)&victim->u.p.static_steal_counter !=
|
||||
*(volatile T *)&pr->u.p.static_steal_counter ) )
|
||||
{
|
||||
continue; // try once more (nproc attempts in total)
|
||||
// no victim is ready yet to participate in stealing
|
||||
// because all victims are still in kmp_init_dispatch
|
||||
}
|
||||
if ( oldVictimIdx == victimIdx ) {
|
||||
break;
|
||||
}
|
||||
pr->u.p.parm4 = victimIdx;
|
||||
|
||||
while( 1 ) {
|
||||
pr->u.p.parm4 = victimIdx; // new victim found
|
||||
while( 1 ) { // CAS loop if victim has enough chunks to steal
|
||||
vold.b = *( volatile kmp_int64 * )( &victim->u.p.count );
|
||||
vnew = vold;
|
||||
|
||||
KMP_DEBUG_ASSERT( (vnew.p.ub - 1) * (UT)chunk <= trip );
|
||||
if ( vnew.p.count >= (UT)vnew.p.ub || (remaining = vnew.p.ub - vnew.p.count) < 4 ) {
|
||||
break;
|
||||
if ( vnew.p.count >= (UT)vnew.p.ub ||
|
||||
(remaining = vnew.p.ub - vnew.p.count) < 2 )
|
||||
{
|
||||
pr->u.p.parm4 = (victimIdx + 1) % nproc; // shift start victim id
|
||||
break; // not enough chunks to steal, goto next victim
|
||||
}
|
||||
if( remaining > 3 ) {
|
||||
vnew.p.ub -= (remaining>>2); // try to steal 1/4 of remaining
|
||||
} else {
|
||||
vnew.p.ub -= 1; // steal 1 chunk of 2 or 3 remaining
|
||||
}
|
||||
vnew.p.ub -= (remaining >> 2);
|
||||
KMP_DEBUG_ASSERT((vnew.p.ub - 1) * (UT)chunk <= trip);
|
||||
#pragma warning( push )
|
||||
// disable warning on pointless comparison of unsigned with 0
|
||||
#pragma warning( disable: 186 )
|
||||
KMP_DEBUG_ASSERT(vnew.p.ub >= 0);
|
||||
#pragma warning( pop )
|
||||
// TODO: Should this be acquire or release?
|
||||
if ( KMP_COMPARE_AND_STORE_ACQ64(
|
||||
( volatile kmp_int64 * )&victim->u.p.count,
|
||||
*VOLATILE_CAST(kmp_int64 *)&vold.b,
|
||||
*VOLATILE_CAST(kmp_int64 *)&vnew.b ) ) {
|
||||
// stealing succedded
|
||||
status = 1;
|
||||
while_index = 0;
|
||||
// now update own count and ub
|
||||
init = vnew.p.ub;
|
||||
vold.p.count = init + 1;
|
||||
#if KMP_ARCH_X86
|
||||
// stealing executed on non-KMP_ARCH_X86 only
|
||||
// Atomic 64-bit write on ia32 is
|
||||
// unavailable, so we do this in steps.
|
||||
// This code is not tested.
|
||||
init = vold.p.count;
|
||||
pr->u.p.ub = 0;
|
||||
pr->u.p.count = init + 1;
|
||||
pr->u.p.ub = vnew.p.count;
|
||||
KMP_XCHG_FIXED64(( volatile kmp_int64 * )(&pr->u.p.count), vold.b);
|
||||
#else
|
||||
init = vnew.p.ub;
|
||||
vold.p.count = init + 1;
|
||||
// TODO: is it safe and enough?
|
||||
*( volatile kmp_int64 * )(&pr->u.p.count) = vold.b;
|
||||
#endif // KMP_ARCH_X86
|
||||
*( volatile kmp_int64 * )(&pr->u.p.count) = vold.b;
|
||||
#endif
|
||||
break;
|
||||
} // if
|
||||
KMP_CPU_PAUSE();
|
||||
} // while (1)
|
||||
} // while
|
||||
} // if
|
||||
} // if
|
||||
} // if (check CAS result)
|
||||
KMP_CPU_PAUSE(); // CAS failed, repeate attempt
|
||||
} // while (try to steal from particular victim)
|
||||
} // while (search for victim)
|
||||
} // if (try to find victim and steal)
|
||||
} // if (4-byte induction variable)
|
||||
if ( !status ) {
|
||||
*p_lb = 0;
|
||||
*p_ub = 0;
|
||||
@@ -1700,7 +1829,7 @@ __kmp_dispatch_next(
|
||||
} // if
|
||||
break;
|
||||
} // case
|
||||
#endif // ( KMP_STATIC_STEAL_ENABLED && KMP_ARCH_X86_64 )
|
||||
#endif // ( KMP_STATIC_STEAL_ENABLED )
|
||||
case kmp_sch_static_balanced:
|
||||
{
|
||||
KD_TRACE(100, ("__kmp_dispatch_next: T#%d kmp_sch_static_balanced case\n", gtid) );
|
||||
@@ -1751,7 +1880,7 @@ __kmp_dispatch_next(
|
||||
|
||||
if ( p_st != NULL ) *p_st = incr;
|
||||
|
||||
pr->u.p.count += team->t.t_nproc;
|
||||
pr->u.p.count += th->th.th_team_nproc;
|
||||
|
||||
if ( incr == 1 ) {
|
||||
*p_lb = start + init;
|
||||
@@ -1921,8 +2050,8 @@ __kmp_dispatch_next(
|
||||
|
||||
trip = pr->u.p.tc;
|
||||
|
||||
KMP_DEBUG_ASSERT(team->t.t_nproc > 1);
|
||||
KMP_DEBUG_ASSERT((2UL * chunkspec + 1) * (UT)team->t.t_nproc < trip);
|
||||
KMP_DEBUG_ASSERT(th->th.th_team_nproc > 1);
|
||||
KMP_DEBUG_ASSERT((2UL * chunkspec + 1) * (UT)th->th.th_team_nproc < trip);
|
||||
|
||||
while(1) { /* this while loop is a safeguard against unexpected zero chunk sizes */
|
||||
chunkIdx = test_then_inc_acq< ST >((volatile ST *) & sh->u.s.iteration );
|
||||
@@ -2093,7 +2222,21 @@ __kmp_dispatch_next(
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (ST)num_done == team->t.t_nproc-1 ) {
|
||||
if ( (ST)num_done == th->th.th_team_nproc - 1 ) {
|
||||
#if ( KMP_STATIC_STEAL_ENABLED )
|
||||
if( pr->schedule == kmp_sch_static_steal && ___kmp_size_type > 4 ) {
|
||||
int i;
|
||||
kmp_info_t **other_threads = team->t.t_threads;
|
||||
// loop complete, safe to destroy locks used for stealing
|
||||
for( i = 0; i < th->th.th_team_nproc; ++i ) {
|
||||
kmp_lock_t * lck = other_threads[i]->th.th_dispatch->th_steal_lock;
|
||||
KMP_ASSERT(lck != NULL);
|
||||
__kmp_destroy_lock( lck );
|
||||
__kmp_free( lck );
|
||||
other_threads[i]->th.th_dispatch->th_steal_lock = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* NOTE: release this buffer to be reused */
|
||||
|
||||
KMP_MB(); /* Flush all pending memory write invalidates. */
|
||||
@@ -2108,7 +2251,7 @@ __kmp_dispatch_next(
|
||||
|
||||
KMP_MB(); /* Flush all pending memory write invalidates. */
|
||||
|
||||
sh -> buffer_index += KMP_MAX_DISP_BUF;
|
||||
sh -> buffer_index += __kmp_dispatch_num_buffers;
|
||||
KD_TRACE(100, ("__kmp_dispatch_next: T#%d change buffer_index:%d\n",
|
||||
gtid, sh->buffer_index) );
|
||||
|
||||
@@ -2164,7 +2307,6 @@ __kmp_dist_get_bounds(
|
||||
T *pupper,
|
||||
typename traits_t< T >::signed_t incr
|
||||
) {
|
||||
KMP_COUNT_BLOCK(OMP_DISTR_FOR_dynamic);
|
||||
typedef typename traits_t< T >::unsigned_t UT;
|
||||
typedef typename traits_t< T >::signed_t ST;
|
||||
register kmp_uint32 team_id;
|
||||
@@ -2206,9 +2348,9 @@ __kmp_dist_get_bounds(
|
||||
}
|
||||
}
|
||||
th = __kmp_threads[gtid];
|
||||
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
|
||||
team = th->th.th_team;
|
||||
#if OMP_40_ENABLED
|
||||
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
|
||||
nteams = th->th.th_teams_size.nteams;
|
||||
#endif
|
||||
team_id = team->t.t_master_tid;
|
||||
@@ -2219,9 +2361,13 @@ __kmp_dist_get_bounds(
|
||||
trip_count = *pupper - *plower + 1;
|
||||
} else if(incr == -1) {
|
||||
trip_count = *plower - *pupper + 1;
|
||||
} else if ( incr > 0 ) {
|
||||
// upper-lower can exceed the limit of signed type
|
||||
trip_count = (UT)(*pupper - *plower) / incr + 1;
|
||||
} else {
|
||||
trip_count = (ST)(*pupper - *plower) / incr + 1; // cast to signed to cover incr<0 case
|
||||
trip_count = (UT)(*plower - *pupper) / ( -incr ) + 1;
|
||||
}
|
||||
|
||||
if( trip_count <= nteams ) {
|
||||
KMP_DEBUG_ASSERT(
|
||||
__kmp_static == kmp_sch_static_greedy || \
|
||||
@@ -2297,7 +2443,6 @@ void
|
||||
__kmpc_dispatch_init_4( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
|
||||
kmp_int32 lb, kmp_int32 ub, kmp_int32 st, kmp_int32 chunk )
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_dispatch_init< kmp_int32 >( loc, gtid, schedule, lb, ub, st, chunk, true );
|
||||
}
|
||||
@@ -2308,7 +2453,6 @@ void
|
||||
__kmpc_dispatch_init_4u( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
|
||||
kmp_uint32 lb, kmp_uint32 ub, kmp_int32 st, kmp_int32 chunk )
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_dispatch_init< kmp_uint32 >( loc, gtid, schedule, lb, ub, st, chunk, true );
|
||||
}
|
||||
@@ -2321,7 +2465,6 @@ __kmpc_dispatch_init_8( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
|
||||
kmp_int64 lb, kmp_int64 ub,
|
||||
kmp_int64 st, kmp_int64 chunk )
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_dispatch_init< kmp_int64 >( loc, gtid, schedule, lb, ub, st, chunk, true );
|
||||
}
|
||||
@@ -2334,7 +2477,6 @@ __kmpc_dispatch_init_8u( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
|
||||
kmp_uint64 lb, kmp_uint64 ub,
|
||||
kmp_int64 st, kmp_int64 chunk )
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_dispatch_init< kmp_uint64 >( loc, gtid, schedule, lb, ub, st, chunk, true );
|
||||
}
|
||||
@@ -2352,7 +2494,6 @@ void
|
||||
__kmpc_dist_dispatch_init_4( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
|
||||
kmp_int32 *p_last, kmp_int32 lb, kmp_int32 ub, kmp_int32 st, kmp_int32 chunk )
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_dist_get_bounds< kmp_int32 >( loc, gtid, p_last, &lb, &ub, st );
|
||||
__kmp_dispatch_init< kmp_int32 >( loc, gtid, schedule, lb, ub, st, chunk, true );
|
||||
@@ -2362,7 +2503,6 @@ void
|
||||
__kmpc_dist_dispatch_init_4u( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
|
||||
kmp_int32 *p_last, kmp_uint32 lb, kmp_uint32 ub, kmp_int32 st, kmp_int32 chunk )
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_dist_get_bounds< kmp_uint32 >( loc, gtid, p_last, &lb, &ub, st );
|
||||
__kmp_dispatch_init< kmp_uint32 >( loc, gtid, schedule, lb, ub, st, chunk, true );
|
||||
@@ -2372,7 +2512,6 @@ void
|
||||
__kmpc_dist_dispatch_init_8( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
|
||||
kmp_int32 *p_last, kmp_int64 lb, kmp_int64 ub, kmp_int64 st, kmp_int64 chunk )
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_dist_get_bounds< kmp_int64 >( loc, gtid, p_last, &lb, &ub, st );
|
||||
__kmp_dispatch_init< kmp_int64 >( loc, gtid, schedule, lb, ub, st, chunk, true );
|
||||
@@ -2382,7 +2521,6 @@ void
|
||||
__kmpc_dist_dispatch_init_8u( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
|
||||
kmp_int32 *p_last, kmp_uint64 lb, kmp_uint64 ub, kmp_int64 st, kmp_int64 chunk )
|
||||
{
|
||||
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_dist_get_bounds< kmp_uint64 >( loc, gtid, p_last, &lb, &ub, st );
|
||||
__kmp_dispatch_init< kmp_uint64 >( loc, gtid, schedule, lb, ub, st, chunk, true );
|
||||
@@ -2499,25 +2637,6 @@ kmp_uint32 __kmp_ge_4( kmp_uint32 value, kmp_uint32 checker) {
|
||||
kmp_uint32 __kmp_le_4( kmp_uint32 value, kmp_uint32 checker) {
|
||||
return value <= checker;
|
||||
}
|
||||
kmp_uint32 __kmp_eq_8( kmp_uint64 value, kmp_uint64 checker) {
|
||||
return value == checker;
|
||||
}
|
||||
|
||||
kmp_uint32 __kmp_neq_8( kmp_uint64 value, kmp_uint64 checker) {
|
||||
return value != checker;
|
||||
}
|
||||
|
||||
kmp_uint32 __kmp_lt_8( kmp_uint64 value, kmp_uint64 checker) {
|
||||
return value < checker;
|
||||
}
|
||||
|
||||
kmp_uint32 __kmp_ge_8( kmp_uint64 value, kmp_uint64 checker) {
|
||||
return value >= checker;
|
||||
}
|
||||
|
||||
kmp_uint32 __kmp_le_8( kmp_uint64 value, kmp_uint64 checker) {
|
||||
return value <= checker;
|
||||
}
|
||||
|
||||
kmp_uint32
|
||||
__kmp_wait_yield_4(volatile kmp_uint32 * spinner,
|
||||
@@ -2552,39 +2671,30 @@ __kmp_wait_yield_4(volatile kmp_uint32 * spinner,
|
||||
return r;
|
||||
}
|
||||
|
||||
kmp_uint64
|
||||
__kmp_wait_yield_8( volatile kmp_uint64 * spinner,
|
||||
kmp_uint64 checker,
|
||||
kmp_uint32 (* pred)( kmp_uint64, kmp_uint64 )
|
||||
, void * obj // Higher-level synchronization object, or NULL.
|
||||
)
|
||||
void
|
||||
__kmp_wait_yield_4_ptr(void *spinner,
|
||||
kmp_uint32 checker,
|
||||
kmp_uint32 (*pred)( void *, kmp_uint32 ),
|
||||
void *obj // Higher-level synchronization object, or NULL.
|
||||
)
|
||||
{
|
||||
// note: we may not belong to a team at this point
|
||||
register volatile kmp_uint64 * spin = spinner;
|
||||
register kmp_uint64 check = checker;
|
||||
register kmp_uint32 spins;
|
||||
register kmp_uint32 (*f) ( kmp_uint64, kmp_uint64 ) = pred;
|
||||
register kmp_uint64 r;
|
||||
register void *spin = spinner;
|
||||
register kmp_uint32 check = checker;
|
||||
register kmp_uint32 spins;
|
||||
register kmp_uint32 (*f) ( void *, kmp_uint32 ) = pred;
|
||||
|
||||
KMP_FSYNC_SPIN_INIT( obj, (void*) spin );
|
||||
KMP_FSYNC_SPIN_INIT( obj, spin );
|
||||
KMP_INIT_YIELD( spins );
|
||||
// main wait spin loop
|
||||
while(!f(r = *spin, check))
|
||||
{
|
||||
while ( !f( spin, check ) ) {
|
||||
KMP_FSYNC_SPIN_PREPARE( obj );
|
||||
/* GEH - remove this since it was accidentally introduced when kmp_wait was split.
|
||||
It causes problems with infinite recursion because of exit lock */
|
||||
/* if ( TCR_4(__kmp_global.g.g_done) && __kmp_global.g.g_abort)
|
||||
__kmp_abort_thread(); */
|
||||
|
||||
// if we are oversubscribed,
|
||||
// or have waited a bit (and KMP_LIBARRY=throughput, then yield
|
||||
// pause is in the following code
|
||||
KMP_YIELD( TCR_4(__kmp_nth) > __kmp_avail_proc );
|
||||
/* if we have waited a bit, or are oversubscribed, yield */
|
||||
/* pause is in the following code */
|
||||
KMP_YIELD( TCR_4( __kmp_nth ) > __kmp_avail_proc );
|
||||
KMP_YIELD_SPIN( spins );
|
||||
}
|
||||
KMP_FSYNC_SPIN_ACQUIRED( obj );
|
||||
return r;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
------------------------------------------------------------------------------------------------
|
||||
On Windows* OS, there are two environments (at least, see below):
|
||||
|
||||
1. Environment maintained by Windows* OS on IA-32 architecture.
|
||||
1. Environment maintained by Windows* OS on IA-32 architecture.
|
||||
Accessible through GetEnvironmentVariable(),
|
||||
SetEnvironmentVariable(), and GetEnvironmentStrings().
|
||||
|
||||
2. Environment maintained by C RTL. Accessible through getenv(), putenv().
|
||||
|
||||
putenv() function updates both C and Windows* OS on IA-32 architecture. getenv() function
|
||||
search for variables in C RTL environment only. Windows* OS on IA-32 architecture functions work *only*
|
||||
putenv() function updates both C and Windows* OS on IA-32 architecture. getenv() function
|
||||
search for variables in C RTL environment only. Windows* OS on IA-32 architecture functions work *only*
|
||||
with Windows* OS on IA-32 architecture.
|
||||
|
||||
Windows* OS on IA-32 architecture maintained by OS, so there is always only one Windows* OS on
|
||||
Windows* OS on IA-32 architecture maintained by OS, so there is always only one Windows* OS on
|
||||
IA-32 architecture per process. Changes in Windows* OS on IA-32 architecture are process-visible.
|
||||
|
||||
C environment maintained by C RTL. Multiple copies of C RTL may be present in the process, and
|
||||
@@ -42,11 +42,11 @@
|
||||
Thus, proper way to work with environment on Windows* OS is:
|
||||
|
||||
1. Set variables with putenv() function -- both C and Windows* OS on
|
||||
IA-32 architecture are being updated. Windows* OS on
|
||||
IA-32 architecture are being updated. Windows* OS on
|
||||
IA-32 architecture may be considered as primary target,
|
||||
while updating C RTL environment is a free bonus.
|
||||
|
||||
2. Get variables with GetEnvironmentVariable() -- getenv() does not
|
||||
2. Get variables with GetEnvironmentVariable() -- getenv() does not
|
||||
search Windows* OS on IA-32 architecture, and can not see variables
|
||||
set with SetEnvironmentVariable().
|
||||
|
||||
@@ -64,13 +64,11 @@
|
||||
#if KMP_OS_UNIX
|
||||
#include <stdlib.h> // getenv, setenv, unsetenv.
|
||||
#include <string.h> // strlen, strcpy.
|
||||
#if KMP_OS_LINUX || KMP_OS_FREEBSD
|
||||
extern char * * environ;
|
||||
#elif KMP_OS_DARWIN
|
||||
#if KMP_OS_DARWIN
|
||||
#include <crt_externs.h>
|
||||
#define environ (*_NSGetEnviron())
|
||||
#else
|
||||
#error Unknown or unsupported OS.
|
||||
extern char * * environ;
|
||||
#endif
|
||||
#elif KMP_OS_WINDOWS
|
||||
#include <windows.h> // GetEnvironmentVariable, SetEnvironmentVariable, GetLastError.
|
||||
@@ -216,7 +214,7 @@ __kmp_env_set( char const * name, char const * value, int overwrite ) {
|
||||
// Dead code. I tried to put too many variables into Linux* OS
|
||||
// environment on IA-32 architecture. When application consumes
|
||||
// more than ~2.5 GB of memory, entire system feels bad. Sometimes
|
||||
// application is killed (by OS?), sometimes system stops
|
||||
// application is killed (by OS?), sometimes system stops
|
||||
// responding... But this error message never appears. --ln
|
||||
__kmp_msg(
|
||||
kmp_ms_fatal,
|
||||
|
||||
+251
-16
@@ -215,6 +215,19 @@ FTN_GET_LIBRARY (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void FTN_STDCALL
|
||||
FTN_SET_DISP_NUM_BUFFERS( int KMP_DEREF arg )
|
||||
{
|
||||
#ifdef KMP_STUB
|
||||
; // empty routine
|
||||
#else
|
||||
// ignore after initialization because some teams have already
|
||||
// allocated dispatch buffers
|
||||
if( __kmp_init_serial == 0 && (KMP_DEREF arg) > 0 )
|
||||
__kmp_dispatch_num_buffers = KMP_DEREF arg;
|
||||
#endif
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_SET_AFFINITY( void **mask )
|
||||
{
|
||||
@@ -259,7 +272,7 @@ FTN_GET_AFFINITY_MAX_PROC( void )
|
||||
|
||||
#if KMP_GROUP_AFFINITY
|
||||
if ( __kmp_num_proc_groups > 1 ) {
|
||||
return (int)KMP_CPU_SETSIZE;
|
||||
return (int)(__kmp_num_proc_groups*sizeof(DWORD_PTR)*CHAR_BIT);
|
||||
}
|
||||
#endif /* KMP_GROUP_AFFINITY */
|
||||
return __kmp_xproc;
|
||||
@@ -278,7 +291,11 @@ FTN_CREATE_AFFINITY_MASK( void **mask )
|
||||
if ( ! TCR_4(__kmp_init_middle) ) {
|
||||
__kmp_middle_initialize();
|
||||
}
|
||||
# if KMP_USE_HWLOC
|
||||
*mask = (hwloc_cpuset_t)hwloc_bitmap_alloc();
|
||||
# else
|
||||
*mask = kmpc_malloc( __kmp_affin_mask_size );
|
||||
# endif
|
||||
KMP_CPU_ZERO( (kmp_affin_mask_t *)(*mask) );
|
||||
#endif
|
||||
}
|
||||
@@ -300,7 +317,11 @@ FTN_DESTROY_AFFINITY_MASK( void **mask )
|
||||
KMP_FATAL( AffinityInvalidMask, "kmp_destroy_affinity_mask" );
|
||||
}
|
||||
}
|
||||
# if KMP_USE_HWLOC
|
||||
hwloc_bitmap_free((hwloc_cpuset_t)(*mask));
|
||||
# else
|
||||
kmpc_free( *mask );
|
||||
# endif
|
||||
*mask = NULL;
|
||||
#endif
|
||||
}
|
||||
@@ -398,7 +419,7 @@ xexpand(FTN_GET_THREAD_NUM)( void )
|
||||
#else
|
||||
int gtid;
|
||||
|
||||
#if KMP_OS_DARWIN || KMP_OS_FREEBSD
|
||||
#if KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_NETBSD
|
||||
gtid = __kmp_entry_gtid();
|
||||
#elif KMP_OS_WINDOWS
|
||||
if (!__kmp_init_parallel ||
|
||||
@@ -668,6 +689,143 @@ xexpand(FTN_GET_PROC_BIND)( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
int FTN_STDCALL
|
||||
FTN_GET_NUM_PLACES( void )
|
||||
{
|
||||
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
|
||||
return 0;
|
||||
#else
|
||||
if ( ! TCR_4(__kmp_init_middle) ) {
|
||||
__kmp_middle_initialize();
|
||||
}
|
||||
return __kmp_affinity_num_masks;
|
||||
#endif
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_GET_PLACE_NUM_PROCS( int place_num )
|
||||
{
|
||||
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
|
||||
return 0;
|
||||
#else
|
||||
int i;
|
||||
int retval = 0;
|
||||
if ( ! TCR_4(__kmp_init_middle) ) {
|
||||
__kmp_middle_initialize();
|
||||
}
|
||||
if ( place_num < 0 || place_num >= (int)__kmp_affinity_num_masks )
|
||||
return 0;
|
||||
kmp_affin_mask_t *mask = KMP_CPU_INDEX(__kmp_affinity_masks, place_num);
|
||||
KMP_CPU_SET_ITERATE(i, mask) {
|
||||
if ((! KMP_CPU_ISSET(i, __kmp_affin_fullMask)) ||
|
||||
(!KMP_CPU_ISSET(i, mask))) {
|
||||
continue;
|
||||
}
|
||||
++retval;
|
||||
}
|
||||
return retval;
|
||||
#endif
|
||||
}
|
||||
|
||||
void FTN_STDCALL
|
||||
FTN_GET_PLACE_PROC_IDS( int place_num, int *ids )
|
||||
{
|
||||
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
|
||||
// Nothing.
|
||||
#else
|
||||
int i,j;
|
||||
if ( ! TCR_4(__kmp_init_middle) ) {
|
||||
__kmp_middle_initialize();
|
||||
}
|
||||
if ( place_num < 0 || place_num >= (int)__kmp_affinity_num_masks )
|
||||
return;
|
||||
kmp_affin_mask_t *mask = KMP_CPU_INDEX(__kmp_affinity_masks, place_num);
|
||||
j = 0;
|
||||
KMP_CPU_SET_ITERATE(i, mask) {
|
||||
if ((! KMP_CPU_ISSET(i, __kmp_affin_fullMask)) ||
|
||||
(!KMP_CPU_ISSET(i, mask))) {
|
||||
continue;
|
||||
}
|
||||
ids[j++] = i;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_GET_PLACE_NUM( void )
|
||||
{
|
||||
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
|
||||
return -1;
|
||||
#else
|
||||
int gtid;
|
||||
kmp_info_t *thread;
|
||||
if ( ! TCR_4(__kmp_init_middle) ) {
|
||||
__kmp_middle_initialize();
|
||||
}
|
||||
gtid = __kmp_entry_gtid();
|
||||
thread = __kmp_thread_from_gtid(gtid);
|
||||
if ( thread->th.th_current_place < 0 )
|
||||
return -1;
|
||||
return thread->th.th_current_place;
|
||||
#endif
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_GET_PARTITION_NUM_PLACES( void )
|
||||
{
|
||||
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
|
||||
return 0;
|
||||
#else
|
||||
int gtid, num_places, first_place, last_place;
|
||||
kmp_info_t *thread;
|
||||
if ( ! TCR_4(__kmp_init_middle) ) {
|
||||
__kmp_middle_initialize();
|
||||
}
|
||||
gtid = __kmp_entry_gtid();
|
||||
thread = __kmp_thread_from_gtid(gtid);
|
||||
first_place = thread->th.th_first_place;
|
||||
last_place = thread->th.th_last_place;
|
||||
if ( first_place < 0 || last_place < 0 )
|
||||
return 0;
|
||||
if ( first_place <= last_place )
|
||||
num_places = last_place - first_place + 1;
|
||||
else
|
||||
num_places = __kmp_affinity_num_masks - first_place + last_place + 1;
|
||||
return num_places;
|
||||
#endif
|
||||
}
|
||||
|
||||
void FTN_STDCALL
|
||||
FTN_GET_PARTITION_PLACE_NUMS( int *place_nums ) {
|
||||
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
|
||||
// Nothing.
|
||||
#else
|
||||
int i, gtid, place_num, first_place, last_place, start, end;
|
||||
kmp_info_t *thread;
|
||||
if ( ! TCR_4(__kmp_init_middle) ) {
|
||||
__kmp_middle_initialize();
|
||||
}
|
||||
gtid = __kmp_entry_gtid();
|
||||
thread = __kmp_thread_from_gtid(gtid);
|
||||
first_place = thread->th.th_first_place;
|
||||
last_place = thread->th.th_last_place;
|
||||
if ( first_place < 0 || last_place < 0 )
|
||||
return;
|
||||
if ( first_place <= last_place ) {
|
||||
start = first_place;
|
||||
end = last_place;
|
||||
} else {
|
||||
start = last_place;
|
||||
end = first_place;
|
||||
}
|
||||
for (i = 0, place_num = start; place_num <= end; ++place_num, ++i) {
|
||||
place_nums[i] = place_num;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
int FTN_STDCALL
|
||||
xexpand(FTN_GET_NUM_TEAMS)( void )
|
||||
{
|
||||
@@ -746,20 +904,17 @@ xexpand(FTN_GET_TEAM_NUM)( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
#if KMP_MIC || KMP_OS_DARWIN
|
||||
|
||||
static int __kmp_default_device = 0;
|
||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_GET_DEFAULT_DEVICE( void )
|
||||
{
|
||||
return __kmp_default_device;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FTN_STDCALL
|
||||
FTN_SET_DEFAULT_DEVICE( int KMP_DEREF arg )
|
||||
{
|
||||
__kmp_default_device = KMP_DEREF arg;
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
@@ -768,7 +923,7 @@ FTN_GET_NUM_DEVICES( void )
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // KMP_MIC || KMP_OS_DARWIN
|
||||
#endif // KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||
|
||||
#if ! KMP_OS_LINUX
|
||||
|
||||
@@ -798,28 +953,85 @@ xexpand(FTN_IS_INITIAL_DEVICE)( void )
|
||||
|
||||
#endif // OMP_40_ENABLED
|
||||
|
||||
#if OMP_45_ENABLED && defined(KMP_STUB)
|
||||
// OpenMP 4.5 entries for stubs library
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_GET_INITIAL_DEVICE(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// As all *target* functions are C-only parameters always passed by value
|
||||
void * FTN_STDCALL
|
||||
FTN_TARGET_ALLOC(size_t size, int device_num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FTN_STDCALL
|
||||
FTN_TARGET_FREE(void * device_ptr, int device_num)
|
||||
{
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_TARGET_IS_PRESENT(void * ptr, int device_num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_TARGET_MEMCPY(void *dst, void *src, size_t length, size_t dst_offset,
|
||||
size_t src_offset, int dst_device, int src_device)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_TARGET_MEMCPY_RECT(void *dst, void *src, size_t element_size, int num_dims,
|
||||
const size_t *volume, const size_t *dst_offsets,
|
||||
const size_t *src_offsets, const size_t *dst_dimensions,
|
||||
const size_t *src_dimensions, int dst_device, int src_device)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_TARGET_ASSOCIATE_PTR(void *host_ptr, void *device_ptr, size_t size,
|
||||
size_t device_offset, int device_num)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_TARGET_DISASSOCIATE_PTR(void *host_ptr, int device_num)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif // OMP_45_ENABLED && defined(KMP_STUB)
|
||||
|
||||
#ifdef KMP_STUB
|
||||
typedef enum { UNINIT = -1, UNLOCKED, LOCKED } kmp_stub_lock_t;
|
||||
#endif /* KMP_STUB */
|
||||
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
void FTN_STDCALL
|
||||
FTN_INIT_LOCK_HINTED( void **user_lock, int KMP_DEREF hint )
|
||||
FTN_INIT_LOCK_WITH_HINT( void **user_lock, uintptr_t KMP_DEREF hint )
|
||||
{
|
||||
#ifdef KMP_STUB
|
||||
*((kmp_stub_lock_t *)user_lock) = UNLOCKED;
|
||||
#else
|
||||
__kmp_init_lock_hinted( user_lock, KMP_DEREF hint );
|
||||
__kmpc_init_lock_with_hint( NULL, __kmp_entry_gtid(), user_lock, KMP_DEREF hint );
|
||||
#endif
|
||||
}
|
||||
|
||||
void FTN_STDCALL
|
||||
FTN_INIT_NEST_LOCK_HINTED( void **user_lock, int KMP_DEREF hint )
|
||||
FTN_INIT_NEST_LOCK_WITH_HINT( void **user_lock, uintptr_t KMP_DEREF hint )
|
||||
{
|
||||
#ifdef KMP_STUB
|
||||
*((kmp_stub_lock_t *)user_lock) = UNLOCKED;
|
||||
#else
|
||||
__kmp_init_nest_lock_hinted( user_lock, KMP_DEREF hint );
|
||||
__kmpc_init_nest_lock_with_hint( NULL, __kmp_entry_gtid(), user_lock, KMP_DEREF hint );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -1000,6 +1212,13 @@ FTN_MALLOC( size_t KMP_DEREF size )
|
||||
return kmpc_malloc( KMP_DEREF size );
|
||||
}
|
||||
|
||||
void * FTN_STDCALL
|
||||
FTN_ALIGNED_MALLOC( size_t KMP_DEREF size, size_t KMP_DEREF alignment )
|
||||
{
|
||||
// kmpc_aligned_malloc initializes the library if needed
|
||||
return kmpc_aligned_malloc( KMP_DEREF size, KMP_DEREF alignment );
|
||||
}
|
||||
|
||||
void * FTN_STDCALL
|
||||
FTN_CALLOC( size_t KMP_DEREF nelem, size_t KMP_DEREF elsize )
|
||||
{
|
||||
@@ -1081,6 +1300,22 @@ FTN_GET_CANCELLATION_STATUS(int cancel_kind) {
|
||||
|
||||
#endif // OMP_40_ENABLED
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
/* returns the maximum allowed task priority */
|
||||
int FTN_STDCALL
|
||||
FTN_GET_MAX_TASK_PRIORITY( void )
|
||||
{
|
||||
#ifdef KMP_STUB
|
||||
return 0;
|
||||
#else
|
||||
if ( ! __kmp_init_serial ) {
|
||||
__kmp_serial_initialize();
|
||||
}
|
||||
return __kmp_max_task_priority;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// GCC compatibility (versioned symbols)
|
||||
#ifdef KMP_USE_VERSION_SYMBOLS
|
||||
|
||||
@@ -1159,8 +1394,8 @@ xaliasify(FTN_GET_CANCELLATION, 40);
|
||||
xaliasify(FTN_IS_INITIAL_DEVICE, 40);
|
||||
#endif /* OMP_40_ENABLED */
|
||||
|
||||
#if OMP_41_ENABLED
|
||||
// OMP_4.1 aliases
|
||||
#if OMP_45_ENABLED
|
||||
// OMP_4.5 aliases
|
||||
#endif
|
||||
|
||||
#if OMP_50_ENABLED
|
||||
@@ -1228,8 +1463,8 @@ xversionify(FTN_GET_CANCELLATION, 40, "OMP_4.0");
|
||||
xversionify(FTN_IS_INITIAL_DEVICE, 40, "OMP_4.0");
|
||||
#endif /* OMP_40_ENABLED */
|
||||
|
||||
#if OMP_41_ENABLED
|
||||
// OMP_4.1 versioned symbols
|
||||
#if OMP_45_ENABLED
|
||||
// OMP_4.5 versioned symbols
|
||||
#endif
|
||||
|
||||
#if OMP_50_ENABLED
|
||||
|
||||
+101
-13
@@ -35,6 +35,7 @@
|
||||
#define FTN_SET_LIBRARY kmp_set_library
|
||||
#define FTN_GET_LIBRARY kmp_get_library
|
||||
#define FTN_SET_DEFAULTS kmp_set_defaults
|
||||
#define FTN_SET_DISP_NUM_BUFFERS kmp_set_disp_num_buffers
|
||||
#define FTN_SET_AFFINITY kmp_set_affinity
|
||||
#define FTN_GET_AFFINITY kmp_get_affinity
|
||||
#define FTN_GET_AFFINITY_MAX_PROC kmp_get_affinity_max_proc
|
||||
@@ -45,6 +46,7 @@
|
||||
#define FTN_GET_AFFINITY_MASK_PROC kmp_get_affinity_mask_proc
|
||||
|
||||
#define FTN_MALLOC kmp_malloc
|
||||
#define FTN_ALIGNED_MALLOC kmp_aligned_malloc
|
||||
#define FTN_CALLOC kmp_calloc
|
||||
#define FTN_REALLOC kmp_realloc
|
||||
#define FTN_FREE kmp_free
|
||||
@@ -80,8 +82,8 @@
|
||||
#endif
|
||||
#define FTN_INIT_LOCK omp_init_lock
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
#define FTN_INIT_LOCK_HINTED kmp_init_lock_hinted
|
||||
#define FTN_INIT_NEST_LOCK_HINTED kmp_init_nest_lock_hinted
|
||||
#define FTN_INIT_LOCK_WITH_HINT omp_init_lock_with_hint
|
||||
#define FTN_INIT_NEST_LOCK_WITH_HINT omp_init_nest_lock_with_hint
|
||||
#endif
|
||||
#define FTN_DESTROY_LOCK omp_destroy_lock
|
||||
#define FTN_SET_LOCK omp_set_lock
|
||||
@@ -100,7 +102,7 @@
|
||||
#define FTN_GET_WTICK omp_get_wtick
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
#if KMP_MIC || KMP_OS_DARWIN
|
||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device
|
||||
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device
|
||||
#define FTN_GET_NUM_DEVICES omp_get_num_devices
|
||||
@@ -113,6 +115,26 @@
|
||||
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status
|
||||
#endif
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority
|
||||
#define FTN_GET_NUM_PLACES omp_get_num_places
|
||||
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs
|
||||
#define FTN_GET_PLACE_PROC_IDS omp_get_place_proc_ids
|
||||
#define FTN_GET_PLACE_NUM omp_get_place_num
|
||||
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places
|
||||
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums
|
||||
# ifdef KMP_STUB
|
||||
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device
|
||||
#define FTN_TARGET_ALLOC omp_target_alloc
|
||||
#define FTN_TARGET_FREE omp_target_free
|
||||
#define FTN_TARGET_IS_PRESENT omp_target_is_present
|
||||
#define FTN_TARGET_MEMCPY omp_target_memcpy
|
||||
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect
|
||||
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr
|
||||
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* KMP_FTN_PLAIN */
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -131,6 +153,7 @@
|
||||
#define FTN_SET_LIBRARY kmp_set_library_
|
||||
#define FTN_GET_LIBRARY kmp_get_library_
|
||||
#define FTN_SET_DEFAULTS kmp_set_defaults_
|
||||
#define FTN_SET_DISP_NUM_BUFFERS kmp_set_disp_num_buffers_
|
||||
#define FTN_SET_AFFINITY kmp_set_affinity_
|
||||
#define FTN_GET_AFFINITY kmp_get_affinity_
|
||||
#define FTN_GET_AFFINITY_MAX_PROC kmp_get_affinity_max_proc_
|
||||
@@ -141,6 +164,7 @@
|
||||
#define FTN_GET_AFFINITY_MASK_PROC kmp_get_affinity_mask_proc_
|
||||
|
||||
#define FTN_MALLOC kmp_malloc_
|
||||
#define FTN_ALIGNED_MALLOC kmp_aligned_malloc_
|
||||
#define FTN_CALLOC kmp_calloc_
|
||||
#define FTN_REALLOC kmp_realloc_
|
||||
#define FTN_FREE kmp_free_
|
||||
@@ -176,8 +200,8 @@
|
||||
#endif
|
||||
#define FTN_INIT_LOCK omp_init_lock_
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
#define FTN_INIT_LOCK_HINTED kmp_init_lock_hinted_
|
||||
#define FTN_INIT_NEST_LOCK_HINTED kmp_init_nest_lock_hinted_
|
||||
#define FTN_INIT_LOCK_WITH_HINT omp_init_lock_with_hint_
|
||||
#define FTN_INIT_NEST_LOCK_WITH_HINT omp_init_nest_lock_with_hint_
|
||||
#endif
|
||||
#define FTN_DESTROY_LOCK omp_destroy_lock_
|
||||
#define FTN_SET_LOCK omp_set_lock_
|
||||
@@ -196,7 +220,7 @@
|
||||
#define FTN_GET_WTICK omp_get_wtick_
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
#if KMP_MIC || KMP_OS_DARWIN
|
||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device_
|
||||
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device_
|
||||
#define FTN_GET_NUM_DEVICES omp_get_num_devices_
|
||||
@@ -210,6 +234,26 @@
|
||||
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status_
|
||||
#endif
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority_
|
||||
#define FTN_GET_NUM_PLACES omp_get_num_places_
|
||||
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs_
|
||||
#define FTN_GET_PLACE_PROC_IDS omp_get_place_proc_ids_
|
||||
#define FTN_GET_PLACE_NUM omp_get_place_num_
|
||||
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places_
|
||||
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums_
|
||||
# ifdef KMP_STUB
|
||||
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device_
|
||||
#define FTN_TARGET_ALLOC omp_target_alloc_
|
||||
#define FTN_TARGET_FREE omp_target_free_
|
||||
#define FTN_TARGET_IS_PRESENT omp_target_is_present_
|
||||
#define FTN_TARGET_MEMCPY omp_target_memcpy_
|
||||
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect_
|
||||
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr_
|
||||
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr_
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* KMP_FTN_APPEND */
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -228,6 +272,7 @@
|
||||
#define FTN_SET_LIBRARY KMP_SET_LIBRARY
|
||||
#define FTN_GET_LIBRARY KMP_GET_LIBRARY
|
||||
#define FTN_SET_DEFAULTS KMP_SET_DEFAULTS
|
||||
#define FTN_SET_DISP_NUM_BUFFERS KMP_SET_DISP_NUM_BUFFERS
|
||||
#define FTN_SET_AFFINITY KMP_SET_AFFINITY
|
||||
#define FTN_GET_AFFINITY KMP_GET_AFFINITY
|
||||
#define FTN_GET_AFFINITY_MAX_PROC KMP_GET_AFFINITY_MAX_PROC
|
||||
@@ -238,6 +283,7 @@
|
||||
#define FTN_GET_AFFINITY_MASK_PROC KMP_GET_AFFINITY_MASK_PROC
|
||||
|
||||
#define FTN_MALLOC KMP_MALLOC
|
||||
#define FTN_ALIGNED_MALLOC KMP_ALIGNED_MALLOC
|
||||
#define FTN_CALLOC KMP_CALLOC
|
||||
#define FTN_REALLOC KMP_REALLOC
|
||||
#define FTN_FREE KMP_FREE
|
||||
@@ -273,8 +319,8 @@
|
||||
#endif
|
||||
#define FTN_INIT_LOCK OMP_INIT_LOCK
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
#define FTN_INIT_LOCK_HINTED KMP_INIT_LOCK_HINTED
|
||||
#define FTN_INIT_NEST_LOCK_HINTED KMP_INIT_NEST_LOCK_HINTED
|
||||
#define FTN_INIT_LOCK_WITH_HINT OMP_INIT_LOCK_WITH_HINT
|
||||
#define FTN_INIT_NEST_LOCK_WITH_HINT OMP_INIT_NEST_LOCK_WITH_HINT
|
||||
#endif
|
||||
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK
|
||||
#define FTN_SET_LOCK OMP_SET_LOCK
|
||||
@@ -293,7 +339,7 @@
|
||||
#define FTN_GET_WTICK OMP_GET_WTICK
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
#if KMP_MIC || KMP_OS_DARWIN
|
||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE
|
||||
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE
|
||||
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES
|
||||
@@ -307,6 +353,26 @@
|
||||
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS
|
||||
#endif
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY
|
||||
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES
|
||||
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS
|
||||
#define FTN_GET_PLACE_PROC_IDS OMP_GET_PLACE_PROC_IDS
|
||||
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM
|
||||
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES
|
||||
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS
|
||||
# ifdef KMP_STUB
|
||||
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE
|
||||
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC
|
||||
#define FTN_TARGET_FREE OMP_TARGET_FREE
|
||||
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT
|
||||
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY
|
||||
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT
|
||||
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR
|
||||
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* KMP_FTN_UPPER */
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -325,6 +391,7 @@
|
||||
#define FTN_SET_LIBRARY KMP_SET_LIBRARY_
|
||||
#define FTN_GET_LIBRARY KMP_GET_LIBRARY_
|
||||
#define FTN_SET_DEFAULTS KMP_SET_DEFAULTS_
|
||||
#define FTN_SET_DISP_NUM_BUFFERS KMP_SET_DISP_NUM_BUFFERS_
|
||||
#define FTN_SET_AFFINITY KMP_SET_AFFINITY_
|
||||
#define FTN_GET_AFFINITY KMP_GET_AFFINITY_
|
||||
#define FTN_GET_AFFINITY_MAX_PROC KMP_GET_AFFINITY_MAX_PROC_
|
||||
@@ -335,6 +402,7 @@
|
||||
#define FTN_GET_AFFINITY_MASK_PROC KMP_GET_AFFINITY_MASK_PROC_
|
||||
|
||||
#define FTN_MALLOC KMP_MALLOC_
|
||||
#define FTN_ALIGNED_MALLOC KMP_ALIGNED_MALLOC_
|
||||
#define FTN_CALLOC KMP_CALLOC_
|
||||
#define FTN_REALLOC KMP_REALLOC_
|
||||
#define FTN_FREE KMP_FREE_
|
||||
@@ -370,8 +438,8 @@
|
||||
#endif
|
||||
#define FTN_INIT_LOCK OMP_INIT_LOCK_
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
#define FTN_INIT_LOCK_HINTED KMP_INIT_LOCK_HINTED_
|
||||
#define FTN_INIT_NEST_LOCK_HINTED KMP_INIT_NEST_LOCK_HINTED_
|
||||
#define FTN_INIT_LOCK_WITH_HINT OMP_INIT_LOCK_WITH_HINT_
|
||||
#define FTN_INIT_NEST_LOCK_WITH_HINT OMP_INIT_NEST_LOCK_WITH_HINT_
|
||||
#endif
|
||||
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK_
|
||||
#define FTN_SET_LOCK OMP_SET_LOCK_
|
||||
@@ -390,7 +458,7 @@
|
||||
#define FTN_GET_WTICK OMP_GET_WTICK_
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
#if KMP_MIC || KMP_OS_DARWIN
|
||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE_
|
||||
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE_
|
||||
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES_
|
||||
@@ -404,6 +472,26 @@
|
||||
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS_
|
||||
#endif
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY_
|
||||
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES_
|
||||
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS_
|
||||
#define FTN_GET_PLACE_PROC_IDS OMP_GET_PLACE_PROC_IDS_
|
||||
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM_
|
||||
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES_
|
||||
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS_
|
||||
# ifdef KMP_STUB
|
||||
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE_
|
||||
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC_
|
||||
#define FTN_TARGET_FREE OMP_TARGET_FREE_
|
||||
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT_
|
||||
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY_
|
||||
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT_
|
||||
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR_
|
||||
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR_
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* KMP_FTN_UAPPEND */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -474,7 +562,7 @@
|
||||
// All GOMP_3.0 symbols
|
||||
#define KMP_API_NAME_GOMP_TASKYIELD GOMP_taskyield
|
||||
|
||||
// All GOMP_4.0 symbols
|
||||
// All GOMP_4.0 symbols
|
||||
// TODO: As of 2013-10-14, none of the GOMP_4.0 functions are implemented in libomp
|
||||
#define KMP_API_NAME_GOMP_BARRIER_CANCEL GOMP_barrier_cancel
|
||||
#define KMP_API_NAME_GOMP_CANCEL GOMP_cancel
|
||||
|
||||
@@ -15,18 +15,16 @@
|
||||
|
||||
#include "kmp.h"
|
||||
|
||||
#ifdef KMP_SETVERSION
|
||||
char __kmp_setversion_string[] = VERSION_STRING;
|
||||
#endif
|
||||
|
||||
kmp_key_t __kmp_gtid_threadprivate_key;
|
||||
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
kmp_cpuinfo_t __kmp_cpuinfo = { 0 }; // Not initialized
|
||||
#endif
|
||||
|
||||
#if KMP_STATS_ENABLED
|
||||
#include "kmp_stats.h"
|
||||
// lock for modifying the global __kmp_stats_list
|
||||
kmp_tas_lock_t __kmp_stats_lock = KMP_TAS_LOCK_INITIALIZER(__kmp_stats_lock);
|
||||
kmp_tas_lock_t __kmp_stats_lock;
|
||||
|
||||
// global list of per thread stats, the head is a sentinel node which accumulates all stats produced before __kmp_create_worker is called.
|
||||
kmp_stats_list __kmp_stats_list;
|
||||
@@ -107,8 +105,7 @@ char const *__kmp_barrier_type_name [ bs_last_barrier ] =
|
||||
, "reduction"
|
||||
#endif // KMP_FAST_REDUCTION_BARRIER
|
||||
};
|
||||
char const *__kmp_barrier_pattern_name [ bp_last_bar ] = { "linear", "tree", "hyper", "hierarchical" };
|
||||
|
||||
char const *__kmp_barrier_pattern_name[bp_last_bar] = {"linear","tree","hyper","hierarchical"};
|
||||
|
||||
int __kmp_allThreadsSpecified = 0;
|
||||
size_t __kmp_align_alloc = CACHE_LINE;
|
||||
@@ -127,6 +124,7 @@ int __kmp_dflt_team_nth_ub = 0;
|
||||
int __kmp_tp_capacity = 0;
|
||||
int __kmp_tp_cached = 0;
|
||||
int __kmp_dflt_nested = FALSE;
|
||||
int __kmp_dispatch_num_buffers = KMP_DFLT_DISP_NUM_BUFF;
|
||||
int __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT; /* max_active_levels limit */
|
||||
#if KMP_NESTED_HOT_TEAMS
|
||||
int __kmp_hot_teams_mode = 0; /* 0 - free extra threads when reduced */
|
||||
@@ -218,6 +216,11 @@ enum mic_type __kmp_mic_type = non_mic;
|
||||
|
||||
#if KMP_AFFINITY_SUPPORTED
|
||||
|
||||
# if KMP_USE_HWLOC
|
||||
int __kmp_hwloc_error = FALSE;
|
||||
hwloc_topology_t __kmp_hwloc_topology = NULL;
|
||||
# endif
|
||||
|
||||
# if KMP_GROUP_AFFINITY
|
||||
|
||||
int __kmp_num_proc_groups = 1;
|
||||
@@ -253,11 +256,16 @@ kmp_nested_proc_bind_t __kmp_nested_proc_bind = { NULL, 0, 0 };
|
||||
int __kmp_affinity_num_places = 0;
|
||||
#endif
|
||||
|
||||
int __kmp_place_num_sockets = 0;
|
||||
int __kmp_place_socket_offset = 0;
|
||||
int __kmp_place_num_cores = 0;
|
||||
int __kmp_place_num_threads_per_core = 0;
|
||||
int __kmp_place_core_offset = 0;
|
||||
int __kmp_place_num_threads_per_core = 0;
|
||||
|
||||
kmp_tasking_mode_t __kmp_tasking_mode = tskm_task_teams;
|
||||
#if OMP_45_ENABLED
|
||||
kmp_int32 __kmp_max_task_priority = 0;
|
||||
#endif
|
||||
|
||||
/* This check ensures that the compiler is passing the correct data type
|
||||
* for the flags formal parameter of the function kmpc_omp_task_alloc().
|
||||
@@ -320,7 +328,6 @@ int __kmp_storage_map_verbose_specified = FALSE;
|
||||
int __kmp_need_register_atfork = TRUE; /* At initialization, call pthread_atfork to install fork handler */
|
||||
int __kmp_need_register_atfork_specified = TRUE;
|
||||
|
||||
|
||||
int __kmp_env_chunk = FALSE; /* KMP_CHUNK specified? */
|
||||
int __kmp_env_stksize = FALSE; /* KMP_STACKSIZE specified? */
|
||||
int __kmp_env_omp_stksize = FALSE; /* OMP_STACKSIZE specified? */
|
||||
|
||||
+137
-60
@@ -13,9 +13,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#if defined(__x86_64) || defined (__powerpc64__) || defined(__aarch64__)
|
||||
# define KMP_I8
|
||||
#endif
|
||||
#include "kmp.h"
|
||||
#include "kmp_atomic.h"
|
||||
|
||||
@@ -259,7 +256,7 @@ __kmp_GOMP_microtask_wrapper(int *gtid, int *npr, void (*task)(void *),
|
||||
ompt_frame_t *ompt_frame;
|
||||
ompt_state_t enclosing_state;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
// get pointer to thread data structure
|
||||
thr = __kmp_threads[*gtid];
|
||||
|
||||
@@ -276,7 +273,7 @@ __kmp_GOMP_microtask_wrapper(int *gtid, int *npr, void (*task)(void *),
|
||||
task(data);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
// clear task frame
|
||||
ompt_frame->exit_runtime_frame = NULL;
|
||||
|
||||
@@ -306,7 +303,7 @@ __kmp_GOMP_parallel_microtask_wrapper(int *gtid, int *npr,
|
||||
ompt_frame_t *ompt_frame;
|
||||
ompt_state_t enclosing_state;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
thr = __kmp_threads[*gtid];
|
||||
// save enclosing task state; set current state for task
|
||||
enclosing_state = thr->th.ompt_thread_info.state;
|
||||
@@ -324,7 +321,7 @@ __kmp_GOMP_parallel_microtask_wrapper(int *gtid, int *npr,
|
||||
task(data);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
// clear task frame
|
||||
ompt_frame->exit_runtime_frame = NULL;
|
||||
|
||||
@@ -367,15 +364,14 @@ __kmp_GOMP_fork_call(ident_t *loc, int gtid, void (*unwrapped_task)(void *), mic
|
||||
__kmp_run_before_invoked_task(gtid, tid, thr, team);
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_enabled) {
|
||||
#if OMPT_TRACE
|
||||
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
|
||||
// implicit task callback
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
|
||||
team_info->parallel_id, task_info->task_id);
|
||||
}
|
||||
@@ -388,28 +384,33 @@ __kmp_GOMP_fork_call(ident_t *loc, int gtid, void (*unwrapped_task)(void *), mic
|
||||
static void
|
||||
__kmp_GOMP_serialized_parallel(ident_t *loc, kmp_int32 gtid, void (*task)(void *))
|
||||
{
|
||||
#if OMPT_SUPPORT
|
||||
ompt_parallel_id_t ompt_parallel_id;
|
||||
if (ompt_enabled) {
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
task_info->frame.exit_runtime_frame = NULL;
|
||||
|
||||
ompt_parallel_id = __ompt_parallel_id_new(gtid);
|
||||
|
||||
// parallel region callback
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) {
|
||||
int team_size = 1;
|
||||
ompt_callbacks.ompt_callback(ompt_event_parallel_begin)(
|
||||
task_info->task_id, &task_info->frame, ompt_parallel_id,
|
||||
team_size, (void *) task,
|
||||
OMPT_INVOKER(fork_context_gnu));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
__kmp_serialized_parallel(loc, gtid);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
ompt_task_id_t ompt_task_id = __ompt_get_task_id_internal(0);
|
||||
ompt_frame_t *ompt_frame = __ompt_get_task_frame_internal(0);
|
||||
if (ompt_enabled) {
|
||||
kmp_info_t *thr = __kmp_threads[gtid];
|
||||
|
||||
ompt_parallel_id_t ompt_parallel_id = __ompt_parallel_id_new(gtid);
|
||||
ompt_task_id_t my_ompt_task_id = __ompt_task_id_new(gtid);
|
||||
|
||||
ompt_frame->exit_runtime_frame = NULL;
|
||||
|
||||
// parallel region callback
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) {
|
||||
int team_size = 1;
|
||||
ompt_callbacks.ompt_callback(ompt_event_parallel_begin)(
|
||||
ompt_task_id, ompt_frame, ompt_parallel_id,
|
||||
team_size, (void *) task);
|
||||
}
|
||||
|
||||
// set up lightweight task
|
||||
ompt_lw_taskteam_t *lwt = (ompt_lw_taskteam_t *)
|
||||
__kmp_allocate(sizeof(ompt_lw_taskteam_t));
|
||||
@@ -420,8 +421,7 @@ __kmp_GOMP_serialized_parallel(ident_t *loc, kmp_int32 gtid, void (*task)(void *
|
||||
|
||||
#if OMPT_TRACE
|
||||
// implicit task callback
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
|
||||
ompt_parallel_id, my_ompt_task_id);
|
||||
}
|
||||
@@ -440,7 +440,7 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_START)(void (*task)(void *), void *data, unsi
|
||||
#if OMPT_SUPPORT
|
||||
ompt_frame_t *parent_frame;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
parent_frame = __ompt_get_task_frame_internal(0);
|
||||
parent_frame->reenter_runtime_frame = __builtin_frame_address(0);
|
||||
}
|
||||
@@ -461,7 +461,7 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_START)(void (*task)(void *), void *data, unsi
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
parent_frame->reenter_runtime_frame = NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -482,55 +482,95 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(void)
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
ompt_parallel_id_t parallel_id;
|
||||
ompt_task_id_t serialized_task_id;
|
||||
ompt_frame_t *ompt_frame = NULL;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
|
||||
parallel_id = team_info->parallel_id;
|
||||
|
||||
ompt_frame = __ompt_get_task_frame_internal(0);
|
||||
ompt_frame->exit_runtime_frame = __builtin_frame_address(0);
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
serialized_task_id = task_info->task_id;
|
||||
|
||||
#if OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
|
||||
parallel_id, task_info->task_id);
|
||||
}
|
||||
#endif
|
||||
// Record that we re-entered the runtime system in the implicit
|
||||
// task frame representing the parallel region.
|
||||
ompt_frame = &task_info->frame;
|
||||
ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
|
||||
|
||||
// unlink if necessary. no-op if there is not a lightweight task.
|
||||
ompt_lw_taskteam_t *lwt = __ompt_lw_taskteam_unlink(thr);
|
||||
// GOMP allocates/frees lwt since it can't be kept on the stack
|
||||
if (lwt) __kmp_free(lwt);
|
||||
if (lwt) {
|
||||
__kmp_free(lwt);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_enabled) {
|
||||
// Since a lightweight task was destroyed, make sure that the
|
||||
// remaining deepest task knows the stack frame where the runtime
|
||||
// was reentered.
|
||||
ompt_frame = __ompt_get_task_frame_internal(0);
|
||||
ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! __kmp_threads[gtid]->th.th_team->t.t_serialized) {
|
||||
kmp_info_t *thr = __kmp_threads[gtid];
|
||||
if (! thr->th.th_team->t.t_serialized) {
|
||||
__kmp_run_after_invoked_task(gtid, __kmp_tid_from_gtid(gtid), thr,
|
||||
thr->th.th_team);
|
||||
__kmp_join_call(&loc, gtid);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_enabled) {
|
||||
// Set reenter frame in parent task, which will become current task
|
||||
// in the midst of join. This is needed before the end_parallel callback.
|
||||
ompt_frame = __ompt_get_task_frame_internal(1);
|
||||
ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
__kmp_join_call(&loc, gtid
|
||||
#if OMPT_SUPPORT
|
||||
, fork_context_gnu
|
||||
#endif
|
||||
);
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_enabled) {
|
||||
ompt_frame->reenter_runtime_frame = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
|
||||
parallel_id, serialized_task_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
__kmpc_end_serialized_parallel(&loc, gtid);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
|
||||
if (ompt_enabled) {
|
||||
// Record that we re-entered the runtime system in the frame that
|
||||
// created the parallel region.
|
||||
ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
|
||||
|
||||
if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
ompt_callbacks.ompt_callback(ompt_event_parallel_end)(
|
||||
parallel_id, task_info->task_id);
|
||||
parallel_id, task_info->task_id,
|
||||
OMPT_INVOKER(fork_context_gnu));
|
||||
}
|
||||
|
||||
ompt_frame->reenter_runtime_frame = NULL;
|
||||
|
||||
thr->th.ompt_thread_info.state =
|
||||
(((thr->th.th_team)->t.t_serialized) ?
|
||||
ompt_state_work_serial : ompt_state_work_parallel);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -817,7 +857,7 @@ LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
|
||||
// There are no ull versions (yet).
|
||||
//
|
||||
|
||||
#define PARALLEL_LOOP_START(func, schedule) \
|
||||
#define PARALLEL_LOOP_START(func, schedule, ompt_pre, ompt_post) \
|
||||
void func (void (*task) (void *), void *data, unsigned num_threads, \
|
||||
long lb, long ub, long str, long chunk_sz) \
|
||||
{ \
|
||||
@@ -826,6 +866,8 @@ LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
|
||||
KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
|
||||
gtid, lb, ub, str, chunk_sz )); \
|
||||
\
|
||||
ompt_pre(); \
|
||||
\
|
||||
if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) { \
|
||||
if (num_threads != 0) { \
|
||||
__kmp_push_num_threads(&loc, gtid, num_threads); \
|
||||
@@ -843,14 +885,45 @@ LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
|
||||
(str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
|
||||
(schedule) != kmp_sch_static); \
|
||||
\
|
||||
ompt_post(); \
|
||||
\
|
||||
KA_TRACE(20, ( #func " exit: T#%d\n", gtid)); \
|
||||
}
|
||||
|
||||
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START), kmp_sch_static)
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START), kmp_sch_dynamic_chunked)
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START), kmp_sch_guided_chunked)
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START), kmp_sch_runtime)
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
|
||||
#define OMPT_LOOP_PRE() \
|
||||
ompt_frame_t *parent_frame; \
|
||||
if (ompt_enabled) { \
|
||||
parent_frame = __ompt_get_task_frame_internal(0); \
|
||||
parent_frame->reenter_runtime_frame = __builtin_frame_address(0); \
|
||||
}
|
||||
|
||||
|
||||
#define OMPT_LOOP_POST() \
|
||||
if (ompt_enabled) { \
|
||||
parent_frame->reenter_runtime_frame = NULL; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define OMPT_LOOP_PRE()
|
||||
|
||||
#define OMPT_LOOP_POST()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START),
|
||||
kmp_sch_static, OMPT_LOOP_PRE, OMPT_LOOP_POST)
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START),
|
||||
kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START),
|
||||
kmp_sch_guided_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START),
|
||||
kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
|
||||
|
||||
|
||||
//
|
||||
@@ -859,7 +932,7 @@ PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START), kmp_
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_func)(void *, void *),
|
||||
long arg_size, long arg_align, int if_cond, unsigned gomp_flags)
|
||||
long arg_size, long arg_align, bool if_cond, unsigned gomp_flags)
|
||||
{
|
||||
MKLOC(loc, "GOMP_task");
|
||||
int gtid = __kmp_entry_gtid();
|
||||
@@ -872,6 +945,10 @@ xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_fu
|
||||
if (gomp_flags & 1) {
|
||||
input_flags->tiedness = 1;
|
||||
}
|
||||
// The second low-order bit is the "final" flag
|
||||
if (gomp_flags & 2) {
|
||||
input_flags->final = 1;
|
||||
}
|
||||
input_flags->native = 1;
|
||||
// __kmp_task_alloc() sets up all other flags
|
||||
|
||||
@@ -906,7 +983,7 @@ xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_fu
|
||||
ompt_thread_info_t oldInfo;
|
||||
kmp_info_t *thread;
|
||||
kmp_taskdata_t *taskdata;
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
// Store the threads states and restore them after the task
|
||||
thread = __kmp_threads[ gtid ];
|
||||
taskdata = KMP_TASK_TO_TASKDATA(task);
|
||||
@@ -923,7 +1000,7 @@ xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_fu
|
||||
__kmpc_omp_task_complete_if0(&loc, gtid, task);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
thread->th.ompt_thread_info = oldInfo;
|
||||
taskdata->ompt_task_info.frame.exit_runtime_frame = 0;
|
||||
}
|
||||
@@ -1022,7 +1099,7 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(void (*task) (void *), void *
|
||||
#if OMPT_SUPPORT
|
||||
ompt_frame_t *parent_frame;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
parent_frame = __ompt_get_task_frame_internal(0);
|
||||
parent_frame->reenter_runtime_frame = __builtin_frame_address(0);
|
||||
}
|
||||
@@ -1045,7 +1122,7 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(void (*task) (void *), void *
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
if (ompt_enabled) {
|
||||
parent_frame->reenter_runtime_frame = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@ kmp_bootstrap_lock_t __kmp_console_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
|
||||
# ifdef KMP_DEBUG
|
||||
# ifdef KMP_DEBUG
|
||||
/* __kmp_stdout is used only for dev build */
|
||||
static HANDLE __kmp_stdout = NULL;
|
||||
# endif
|
||||
@@ -77,7 +77,7 @@ kmp_bootstrap_lock_t __kmp_console_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_
|
||||
/* wait until user presses return before closing window */
|
||||
/* TODO only close if a window was opened */
|
||||
if( __kmp_console_exists ) {
|
||||
#ifdef KMP_DEBUG
|
||||
#ifdef KMP_DEBUG
|
||||
/* standard out is used only in dev build */
|
||||
__kmp_stdout = NULL;
|
||||
#endif
|
||||
@@ -95,7 +95,7 @@ kmp_bootstrap_lock_t __kmp_console_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_
|
||||
__kmp_acquire_bootstrap_lock( &__kmp_console_lock );
|
||||
|
||||
if( ! __kmp_console_exists ) {
|
||||
#ifdef KMP_DEBUG
|
||||
#ifdef KMP_DEBUG
|
||||
/* standard out is used only in dev build */
|
||||
HANDLE ho;
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "kmp_config.h"
|
||||
|
||||
#if USE_ITT_BUILD
|
||||
/*
|
||||
* kmp_itt.c -- ITT Notify interface.
|
||||
@@ -30,6 +32,9 @@
|
||||
__itt_domain* __kmp_itt_imbalance_domains[KMP_MAX_FRAME_DOMAINS];
|
||||
kmp_int32 __kmp_itt_region_team_size[KMP_MAX_FRAME_DOMAINS];
|
||||
__itt_domain * metadata_domain = NULL;
|
||||
__itt_string_handle * string_handle_imbl = NULL;
|
||||
__itt_string_handle * string_handle_loop = NULL;
|
||||
__itt_string_handle * string_handle_sngl = NULL;
|
||||
|
||||
#include "kmp_version.h"
|
||||
#include "kmp_i18n.h"
|
||||
|
||||
@@ -53,8 +53,8 @@ void __kmp_itt_destroy();
|
||||
// __kmp_itt_xxxed() function should be called after action.
|
||||
|
||||
// --- Parallel region reporting ---
|
||||
__kmp_inline void __kmp_itt_region_forking( int gtid, int team_size, int barriers, int serialized = 0 ); // Master only, before forking threads.
|
||||
__kmp_inline void __kmp_itt_region_joined( int gtid, int serialized = 0 ); // Master only, after joining threads.
|
||||
__kmp_inline void __kmp_itt_region_forking( int gtid, int team_size, int barriers ); // Master only, before forking threads.
|
||||
__kmp_inline void __kmp_itt_region_joined( int gtid ); // Master only, after joining threads.
|
||||
// (*) Note: A thread may execute tasks after this point, though.
|
||||
|
||||
// --- Frame reporting ---
|
||||
@@ -264,6 +264,9 @@ __kmp_inline void __kmp_itt_stack_callee_leave(__itt_caller);
|
||||
extern __itt_domain* __kmp_itt_imbalance_domains[KMP_MAX_FRAME_DOMAINS];
|
||||
extern kmp_int32 __kmp_itt_region_team_size[KMP_MAX_FRAME_DOMAINS];
|
||||
extern __itt_domain * metadata_domain;
|
||||
extern __itt_string_handle * string_handle_imbl;
|
||||
extern __itt_string_handle * string_handle_loop;
|
||||
extern __itt_string_handle * string_handle_sngl;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
+48
-30
@@ -89,10 +89,10 @@ static kmp_bootstrap_lock_t metadata_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( met
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
LINKAGE void
|
||||
__kmp_itt_region_forking( int gtid, int team_size, int barriers, int serialized ) {
|
||||
__kmp_itt_region_forking( int gtid, int team_size, int barriers ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
kmp_team_t * team = __kmp_team_from_gtid( gtid );
|
||||
if (team->t.t_active_level + serialized > 1)
|
||||
if (team->t.t_active_level > 1)
|
||||
{
|
||||
// The frame notifications are only supported for the outermost teams.
|
||||
return;
|
||||
@@ -176,8 +176,8 @@ __kmp_itt_region_forking( int gtid, int team_size, int barriers, int serialized
|
||||
}
|
||||
}
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
KMP_ITT_DEBUG_PRINT( "[frm beg] gtid=%d, idx=%x, serialized:%d, loc:%p\n",
|
||||
gtid, loc->reserved_2, serialized, loc );
|
||||
KMP_ITT_DEBUG_PRINT( "[frm beg] gtid=%d, idx=%x, loc:%p\n",
|
||||
gtid, loc->reserved_2, loc );
|
||||
}
|
||||
#endif
|
||||
} // __kmp_itt_region_forking
|
||||
@@ -315,20 +315,21 @@ __kmp_itt_metadata_imbalance( int gtid, kmp_uint64 begin, kmp_uint64 end, kmp_ui
|
||||
if( metadata_domain == NULL) {
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
metadata_domain = __itt_domain_create( "OMP Metadata" );
|
||||
string_handle_imbl = __itt_string_handle_create( "omp_metadata_imbalance");
|
||||
string_handle_loop = __itt_string_handle_create( "omp_metadata_loop");
|
||||
string_handle_sngl = __itt_string_handle_create( "omp_metadata_single");
|
||||
__itt_suppress_pop();
|
||||
}
|
||||
__kmp_release_bootstrap_lock( & metadata_lock );
|
||||
}
|
||||
|
||||
__itt_string_handle * string_handle = __itt_string_handle_create( "omp_metadata_imbalance");
|
||||
|
||||
kmp_uint64 imbalance_data[ 4 ];
|
||||
imbalance_data[ 0 ] = begin;
|
||||
imbalance_data[ 1 ] = end;
|
||||
imbalance_data[ 2 ] = imbalance;
|
||||
imbalance_data[ 3 ] = reduction;
|
||||
|
||||
__itt_metadata_add(metadata_domain, __itt_null, string_handle, __itt_metadata_u64, 4, imbalance_data);
|
||||
__itt_metadata_add(metadata_domain, __itt_null, string_handle_imbl, __itt_metadata_u64, 4, imbalance_data);
|
||||
#endif
|
||||
} // __kmp_itt_metadata_imbalance
|
||||
|
||||
@@ -342,24 +343,39 @@ __kmp_itt_metadata_loop( ident_t * loc, kmp_uint64 sched_type, kmp_uint64 iterat
|
||||
if( metadata_domain == NULL) {
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
metadata_domain = __itt_domain_create( "OMP Metadata" );
|
||||
string_handle_imbl = __itt_string_handle_create( "omp_metadata_imbalance");
|
||||
string_handle_loop = __itt_string_handle_create( "omp_metadata_loop");
|
||||
string_handle_sngl = __itt_string_handle_create( "omp_metadata_single");
|
||||
__itt_suppress_pop();
|
||||
}
|
||||
__kmp_release_bootstrap_lock( & metadata_lock );
|
||||
}
|
||||
|
||||
__itt_string_handle * string_handle = __itt_string_handle_create( "omp_metadata_loop");
|
||||
kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
|
||||
// Parse line and column from psource string: ";file;func;line;col;;"
|
||||
char * s_line;
|
||||
char * s_col;
|
||||
KMP_DEBUG_ASSERT(loc->psource);
|
||||
#ifdef __cplusplus
|
||||
s_line = strchr((char*)loc->psource, ';');
|
||||
#else
|
||||
s_line = strchr(loc->psource, ';');
|
||||
#endif
|
||||
KMP_DEBUG_ASSERT(s_line);
|
||||
s_line = strchr(s_line + 1, ';'); // 2-nd semicolon
|
||||
KMP_DEBUG_ASSERT(s_line);
|
||||
s_line = strchr(s_line + 1, ';'); // 3-rd semicolon
|
||||
KMP_DEBUG_ASSERT(s_line);
|
||||
s_col = strchr(s_line + 1, ';'); // 4-th semicolon
|
||||
KMP_DEBUG_ASSERT(s_col);
|
||||
|
||||
kmp_uint64 loop_data[ 5 ];
|
||||
loop_data[ 0 ] = str_loc.line;
|
||||
loop_data[ 1 ] = str_loc.col;
|
||||
loop_data[ 0 ] = atoi(s_line + 1); // read line
|
||||
loop_data[ 1 ] = atoi(s_col + 1); // read column
|
||||
loop_data[ 2 ] = sched_type;
|
||||
loop_data[ 3 ] = iterations;
|
||||
loop_data[ 4 ] = chunk;
|
||||
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
|
||||
__itt_metadata_add(metadata_domain, __itt_null, string_handle, __itt_metadata_u64, 5, loop_data);
|
||||
__itt_metadata_add(metadata_domain, __itt_null, string_handle_loop, __itt_metadata_u64, 5, loop_data);
|
||||
#endif
|
||||
} // __kmp_itt_metadata_loop
|
||||
|
||||
@@ -373,12 +389,14 @@ __kmp_itt_metadata_single( ident_t * loc ) {
|
||||
if( metadata_domain == NULL) {
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
metadata_domain = __itt_domain_create( "OMP Metadata" );
|
||||
string_handle_imbl = __itt_string_handle_create( "omp_metadata_imbalance");
|
||||
string_handle_loop = __itt_string_handle_create( "omp_metadata_loop");
|
||||
string_handle_sngl = __itt_string_handle_create( "omp_metadata_single");
|
||||
__itt_suppress_pop();
|
||||
}
|
||||
__kmp_release_bootstrap_lock( & metadata_lock );
|
||||
}
|
||||
|
||||
__itt_string_handle * string_handle = __itt_string_handle_create( "omp_metadata_single");
|
||||
kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
|
||||
kmp_uint64 single_data[ 2 ];
|
||||
single_data[ 0 ] = str_loc.line;
|
||||
@@ -386,7 +404,7 @@ __kmp_itt_metadata_single( ident_t * loc ) {
|
||||
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
|
||||
__itt_metadata_add(metadata_domain, __itt_null, string_handle, __itt_metadata_u64, 2, single_data);
|
||||
__itt_metadata_add(metadata_domain, __itt_null, string_handle_sngl, __itt_metadata_u64, 2, single_data);
|
||||
#endif
|
||||
} // __kmp_itt_metadata_single
|
||||
|
||||
@@ -409,10 +427,10 @@ __kmp_itt_region_finished( int gtid ) {
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
LINKAGE void
|
||||
__kmp_itt_region_joined( int gtid, int serialized ) {
|
||||
__kmp_itt_region_joined( int gtid ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
kmp_team_t * team = __kmp_team_from_gtid( gtid );
|
||||
if (team->t.t_active_level + serialized > 1)
|
||||
if (team->t.t_active_level > 1)
|
||||
{
|
||||
// The frame notifications are only supported for the outermost teams.
|
||||
return;
|
||||
@@ -424,8 +442,8 @@ __kmp_itt_region_joined( int gtid, int serialized ) {
|
||||
if(frm < KMP_MAX_FRAME_DOMAINS) {
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
__itt_frame_end_v3(__kmp_itt_region_domains[frm], NULL);
|
||||
KMP_ITT_DEBUG_PRINT( "[frm end] gtid=%d, idx=%x, serialized:%d, loc:%p\n",
|
||||
gtid, loc->reserved_2, serialized, loc );
|
||||
KMP_ITT_DEBUG_PRINT( "[frm end] gtid=%d, idx=%x, loc:%p\n",
|
||||
gtid, loc->reserved_2, loc );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -483,7 +501,7 @@ __kmp_itt_barrier_object(
|
||||
|
||||
// Master thread increases b_arrived by KMP_BARRIER_STATE_BUMP each time. Divide b_arrived
|
||||
// by KMP_BARRIER_STATE_BUMP to get plain barrier counter.
|
||||
kmp_uint counter = team->t.t_bar[ bt ].b_arrived / KMP_BARRIER_STATE_BUMP + delta;
|
||||
kmp_uint64 counter = team->t.t_bar[ bt ].b_arrived / KMP_BARRIER_STATE_BUMP + delta;
|
||||
// Now form the barrier id. Encode barrier type (bt) in barrier id too, so barriers of
|
||||
// different types do not have the same ids.
|
||||
KMP_BUILD_ASSERT( sizeof( kmp_team_t ) >= bs_last_barrier );
|
||||
@@ -498,7 +516,7 @@ __kmp_itt_barrier_object(
|
||||
+ bt
|
||||
);
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
KMP_ITT_DEBUG_PRINT( "[bar obj] type=%d, counter=%d, object=%p\n", bt, counter, object );
|
||||
KMP_ITT_DEBUG_PRINT( "[bar obj] type=%d, counter=%lld, object=%p\n", bt, counter, object );
|
||||
|
||||
if ( set_name ) {
|
||||
ident_t const * loc = NULL;
|
||||
@@ -798,8 +816,8 @@ __kmp_itt_lock_acquiring( kmp_user_lock_p lock ) {
|
||||
#if KMP_USE_DYNAMIC_LOCK && USE_ITT_NOTIFY
|
||||
// postpone lock object access
|
||||
if ( __itt_sync_prepare_ptr ) {
|
||||
if ( DYNA_EXTRACT_D_TAG(lock) == 0 ) {
|
||||
kmp_indirect_lock_t *ilk = DYNA_LOOKUP_I_LOCK(lock);
|
||||
if ( KMP_EXTRACT_D_TAG(lock) == 0 ) {
|
||||
kmp_indirect_lock_t *ilk = KMP_LOOKUP_I_LOCK(lock);
|
||||
__itt_sync_prepare( ilk->lock );
|
||||
} else {
|
||||
__itt_sync_prepare( lock );
|
||||
@@ -815,8 +833,8 @@ __kmp_itt_lock_acquired( kmp_user_lock_p lock ) {
|
||||
#if KMP_USE_DYNAMIC_LOCK && USE_ITT_NOTIFY
|
||||
// postpone lock object access
|
||||
if ( __itt_sync_acquired_ptr ) {
|
||||
if ( DYNA_EXTRACT_D_TAG(lock) == 0 ) {
|
||||
kmp_indirect_lock_t *ilk = DYNA_LOOKUP_I_LOCK(lock);
|
||||
if ( KMP_EXTRACT_D_TAG(lock) == 0 ) {
|
||||
kmp_indirect_lock_t *ilk = KMP_LOOKUP_I_LOCK(lock);
|
||||
__itt_sync_acquired( ilk->lock );
|
||||
} else {
|
||||
__itt_sync_acquired( lock );
|
||||
@@ -831,8 +849,8 @@ void
|
||||
__kmp_itt_lock_releasing( kmp_user_lock_p lock ) {
|
||||
#if KMP_USE_DYNAMIC_LOCK && USE_ITT_NOTIFY
|
||||
if ( __itt_sync_releasing_ptr ) {
|
||||
if ( DYNA_EXTRACT_D_TAG(lock) == 0 ) {
|
||||
kmp_indirect_lock_t *ilk = DYNA_LOOKUP_I_LOCK(lock);
|
||||
if ( KMP_EXTRACT_D_TAG(lock) == 0 ) {
|
||||
kmp_indirect_lock_t *ilk = KMP_LOOKUP_I_LOCK(lock);
|
||||
__itt_sync_releasing( ilk->lock );
|
||||
} else {
|
||||
__itt_sync_releasing( lock );
|
||||
@@ -847,8 +865,8 @@ void
|
||||
__kmp_itt_lock_cancelled( kmp_user_lock_p lock ) {
|
||||
#if KMP_USE_DYNAMIC_LOCK && USE_ITT_NOTIFY
|
||||
if ( __itt_sync_cancel_ptr ) {
|
||||
if ( DYNA_EXTRACT_D_TAG(lock) == 0 ) {
|
||||
kmp_indirect_lock_t *ilk = DYNA_LOOKUP_I_LOCK(lock);
|
||||
if ( KMP_EXTRACT_D_TAG(lock) == 0 ) {
|
||||
kmp_indirect_lock_t *ilk = KMP_LOOKUP_I_LOCK(lock);
|
||||
__itt_sync_cancel( ilk->lock );
|
||||
} else {
|
||||
__itt_sync_cancel( lock );
|
||||
|
||||
+536
-439
File diff suppressed because it is too large
Load Diff
+212
-134
@@ -23,6 +23,8 @@
|
||||
#include "kmp_debug.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <atomic>
|
||||
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -159,13 +161,13 @@ typedef union kmp_tas_lock kmp_tas_lock_t;
|
||||
//
|
||||
#define KMP_TAS_LOCK_INITIALIZER( lock ) { { 0, 0 } }
|
||||
|
||||
extern void __kmp_acquire_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_tas_lock( kmp_tas_lock_t *lck );
|
||||
extern void __kmp_destroy_tas_lock( kmp_tas_lock_t *lck );
|
||||
|
||||
extern void __kmp_acquire_nested_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_nested_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_nested_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_nested_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_nested_tas_lock( kmp_tas_lock_t *lck );
|
||||
@@ -173,9 +175,12 @@ extern void __kmp_destroy_nested_tas_lock( kmp_tas_lock_t *lck );
|
||||
|
||||
#define KMP_LOCK_RELEASED 1
|
||||
#define KMP_LOCK_STILL_HELD 0
|
||||
#define KMP_LOCK_ACQUIRED_FIRST 1
|
||||
#define KMP_LOCK_ACQUIRED_NEXT 0
|
||||
|
||||
#define KMP_USE_FUTEX (KMP_OS_LINUX && !KMP_OS_CNK && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64))
|
||||
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
#if KMP_USE_FUTEX
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// futex locks. futex locks are only available on Linux* OS.
|
||||
@@ -213,35 +218,60 @@ typedef union kmp_futex_lock kmp_futex_lock_t;
|
||||
//
|
||||
#define KMP_FUTEX_LOCK_INITIALIZER( lock ) { { 0, 0 } }
|
||||
|
||||
extern void __kmp_acquire_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_futex_lock( kmp_futex_lock_t *lck );
|
||||
extern void __kmp_destroy_futex_lock( kmp_futex_lock_t *lck );
|
||||
|
||||
extern void __kmp_acquire_nested_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_nested_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_nested_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_nested_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_nested_futex_lock( kmp_futex_lock_t *lck );
|
||||
extern void __kmp_destroy_nested_futex_lock( kmp_futex_lock_t *lck );
|
||||
|
||||
#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
#endif // KMP_USE_FUTEX
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Ticket locks.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// MSVC won't allow use of std::atomic<> in a union since it has non-trivial copy constructor.
|
||||
|
||||
struct kmp_base_ticket_lock {
|
||||
// `initialized' must be the first entry in the lock data structure!
|
||||
volatile union kmp_ticket_lock * initialized; // points to the lock union if in initialized state
|
||||
ident_t const * location; // Source code location of omp_init_lock().
|
||||
volatile kmp_uint32 next_ticket; // ticket number to give to next thread which acquires
|
||||
volatile kmp_uint32 now_serving; // ticket number for thread which holds the lock
|
||||
volatile kmp_int32 owner_id; // (gtid+1) of owning thread, 0 if unlocked
|
||||
kmp_int32 depth_locked; // depth locked, for nested locks only
|
||||
kmp_lock_flags_t flags; // lock specifics, e.g. critical section lock
|
||||
std::atomic_bool initialized;
|
||||
volatile union kmp_ticket_lock *self; // points to the lock union
|
||||
ident_t const * location; // Source code location of omp_init_lock().
|
||||
std::atomic_uint next_ticket; // ticket number to give to next thread which acquires
|
||||
std::atomic_uint now_serving; // ticket number for thread which holds the lock
|
||||
std::atomic_int owner_id; // (gtid+1) of owning thread, 0 if unlocked
|
||||
std::atomic_int depth_locked; // depth locked, for nested locks only
|
||||
kmp_lock_flags_t flags; // lock specifics, e.g. critical section lock
|
||||
};
|
||||
#else
|
||||
struct kmp_base_ticket_lock {
|
||||
// `initialized' must be the first entry in the lock data structure!
|
||||
std::atomic<bool> initialized;
|
||||
volatile union kmp_ticket_lock *self; // points to the lock union
|
||||
ident_t const * location; // Source code location of omp_init_lock().
|
||||
std::atomic<unsigned> next_ticket; // ticket number to give to next thread which acquires
|
||||
std::atomic<unsigned> now_serving; // ticket number for thread which holds the lock
|
||||
std::atomic<int> owner_id; // (gtid+1) of owning thread, 0 if unlocked
|
||||
std::atomic<int> depth_locked; // depth locked, for nested locks only
|
||||
kmp_lock_flags_t flags; // lock specifics, e.g. critical section lock
|
||||
};
|
||||
#endif
|
||||
|
||||
#else // __cplusplus
|
||||
|
||||
struct kmp_base_ticket_lock;
|
||||
|
||||
#endif // !__cplusplus
|
||||
|
||||
typedef struct kmp_base_ticket_lock kmp_base_ticket_lock_t;
|
||||
|
||||
@@ -259,16 +289,22 @@ typedef union kmp_ticket_lock kmp_ticket_lock_t;
|
||||
// kmp_ticket_lock_t xlock = KMP_TICKET_LOCK_INITIALIZER( xlock );
|
||||
// Note the macro argument. It is important to make var properly initialized.
|
||||
//
|
||||
#define KMP_TICKET_LOCK_INITIALIZER( lock ) { { (kmp_ticket_lock_t *) & (lock), NULL, 0, 0, 0, -1 } }
|
||||
#define KMP_TICKET_LOCK_INITIALIZER( lock ) { { ATOMIC_VAR_INIT(true), \
|
||||
&(lock), \
|
||||
NULL, \
|
||||
ATOMIC_VAR_INIT(0U), \
|
||||
ATOMIC_VAR_INIT(0U), \
|
||||
ATOMIC_VAR_INIT(0), \
|
||||
ATOMIC_VAR_INIT(-1) } }
|
||||
|
||||
extern void __kmp_acquire_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_ticket_lock_with_cheks( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_ticket_lock( kmp_ticket_lock_t *lck );
|
||||
extern void __kmp_destroy_ticket_lock( kmp_ticket_lock_t *lck );
|
||||
|
||||
extern void __kmp_acquire_nested_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_nested_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_nested_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_nested_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_nested_ticket_lock( kmp_ticket_lock_t *lck );
|
||||
@@ -364,13 +400,13 @@ union KMP_ALIGN_CACHE kmp_queuing_lock {
|
||||
|
||||
typedef union kmp_queuing_lock kmp_queuing_lock_t;
|
||||
|
||||
extern void __kmp_acquire_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_queuing_lock( kmp_queuing_lock_t *lck );
|
||||
extern void __kmp_destroy_queuing_lock( kmp_queuing_lock_t *lck );
|
||||
|
||||
extern void __kmp_acquire_nested_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_nested_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_nested_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_nested_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_nested_queuing_lock( kmp_queuing_lock_t *lck );
|
||||
@@ -468,13 +504,13 @@ union KMP_ALIGN_CACHE kmp_drdpa_lock {
|
||||
|
||||
typedef union kmp_drdpa_lock kmp_drdpa_lock_t;
|
||||
|
||||
extern void __kmp_acquire_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_drdpa_lock( kmp_drdpa_lock_t *lck );
|
||||
extern void __kmp_destroy_drdpa_lock( kmp_drdpa_lock_t *lck );
|
||||
|
||||
extern void __kmp_acquire_nested_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_acquire_nested_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_test_nested_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern int __kmp_release_nested_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_init_nested_drdpa_lock( kmp_drdpa_lock_t *lck );
|
||||
@@ -500,10 +536,10 @@ typedef kmp_ticket_lock_t kmp_bootstrap_lock_t;
|
||||
|
||||
#define KMP_BOOTSTRAP_LOCK_INITIALIZER( lock ) KMP_TICKET_LOCK_INITIALIZER( (lock) )
|
||||
|
||||
static inline void
|
||||
static inline int
|
||||
__kmp_acquire_bootstrap_lock( kmp_bootstrap_lock_t *lck )
|
||||
{
|
||||
__kmp_acquire_ticket_lock( lck, KMP_GTID_DNE );
|
||||
return __kmp_acquire_ticket_lock( lck, KMP_GTID_DNE );
|
||||
}
|
||||
|
||||
static inline int
|
||||
@@ -545,10 +581,10 @@ __kmp_destroy_bootstrap_lock( kmp_bootstrap_lock_t *lck )
|
||||
|
||||
typedef kmp_ticket_lock_t kmp_lock_t;
|
||||
|
||||
static inline void
|
||||
static inline int
|
||||
__kmp_acquire_lock( kmp_lock_t *lck, kmp_int32 gtid )
|
||||
{
|
||||
__kmp_acquire_ticket_lock( lck, gtid );
|
||||
return __kmp_acquire_ticket_lock( lck, gtid );
|
||||
}
|
||||
|
||||
static inline int
|
||||
@@ -591,8 +627,12 @@ __kmp_destroy_lock( kmp_lock_t *lck )
|
||||
enum kmp_lock_kind {
|
||||
lk_default = 0,
|
||||
lk_tas,
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
#if KMP_USE_FUTEX
|
||||
lk_futex,
|
||||
#endif
|
||||
#if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX
|
||||
lk_hle,
|
||||
lk_rtm,
|
||||
#endif
|
||||
lk_ticket,
|
||||
lk_queuing,
|
||||
@@ -608,7 +648,7 @@ extern kmp_lock_kind_t __kmp_user_lock_kind;
|
||||
|
||||
union kmp_user_lock {
|
||||
kmp_tas_lock_t tas;
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
#if KMP_USE_FUTEX
|
||||
kmp_futex_lock_t futex;
|
||||
#endif
|
||||
kmp_ticket_lock_t ticket;
|
||||
@@ -636,7 +676,7 @@ __kmp_get_user_lock_owner( kmp_user_lock_p lck )
|
||||
return ( *__kmp_get_user_lock_owner_ )( lck );
|
||||
}
|
||||
|
||||
extern void ( *__kmp_acquire_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_int32 gtid );
|
||||
extern int ( *__kmp_acquire_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_int32 gtid );
|
||||
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
|
||||
@@ -678,11 +718,11 @@ extern void ( *__kmp_acquire_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_
|
||||
}
|
||||
|
||||
#else
|
||||
static inline void
|
||||
static inline int
|
||||
__kmp_acquire_user_lock_with_checks( kmp_user_lock_p lck, kmp_int32 gtid )
|
||||
{
|
||||
KMP_DEBUG_ASSERT( __kmp_acquire_user_lock_with_checks_ != NULL );
|
||||
( *__kmp_acquire_user_lock_with_checks_ )( lck, gtid );
|
||||
return ( *__kmp_acquire_user_lock_with_checks_ )( lck, gtid );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -759,11 +799,11 @@ __kmp_destroy_user_lock_with_checks( kmp_user_lock_p lck )
|
||||
( *__kmp_destroy_user_lock_with_checks_ )( lck );
|
||||
}
|
||||
|
||||
extern void ( *__kmp_acquire_nested_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_int32 gtid );
|
||||
extern int ( *__kmp_acquire_nested_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_int32 gtid );
|
||||
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64)
|
||||
|
||||
#define __kmp_acquire_nested_user_lock_with_checks(lck,gtid) \
|
||||
#define __kmp_acquire_nested_user_lock_with_checks(lck,gtid,depth) \
|
||||
if (__kmp_user_lock_kind == lk_tas) { \
|
||||
if ( __kmp_env_consistency_check ) { \
|
||||
char const * const func = "omp_set_nest_lock"; \
|
||||
@@ -774,6 +814,7 @@ extern void ( *__kmp_acquire_nested_user_lock_with_checks_ )( kmp_user_lock_p lc
|
||||
} \
|
||||
if ( lck->tas.lk.poll - 1 == gtid ) { \
|
||||
lck->tas.lk.depth_locked += 1; \
|
||||
*depth = KMP_LOCK_ACQUIRED_NEXT; \
|
||||
} else { \
|
||||
if ( ( lck->tas.lk.poll != 0 ) || \
|
||||
( ! KMP_COMPARE_AND_STORE_ACQ32( &(lck->tas.lk.poll), 0, gtid + 1 ) ) ) { \
|
||||
@@ -795,19 +836,20 @@ extern void ( *__kmp_acquire_nested_user_lock_with_checks_ )( kmp_user_lock_p lc
|
||||
} \
|
||||
} \
|
||||
lck->tas.lk.depth_locked = 1; \
|
||||
*depth = KMP_LOCK_ACQUIRED_FIRST; \
|
||||
} \
|
||||
KMP_FSYNC_ACQUIRED( lck ); \
|
||||
} else { \
|
||||
KMP_DEBUG_ASSERT( __kmp_acquire_nested_user_lock_with_checks_ != NULL ); \
|
||||
( *__kmp_acquire_nested_user_lock_with_checks_ )( lck, gtid ); \
|
||||
*depth = ( *__kmp_acquire_nested_user_lock_with_checks_ )( lck, gtid ); \
|
||||
}
|
||||
|
||||
#else
|
||||
static inline void
|
||||
__kmp_acquire_nested_user_lock_with_checks( kmp_user_lock_p lck, kmp_int32 gtid )
|
||||
__kmp_acquire_nested_user_lock_with_checks( kmp_user_lock_p lck, kmp_int32 gtid, int* depth )
|
||||
{
|
||||
KMP_DEBUG_ASSERT( __kmp_acquire_nested_user_lock_with_checks_ != NULL );
|
||||
( *__kmp_acquire_nested_user_lock_with_checks_ )( lck, gtid );
|
||||
*depth = ( *__kmp_acquire_nested_user_lock_with_checks_ )( lck, gtid );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -940,7 +982,7 @@ extern void __kmp_set_user_lock_vptrs( kmp_lock_kind_t user_lock_kind );
|
||||
// Macros for binding user lock functions.
|
||||
//
|
||||
#define KMP_BIND_USER_LOCK_TEMPLATE(nest, kind, suffix) { \
|
||||
__kmp_acquire##nest##user_lock_with_checks_ = ( void (*)( kmp_user_lock_p, kmp_int32 ) ) \
|
||||
__kmp_acquire##nest##user_lock_with_checks_ = ( int (*)( kmp_user_lock_p, kmp_int32 ) ) \
|
||||
__kmp_acquire##nest##kind##_##suffix; \
|
||||
__kmp_release##nest##user_lock_with_checks_ = ( int (*)( kmp_user_lock_p, kmp_int32 ) ) \
|
||||
__kmp_release##nest##kind##_##suffix; \
|
||||
@@ -1027,55 +1069,81 @@ extern void __kmp_cleanup_user_locks();
|
||||
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
|
||||
#define DYNA_HAS_FUTEX (KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM))
|
||||
#define DYNA_HAS_HLE (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_MIC)
|
||||
#define DYNA_USE_FAST_FUTEX 0 && DYNA_HAS_FUTEX
|
||||
#define DYNA_USE_FAST_TAS 1 && DYNA_HAS_FUTEX
|
||||
//
|
||||
// KMP_USE_DYNAMIC_LOCK enables dynamic dispatch of lock functions without breaking the current
|
||||
// compatibility. Essential functionality of this new code is dynamic dispatch, but it also
|
||||
// implements (or enables implementation of) hinted user lock and critical section which will be
|
||||
// part of OMP 4.5 soon.
|
||||
//
|
||||
// Lock type can be decided at creation time (i.e., lock initialization), and subsequent lock
|
||||
// function call on the created lock object requires type extraction and call through jump table
|
||||
// using the extracted type. This type information is stored in two different ways depending on
|
||||
// the size of the lock object, and we differentiate lock types by this size requirement - direct
|
||||
// and indirect locks.
|
||||
//
|
||||
// Direct locks:
|
||||
// A direct lock object fits into the space created by the compiler for an omp_lock_t object, and
|
||||
// TAS/Futex lock falls into this category. We use low one byte of the lock object as the storage
|
||||
// for the lock type, and appropriate bit operation is required to access the data meaningful to
|
||||
// the lock algorithms. Also, to differentiate direct lock from indirect lock, 1 is written to LSB
|
||||
// of the lock object. The newly introduced "hle" lock is also a direct lock.
|
||||
//
|
||||
// Indirect locks:
|
||||
// An indirect lock object requires more space than the compiler-generated space, and it should be
|
||||
// allocated from heap. Depending on the size of the compiler-generated space for the lock (i.e.,
|
||||
// size of omp_lock_t), this omp_lock_t object stores either the address of the heap-allocated
|
||||
// indirect lock (void * fits in the object) or an index to the indirect lock table entry that
|
||||
// holds the address. Ticket/Queuing/DRDPA/Adaptive lock falls into this category, and the newly
|
||||
// introduced "rtm" lock is also an indirect lock which was implemented on top of the Queuing lock.
|
||||
// When the omp_lock_t object holds an index (not lock address), 0 is written to LSB to
|
||||
// differentiate the lock from a direct lock, and the remaining part is the actual index to the
|
||||
// indirect lock table.
|
||||
//
|
||||
|
||||
#include <stdint.h> // for uintptr_t
|
||||
|
||||
// Shortcuts
|
||||
#define KMP_USE_INLINED_TAS (KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)) && 1
|
||||
#define KMP_USE_INLINED_FUTEX KMP_USE_FUTEX && 0
|
||||
|
||||
// List of lock definitions; all nested locks are indirect locks.
|
||||
// hle lock is xchg lock prefixed with XACQUIRE/XRELEASE.
|
||||
// All nested locks are indirect lock types.
|
||||
#if DYNA_HAS_FUTEX
|
||||
# if DYNA_HAS_HLE
|
||||
# define FOREACH_D_LOCK(m, a) m(tas, a) m(futex, a) m(hle, a)
|
||||
# define DYNA_LAST_D_LOCK_SEQ lockseq_hle
|
||||
#if KMP_USE_TSX
|
||||
# if KMP_USE_FUTEX
|
||||
# define KMP_FOREACH_D_LOCK(m, a) m(tas, a) m(futex, a) m(hle, a)
|
||||
# define KMP_FOREACH_I_LOCK(m, a) m(ticket, a) m(queuing, a) m(adaptive, a) m(drdpa, a) m(rtm, a) \
|
||||
m(nested_tas, a) m(nested_futex, a) m(nested_ticket, a) \
|
||||
m(nested_queuing, a) m(nested_drdpa, a)
|
||||
# else
|
||||
# define FOREACH_D_LOCK(m, a) m(tas, a) m(futex, a)
|
||||
# define DYNA_LAST_D_LOCK_SEQ lockseq_futex
|
||||
# endif // DYNA_HAS_HLE
|
||||
# if KMP_USE_ADAPTIVE_LOCKS
|
||||
# define FOREACH_I_LOCK(m, a) m(ticket, a) m(queuing, a) m(adaptive, a) m(drdpa, a) \
|
||||
m(nested_tas, a) m(nested_futex, a) m(nested_ticket, a) \
|
||||
m(nested_queuing, a) m(nested_drdpa, a)
|
||||
# else
|
||||
# define FOREACH_I_LOCK(m, a) m(ticket, a) m(queuing, a) m(drdpa, a) \
|
||||
m(nested_tas, a) m(nested_futex, a) m(nested_ticket, a) \
|
||||
m(nested_queuing, a) m(nested_drdpa, a)
|
||||
# endif // KMP_USE_ADAPTIVE_LOCKS
|
||||
# define KMP_FOREACH_D_LOCK(m, a) m(tas, a) m(hle, a)
|
||||
# define KMP_FOREACH_I_LOCK(m, a) m(ticket, a) m(queuing, a) m(adaptive, a) m(drdpa, a) m(rtm, a) \
|
||||
m(nested_tas, a) m(nested_ticket, a) \
|
||||
m(nested_queuing, a) m(nested_drdpa, a)
|
||||
# endif // KMP_USE_FUTEX
|
||||
# define KMP_LAST_D_LOCK lockseq_hle
|
||||
#else
|
||||
# if DYNA_HAS_HLE
|
||||
# define FOREACH_D_LOCK(m, a) m(tas, a) m(hle, a)
|
||||
# define DYNA_LAST_D_LOCK_SEQ lockseq_hle
|
||||
# if KMP_USE_FUTEX
|
||||
# define KMP_FOREACH_D_LOCK(m, a) m(tas, a) m(futex, a)
|
||||
# define KMP_FOREACH_I_LOCK(m, a) m(ticket, a) m(queuing, a) m(drdpa, a) \
|
||||
m(nested_tas, a) m(nested_futex, a) m(nested_ticket, a) \
|
||||
m(nested_queuing, a) m(nested_drdpa, a)
|
||||
# define KMP_LAST_D_LOCK lockseq_futex
|
||||
# else
|
||||
# define FOREACH_D_LOCK(m, a) m(tas, a)
|
||||
# define DYNA_LAST_D_LOCK_SEQ lockseq_tas
|
||||
# endif // DYNA_HAS_HLE
|
||||
# if KMP_USE_ADAPTIVE_LOCKS
|
||||
# define FOREACH_I_LOCK(m, a) m(ticket, a) m(queuing, a) m(adaptive, a) m(drdpa, a) \
|
||||
m(nested_tas, a) m(nested_ticket, a) \
|
||||
m(nested_queuing, a) m(nested_drdpa, a)
|
||||
# else
|
||||
# define FOREACH_I_LOCK(m, a) m(ticket, a) m(queuing, a) m(drdpa, a) \
|
||||
m(nested_tas, a) m(nested_ticket, a) \
|
||||
m(nested_queuing, a) m(nested_drdpa, a)
|
||||
# endif // KMP_USE_ADAPTIVE_LOCKS
|
||||
#endif // DYNA_HAS_FUTEX
|
||||
# define KMP_FOREACH_D_LOCK(m, a) m(tas, a)
|
||||
# define KMP_FOREACH_I_LOCK(m, a) m(ticket, a) m(queuing, a) m(drdpa, a) \
|
||||
m(nested_tas, a) m(nested_ticket, a) \
|
||||
m(nested_queuing, a) m(nested_drdpa, a)
|
||||
# define KMP_LAST_D_LOCK lockseq_tas
|
||||
# endif // KMP_USE_FUTEX
|
||||
#endif // KMP_USE_TSX
|
||||
|
||||
// Information used in dynamic dispatch
|
||||
#define DYNA_LOCK_VALUE_SHIFT 8
|
||||
#define DYNA_LOCK_TYPE_MASK ((1<<DYNA_LOCK_VALUE_SHIFT)-1)
|
||||
#define DYNA_NUM_D_LOCKS DYNA_LAST_D_LOCK_SEQ
|
||||
#define DYNA_NUM_I_LOCKS (locktag_nested_drdpa+1)
|
||||
#define KMP_LOCK_SHIFT 8 // number of low bits to be used as tag for direct locks
|
||||
#define KMP_FIRST_D_LOCK lockseq_tas
|
||||
#define KMP_FIRST_I_LOCK lockseq_ticket
|
||||
#define KMP_LAST_I_LOCK lockseq_nested_drdpa
|
||||
#define KMP_NUM_I_LOCKS (locktag_nested_drdpa+1) // number of indirect lock types
|
||||
|
||||
// Base type for dynamic locks.
|
||||
typedef kmp_uint32 kmp_dyna_lock_t;
|
||||
@@ -1085,28 +1153,28 @@ typedef kmp_uint32 kmp_dyna_lock_t;
|
||||
typedef enum {
|
||||
lockseq_indirect = 0,
|
||||
#define expand_seq(l,a) lockseq_##l,
|
||||
FOREACH_D_LOCK(expand_seq, 0)
|
||||
FOREACH_I_LOCK(expand_seq, 0)
|
||||
KMP_FOREACH_D_LOCK(expand_seq, 0)
|
||||
KMP_FOREACH_I_LOCK(expand_seq, 0)
|
||||
#undef expand_seq
|
||||
} kmp_dyna_lockseq_t;
|
||||
|
||||
// Enumerates indirect lock tags.
|
||||
typedef enum {
|
||||
#define expand_tag(l,a) locktag_##l,
|
||||
FOREACH_I_LOCK(expand_tag, 0)
|
||||
KMP_FOREACH_I_LOCK(expand_tag, 0)
|
||||
#undef expand_tag
|
||||
} kmp_indirect_locktag_t;
|
||||
|
||||
// Utility macros that extract information from lock sequences.
|
||||
#define DYNA_IS_D_LOCK(seq) (seq >= lockseq_tas && seq <= DYNA_LAST_D_LOCK_SEQ)
|
||||
#define DYNA_IS_I_LOCK(seq) (seq >= lockseq_ticket && seq <= lockseq_nested_drdpa)
|
||||
#define DYNA_GET_I_TAG(seq) (kmp_indirect_locktag_t)(seq - lockseq_ticket)
|
||||
#define DYNA_GET_D_TAG(seq) (seq<<1 | 1)
|
||||
#define KMP_IS_D_LOCK(seq) ((seq) >= KMP_FIRST_D_LOCK && (seq) <= KMP_LAST_D_LOCK)
|
||||
#define KMP_IS_I_LOCK(seq) ((seq) >= KMP_FIRST_I_LOCK && (seq) <= KMP_LAST_I_LOCK)
|
||||
#define KMP_GET_I_TAG(seq) (kmp_indirect_locktag_t)((seq) - KMP_FIRST_I_LOCK)
|
||||
#define KMP_GET_D_TAG(seq) ((seq)<<1 | 1)
|
||||
|
||||
// Enumerates direct lock tags starting from indirect tag.
|
||||
typedef enum {
|
||||
#define expand_tag(l,a) locktag_##l = DYNA_GET_D_TAG(lockseq_##l),
|
||||
FOREACH_D_LOCK(expand_tag, 0)
|
||||
#define expand_tag(l,a) locktag_##l = KMP_GET_D_TAG(lockseq_##l),
|
||||
KMP_FOREACH_D_LOCK(expand_tag, 0)
|
||||
#undef expand_tag
|
||||
} kmp_direct_locktag_t;
|
||||
|
||||
@@ -1117,52 +1185,45 @@ typedef struct {
|
||||
} kmp_indirect_lock_t;
|
||||
|
||||
// Function tables for direct locks. Set/unset/test differentiate functions with/without consistency checking.
|
||||
extern void (*__kmp_direct_init_ops[])(kmp_dyna_lock_t *, kmp_dyna_lockseq_t);
|
||||
extern void (*__kmp_direct_destroy_ops[])(kmp_dyna_lock_t *);
|
||||
extern void (*(*__kmp_direct_set_ops))(kmp_dyna_lock_t *, kmp_int32);
|
||||
extern void (*(*__kmp_direct_unset_ops))(kmp_dyna_lock_t *, kmp_int32);
|
||||
extern int (*(*__kmp_direct_test_ops))(kmp_dyna_lock_t *, kmp_int32);
|
||||
extern void (*__kmp_direct_init[])(kmp_dyna_lock_t *, kmp_dyna_lockseq_t);
|
||||
extern void (*__kmp_direct_destroy[])(kmp_dyna_lock_t *);
|
||||
extern void (*(*__kmp_direct_set))(kmp_dyna_lock_t *, kmp_int32);
|
||||
extern int (*(*__kmp_direct_unset))(kmp_dyna_lock_t *, kmp_int32);
|
||||
extern int (*(*__kmp_direct_test))(kmp_dyna_lock_t *, kmp_int32);
|
||||
|
||||
// Function tables for indirect locks. Set/unset/test differentiate functions with/withuot consistency checking.
|
||||
extern void (*__kmp_indirect_init_ops[])(kmp_user_lock_p);
|
||||
extern void (*__kmp_indirect_destroy_ops[])(kmp_user_lock_p);
|
||||
extern void (*(*__kmp_indirect_set_ops))(kmp_user_lock_p, kmp_int32);
|
||||
extern void (*(*__kmp_indirect_unset_ops))(kmp_user_lock_p, kmp_int32);
|
||||
extern int (*(*__kmp_indirect_test_ops))(kmp_user_lock_p, kmp_int32);
|
||||
extern void (*__kmp_indirect_init[])(kmp_user_lock_p);
|
||||
extern void (*__kmp_indirect_destroy[])(kmp_user_lock_p);
|
||||
extern void (*(*__kmp_indirect_set))(kmp_user_lock_p, kmp_int32);
|
||||
extern int (*(*__kmp_indirect_unset))(kmp_user_lock_p, kmp_int32);
|
||||
extern int (*(*__kmp_indirect_test))(kmp_user_lock_p, kmp_int32);
|
||||
|
||||
// Extracts direct lock tag from a user lock pointer
|
||||
#define DYNA_EXTRACT_D_TAG(l) (*((kmp_dyna_lock_t *)(l)) & DYNA_LOCK_TYPE_MASK & -(*((kmp_dyna_lock_t *)(l)) & 1))
|
||||
#define KMP_EXTRACT_D_TAG(l) (*((kmp_dyna_lock_t *)(l)) & ((1<<KMP_LOCK_SHIFT)-1) & -(*((kmp_dyna_lock_t *)(l)) & 1))
|
||||
|
||||
// Extracts indirect lock index from a user lock pointer
|
||||
#define DYNA_EXTRACT_I_INDEX(l) (*(kmp_lock_index_t *)(l) >> 1)
|
||||
#define KMP_EXTRACT_I_INDEX(l) (*(kmp_lock_index_t *)(l) >> 1)
|
||||
|
||||
// Returns function pointer to the direct lock function with l (kmp_dyna_lock_t *) and op (operation type).
|
||||
#define DYNA_D_LOCK_FUNC(l, op) __kmp_direct_##op##_ops[DYNA_EXTRACT_D_TAG(l)]
|
||||
#define KMP_D_LOCK_FUNC(l, op) __kmp_direct_##op[KMP_EXTRACT_D_TAG(l)]
|
||||
|
||||
// Returns function pointer to the indirect lock function with l (kmp_indirect_lock_t *) and op (operation type).
|
||||
#define DYNA_I_LOCK_FUNC(l, op) __kmp_indirect_##op##_ops[((kmp_indirect_lock_t *)(l))->type]
|
||||
#define KMP_I_LOCK_FUNC(l, op) __kmp_indirect_##op[((kmp_indirect_lock_t *)(l))->type]
|
||||
|
||||
// Initializes a direct lock with the given lock pointer and lock sequence.
|
||||
#define DYNA_INIT_D_LOCK(l, seq) __kmp_direct_init_ops[DYNA_GET_D_TAG(seq)]((kmp_dyna_lock_t *)l, seq)
|
||||
#define KMP_INIT_D_LOCK(l, seq) __kmp_direct_init[KMP_GET_D_TAG(seq)]((kmp_dyna_lock_t *)l, seq)
|
||||
|
||||
// Initializes an indirect lock with the given lock pointer and lock sequence.
|
||||
#define DYNA_INIT_I_LOCK(l, seq) __kmp_direct_init_ops[0]((kmp_dyna_lock_t *)(l), seq)
|
||||
#define KMP_INIT_I_LOCK(l, seq) __kmp_direct_init[0]((kmp_dyna_lock_t *)(l), seq)
|
||||
|
||||
// Returns "free" lock value for the given lock type.
|
||||
#define DYNA_LOCK_FREE(type) (locktag_##type)
|
||||
#define KMP_LOCK_FREE(type) (locktag_##type)
|
||||
|
||||
// Returns "busy" lock value for the given lock teyp.
|
||||
#define DYNA_LOCK_BUSY(v, type) ((v)<<DYNA_LOCK_VALUE_SHIFT | locktag_##type)
|
||||
#define KMP_LOCK_BUSY(v, type) ((v)<<KMP_LOCK_SHIFT | locktag_##type)
|
||||
|
||||
// Returns lock value after removing (shifting) lock tag.
|
||||
#define DYNA_LOCK_STRIP(v) ((v)>>DYNA_LOCK_VALUE_SHIFT)
|
||||
|
||||
// Updates __kmp_user_lock_seq with the give lock type.
|
||||
#define DYNA_STORE_LOCK_SEQ(type) (__kmp_user_lock_seq = lockseq_##type)
|
||||
|
||||
// Internal entries for hinted lock initializers.
|
||||
extern void __kmp_init_lock_hinted(void **, int);
|
||||
extern void __kmp_init_nest_lock_hinted(void **, int);
|
||||
#define KMP_LOCK_STRIP(v) ((v)>>KMP_LOCK_SHIFT)
|
||||
|
||||
// Initializes global states and data structures for managing dynamic user locks.
|
||||
extern void __kmp_init_dynamic_user_locks();
|
||||
@@ -1173,53 +1234,58 @@ extern kmp_indirect_lock_t * __kmp_allocate_indirect_lock(void **, kmp_int32, km
|
||||
// Cleans up global states and data structures for managing dynamic user locks.
|
||||
extern void __kmp_cleanup_indirect_user_locks();
|
||||
|
||||
// Default user lock sequence when not using hinted locks.
|
||||
// Default user lock sequence when not using hinted locks.
|
||||
extern kmp_dyna_lockseq_t __kmp_user_lock_seq;
|
||||
|
||||
// Jump table for "set lock location", available only for indirect locks.
|
||||
extern void (*__kmp_indirect_set_location[DYNA_NUM_I_LOCKS])(kmp_user_lock_p, const ident_t *);
|
||||
#define DYNA_SET_I_LOCK_LOCATION(lck, loc) { \
|
||||
extern void (*__kmp_indirect_set_location[KMP_NUM_I_LOCKS])(kmp_user_lock_p, const ident_t *);
|
||||
#define KMP_SET_I_LOCK_LOCATION(lck, loc) { \
|
||||
if (__kmp_indirect_set_location[(lck)->type] != NULL) \
|
||||
__kmp_indirect_set_location[(lck)->type]((lck)->lock, loc); \
|
||||
}
|
||||
|
||||
// Jump table for "set lock flags", available only for indirect locks.
|
||||
extern void (*__kmp_indirect_set_flags[DYNA_NUM_I_LOCKS])(kmp_user_lock_p, kmp_lock_flags_t);
|
||||
#define DYNA_SET_I_LOCK_FLAGS(lck, flag) { \
|
||||
extern void (*__kmp_indirect_set_flags[KMP_NUM_I_LOCKS])(kmp_user_lock_p, kmp_lock_flags_t);
|
||||
#define KMP_SET_I_LOCK_FLAGS(lck, flag) { \
|
||||
if (__kmp_indirect_set_flags[(lck)->type] != NULL) \
|
||||
__kmp_indirect_set_flags[(lck)->type]((lck)->lock, flag); \
|
||||
}
|
||||
|
||||
// Jump table for "get lock location", available only for indirect locks.
|
||||
extern const ident_t * (*__kmp_indirect_get_location[DYNA_NUM_I_LOCKS])(kmp_user_lock_p);
|
||||
#define DYNA_GET_I_LOCK_LOCATION(lck) ( __kmp_indirect_get_location[(lck)->type] != NULL \
|
||||
extern const ident_t * (*__kmp_indirect_get_location[KMP_NUM_I_LOCKS])(kmp_user_lock_p);
|
||||
#define KMP_GET_I_LOCK_LOCATION(lck) ( __kmp_indirect_get_location[(lck)->type] != NULL \
|
||||
? __kmp_indirect_get_location[(lck)->type]((lck)->lock) \
|
||||
: NULL )
|
||||
|
||||
// Jump table for "get lock flags", available only for indirect locks.
|
||||
extern kmp_lock_flags_t (*__kmp_indirect_get_flags[DYNA_NUM_I_LOCKS])(kmp_user_lock_p);
|
||||
#define DYNA_GET_I_LOCK_FLAGS(lck) ( __kmp_indirect_get_flags[(lck)->type] != NULL \
|
||||
extern kmp_lock_flags_t (*__kmp_indirect_get_flags[KMP_NUM_I_LOCKS])(kmp_user_lock_p);
|
||||
#define KMP_GET_I_LOCK_FLAGS(lck) ( __kmp_indirect_get_flags[(lck)->type] != NULL \
|
||||
? __kmp_indirect_get_flags[(lck)->type]((lck)->lock) \
|
||||
: NULL )
|
||||
|
||||
//
|
||||
#define KMP_I_LOCK_CHUNK 1024 // number of kmp_indirect_lock_t objects to be allocated together
|
||||
|
||||
// Lock table for indirect locks.
|
||||
//
|
||||
// Simple linear structure is used to keep pointers to allocated indirect locks.
|
||||
extern kmp_indirect_lock_t **__kmp_indirect_lock_table;
|
||||
// Current size of the lock table; it may increase but never shrink.
|
||||
extern kmp_lock_index_t __kmp_indirect_lock_table_size;
|
||||
// Next index to be used for a new indirect lock (= number of indirect locks allocated).
|
||||
extern kmp_lock_index_t __kmp_indirect_lock_table_next;
|
||||
typedef struct kmp_indirect_lock_table {
|
||||
kmp_indirect_lock_t **table; // blocks of indirect locks allocated
|
||||
kmp_lock_index_t size; // size of the indirect lock table
|
||||
kmp_lock_index_t next; // index to the next lock to be allocated
|
||||
} kmp_indirect_lock_table_t;
|
||||
|
||||
extern kmp_indirect_lock_table_t __kmp_i_lock_table;
|
||||
|
||||
// Returns the indirect lock associated with the given index.
|
||||
#define KMP_GET_I_LOCK(index) (*(__kmp_i_lock_table.table + (index)/KMP_I_LOCK_CHUNK) + (index)%KMP_I_LOCK_CHUNK)
|
||||
|
||||
// Number of locks in a lock block, which is fixed to "1" now.
|
||||
// TODO: No lock block implementation now. If we do support, we need to manage lock block data
|
||||
// structure for each indirect lock type.
|
||||
extern int __kmp_num_locks_in_block;
|
||||
|
||||
// Fast lock table lookup without consistency checking
|
||||
#define DYNA_LOOKUP_I_LOCK(l) ( (OMP_LOCK_T_SIZE < sizeof(void *)) \
|
||||
? __kmp_indirect_lock_table[DYNA_EXTRACT_I_INDEX(l)] \
|
||||
: *((kmp_indirect_lock_t **)l) )
|
||||
#define KMP_LOOKUP_I_LOCK(l) ( (OMP_LOCK_T_SIZE < sizeof(void *)) \
|
||||
? KMP_GET_I_LOCK(KMP_EXTRACT_I_INDEX(l)) \
|
||||
: *((kmp_indirect_lock_t **)(l)) )
|
||||
|
||||
// Used once in kmp_error.c
|
||||
extern kmp_int32
|
||||
@@ -1227,13 +1293,25 @@ __kmp_get_user_lock_owner(kmp_user_lock_p, kmp_uint32);
|
||||
|
||||
#else // KMP_USE_DYNAMIC_LOCK
|
||||
|
||||
# define DYNA_LOCK_BUSY(v, type) (v)
|
||||
# define DYNA_LOCK_FREE(type) 0
|
||||
# define DYNA_LOCK_STRIP(v) (v)
|
||||
# define DYNA_STORE_LOCK_SEQ(seq)
|
||||
# define KMP_LOCK_BUSY(v, type) (v)
|
||||
# define KMP_LOCK_FREE(type) 0
|
||||
# define KMP_LOCK_STRIP(v) (v)
|
||||
|
||||
#endif // KMP_USE_DYNAMIC_LOCK
|
||||
|
||||
// data structure for using backoff within spin locks.
|
||||
typedef struct {
|
||||
kmp_uint32 step; // current step
|
||||
kmp_uint32 max_backoff; // upper bound of outer delay loop
|
||||
kmp_uint32 min_tick; // size of inner delay loop in ticks (machine-dependent)
|
||||
} kmp_backoff_t;
|
||||
|
||||
// Runtime's default backoff parameters
|
||||
extern kmp_backoff_t __kmp_spin_backoff_params;
|
||||
|
||||
// Backoff function
|
||||
extern void __kmp_spin_backoff(kmp_backoff_t *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -109,11 +109,13 @@ typedef struct {
|
||||
offset_and_size_t th_bar;
|
||||
offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it arrives to the barrier
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
/* teams information */
|
||||
offset_and_size_t th_teams_microtask;// entry address for teams construct
|
||||
offset_and_size_t th_teams_level; // initial level of teams construct
|
||||
offset_and_size_t th_teams_nteams; // number of teams in a league
|
||||
offset_and_size_t th_teams_nth; // number of threads in each team of the league
|
||||
#endif
|
||||
|
||||
/* kmp_desc structure (for info field above) */
|
||||
kmp_int32 ds_sizeof_struct;
|
||||
@@ -133,7 +135,9 @@ typedef struct {
|
||||
offset_and_size_t t_pkfn;
|
||||
offset_and_size_t t_task_team; // task team structure
|
||||
offset_and_size_t t_implicit_task; // taskdata for the thread's implicit task
|
||||
#if OMP_40_ENABLED
|
||||
offset_and_size_t t_cancel_request;
|
||||
#endif
|
||||
offset_and_size_t t_bar;
|
||||
offset_and_size_t t_b_master_arrived; // increased by 1 when master arrives to a barrier
|
||||
offset_and_size_t t_b_team_arrived; // increased by one when all the threads arrived
|
||||
@@ -194,6 +198,7 @@ typedef struct {
|
||||
offset_and_size_t td_taskwait_counter;
|
||||
offset_and_size_t td_taskwait_thread; // gtid + 1 of thread encountered taskwait
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
/* Taskgroup */
|
||||
offset_and_size_t td_taskgroup; // pointer to the current taskgroup
|
||||
offset_and_size_t td_task_count; // number of allocated and not yet complete tasks
|
||||
@@ -207,11 +212,13 @@ typedef struct {
|
||||
offset_and_size_t dn_task;
|
||||
offset_and_size_t dn_npredecessors;
|
||||
offset_and_size_t dn_nrefs;
|
||||
#endif
|
||||
offset_and_size_t dn_routine;
|
||||
|
||||
/* kmp_thread_data_t */
|
||||
kmp_int32 hd_sizeof_struct;
|
||||
offset_and_size_t hd_deque;
|
||||
offset_and_size_t hd_deque_size;
|
||||
offset_and_size_t hd_deque_head;
|
||||
offset_and_size_t hd_deque_tail;
|
||||
offset_and_size_t hd_deque_ntasks;
|
||||
|
||||
+35
-47
@@ -16,6 +16,7 @@
|
||||
#ifndef KMP_OS_H
|
||||
#define KMP_OS_H
|
||||
|
||||
#include "kmp_config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define KMP_FTN_PLAIN 1
|
||||
@@ -62,8 +63,6 @@
|
||||
# error Unknown compiler
|
||||
#endif
|
||||
|
||||
#include "kmp_platform.h"
|
||||
|
||||
#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64
|
||||
# define KMP_AFFINITY_SUPPORTED 1
|
||||
# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
|
||||
@@ -174,21 +173,15 @@ typedef double kmp_real64;
|
||||
# define KMP_UINTPTR_SPEC "lu"
|
||||
#endif
|
||||
|
||||
#ifdef KMP_I8
|
||||
#ifdef BUILD_I8
|
||||
typedef kmp_int64 kmp_int;
|
||||
typedef kmp_uint64 kmp_uint;
|
||||
# define KMP_INT_SPEC KMP_INT64_SPEC
|
||||
# define KMP_UINT_SPEC KMP_UINT64_SPEC
|
||||
# define KMP_INT_MAX ((kmp_int64)0x7FFFFFFFFFFFFFFFLL)
|
||||
# define KMP_INT_MIN ((kmp_int64)0x8000000000000000LL)
|
||||
#else
|
||||
typedef kmp_int32 kmp_int;
|
||||
typedef kmp_uint32 kmp_uint;
|
||||
# define KMP_INT_SPEC KMP_INT32_SPEC
|
||||
# define KMP_UINT_SPEC KMP_UINT32_SPEC
|
||||
# define KMP_INT_MAX ((kmp_int32)0x7FFFFFFF)
|
||||
# define KMP_INT_MIN ((kmp_int32)0x80000000)
|
||||
#endif /* KMP_I8 */
|
||||
#endif /* BUILD_I8 */
|
||||
#define KMP_INT_MAX ((kmp_int32)0x7FFFFFFF)
|
||||
#define KMP_INT_MIN ((kmp_int32)0x80000000)
|
||||
|
||||
#ifdef __cplusplus
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -281,22 +274,6 @@ extern "C" {
|
||||
# define KMP_ALIGN(bytes) __declspec( align(bytes) )
|
||||
#endif
|
||||
|
||||
#if defined(__MIC__) || defined(__MIC2__)
|
||||
#define KMP_MIC 1
|
||||
// Intel(R) Composer XE (13.0) defines both __MIC__ and __MIC2__ !
|
||||
# if __MIC2__ || __KNC__
|
||||
#define KMP_MIC1 0
|
||||
#define KMP_MIC2 1
|
||||
# else
|
||||
#define KMP_MIC1 1
|
||||
#define KMP_MIC2 0
|
||||
# endif
|
||||
#else
|
||||
#define KMP_MIC 0
|
||||
#define KMP_MIC1 0
|
||||
#define KMP_MIC2 0
|
||||
#endif
|
||||
|
||||
/* General purpose fence types for memory operations */
|
||||
enum kmp_mem_fence_type {
|
||||
kmp_no_fence, /* No memory fence */
|
||||
@@ -414,7 +391,7 @@ extern kmp_real64 __kmp_xchg_real64( volatile kmp_real64 *p, kmp_real64 v );
|
||||
//# define KMP_COMPARE_AND_STORE_RET32(p, cv, sv) __kmp_compare_and_store_ret32( (p), (cv), (sv) )
|
||||
# define KMP_COMPARE_AND_STORE_RET64(p, cv, sv) __kmp_compare_and_store_ret64( (p), (cv), (sv) )
|
||||
|
||||
# define KMP_XCHG_FIXED8(p, v) __kmp_xchg_fixed8( (p), (v) );
|
||||
# define KMP_XCHG_FIXED8(p, v) __kmp_xchg_fixed8( (volatile kmp_int8*)(p), (kmp_int8)(v) );
|
||||
# define KMP_XCHG_FIXED16(p, v) __kmp_xchg_fixed16( (p), (v) );
|
||||
//# define KMP_XCHG_FIXED32(p, v) __kmp_xchg_fixed32( (p), (v) );
|
||||
//# define KMP_XCHG_FIXED64(p, v) __kmp_xchg_fixed64( (p), (v) );
|
||||
@@ -551,7 +528,7 @@ extern kmp_real64 __kmp_xchg_real64( volatile kmp_real64 *p, kmp_real64 v );
|
||||
# define KMP_COMPARE_AND_STORE_RET32(p, cv, sv) __kmp_compare_and_store_ret32( (p), (cv), (sv) )
|
||||
# define KMP_COMPARE_AND_STORE_RET64(p, cv, sv) __kmp_compare_and_store_ret64( (p), (cv), (sv) )
|
||||
|
||||
# define KMP_XCHG_FIXED8(p, v) __kmp_xchg_fixed8( (p), (v) );
|
||||
# define KMP_XCHG_FIXED8(p, v) __kmp_xchg_fixed8( (volatile kmp_int8*)(p), (kmp_int8)(v) );
|
||||
# define KMP_XCHG_FIXED16(p, v) __kmp_xchg_fixed16( (p), (v) );
|
||||
# define KMP_XCHG_FIXED32(p, v) __kmp_xchg_fixed32( (p), (v) );
|
||||
# define KMP_XCHG_FIXED64(p, v) __kmp_xchg_fixed64( (p), (v) );
|
||||
@@ -619,8 +596,12 @@ extern kmp_real64 __kmp_xchg_real64( volatile kmp_real64 *p, kmp_real64 v );
|
||||
|
||||
#define TCR_4(a) (a)
|
||||
#define TCW_4(a,b) (a) = (b)
|
||||
#define TCI_4(a) (++(a))
|
||||
#define TCD_4(a) (--(a))
|
||||
#define TCR_8(a) (a)
|
||||
#define TCW_8(a,b) (a) = (b)
|
||||
#define TCI_8(a) (++(a))
|
||||
#define TCD_8(a) (--(a))
|
||||
#define TCR_SYNC_4(a) (a)
|
||||
#define TCW_SYNC_4(a,b) (a) = (b)
|
||||
#define TCX_SYNC_4(a,b,c) KMP_COMPARE_AND_STORE_REL32((volatile kmp_int32 *)(volatile void *)&(a), (kmp_int32)(b), (kmp_int32)(c))
|
||||
@@ -668,21 +649,13 @@ typedef void (*microtask_t)( int *gtid, int *npr, ... );
|
||||
# define VOLATILE_CAST(x) (x)
|
||||
#endif
|
||||
|
||||
#ifdef KMP_I8
|
||||
# define KMP_WAIT_YIELD __kmp_wait_yield_8
|
||||
# define KMP_EQ __kmp_eq_8
|
||||
# define KMP_NEQ __kmp_neq_8
|
||||
# define KMP_LT __kmp_lt_8
|
||||
# define KMP_GE __kmp_ge_8
|
||||
# define KMP_LE __kmp_le_8
|
||||
#else
|
||||
# define KMP_WAIT_YIELD __kmp_wait_yield_4
|
||||
# define KMP_EQ __kmp_eq_4
|
||||
# define KMP_NEQ __kmp_neq_4
|
||||
# define KMP_LT __kmp_lt_4
|
||||
# define KMP_GE __kmp_ge_4
|
||||
# define KMP_LE __kmp_le_4
|
||||
#endif /* KMP_I8 */
|
||||
#define KMP_WAIT_YIELD __kmp_wait_yield_4
|
||||
#define KMP_WAIT_YIELD_PTR __kmp_wait_yield_4_ptr
|
||||
#define KMP_EQ __kmp_eq_4
|
||||
#define KMP_NEQ __kmp_neq_4
|
||||
#define KMP_LT __kmp_lt_4
|
||||
#define KMP_GE __kmp_ge_4
|
||||
#define KMP_LE __kmp_le_4
|
||||
|
||||
/* Workaround for Intel(R) 64 code gen bug when taking address of static array (Intel(R) 64 Tracker #138) */
|
||||
#if (KMP_ARCH_X86_64 || KMP_ARCH_PPC64) && KMP_OS_LINUX
|
||||
@@ -706,8 +679,23 @@ typedef void (*microtask_t)( int *gtid, int *npr, ... );
|
||||
#endif
|
||||
|
||||
// Enable dynamic user lock
|
||||
#ifndef KMP_USE_DYNAMIC_LOCK
|
||||
# define KMP_USE_DYNAMIC_LOCK 0
|
||||
#if OMP_45_ENABLED
|
||||
# define KMP_USE_DYNAMIC_LOCK 1
|
||||
#endif
|
||||
|
||||
// Enable TSX if dynamic user lock is turned on
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
// Visual studio can't handle the asm sections in this code
|
||||
# define KMP_USE_TSX (KMP_ARCH_X86 || KMP_ARCH_X86_64) && !KMP_COMPILER_MSVC
|
||||
# ifdef KMP_USE_ADAPTIVE_LOCKS
|
||||
# undef KMP_USE_ADAPTIVE_LOCKS
|
||||
# endif
|
||||
# define KMP_USE_ADAPTIVE_LOCKS KMP_USE_TSX
|
||||
#endif
|
||||
|
||||
// Enable tick time conversion of ticks to seconds
|
||||
#if KMP_STATS_ENABLED
|
||||
# define KMP_HAVE_TICK_TIME (KMP_OS_LINUX && (KMP_MIC || KMP_ARCH_X86 || KMP_ARCH_X86_64))
|
||||
#endif
|
||||
|
||||
// Warning levels
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#define KMP_OS_LINUX 0
|
||||
#define KMP_OS_FREEBSD 0
|
||||
#define KMP_OS_NETBSD 0
|
||||
#define KMP_OS_DARWIN 0
|
||||
#define KMP_OS_WINDOWS 0
|
||||
#define KMP_OS_CNK 0
|
||||
@@ -49,16 +50,21 @@
|
||||
# define KMP_OS_FREEBSD 1
|
||||
#endif
|
||||
|
||||
#if ( defined __NetBSD__ )
|
||||
# undef KMP_OS_NETBSD
|
||||
# define KMP_OS_NETBSD 1
|
||||
#endif
|
||||
|
||||
#if ( defined __bgq__ )
|
||||
# undef KMP_OS_CNK
|
||||
# define KMP_OS_CNK 1
|
||||
#endif
|
||||
|
||||
#if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)
|
||||
#if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_NETBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)
|
||||
# error Unknown OS
|
||||
#endif
|
||||
|
||||
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_DARWIN
|
||||
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DARWIN
|
||||
# undef KMP_OS_UNIX
|
||||
# define KMP_OS_UNIX 1
|
||||
#endif
|
||||
@@ -139,6 +145,24 @@
|
||||
# define KMP_ARCH_ARM 1
|
||||
#endif
|
||||
|
||||
#if defined(__MIC__) || defined(__MIC2__)
|
||||
# define KMP_MIC 1
|
||||
# if __MIC2__ || __KNC__
|
||||
# define KMP_MIC1 0
|
||||
# define KMP_MIC2 1
|
||||
# else
|
||||
# define KMP_MIC1 1
|
||||
# define KMP_MIC2 0
|
||||
# endif
|
||||
#else
|
||||
# define KMP_MIC 0
|
||||
# define KMP_MIC1 0
|
||||
# define KMP_MIC2 0
|
||||
#endif
|
||||
|
||||
/* Specify 32 bit architectures here */
|
||||
#define KMP_32_BIT_ARCH (KMP_ARCH_X86 || KMP_ARCH_ARM)
|
||||
|
||||
// TODO: Fixme - This is clever, but really fugly
|
||||
#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + KMP_ARCH_AARCH64)
|
||||
# error Unknown or unsupported architecture
|
||||
|
||||
+436
-475
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@
|
||||
# define KMP_MEMCPY_S(dst, bsz, src, cnt) memcpy(dst, src, cnt)
|
||||
# define KMP_SNPRINTF snprintf
|
||||
# define KMP_SSCANF sscanf
|
||||
# define KMP_STRCPY_S(dst, bsz, src) strcpy(dst, src)
|
||||
# define KMP_STRCPY_S(dst, bsz, src) strcpy(dst, src)
|
||||
# define KMP_STRNCPY_S(dst, bsz, src, cnt) strncpy(dst, src, cnt)
|
||||
# define KMP_VSNPRINTF vsnprintf
|
||||
# define KMP_STRNCPY strncpy
|
||||
|
||||
+62
-17
@@ -84,6 +84,8 @@ __kmp_for_static_init(
|
||||
typename traits_t< T >::signed_t chunk
|
||||
) {
|
||||
KMP_COUNT_BLOCK(OMP_FOR_static);
|
||||
KMP_TIME_PARTITIONED_BLOCK(FOR_static_scheduling);
|
||||
|
||||
typedef typename traits_t< T >::unsigned_t UT;
|
||||
typedef typename traits_t< T >::signed_t ST;
|
||||
/* this all has to be changed back to TID and such.. */
|
||||
@@ -95,8 +97,14 @@ __kmp_for_static_init(
|
||||
register kmp_info_t *th = __kmp_threads[ gtid ];
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
ompt_team_info_t *team_info = NULL;
|
||||
ompt_task_info_t *task_info = NULL;
|
||||
|
||||
if (ompt_enabled) {
|
||||
// Only fully initialize variables needed by OMPT if OMPT is enabled.
|
||||
team_info = __ompt_get_teaminfo(0, NULL);
|
||||
task_info = __ompt_get_taskinfo(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
KMP_DEBUG_ASSERT( plastiter && plower && pupper && pstride );
|
||||
@@ -144,17 +152,21 @@ __kmp_for_static_init(
|
||||
KE_TRACE( 10, ("__kmpc_for_static_init: T#%d return\n", global_tid ) );
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)(
|
||||
team_info->parallel_id, task_info->task_id,
|
||||
team_info->microtask);
|
||||
}
|
||||
#endif
|
||||
KMP_COUNT_VALUE (FOR_static_iterations, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
// Although there are schedule enumerations above kmp_ord_upper which are not schedules for "distribute",
|
||||
// the only ones which are useful are dynamic, so cannot be seen here, since this codepath is only executed
|
||||
// for static schedules.
|
||||
if ( schedtype > kmp_ord_upper ) {
|
||||
// we are in DISTRIBUTE construct
|
||||
schedtype += kmp_sch_static - kmp_distribute_static; // AC: convert to usual schedule type
|
||||
@@ -189,7 +201,7 @@ __kmp_for_static_init(
|
||||
KE_TRACE( 10, ("__kmpc_for_static_init: T#%d return\n", global_tid ) );
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)(
|
||||
team_info->parallel_id, task_info->task_id,
|
||||
@@ -217,7 +229,7 @@ __kmp_for_static_init(
|
||||
KE_TRACE( 10, ("__kmpc_for_static_init: T#%d return\n", global_tid ) );
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)(
|
||||
team_info->parallel_id, task_info->task_id,
|
||||
@@ -232,12 +244,11 @@ __kmp_for_static_init(
|
||||
trip_count = *pupper - *plower + 1;
|
||||
} else if (incr == -1) {
|
||||
trip_count = *plower - *pupper + 1;
|
||||
} else if ( incr > 0 ) {
|
||||
// upper-lower can exceed the limit of signed type
|
||||
trip_count = (UT)(*pupper - *plower) / incr + 1;
|
||||
} else {
|
||||
if ( incr > 1 ) { // the check is needed for unsigned division when incr < 0
|
||||
trip_count = (*pupper - *plower) / incr + 1;
|
||||
} else {
|
||||
trip_count = (*plower - *pupper) / ( -incr ) + 1;
|
||||
}
|
||||
trip_count = (UT)(*plower - *pupper) / (-incr) + 1;
|
||||
}
|
||||
|
||||
if ( __kmp_env_consistency_check ) {
|
||||
@@ -246,6 +257,7 @@ __kmp_for_static_init(
|
||||
__kmp_error_construct( kmp_i18n_msg_CnsIterationRangeTooLarge, ct_pdo, loc );
|
||||
}
|
||||
}
|
||||
KMP_COUNT_VALUE (FOR_static_iterations, trip_count);
|
||||
|
||||
/* compute remaining parameters */
|
||||
switch ( schedtype ) {
|
||||
@@ -312,6 +324,29 @@ __kmp_for_static_init(
|
||||
*plastiter = (tid == ((trip_count - 1)/( UT )chunk) % nth);
|
||||
break;
|
||||
}
|
||||
#if OMP_45_ENABLED
|
||||
case kmp_sch_static_balanced_chunked:
|
||||
{
|
||||
register T old_upper = *pupper;
|
||||
// round up to make sure the chunk is enough to cover all iterations
|
||||
register UT span = (trip_count+nth-1) / nth;
|
||||
|
||||
// perform chunk adjustment
|
||||
chunk = (span + chunk - 1) & ~(chunk-1);
|
||||
|
||||
span = chunk * incr;
|
||||
*plower = *plower + (span * tid);
|
||||
*pupper = *plower + span - incr;
|
||||
if ( incr > 0 ) {
|
||||
if ( *pupper > old_upper ) *pupper = old_upper;
|
||||
} else
|
||||
if ( *pupper < old_upper ) *pupper = old_upper;
|
||||
|
||||
if( plastiter != NULL )
|
||||
*plastiter = ( tid == ((trip_count - 1)/( UT )chunk) );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
KMP_ASSERT2( 0, "__kmpc_for_static_init: unknown scheduling type" );
|
||||
break;
|
||||
@@ -348,7 +383,7 @@ __kmp_for_static_init(
|
||||
KE_TRACE( 10, ("__kmpc_for_static_init: T#%d return\n", global_tid ) );
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)(
|
||||
team_info->parallel_id, task_info->task_id, team_info->microtask);
|
||||
@@ -372,7 +407,7 @@ __kmp_dist_for_static_init(
|
||||
typename traits_t< T >::signed_t incr,
|
||||
typename traits_t< T >::signed_t chunk
|
||||
) {
|
||||
KMP_COUNT_BLOCK(OMP_DISTR_FOR_static);
|
||||
KMP_COUNT_BLOCK(OMP_DISTRIBUTE);
|
||||
typedef typename traits_t< T >::unsigned_t UT;
|
||||
typedef typename traits_t< T >::signed_t ST;
|
||||
register kmp_uint32 tid;
|
||||
@@ -420,10 +455,10 @@ __kmp_dist_for_static_init(
|
||||
}
|
||||
tid = __kmp_tid_from_gtid( gtid );
|
||||
th = __kmp_threads[gtid];
|
||||
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
|
||||
nth = th->th.th_team_nproc;
|
||||
team = th->th.th_team;
|
||||
#if OMP_40_ENABLED
|
||||
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
|
||||
nteams = th->th.th_teams_size.nteams;
|
||||
#endif
|
||||
team_id = team->t.t_master_tid;
|
||||
@@ -434,9 +469,13 @@ __kmp_dist_for_static_init(
|
||||
trip_count = *pupper - *plower + 1;
|
||||
} else if(incr == -1) {
|
||||
trip_count = *plower - *pupper + 1;
|
||||
} else if ( incr > 0 ) {
|
||||
// upper-lower can exceed the limit of signed type
|
||||
trip_count = (UT)(*pupper - *plower) / incr + 1;
|
||||
} else {
|
||||
trip_count = (ST)(*pupper - *plower) / incr + 1; // cast to signed to cover incr<0 case
|
||||
trip_count = (UT)(*plower - *pupper) / (-incr) + 1;
|
||||
}
|
||||
|
||||
*pstride = *pupper - *plower; // just in case (can be unused)
|
||||
if( trip_count <= nteams ) {
|
||||
KMP_DEBUG_ASSERT(
|
||||
@@ -500,8 +539,11 @@ __kmp_dist_for_static_init(
|
||||
trip_count = *pupperDist - *plower + 1;
|
||||
} else if(incr == -1) {
|
||||
trip_count = *plower - *pupperDist + 1;
|
||||
} else if ( incr > 1 ) {
|
||||
// upper-lower can exceed the limit of signed type
|
||||
trip_count = (UT)(*pupperDist - *plower) / incr + 1;
|
||||
} else {
|
||||
trip_count = (ST)(*pupperDist - *plower) / incr + 1;
|
||||
trip_count = (UT)(*plower - *pupperDist) / (-incr) + 1;
|
||||
}
|
||||
KMP_DEBUG_ASSERT( trip_count );
|
||||
switch( schedule ) {
|
||||
@@ -657,9 +699,9 @@ __kmp_team_static_init(
|
||||
}
|
||||
}
|
||||
th = __kmp_threads[gtid];
|
||||
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
|
||||
team = th->th.th_team;
|
||||
#if OMP_40_ENABLED
|
||||
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
|
||||
nteams = th->th.th_teams_size.nteams;
|
||||
#endif
|
||||
team_id = team->t.t_master_tid;
|
||||
@@ -670,8 +712,11 @@ __kmp_team_static_init(
|
||||
trip_count = upper - lower + 1;
|
||||
} else if(incr == -1) {
|
||||
trip_count = lower - upper + 1;
|
||||
} else if ( incr > 0 ) {
|
||||
// upper-lower can exceed the limit of signed type
|
||||
trip_count = (UT)(upper - lower) / incr + 1;
|
||||
} else {
|
||||
trip_count = (ST)(upper - lower) / incr + 1; // cast to signed to cover incr<0 case
|
||||
trip_count = (UT)(lower - upper) / (-incr) + 1;
|
||||
}
|
||||
if( chunk < 1 )
|
||||
chunk = 1;
|
||||
|
||||
+484
-117
@@ -21,6 +21,7 @@
|
||||
#include "kmp_str.h"
|
||||
#include "kmp_settings.h"
|
||||
#include "kmp_i18n.h"
|
||||
#include "kmp_lock.h"
|
||||
#include "kmp_io.h"
|
||||
|
||||
static int __kmp_env_toPrint( char const * name, int flag );
|
||||
@@ -712,6 +713,8 @@ __kmp_stg_print_inherit_fp_control( kmp_str_buf_t * buffer, char const * name, v
|
||||
// KMP_LIBRARY, OMP_WAIT_POLICY
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
static char const *blocktime_str = NULL;
|
||||
|
||||
static void
|
||||
__kmp_stg_parse_wait_policy( char const * name, char const * value, void * data ) {
|
||||
|
||||
@@ -725,9 +728,17 @@ __kmp_stg_parse_wait_policy( char const * name, char const * value, void * data
|
||||
|
||||
if ( wait->omp ) {
|
||||
if ( __kmp_str_match( "ACTIVE", 1, value ) ) {
|
||||
__kmp_library = library_turnaround;
|
||||
__kmp_library = library_turnaround;
|
||||
if ( blocktime_str == NULL ) {
|
||||
// KMP_BLOCKTIME not specified, so set default to "infinite".
|
||||
__kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
|
||||
}
|
||||
} else if ( __kmp_str_match( "PASSIVE", 1, value ) ) {
|
||||
__kmp_library = library_throughput;
|
||||
__kmp_library = library_throughput;
|
||||
if ( blocktime_str == NULL ) {
|
||||
// KMP_BLOCKTIME not specified, so set default to 0.
|
||||
__kmp_dflt_blocktime = 0;
|
||||
}
|
||||
} else {
|
||||
KMP_WARNING( StgInvalidValue, name, value );
|
||||
}; // if
|
||||
@@ -1163,7 +1174,7 @@ __kmp_stg_print_task_stealing( kmp_str_buf_t * buffer, char const * name, void *
|
||||
|
||||
static void
|
||||
__kmp_stg_parse_max_active_levels( char const * name, char const * value, void * data ) {
|
||||
__kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_dflt_max_active_levels );
|
||||
__kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_dflt_max_active_levels );
|
||||
} // __kmp_stg_parse_max_active_levels
|
||||
|
||||
static void
|
||||
@@ -1171,6 +1182,38 @@ __kmp_stg_print_max_active_levels( kmp_str_buf_t * buffer, char const * name, vo
|
||||
__kmp_stg_print_int( buffer, name, __kmp_dflt_max_active_levels );
|
||||
} // __kmp_stg_print_max_active_levels
|
||||
|
||||
#if OMP_45_ENABLED
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// OpenMP 4.5: OMP_MAX_TASK_PRIORITY
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
static void
|
||||
__kmp_stg_parse_max_task_priority(char const *name, char const *value, void *data) {
|
||||
__kmp_stg_parse_int(name, value, 0, KMP_MAX_TASK_PRIORITY_LIMIT, &__kmp_max_task_priority);
|
||||
} // __kmp_stg_parse_max_task_priority
|
||||
|
||||
static void
|
||||
__kmp_stg_print_max_task_priority(kmp_str_buf_t *buffer, char const *name, void *data) {
|
||||
__kmp_stg_print_int(buffer, name, __kmp_max_task_priority);
|
||||
} // __kmp_stg_print_max_task_priority
|
||||
#endif // OMP_45_ENABLED
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// KMP_DISP_NUM_BUFFERS
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
static void
|
||||
__kmp_stg_parse_disp_buffers( char const * name, char const * value, void * data ) {
|
||||
if ( TCR_4(__kmp_init_serial) ) {
|
||||
KMP_WARNING( EnvSerialWarn, name );
|
||||
return;
|
||||
} // read value before serial initialization only
|
||||
__kmp_stg_parse_int( name, value, 1, KMP_MAX_NTH, & __kmp_dispatch_num_buffers );
|
||||
} // __kmp_stg_parse_disp_buffers
|
||||
|
||||
static void
|
||||
__kmp_stg_print_disp_buffers( kmp_str_buf_t * buffer, char const * name, void * data ) {
|
||||
__kmp_stg_print_int( buffer, name, __kmp_dispatch_num_buffers );
|
||||
} // __kmp_stg_print_disp_buffers
|
||||
|
||||
#if KMP_NESTED_HOT_TEAMS
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// KMP_HOT_TEAMS_MAX_LEVEL, KMP_HOT_TEAMS_MODE
|
||||
@@ -2926,11 +2969,12 @@ __kmp_stg_parse_proc_bind( char const * name, char const * value, void * data )
|
||||
// OMP_PROC_BIND => granularity=core,scatter elsewhere
|
||||
//
|
||||
__kmp_affinity_type = affinity_scatter;
|
||||
if( __kmp_mic_type != non_mic ) {
|
||||
# if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
|
||||
if( __kmp_mic_type != non_mic )
|
||||
__kmp_affinity_gran = affinity_gran_fine;
|
||||
} else {
|
||||
else
|
||||
# endif
|
||||
__kmp_affinity_gran = affinity_gran_core;
|
||||
}
|
||||
}
|
||||
else {
|
||||
__kmp_affinity_type = affinity_none;
|
||||
@@ -3008,6 +3052,11 @@ __kmp_stg_parse_topology_method( char const * name, char const * value,
|
||||
else if ( __kmp_str_match( "flat", 1, value ) ) {
|
||||
__kmp_affinity_top_method = affinity_top_method_flat;
|
||||
}
|
||||
# if KMP_USE_HWLOC
|
||||
else if ( __kmp_str_match( "hwloc", 1, value) ) {
|
||||
__kmp_affinity_top_method = affinity_top_method_hwloc;
|
||||
}
|
||||
# endif
|
||||
else {
|
||||
KMP_WARNING( StgInvalidValue, name, value );
|
||||
}
|
||||
@@ -3373,8 +3422,6 @@ __kmp_stg_print_ld_balance_interval( kmp_str_buf_t * buffer, char const * name,
|
||||
|
||||
#endif /* USE_LOAD_BALANCE */
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// KMP_INIT_AT_FORK
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
@@ -3496,9 +3543,8 @@ __kmp_stg_parse_omp_schedule( char const * name, char const * value, void * data
|
||||
__kmp_sched = kmp_sch_trapezoidal;
|
||||
else if (!__kmp_strcasecmp_with_sentinel("static", value, ',')) /* STATIC */
|
||||
__kmp_sched = kmp_sch_static;
|
||||
#ifdef KMP_STATIC_STEAL_ENABLED
|
||||
else if (KMP_ARCH_X86_64 &&
|
||||
!__kmp_strcasecmp_with_sentinel("static_steal", value, ','))
|
||||
#if KMP_STATIC_STEAL_ENABLED
|
||||
else if (!__kmp_strcasecmp_with_sentinel("static_steal", value, ','))
|
||||
__kmp_sched = kmp_sch_static_steal;
|
||||
#endif
|
||||
else {
|
||||
@@ -3850,7 +3896,6 @@ __kmp_stg_print_gtid_mode( kmp_str_buf_t * buffer, char const * name, void * dat
|
||||
}
|
||||
} // __kmp_stg_print_gtid_mode
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// KMP_NUM_LOCKS_IN_BLOCK
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
@@ -3869,6 +3914,12 @@ __kmp_stg_print_lock_block( kmp_str_buf_t * buffer, char const * name, void * da
|
||||
// KMP_LOCK_KIND
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
# define KMP_STORE_LOCK_SEQ(a) (__kmp_user_lock_seq = lockseq_##a)
|
||||
#else
|
||||
# define KMP_STORE_LOCK_SEQ(a)
|
||||
#endif
|
||||
|
||||
static void
|
||||
__kmp_stg_parse_lock_kind( char const * name, char const * value, void * data ) {
|
||||
if ( __kmp_init_user_locks ) {
|
||||
@@ -3888,13 +3939,13 @@ __kmp_stg_parse_lock_kind( char const * name, char const * value, void * data )
|
||||
|| __kmp_str_match( "testand-set", 2, value )
|
||||
|| __kmp_str_match( "testandset", 2, value ) ) {
|
||||
__kmp_user_lock_kind = lk_tas;
|
||||
DYNA_STORE_LOCK_SEQ(tas);
|
||||
KMP_STORE_LOCK_SEQ(tas);
|
||||
}
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)
|
||||
#if KMP_USE_FUTEX
|
||||
else if ( __kmp_str_match( "futex", 1, value ) ) {
|
||||
if ( __kmp_futex_determine_capable() ) {
|
||||
__kmp_user_lock_kind = lk_futex;
|
||||
DYNA_STORE_LOCK_SEQ(futex);
|
||||
KMP_STORE_LOCK_SEQ(futex);
|
||||
}
|
||||
else {
|
||||
KMP_WARNING( FutexNotSupported, name, value );
|
||||
@@ -3903,12 +3954,12 @@ __kmp_stg_parse_lock_kind( char const * name, char const * value, void * data )
|
||||
#endif
|
||||
else if ( __kmp_str_match( "ticket", 2, value ) ) {
|
||||
__kmp_user_lock_kind = lk_ticket;
|
||||
DYNA_STORE_LOCK_SEQ(ticket);
|
||||
KMP_STORE_LOCK_SEQ(ticket);
|
||||
}
|
||||
else if ( __kmp_str_match( "queuing", 1, value )
|
||||
|| __kmp_str_match( "queue", 1, value ) ) {
|
||||
__kmp_user_lock_kind = lk_queuing;
|
||||
DYNA_STORE_LOCK_SEQ(queuing);
|
||||
KMP_STORE_LOCK_SEQ(queuing);
|
||||
}
|
||||
else if ( __kmp_str_match( "drdpa ticket", 1, value )
|
||||
|| __kmp_str_match( "drdpa_ticket", 1, value )
|
||||
@@ -3916,23 +3967,34 @@ __kmp_stg_parse_lock_kind( char const * name, char const * value, void * data )
|
||||
|| __kmp_str_match( "drdpaticket", 1, value )
|
||||
|| __kmp_str_match( "drdpa", 1, value ) ) {
|
||||
__kmp_user_lock_kind = lk_drdpa;
|
||||
DYNA_STORE_LOCK_SEQ(drdpa);
|
||||
KMP_STORE_LOCK_SEQ(drdpa);
|
||||
}
|
||||
#if KMP_USE_ADAPTIVE_LOCKS
|
||||
else if ( __kmp_str_match( "adaptive", 1, value ) ) {
|
||||
if( __kmp_cpuinfo.rtm ) { // ??? Is cpuinfo available here?
|
||||
__kmp_user_lock_kind = lk_adaptive;
|
||||
DYNA_STORE_LOCK_SEQ(adaptive);
|
||||
KMP_STORE_LOCK_SEQ(adaptive);
|
||||
} else {
|
||||
KMP_WARNING( AdaptiveNotSupported, name, value );
|
||||
__kmp_user_lock_kind = lk_queuing;
|
||||
DYNA_STORE_LOCK_SEQ(queuing);
|
||||
KMP_STORE_LOCK_SEQ(queuing);
|
||||
}
|
||||
}
|
||||
#endif // KMP_USE_ADAPTIVE_LOCKS
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
#if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX
|
||||
else if ( __kmp_str_match("rtm", 1, value) ) {
|
||||
if ( __kmp_cpuinfo.rtm ) {
|
||||
__kmp_user_lock_kind = lk_rtm;
|
||||
KMP_STORE_LOCK_SEQ(rtm);
|
||||
} else {
|
||||
KMP_WARNING( AdaptiveNotSupported, name, value );
|
||||
__kmp_user_lock_kind = lk_queuing;
|
||||
KMP_STORE_LOCK_SEQ(queuing);
|
||||
}
|
||||
}
|
||||
else if ( __kmp_str_match("hle", 1, value) ) {
|
||||
DYNA_STORE_LOCK_SEQ(hle);
|
||||
__kmp_user_lock_kind = lk_hle;
|
||||
KMP_STORE_LOCK_SEQ(hle);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
@@ -3953,12 +4015,22 @@ __kmp_stg_print_lock_kind( kmp_str_buf_t * buffer, char const * name, void * dat
|
||||
value = "tas";
|
||||
break;
|
||||
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64)
|
||||
#if KMP_USE_FUTEX
|
||||
case lk_futex:
|
||||
value = "futex";
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX
|
||||
case lk_rtm:
|
||||
value = "rtm";
|
||||
break;
|
||||
|
||||
case lk_hle:
|
||||
value = "hle";
|
||||
break;
|
||||
#endif
|
||||
|
||||
case lk_ticket:
|
||||
value = "ticket";
|
||||
break;
|
||||
@@ -3982,6 +4054,102 @@ __kmp_stg_print_lock_kind( kmp_str_buf_t * buffer, char const * name, void * dat
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// KMP_SPIN_BACKOFF_PARAMS
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
// KMP_SPIN_BACKOFF_PARAMS=max_backoff[,min_tick] (max backoff size, min tick for machine pause)
|
||||
static void
|
||||
__kmp_stg_parse_spin_backoff_params(const char* name, const char* value, void* data)
|
||||
{
|
||||
const char *next = value;
|
||||
|
||||
int total = 0; // Count elements that were set. It'll be used as an array size
|
||||
int prev_comma = FALSE; // For correct processing sequential commas
|
||||
int i;
|
||||
|
||||
kmp_uint32 max_backoff = __kmp_spin_backoff_params.max_backoff;
|
||||
kmp_uint32 min_tick = __kmp_spin_backoff_params.min_tick;
|
||||
|
||||
// Run only 3 iterations because it is enough to read two values or find a syntax error
|
||||
for ( i = 0; i < 3 ; i++) {
|
||||
SKIP_WS( next );
|
||||
|
||||
if ( *next == '\0' ) {
|
||||
break;
|
||||
}
|
||||
// Next character is not an integer or not a comma OR number of values > 2 => end of list
|
||||
if ( ( ( *next < '0' || *next > '9' ) && *next !=',' ) || total > 2 ) {
|
||||
KMP_WARNING( EnvSyntaxError, name, value );
|
||||
return;
|
||||
}
|
||||
// The next character is ','
|
||||
if ( *next == ',' ) {
|
||||
// ',' is the fisrt character
|
||||
if ( total == 0 || prev_comma ) {
|
||||
total++;
|
||||
}
|
||||
prev_comma = TRUE;
|
||||
next++; //skip ','
|
||||
SKIP_WS( next );
|
||||
}
|
||||
// Next character is a digit
|
||||
if ( *next >= '0' && *next <= '9' ) {
|
||||
int num;
|
||||
const char *buf = next;
|
||||
char const * msg = NULL;
|
||||
prev_comma = FALSE;
|
||||
SKIP_DIGITS( next );
|
||||
total++;
|
||||
|
||||
const char *tmp = next;
|
||||
SKIP_WS( tmp );
|
||||
if ( ( *next == ' ' || *next == '\t' ) && ( *tmp >= '0' && *tmp <= '9' ) ) {
|
||||
KMP_WARNING( EnvSpacesNotAllowed, name, value );
|
||||
return;
|
||||
}
|
||||
|
||||
num = __kmp_str_to_int( buf, *next );
|
||||
if ( num <= 0 ) { // The number of retries should be > 0
|
||||
msg = KMP_I18N_STR( ValueTooSmall );
|
||||
num = 1;
|
||||
} else if ( num > KMP_INT_MAX ) {
|
||||
msg = KMP_I18N_STR( ValueTooLarge );
|
||||
num = KMP_INT_MAX;
|
||||
}
|
||||
if ( msg != NULL ) {
|
||||
// Message is not empty. Print warning.
|
||||
KMP_WARNING( ParseSizeIntWarn, name, value, msg );
|
||||
KMP_INFORM( Using_int_Value, name, num );
|
||||
}
|
||||
if( total == 1 ) {
|
||||
max_backoff = num;
|
||||
} else if( total == 2 ) {
|
||||
min_tick = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
KMP_DEBUG_ASSERT( total > 0 );
|
||||
if( total <= 0 ) {
|
||||
KMP_WARNING( EnvSyntaxError, name, value );
|
||||
return;
|
||||
}
|
||||
__kmp_spin_backoff_params.max_backoff = max_backoff;
|
||||
__kmp_spin_backoff_params.min_tick = min_tick;
|
||||
}
|
||||
|
||||
static void
|
||||
__kmp_stg_print_spin_backoff_params(kmp_str_buf_t *buffer, char const* name, void* data)
|
||||
{
|
||||
if( __kmp_env_format ) {
|
||||
KMP_STR_BUF_PRINT_NAME_EX(name);
|
||||
} else {
|
||||
__kmp_str_buf_print( buffer, " %s='", name );
|
||||
}
|
||||
__kmp_str_buf_print( buffer, "%d,%d'\n", __kmp_spin_backoff_params.max_backoff,
|
||||
__kmp_spin_backoff_params.min_tick );
|
||||
}
|
||||
|
||||
#if KMP_USE_ADAPTIVE_LOCKS
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
@@ -4042,7 +4210,7 @@ __kmp_stg_parse_adaptive_lock_props( const char *name, const char *value, void *
|
||||
}
|
||||
|
||||
num = __kmp_str_to_int( buf, *next );
|
||||
if ( num < 1 ) { // The number of retries should be > 0
|
||||
if ( num < 0 ) { // The number of retries should be >= 0
|
||||
msg = KMP_I18N_STR( ValueTooSmall );
|
||||
num = 1;
|
||||
} else if ( num > KMP_INT_MAX ) {
|
||||
@@ -4066,12 +4234,8 @@ __kmp_stg_parse_adaptive_lock_props( const char *name, const char *value, void *
|
||||
KMP_WARNING( EnvSyntaxError, name, value );
|
||||
return;
|
||||
}
|
||||
if( max_retries != 0 ) {
|
||||
__kmp_adaptive_backoff_params.max_soft_retries = max_retries;
|
||||
}
|
||||
if( max_badness != 0 ) {
|
||||
__kmp_adaptive_backoff_params.max_badness = max_badness;
|
||||
}
|
||||
__kmp_adaptive_backoff_params.max_soft_retries = max_retries;
|
||||
__kmp_adaptive_backoff_params.max_badness = max_badness;
|
||||
}
|
||||
|
||||
|
||||
@@ -4109,134 +4273,299 @@ __kmp_stg_print_speculative_statsfile( kmp_str_buf_t * buffer, char const * name
|
||||
#endif // KMP_USE_ADAPTIVE_LOCKS
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// KMP_PLACE_THREADS
|
||||
// KMP_HW_SUBSET (was KMP_PLACE_THREADS)
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
static void
|
||||
__kmp_stg_parse_place_threads( char const * name, char const * value, void * data ) {
|
||||
__kmp_stg_parse_hw_subset( char const * name, char const * value, void * data ) {
|
||||
// Value example: 5Cx2Tx15O
|
||||
// Which means "use 5 cores with offset 15, 2 threads per core"
|
||||
|
||||
// AC: extended to sockets level, examples of
|
||||
// "use 2 sockets with offset 6, 2 cores with offset 2 per socket, 2 threads per core":
|
||||
// 2s,6o,2c,2o,2t; 2s,6o,2c,2t,2o; 2s@6,2c@2,2t
|
||||
// To not break legacy code core-offset can be last;
|
||||
// postfix "o" or prefix @ can be offset designator.
|
||||
// Note: not all syntax errors are analyzed, some may be skipped.
|
||||
#define CHECK_DELIM(_x) (*(_x) == ',' || *(_x) == 'x')
|
||||
static int parsed = 0;
|
||||
int num;
|
||||
int prev_delim = 0;
|
||||
int single_warning = 0;
|
||||
int flagS = 0, flagC = 0, flagT = 0, flagSO = 0, flagCO = 0;
|
||||
const char *next = value;
|
||||
const char *prev;
|
||||
|
||||
SKIP_WS( next );
|
||||
if ( *next == '\0' ) {
|
||||
return; // leave default values
|
||||
if( strcmp(name, "KMP_PLACE_THREADS") == 0 ) {
|
||||
KMP_INFORM(EnvVarDeprecated,name,"KMP_HW_SUBSET");
|
||||
if( parsed == 1 ) {
|
||||
return; // already parsed KMP_HW_SUBSET
|
||||
}
|
||||
}
|
||||
parsed = 1;
|
||||
|
||||
// Get num_cores first
|
||||
if ( *next >= '0' && *next <= '9' ) {
|
||||
SKIP_WS(next); // skip white spaces
|
||||
if (*next == '\0')
|
||||
return; // no data provided, retain default values
|
||||
if( strcmp(name, "KMP_PLACE_THREADS") == 0 ) {
|
||||
KMP_INFORM(EnvVarDeprecated,name,"KMP_HW_SUBSET");
|
||||
if( parsed == 1 ) {
|
||||
return; // already parsed KMP_HW_SUBSET
|
||||
}
|
||||
}
|
||||
parsed = 1;
|
||||
|
||||
SKIP_WS(next); // skip white spaces
|
||||
if (*next == '\0')
|
||||
return; // no data provided, retain default values
|
||||
// Get num_sockets first (or whatever specified)
|
||||
if (*next >= '0' && *next <= '9') {
|
||||
prev = next;
|
||||
SKIP_DIGITS( next );
|
||||
num = __kmp_str_to_int( prev, *next );
|
||||
SKIP_WS( next );
|
||||
if ( *next == 'C' || *next == 'c' ) {
|
||||
__kmp_place_num_cores = num;
|
||||
SKIP_DIGITS(next);
|
||||
num = __kmp_str_to_int(prev, *next);
|
||||
SKIP_WS(next);
|
||||
if (*next == 's' || *next == 'S') { // e.g. "2s"
|
||||
__kmp_place_num_sockets = num;
|
||||
flagS = 1; // got num sockets
|
||||
next++;
|
||||
} else if ( *next == ',' || *next == 'x' ) {
|
||||
if (*next == '@') { // socket offset, e.g. "2s@4"
|
||||
flagSO = 1;
|
||||
prev = ++next; // don't allow spaces for simplicity
|
||||
if (!(*next >= '0' && *next <= '9')) {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
SKIP_DIGITS(next);
|
||||
num = __kmp_str_to_int(prev, *next);
|
||||
__kmp_place_socket_offset = num;
|
||||
}
|
||||
} else if (*next == 'c' || *next == 'C') {
|
||||
__kmp_place_num_cores = num;
|
||||
prev_delim = 1;
|
||||
flagS = flagC = 1; // sockets were not specified - use default
|
||||
next++;
|
||||
} else if ( *next == 'T' || *next == 't' ) {
|
||||
if (*next == '@') { // core offset, e.g. "2c@6"
|
||||
flagCO = 1;
|
||||
prev = ++next; // don't allow spaces for simplicity
|
||||
if (!(*next >= '0' && *next <= '9')) {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
SKIP_DIGITS(next);
|
||||
num = __kmp_str_to_int(prev, *next);
|
||||
__kmp_place_core_offset = num;
|
||||
}
|
||||
} else if (CHECK_DELIM(next)) {
|
||||
__kmp_place_num_cores = num; // no letter-designator - num cores
|
||||
flagS = flagC = 1; // sockets were not specified - use default
|
||||
next++;
|
||||
} else if (*next == 't' || *next == 'T') {
|
||||
__kmp_place_num_threads_per_core = num;
|
||||
// sockets, cores were not specified - use default
|
||||
return; // we ignore offset value in case all cores are used
|
||||
} else if ( *next == '\0' ) {
|
||||
} else if (*next == '\0') {
|
||||
__kmp_place_num_cores = num;
|
||||
return; // the only value provided
|
||||
return; // the only value provided - set num cores
|
||||
} else {
|
||||
KMP_WARNING( AffThrPlaceInvalid, name, value );
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
} else if ( *next == ',' || *next == 'x' ) {
|
||||
// First character is delimiter, skip it, leave num_cores default value
|
||||
prev_delim = 2;
|
||||
next++;
|
||||
} else {
|
||||
KMP_WARNING( AffThrPlaceInvalid, name, value );
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
SKIP_WS( next );
|
||||
if ( *next == '\0' ) {
|
||||
KMP_DEBUG_ASSERT(flagS); // num sockets should already be set here
|
||||
SKIP_WS(next);
|
||||
if (*next == '\0')
|
||||
return; // " n " - something like this
|
||||
}
|
||||
if ( ( *next == ',' || *next == 'x' ) && !prev_delim ) {
|
||||
prev_delim = 1;
|
||||
next++; // skip delimiter after num_core value
|
||||
SKIP_WS( next );
|
||||
if (CHECK_DELIM(next)) {
|
||||
next++; // skip delimiter
|
||||
SKIP_WS(next);
|
||||
}
|
||||
|
||||
// Get threads_per_core next
|
||||
if ( *next >= '0' && *next <= '9' ) {
|
||||
prev_delim = 0;
|
||||
// Get second value (could be offset, num_cores, num_threads)
|
||||
if (*next >= '0' && *next <= '9') {
|
||||
prev = next;
|
||||
SKIP_DIGITS( next );
|
||||
num = __kmp_str_to_int( prev, *next );
|
||||
SKIP_WS( next );
|
||||
if ( *next == 'T' || *next == 't' ) {
|
||||
__kmp_place_num_threads_per_core = num;
|
||||
SKIP_DIGITS(next);
|
||||
num = __kmp_str_to_int(prev, *next);
|
||||
SKIP_WS(next);
|
||||
if (*next == 'c' || *next == 'C') {
|
||||
KMP_DEBUG_ASSERT(flagC == 0);
|
||||
__kmp_place_num_cores = num;
|
||||
flagC = 1;
|
||||
next++;
|
||||
} else if ( *next == ',' || *next == 'x' ) {
|
||||
__kmp_place_num_threads_per_core = num;
|
||||
prev_delim = 1;
|
||||
if (*next == '@') { // core offset, e.g. "2c@6"
|
||||
flagCO = 1;
|
||||
prev = ++next; // don't allow spaces for simplicity
|
||||
if (!(*next >= '0' && *next <= '9')) {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
SKIP_DIGITS(next);
|
||||
num = __kmp_str_to_int(prev, *next);
|
||||
__kmp_place_core_offset = num;
|
||||
}
|
||||
} else if (*next == 'o' || *next == 'O') { // offset specified
|
||||
KMP_WARNING(AffHWSubsetDeprecated);
|
||||
single_warning = 1;
|
||||
if (flagC) { // whether num_cores already specified (sockets skipped)
|
||||
KMP_DEBUG_ASSERT(!flagCO); // either "o" or @, not both
|
||||
__kmp_place_core_offset = num;
|
||||
} else {
|
||||
KMP_DEBUG_ASSERT(!flagSO); // either "o" or @, not both
|
||||
__kmp_place_socket_offset = num;
|
||||
}
|
||||
next++;
|
||||
} else if ( *next == 'O' || *next == 'o' ) {
|
||||
__kmp_place_core_offset = num;
|
||||
return; // threads_per_core remains default
|
||||
} else if ( *next == '\0' ) {
|
||||
} else if (*next == 't' || *next == 'T') {
|
||||
KMP_DEBUG_ASSERT(flagT == 0);
|
||||
__kmp_place_num_threads_per_core = num;
|
||||
return;
|
||||
flagC = 1; // num_cores could be skipped ?
|
||||
flagT = 1;
|
||||
next++; // can have core-offset specified after num threads
|
||||
} else if (*next == '\0') {
|
||||
KMP_DEBUG_ASSERT(flagC); // 4x2 means 4 cores 2 threads per core
|
||||
__kmp_place_num_threads_per_core = num;
|
||||
return; // two values provided without letter-designator
|
||||
} else {
|
||||
KMP_WARNING( AffThrPlaceInvalid, name, value );
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
} else if ( *next == ',' || *next == 'x' ) {
|
||||
if ( prev_delim == 2 ) {
|
||||
return; // no sense in the only offset value, thus skip the rest
|
||||
}
|
||||
KMP_DEBUG_ASSERT( prev_delim == 1 );
|
||||
next++; // no value for threads_per_core provided
|
||||
} else {
|
||||
KMP_WARNING( AffThrPlaceInvalid, name, value );
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
SKIP_WS( next );
|
||||
if ( *next == '\0' ) {
|
||||
return; // " nC,mT " - something like this
|
||||
}
|
||||
if ( ( *next == ',' || *next == 'x' ) && !prev_delim ) {
|
||||
prev_delim = 1;
|
||||
next++; // skip delimiter after threads_per_core value
|
||||
SKIP_WS( next );
|
||||
SKIP_WS(next);
|
||||
if (*next == '\0')
|
||||
return; // " Ns,Nc " - something like this
|
||||
if (CHECK_DELIM(next)) {
|
||||
next++; // skip delimiter
|
||||
SKIP_WS(next);
|
||||
}
|
||||
|
||||
// Get core offset last if any,
|
||||
// don't bother checking syntax after all data obtained
|
||||
if ( *next >= '0' && *next <= '9' ) {
|
||||
// Get third value (could be core-offset, num_cores, num_threads)
|
||||
if (*next >= '0' && *next <= '9') {
|
||||
prev = next;
|
||||
SKIP_DIGITS( next );
|
||||
num = __kmp_str_to_int( prev, *next );
|
||||
__kmp_place_core_offset = num;
|
||||
SKIP_DIGITS(next);
|
||||
num = __kmp_str_to_int(prev, *next);
|
||||
SKIP_WS(next);
|
||||
if (*next == 't' || *next == 'T') {
|
||||
KMP_DEBUG_ASSERT(flagT == 0);
|
||||
__kmp_place_num_threads_per_core = num;
|
||||
if (flagC == 0)
|
||||
return; // num_cores could be skipped (e.g. 2s,4o,2t)
|
||||
flagT = 1;
|
||||
next++; // can have core-offset specified later (e.g. 2s,1c,2t,3o)
|
||||
} else if (*next == 'c' || *next == 'C') {
|
||||
KMP_DEBUG_ASSERT(flagC == 0);
|
||||
__kmp_place_num_cores = num;
|
||||
flagC = 1;
|
||||
next++;
|
||||
//KMP_DEBUG_ASSERT(*next != '@'); // socket offset used "o" designator
|
||||
} else if (*next == 'o' || *next == 'O') {
|
||||
KMP_WARNING(AffHWSubsetDeprecated);
|
||||
single_warning = 1;
|
||||
KMP_DEBUG_ASSERT(flagC);
|
||||
//KMP_DEBUG_ASSERT(!flagSO); // socket offset couldn't use @ designator
|
||||
__kmp_place_core_offset = num;
|
||||
next++;
|
||||
} else {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
KMP_DEBUG_ASSERT(flagC);
|
||||
SKIP_WS(next);
|
||||
if ( *next == '\0' )
|
||||
return;
|
||||
if (CHECK_DELIM(next)) {
|
||||
next++; // skip delimiter
|
||||
SKIP_WS(next);
|
||||
}
|
||||
|
||||
// Get 4-th value (could be core-offset, num_threads)
|
||||
if (*next >= '0' && *next <= '9') {
|
||||
prev = next;
|
||||
SKIP_DIGITS(next);
|
||||
num = __kmp_str_to_int(prev, *next);
|
||||
SKIP_WS(next);
|
||||
if (*next == 'o' || *next == 'O') {
|
||||
if (!single_warning) { // warn once
|
||||
KMP_WARNING(AffHWSubsetDeprecated);
|
||||
}
|
||||
KMP_DEBUG_ASSERT(!flagSO); // socket offset couldn't use @ designator
|
||||
__kmp_place_core_offset = num;
|
||||
next++;
|
||||
} else if (*next == 't' || *next == 'T') {
|
||||
KMP_DEBUG_ASSERT(flagT == 0);
|
||||
__kmp_place_num_threads_per_core = num;
|
||||
flagT = 1;
|
||||
next++; // can have core-offset specified after num threads
|
||||
} else {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
return;
|
||||
}
|
||||
SKIP_WS(next);
|
||||
if ( *next == '\0' )
|
||||
return;
|
||||
if (CHECK_DELIM(next)) {
|
||||
next++; // skip delimiter
|
||||
SKIP_WS(next);
|
||||
}
|
||||
|
||||
// Get 5-th value (could be core-offset, num_threads)
|
||||
if (*next >= '0' && *next <= '9') {
|
||||
prev = next;
|
||||
SKIP_DIGITS(next);
|
||||
num = __kmp_str_to_int(prev, *next);
|
||||
SKIP_WS(next);
|
||||
if (*next == 'o' || *next == 'O') {
|
||||
if (!single_warning) { // warn once
|
||||
KMP_WARNING(AffHWSubsetDeprecated);
|
||||
}
|
||||
KMP_DEBUG_ASSERT(flagT);
|
||||
KMP_DEBUG_ASSERT(!flagSO); // socket offset couldn't use @ designator
|
||||
__kmp_place_core_offset = num;
|
||||
} else if (*next == 't' || *next == 'T') {
|
||||
KMP_DEBUG_ASSERT(flagT == 0);
|
||||
__kmp_place_num_threads_per_core = num;
|
||||
} else {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
}
|
||||
} else {
|
||||
KMP_WARNING(AffHWSubsetInvalid, name, value);
|
||||
}
|
||||
return;
|
||||
#undef CHECK_DELIM
|
||||
}
|
||||
|
||||
static void
|
||||
__kmp_stg_print_place_threads( kmp_str_buf_t * buffer, char const * name, void * data ) {
|
||||
if ( __kmp_place_num_cores + __kmp_place_num_threads_per_core ) {
|
||||
__kmp_stg_print_hw_subset( kmp_str_buf_t * buffer, char const * name, void * data ) {
|
||||
if (__kmp_place_num_sockets + __kmp_place_num_cores + __kmp_place_num_threads_per_core) {
|
||||
int comma = 0;
|
||||
kmp_str_buf_t buf;
|
||||
__kmp_str_buf_init( &buf );
|
||||
if( __kmp_env_format ) {
|
||||
__kmp_str_buf_init(&buf);
|
||||
if(__kmp_env_format)
|
||||
KMP_STR_BUF_PRINT_NAME_EX(name);
|
||||
} else {
|
||||
__kmp_str_buf_print( buffer, " %s='", name );
|
||||
else
|
||||
__kmp_str_buf_print(buffer, " %s='", name);
|
||||
if (__kmp_place_num_sockets) {
|
||||
__kmp_str_buf_print(&buf, "%ds", __kmp_place_num_sockets);
|
||||
if (__kmp_place_socket_offset)
|
||||
__kmp_str_buf_print(&buf, "@%d", __kmp_place_socket_offset);
|
||||
comma = 1;
|
||||
}
|
||||
__kmp_str_buf_print( &buf, "%dC", __kmp_place_num_cores );
|
||||
__kmp_str_buf_print( &buf, "x%dT", __kmp_place_num_threads_per_core );
|
||||
if ( __kmp_place_core_offset ) {
|
||||
__kmp_str_buf_print( &buf, ",%dO", __kmp_place_core_offset );
|
||||
if (__kmp_place_num_cores) {
|
||||
__kmp_str_buf_print(&buf, "%s%dc", comma?",":"", __kmp_place_num_cores);
|
||||
if (__kmp_place_core_offset)
|
||||
__kmp_str_buf_print(&buf, "@%d", __kmp_place_core_offset);
|
||||
comma = 1;
|
||||
}
|
||||
if (__kmp_place_num_threads_per_core)
|
||||
__kmp_str_buf_print(&buf, "%s%dt", comma?",":"", __kmp_place_num_threads_per_core);
|
||||
__kmp_str_buf_print(buffer, "%s'\n", buf.str );
|
||||
__kmp_str_buf_free(&buf);
|
||||
/*
|
||||
@@ -4348,8 +4677,12 @@ static kmp_setting_t __kmp_stg_table[] = {
|
||||
{ "KMP_TASKING", __kmp_stg_parse_tasking, __kmp_stg_print_tasking, NULL, 0, 0 },
|
||||
{ "KMP_TASK_STEALING_CONSTRAINT", __kmp_stg_parse_task_stealing, __kmp_stg_print_task_stealing, NULL, 0, 0 },
|
||||
{ "OMP_MAX_ACTIVE_LEVELS", __kmp_stg_parse_max_active_levels, __kmp_stg_print_max_active_levels, NULL, 0, 0 },
|
||||
#if OMP_45_ENABLED
|
||||
{ "OMP_MAX_TASK_PRIORITY", __kmp_stg_parse_max_task_priority, __kmp_stg_print_max_task_priority, NULL, 0, 0 },
|
||||
#endif
|
||||
{ "OMP_THREAD_LIMIT", __kmp_stg_parse_all_threads, __kmp_stg_print_all_threads, NULL, 0, 0 },
|
||||
{ "OMP_WAIT_POLICY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy, NULL, 0, 0 },
|
||||
{ "KMP_DISP_NUM_BUFFERS", __kmp_stg_parse_disp_buffers, __kmp_stg_print_disp_buffers, NULL, 0, 0 },
|
||||
#if KMP_NESTED_HOT_TEAMS
|
||||
{ "KMP_HOT_TEAMS_MAX_LEVEL", __kmp_stg_parse_hot_teams_level, __kmp_stg_print_hot_teams_level, NULL, 0, 0 },
|
||||
{ "KMP_HOT_TEAMS_MODE", __kmp_stg_parse_hot_teams_mode, __kmp_stg_print_hot_teams_mode, NULL, 0, 0 },
|
||||
@@ -4452,17 +4785,17 @@ static kmp_setting_t __kmp_stg_table[] = {
|
||||
{ "KMP_LOAD_BALANCE_INTERVAL", __kmp_stg_parse_ld_balance_interval,__kmp_stg_print_ld_balance_interval,NULL, 0, 0 },
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
{ "KMP_NUM_LOCKS_IN_BLOCK", __kmp_stg_parse_lock_block, __kmp_stg_print_lock_block, NULL, 0, 0 },
|
||||
{ "KMP_LOCK_KIND", __kmp_stg_parse_lock_kind, __kmp_stg_print_lock_kind, NULL, 0, 0 },
|
||||
{ "KMP_SPIN_BACKOFF_PARAMS", __kmp_stg_parse_spin_backoff_params, __kmp_stg_print_spin_backoff_params, NULL, 0, 0 },
|
||||
#if KMP_USE_ADAPTIVE_LOCKS
|
||||
{ "KMP_ADAPTIVE_LOCK_PROPS", __kmp_stg_parse_adaptive_lock_props,__kmp_stg_print_adaptive_lock_props, NULL, 0, 0 },
|
||||
#if KMP_DEBUG_ADAPTIVE_LOCKS
|
||||
{ "KMP_SPECULATIVE_STATSFILE", __kmp_stg_parse_speculative_statsfile,__kmp_stg_print_speculative_statsfile, NULL, 0, 0 },
|
||||
#endif
|
||||
#endif // KMP_USE_ADAPTIVE_LOCKS
|
||||
{ "KMP_PLACE_THREADS", __kmp_stg_parse_place_threads, __kmp_stg_print_place_threads, NULL, 0, 0 },
|
||||
{ "KMP_PLACE_THREADS", __kmp_stg_parse_hw_subset, __kmp_stg_print_hw_subset, NULL, 0, 0 },
|
||||
{ "KMP_HW_SUBSET", __kmp_stg_parse_hw_subset, __kmp_stg_print_hw_subset, NULL, 0, 0 },
|
||||
#if USE_ITT_BUILD
|
||||
{ "KMP_FORKJOIN_FRAMES", __kmp_stg_parse_forkjoin_frames, __kmp_stg_print_forkjoin_frames, NULL, 0, 0 },
|
||||
{ "KMP_FORKJOIN_FRAMES_MODE", __kmp_stg_parse_forkjoin_frames_mode,__kmp_stg_print_forkjoin_frames_mode, NULL, 0, 0 },
|
||||
@@ -4838,6 +5171,9 @@ __kmp_env_initialize( char const * string ) {
|
||||
}
|
||||
}; // for i
|
||||
|
||||
// We need to know if blocktime was set when processing OMP_WAIT_POLICY
|
||||
blocktime_str = __kmp_env_blk_var( & block, "KMP_BLOCKTIME" );
|
||||
|
||||
// Special case. If we parse environment, not a string, process KMP_WARNINGS first.
|
||||
if ( string == NULL ) {
|
||||
char const * name = "KMP_WARNINGS";
|
||||
@@ -4977,11 +5313,44 @@ __kmp_env_initialize( char const * string ) {
|
||||
// affinity.
|
||||
//
|
||||
const char *var = "KMP_AFFINITY";
|
||||
# if KMP_USE_HWLOC
|
||||
if(__kmp_hwloc_topology == NULL) {
|
||||
if(hwloc_topology_init(&__kmp_hwloc_topology) < 0) {
|
||||
__kmp_hwloc_error = TRUE;
|
||||
if(__kmp_affinity_verbose)
|
||||
KMP_WARNING(AffHwlocErrorOccurred, var, "hwloc_topology_init()");
|
||||
}
|
||||
if(hwloc_topology_load(__kmp_hwloc_topology) < 0) {
|
||||
__kmp_hwloc_error = TRUE;
|
||||
if(__kmp_affinity_verbose)
|
||||
KMP_WARNING(AffHwlocErrorOccurred, var, "hwloc_topology_load()");
|
||||
}
|
||||
}
|
||||
# endif
|
||||
if ( __kmp_affinity_type == affinity_disabled ) {
|
||||
KMP_AFFINITY_DISABLE();
|
||||
}
|
||||
else if ( ! KMP_AFFINITY_CAPABLE() ) {
|
||||
# if KMP_USE_HWLOC
|
||||
const hwloc_topology_support* topology_support = hwloc_topology_get_support(__kmp_hwloc_topology);
|
||||
// Is the system capable of setting/getting this thread's affinity?
|
||||
// also, is topology discovery possible? (pu indicates ability to discover processing units)
|
||||
// and finally, were there no errors when calling any hwloc_* API functions?
|
||||
if(topology_support && topology_support->cpubind->set_thisthread_cpubind &&
|
||||
topology_support->cpubind->get_thisthread_cpubind &&
|
||||
topology_support->discovery->pu &&
|
||||
!__kmp_hwloc_error)
|
||||
{
|
||||
// enables affinity according to KMP_AFFINITY_CAPABLE() macro
|
||||
KMP_AFFINITY_ENABLE(TRUE);
|
||||
} else {
|
||||
// indicate that hwloc didn't work and disable affinity
|
||||
__kmp_hwloc_error = TRUE;
|
||||
KMP_AFFINITY_DISABLE();
|
||||
}
|
||||
# else
|
||||
__kmp_affinity_determine_capable( var );
|
||||
# endif // KMP_USE_HWLOC
|
||||
if ( ! KMP_AFFINITY_CAPABLE() ) {
|
||||
if ( __kmp_affinity_verbose || ( __kmp_affinity_warnings
|
||||
&& ( __kmp_affinity_type != affinity_default )
|
||||
@@ -5050,7 +5419,7 @@ __kmp_env_initialize( char const * string ) {
|
||||
else if ( ( __kmp_affinity_gran != affinity_gran_group )
|
||||
&& ( __kmp_affinity_gran != affinity_gran_fine )
|
||||
&& ( __kmp_affinity_gran != affinity_gran_thread ) ) {
|
||||
char *str = NULL;
|
||||
const char *str = NULL;
|
||||
switch ( __kmp_affinity_gran ) {
|
||||
case affinity_gran_core: str = "core"; break;
|
||||
case affinity_gran_package: str = "package"; break;
|
||||
@@ -5066,7 +5435,7 @@ __kmp_env_initialize( char const * string ) {
|
||||
__kmp_affinity_gran = affinity_gran_core;
|
||||
}
|
||||
else if ( __kmp_affinity_gran == affinity_gran_group ) {
|
||||
char *str = NULL;
|
||||
const char *str = NULL;
|
||||
switch ( __kmp_affinity_type ) {
|
||||
case affinity_physical: str = "physical"; break;
|
||||
case affinity_logical: str = "logical"; break;
|
||||
@@ -5263,7 +5632,5 @@ __kmp_env_print_2() {
|
||||
} // __kmp_env_print_2
|
||||
#endif // OMP_40_ENABLED
|
||||
|
||||
|
||||
|
||||
// end of file
|
||||
|
||||
|
||||
+210
-116
@@ -12,9 +12,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#if KMP_STATS_ENABLED
|
||||
|
||||
#include "kmp.h"
|
||||
#include "kmp_str.h"
|
||||
#include "kmp_lock.h"
|
||||
@@ -24,6 +21,7 @@
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <stdlib.h> // for atexit
|
||||
#include <ctime>
|
||||
|
||||
#define STRINGIZE2(x) #x
|
||||
#define STRINGIZE(x) STRINGIZE2(x)
|
||||
@@ -50,7 +48,7 @@ const kmp_stats_output_module::rgb_color kmp_stats_output_module::globalColorArr
|
||||
{1.0, 0.0, 0.0}, // red
|
||||
{1.0, 0.6, 0.0}, // orange
|
||||
{1.0, 1.0, 0.0}, // yellow
|
||||
{0.0, 1.0, 0.0}, // green
|
||||
{0.0, 1.0, 0.0}, // green
|
||||
{0.0, 0.0, 1.0}, // blue
|
||||
{0.6, 0.2, 0.8}, // purple
|
||||
{1.0, 0.0, 1.0}, // magenta
|
||||
@@ -133,21 +131,33 @@ std::string statistic::format(char unit, bool total) const
|
||||
{
|
||||
std::string result = formatSI(sampleCount,9,' ');
|
||||
|
||||
result = result + std::string(", ") + formatSI(minVal, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(meanVal, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(maxVal, 9, unit);
|
||||
if (total)
|
||||
result = result + std::string(", ") + formatSI(meanVal*sampleCount, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(getSD(), 9, unit);
|
||||
|
||||
if (sampleCount == 0)
|
||||
{
|
||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||
if (total)
|
||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = result + std::string(", ") + formatSI(minVal, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(meanVal, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(maxVal, 9, unit);
|
||||
if (total)
|
||||
result = result + std::string(", ") + formatSI(meanVal*sampleCount, 9, unit);
|
||||
result = result + std::string(", ") + formatSI(getSD(), 9, unit);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
/* ************* explicitTimer member functions ************* */
|
||||
|
||||
void explicitTimer::start(timer_e timerEnumValue) {
|
||||
startTime = tsc_tick_count::now();
|
||||
void explicitTimer::start(timer_e timerEnumValue) {
|
||||
startTime = tsc_tick_count::now();
|
||||
totalPauseTime = 0;
|
||||
if(timeStat::logEvent(timerEnumValue)) {
|
||||
__kmp_stats_thread_ptr->incrementNestValue();
|
||||
}
|
||||
@@ -161,18 +171,86 @@ void explicitTimer::stop(timer_e timerEnumValue) {
|
||||
tsc_tick_count finishTime = tsc_tick_count::now();
|
||||
|
||||
//stat->addSample ((tsc_tick_count::now() - startTime).ticks());
|
||||
stat->addSample ((finishTime - startTime).ticks());
|
||||
stat->addSample(((finishTime - startTime) - totalPauseTime).ticks());
|
||||
|
||||
if(timeStat::logEvent(timerEnumValue)) {
|
||||
__kmp_stats_thread_ptr->push_event(startTime.getValue() - __kmp_stats_start_time.getValue(), finishTime.getValue() - __kmp_stats_start_time.getValue(), __kmp_stats_thread_ptr->getNestValue(), timerEnumValue);
|
||||
__kmp_stats_thread_ptr->push_event(startTime.getValue() - __kmp_stats_start_time.getValue(), finishTime.getValue() - __kmp_stats_start_time.getValue(), __kmp_stats_thread_ptr->getNestValue(), timerEnumValue);
|
||||
__kmp_stats_thread_ptr->decrementNestValue();
|
||||
}
|
||||
|
||||
/* We accept the risk that we drop a sample because it really did start at t==0. */
|
||||
startTime = 0;
|
||||
startTime = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ************************************************************** */
|
||||
/* ************* partitionedTimers member functions ************* */
|
||||
partitionedTimers::partitionedTimers() {
|
||||
timer_stack.reserve(8);
|
||||
}
|
||||
|
||||
// add a timer to this collection of partitioned timers.
|
||||
void partitionedTimers::add_timer(explicit_timer_e timer_index, explicitTimer* timer_pointer) {
|
||||
KMP_DEBUG_ASSERT((int)timer_index < (int)EXPLICIT_TIMER_LAST+1);
|
||||
timers[timer_index] = timer_pointer;
|
||||
}
|
||||
|
||||
// initialize the paritioned timers to an initial timer
|
||||
void partitionedTimers::init(timerPair init_timer_pair) {
|
||||
KMP_DEBUG_ASSERT(this->timer_stack.size() == 0);
|
||||
timer_stack.push_back(init_timer_pair);
|
||||
timers[init_timer_pair.get_index()]->start(init_timer_pair.get_timer());
|
||||
}
|
||||
|
||||
// stop/save the current timer, and start the new timer (timer_pair)
|
||||
// There is a special condition where if the current timer is equal to
|
||||
// the one you are trying to push, then it only manipulates the stack,
|
||||
// and it won't stop/start the currently running timer.
|
||||
void partitionedTimers::push(timerPair timer_pair) {
|
||||
// get the current timer
|
||||
// stop current timer
|
||||
// push new timer
|
||||
// start the new timer
|
||||
KMP_DEBUG_ASSERT(this->timer_stack.size() > 0);
|
||||
timerPair current_timer = timer_stack.back();
|
||||
timer_stack.push_back(timer_pair);
|
||||
if(current_timer != timer_pair) {
|
||||
timers[current_timer.get_index()]->pause();
|
||||
timers[timer_pair.get_index()]->start(timer_pair.get_timer());
|
||||
}
|
||||
}
|
||||
|
||||
// stop/discard the current timer, and start the previously saved timer
|
||||
void partitionedTimers::pop() {
|
||||
// get the current timer
|
||||
// stop current timer
|
||||
// pop current timer
|
||||
// get the new current timer and start it back up
|
||||
KMP_DEBUG_ASSERT(this->timer_stack.size() > 1);
|
||||
timerPair current_timer = timer_stack.back();
|
||||
timer_stack.pop_back();
|
||||
timerPair new_timer = timer_stack.back();
|
||||
if(current_timer != new_timer) {
|
||||
timers[current_timer.get_index()]->stop(current_timer.get_timer());
|
||||
timers[new_timer.get_index()]->resume();
|
||||
}
|
||||
}
|
||||
|
||||
// Wind up all the currently running timers.
|
||||
// This pops off all the timers from the stack and clears the stack
|
||||
// After this is called, init() must be run again to initialize the
|
||||
// stack of timers
|
||||
void partitionedTimers::windup() {
|
||||
while(timer_stack.size() > 1) {
|
||||
this->pop();
|
||||
}
|
||||
if(timer_stack.size() > 0) {
|
||||
timerPair last_timer = timer_stack.back();
|
||||
timer_stack.pop_back();
|
||||
timers[last_timer.get_index()]->stop(last_timer.get_timer());
|
||||
}
|
||||
}
|
||||
|
||||
/* ******************************************************************* */
|
||||
/* ************* kmp_stats_event_vector member functions ************* */
|
||||
|
||||
@@ -185,7 +263,7 @@ void kmp_stats_event_vector::deallocate() {
|
||||
|
||||
// This function is for qsort() which requires the compare function to return
|
||||
// either a negative number if event1 < event2, a positive number if event1 > event2
|
||||
// or zero if event1 == event2.
|
||||
// or zero if event1 == event2.
|
||||
// This sorts by start time (lowest to highest).
|
||||
int compare_two_events(const void* event1, const void* event2) {
|
||||
kmp_stats_event* ev1 = (kmp_stats_event*)event1;
|
||||
@@ -204,7 +282,7 @@ void kmp_stats_event_vector::sort() {
|
||||
/* ************* kmp_stats_list member functions ************* */
|
||||
|
||||
// returns a pointer to newly created stats node
|
||||
kmp_stats_list* kmp_stats_list::push_back(int gtid) {
|
||||
kmp_stats_list* kmp_stats_list::push_back(int gtid) {
|
||||
kmp_stats_list* newnode = (kmp_stats_list*)__kmp_allocate(sizeof(kmp_stats_list));
|
||||
// placement new, only requires space and pointer and initializes (so __kmp_allocate instead of C++ new[] is used)
|
||||
new (newnode) kmp_stats_list();
|
||||
@@ -247,7 +325,7 @@ int kmp_stats_list::size() {
|
||||
/* ********************************************************************* */
|
||||
/* ************* kmp_stats_list::iterator member functions ************* */
|
||||
|
||||
kmp_stats_list::iterator::iterator() : ptr(NULL) {}
|
||||
kmp_stats_list::iterator::iterator() : ptr(NULL) {}
|
||||
kmp_stats_list::iterator::~iterator() {}
|
||||
kmp_stats_list::iterator kmp_stats_list::iterator::operator++() {
|
||||
this->ptr = this->ptr->next;
|
||||
@@ -266,10 +344,10 @@ kmp_stats_list::iterator kmp_stats_list::iterator::operator--(int dummy) {
|
||||
return *this;
|
||||
}
|
||||
bool kmp_stats_list::iterator::operator!=(const kmp_stats_list::iterator & rhs) {
|
||||
return this->ptr!=rhs.ptr;
|
||||
return this->ptr!=rhs.ptr;
|
||||
}
|
||||
bool kmp_stats_list::iterator::operator==(const kmp_stats_list::iterator & rhs) {
|
||||
return this->ptr==rhs.ptr;
|
||||
return this->ptr==rhs.ptr;
|
||||
}
|
||||
kmp_stats_list* kmp_stats_list::iterator::operator*() const {
|
||||
return this->ptr;
|
||||
@@ -278,14 +356,13 @@ kmp_stats_list* kmp_stats_list::iterator::operator*() const {
|
||||
/* *************************************************************** */
|
||||
/* ************* kmp_stats_output_module functions ************** */
|
||||
|
||||
const char* kmp_stats_output_module::outputFileName = NULL;
|
||||
const char* kmp_stats_output_module::eventsFileName = NULL;
|
||||
const char* kmp_stats_output_module::plotFileName = NULL;
|
||||
int kmp_stats_output_module::printPerThreadFlag = 0;
|
||||
int kmp_stats_output_module::printPerThreadEventsFlag = 0;
|
||||
|
||||
// init() is called very near the beginning of execution time in the constructor of __kmp_stats_global_output
|
||||
void kmp_stats_output_module::init()
|
||||
void kmp_stats_output_module::init()
|
||||
{
|
||||
char * statsFileName = getenv("KMP_STATS_FILE");
|
||||
eventsFileName = getenv("KMP_STATS_EVENTS_FILE");
|
||||
@@ -294,7 +371,24 @@ void kmp_stats_output_module::init()
|
||||
char * threadEvents = getenv("KMP_STATS_EVENTS");
|
||||
|
||||
// set the stats output filenames based on environment variables and defaults
|
||||
outputFileName = statsFileName;
|
||||
if(statsFileName) {
|
||||
// append the process id to the output filename
|
||||
// events.csv --> events-pid.csv
|
||||
size_t index;
|
||||
std::string baseFileName, pid, suffix;
|
||||
std::stringstream ss;
|
||||
outputFileName = std::string(statsFileName);
|
||||
index = outputFileName.find_last_of('.');
|
||||
if(index == std::string::npos) {
|
||||
baseFileName = outputFileName;
|
||||
} else {
|
||||
baseFileName = outputFileName.substr(0, index);
|
||||
suffix = outputFileName.substr(index);
|
||||
}
|
||||
ss << getpid();
|
||||
pid = ss.str();
|
||||
outputFileName = baseFileName + "-" + pid + suffix;
|
||||
}
|
||||
eventsFileName = eventsFileName ? eventsFileName : "events.dat";
|
||||
plotFileName = plotFileName ? plotFileName : "events.plt";
|
||||
|
||||
@@ -326,43 +420,31 @@ void kmp_stats_output_module::setupEventColors() {
|
||||
return;
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::printStats(FILE *statsOut, statistic const * theStats, bool areTimers)
|
||||
void kmp_stats_output_module::printTimerStats(FILE *statsOut, statistic const * theStats, statistic const * totalStats)
|
||||
{
|
||||
if (areTimers)
|
||||
{
|
||||
// Check if we have useful timers, since we don't print zero value timers we need to avoid
|
||||
// printing a header and then no data.
|
||||
bool haveTimers = false;
|
||||
for (int s = 0; s<TIMER_LAST; s++)
|
||||
{
|
||||
if (theStats[s].getCount() != 0)
|
||||
{
|
||||
haveTimers = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!haveTimers)
|
||||
return;
|
||||
}
|
||||
fprintf (statsOut, "Timer, SampleCount, Min, Mean, Max, Total, SD\n");
|
||||
for (timer_e s = timer_e(0); s<TIMER_LAST; s = timer_e(s+1)) {
|
||||
statistic const * stat = &theStats[s];
|
||||
char tag = timeStat::noUnits(s) ? ' ' : 'T';
|
||||
|
||||
// Print
|
||||
const char * title = areTimers ? "Timer, SampleCount," : "Counter, ThreadCount,";
|
||||
fprintf (statsOut, "%s Min, Mean, Max, Total, SD\n", title);
|
||||
if (areTimers) {
|
||||
for (int s = 0; s<TIMER_LAST; s++) {
|
||||
statistic const * stat = &theStats[s];
|
||||
if (stat->getCount() != 0) {
|
||||
char tag = timeStat::noUnits(timer_e(s)) ? ' ' : 'T';
|
||||
fprintf (statsOut, "%-25s, %s\n", timeStat::name(timer_e(s)), stat->format(tag, true).c_str());
|
||||
}
|
||||
}
|
||||
} else { // Counters
|
||||
for (int s = 0; s<COUNTER_LAST; s++) {
|
||||
statistic const * stat = &theStats[s];
|
||||
fprintf (statsOut, "%-25s, %s\n", counter::name(counter_e(s)), stat->format(' ', true).c_str());
|
||||
}
|
||||
fprintf (statsOut, "%-28s, %s\n", timeStat::name(s), stat->format(tag, true).c_str());
|
||||
}
|
||||
}
|
||||
// Also print the Total_ versions of times.
|
||||
for (timer_e s = timer_e(0); s<TIMER_LAST; s = timer_e(s+1)) {
|
||||
char tag = timeStat::noUnits(s) ? ' ' : 'T';
|
||||
if (totalStats && !timeStat::noTotal(s))
|
||||
fprintf(statsOut, "Total_%-22s, %s\n", timeStat::name(s), totalStats[s].format(tag, true).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::printCounterStats(FILE *statsOut, statistic const * theStats)
|
||||
{
|
||||
fprintf (statsOut, "Counter, ThreadCount, Min, Mean, Max, Total, SD\n");
|
||||
for (int s = 0; s<COUNTER_LAST; s++) {
|
||||
statistic const * stat = &theStats[s];
|
||||
fprintf (statsOut, "%-25s, %s\n", counter::name(counter_e(s)), stat->format(' ', true).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::printCounters(FILE * statsOut, counter const * theCounters)
|
||||
{
|
||||
@@ -381,10 +463,10 @@ void kmp_stats_output_module::printEvents(FILE* eventsOut, kmp_stats_event_vecto
|
||||
for (int i = 0; i < theEvents->size(); i++) {
|
||||
kmp_stats_event ev = theEvents->at(i);
|
||||
rgb_color color = getEventColor(ev.getTimerName());
|
||||
fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n",
|
||||
gtid,
|
||||
ev.getStart(),
|
||||
ev.getStop(),
|
||||
fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n",
|
||||
gtid,
|
||||
ev.getStart(),
|
||||
ev.getStop(),
|
||||
1.2 - (ev.getNestLevel() * 0.2),
|
||||
color.r, color.g, color.b,
|
||||
timeStat::name(ev.getTimerName())
|
||||
@@ -395,13 +477,15 @@ void kmp_stats_output_module::printEvents(FILE* eventsOut, kmp_stats_event_vecto
|
||||
|
||||
void kmp_stats_output_module::windupExplicitTimers()
|
||||
{
|
||||
// Wind up any explicit timers. We assume that it's fair at this point to just walk all the explcit timers in all threads
|
||||
// Wind up any explicit timers. We assume that it's fair at this point to just walk all the explcit timers in all threads
|
||||
// and say "it's over".
|
||||
// If the timer wasn't running, this won't record anything anyway.
|
||||
kmp_stats_list::iterator it;
|
||||
for(it = __kmp_stats_list.begin(); it != __kmp_stats_list.end(); it++) {
|
||||
kmp_stats_list* ptr = *it;
|
||||
ptr->getPartitionedTimers()->windup();
|
||||
for (int timer=0; timer<EXPLICIT_TIMER_LAST; timer++) {
|
||||
(*it)->getExplicitTimer(explicit_timer_e(timer))->stop((timer_e)timer);
|
||||
ptr->getExplicitTimer(explicit_timer_e(timer))->stop((timer_e)timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -416,7 +500,7 @@ void kmp_stats_output_module::printPloticusFile() {
|
||||
" scale: 1.0\n\n");
|
||||
|
||||
fprintf(plotOut, "#proc getdata\n"
|
||||
" file: %s\n\n",
|
||||
" file: %s\n\n",
|
||||
eventsFileName);
|
||||
|
||||
fprintf(plotOut, "#proc areadef\n"
|
||||
@@ -424,7 +508,7 @@ void kmp_stats_output_module::printPloticusFile() {
|
||||
" titledetails: align=center size=16\n"
|
||||
" rectangle: 1 1 13 9\n"
|
||||
" xautorange: datafield=2,3\n"
|
||||
" yautorange: -1 %d\n\n",
|
||||
" yautorange: -1 %d\n\n",
|
||||
size);
|
||||
|
||||
fprintf(plotOut, "#proc xaxis\n"
|
||||
@@ -438,7 +522,7 @@ void kmp_stats_output_module::printPloticusFile() {
|
||||
" stubrange: 0 %d\n"
|
||||
" stubdetails: size=12\n"
|
||||
" label: Thread #\n"
|
||||
" labeldetails: size=14\n\n",
|
||||
" labeldetails: size=14\n\n",
|
||||
size-1);
|
||||
|
||||
fprintf(plotOut, "#proc bars\n"
|
||||
@@ -469,35 +553,63 @@ void kmp_stats_output_module::printPloticusFile() {
|
||||
return;
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::outputStats(const char* heading)
|
||||
/*
|
||||
* Print some useful information about
|
||||
* * the date and time this experiment ran.
|
||||
* * the machine on which it ran.
|
||||
* We output all of this as stylised comments, though we may decide to parse some of it.
|
||||
*/
|
||||
void kmp_stats_output_module::printHeaderInfo(FILE * statsOut)
|
||||
{
|
||||
statistic allStats[TIMER_LAST];
|
||||
statistic allCounters[COUNTER_LAST];
|
||||
std::time_t now = std::time(0);
|
||||
char buffer[40];
|
||||
char hostName[80];
|
||||
|
||||
// stop all the explicit timers for all threads
|
||||
std::strftime(&buffer[0], sizeof(buffer), "%c", std::localtime(&now));
|
||||
fprintf (statsOut, "# Time of run: %s\n", &buffer[0]);
|
||||
if (gethostname(&hostName[0], sizeof(hostName)) == 0)
|
||||
fprintf (statsOut,"# Hostname: %s\n", &hostName[0]);
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
fprintf (statsOut, "# CPU: %s\n", &__kmp_cpuinfo.name[0]);
|
||||
fprintf (statsOut, "# Family: %d, Model: %d, Stepping: %d\n", __kmp_cpuinfo.family, __kmp_cpuinfo.model, __kmp_cpuinfo.stepping);
|
||||
if (__kmp_cpuinfo.frequency == 0)
|
||||
fprintf (statsOut, "# Nominal frequency: Unknown\n");
|
||||
else
|
||||
fprintf (statsOut, "# Nominal frequency: %sz\n", formatSI(double(__kmp_cpuinfo.frequency),9,'H').c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::outputStats(const char* heading)
|
||||
{
|
||||
// Stop all the explicit timers in all threads
|
||||
// Do this before declaring the local statistics because thay have constructors so will take time to create.
|
||||
windupExplicitTimers();
|
||||
|
||||
FILE * eventsOut;
|
||||
FILE * statsOut = outputFileName ? fopen (outputFileName, "a+") : stderr;
|
||||
statistic allStats[TIMER_LAST];
|
||||
statistic totalStats[TIMER_LAST]; /* Synthesized, cross threads versions of normal timer stats */
|
||||
statistic allCounters[COUNTER_LAST];
|
||||
|
||||
FILE * statsOut = !outputFileName.empty() ? fopen (outputFileName.c_str(), "a+") : stderr;
|
||||
if (!statsOut)
|
||||
statsOut = stderr;
|
||||
|
||||
FILE * eventsOut;
|
||||
if (eventPrintingEnabled()) {
|
||||
eventsOut = fopen(eventsFileName, "w+");
|
||||
}
|
||||
|
||||
if (!statsOut)
|
||||
statsOut = stderr;
|
||||
|
||||
printHeaderInfo (statsOut);
|
||||
fprintf(statsOut, "%s\n",heading);
|
||||
// Accumulate across threads.
|
||||
kmp_stats_list::iterator it;
|
||||
for (it = __kmp_stats_list.begin(); it != __kmp_stats_list.end(); it++) {
|
||||
int t = (*it)->getGtid();
|
||||
// Output per thread stats if requested.
|
||||
if (perThreadPrintingEnabled()) {
|
||||
if (printPerThreadFlag) {
|
||||
fprintf (statsOut, "Thread %d\n", t);
|
||||
printStats(statsOut, (*it)->getTimers(), true);
|
||||
printCounters(statsOut, (*it)->getCounters());
|
||||
fprintf(statsOut,"\n");
|
||||
printTimerStats (statsOut, (*it)->getTimers(), 0);
|
||||
printCounters (statsOut, (*it)->getCounters());
|
||||
fprintf (statsOut,"\n");
|
||||
}
|
||||
// Output per thread events if requested.
|
||||
if (eventPrintingEnabled()) {
|
||||
@@ -505,39 +617,29 @@ void kmp_stats_output_module::outputStats(const char* heading)
|
||||
printEvents(eventsOut, &events, t);
|
||||
}
|
||||
|
||||
for (int s = 0; s<TIMER_LAST; s++) {
|
||||
// Accumulate timers.
|
||||
for (timer_e s = timer_e(0); s<TIMER_LAST; s = timer_e(s+1)) {
|
||||
// See if we should ignore this timer when aggregating
|
||||
if ((timeStat::masterOnly(timer_e(s)) && (t != 0)) || // Timer is only valid on the master and this thread is a worker
|
||||
(timeStat::workerOnly(timer_e(s)) && (t == 0)) || // Timer is only valid on a worker and this thread is the master
|
||||
timeStat::synthesized(timer_e(s)) // It's a synthesized stat, so there's no raw data for it.
|
||||
)
|
||||
if ((timeStat::masterOnly(s) && (t != 0)) || // Timer is only valid on the master and this thread is a worker
|
||||
(timeStat::workerOnly(s) && (t == 0)) // Timer is only valid on a worker and this thread is the master
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
statistic * threadStat = (*it)->getTimer(timer_e(s));
|
||||
statistic * threadStat = (*it)->getTimer(s);
|
||||
allStats[s] += *threadStat;
|
||||
|
||||
// Add Total stats for timers that are valid in more than one thread
|
||||
if (!timeStat::noTotal(s))
|
||||
totalStats[s].addSample(threadStat->getTotal());
|
||||
}
|
||||
|
||||
// Special handling for synthesized statistics.
|
||||
// These just have to be coded specially here for now.
|
||||
// At present we only have one: the total parallel work done in each thread.
|
||||
// The variance here makes it easy to see load imbalance over the whole program (though, of course,
|
||||
// it's possible to have a code with awful load balance in every parallel region but perfect load
|
||||
// balance oever the whole program.)
|
||||
allStats[TIMER_Total_work].addSample ((*it)->getTimer(TIMER_OMP_work)->getTotal());
|
||||
|
||||
// Time waiting for work (synthesized)
|
||||
if ((t != 0) || !timeStat::workerOnly(timer_e(TIMER_OMP_await_work)))
|
||||
allStats[TIMER_Total_await_work].addSample ((*it)->getTimer(TIMER_OMP_await_work)->getTotal());
|
||||
|
||||
// Time in explicit barriers.
|
||||
allStats[TIMER_Total_barrier].addSample ((*it)->getTimer(TIMER_OMP_barrier)->getTotal());
|
||||
|
||||
for (int c = 0; c<COUNTER_LAST; c++) {
|
||||
if (counter::masterOnly(counter_e(c)) && t != 0)
|
||||
// Accumulate counters.
|
||||
for (counter_e c = counter_e(0); c<COUNTER_LAST; c = counter_e(c+1)) {
|
||||
if (counter::masterOnly(c) && t != 0)
|
||||
continue;
|
||||
allCounters[c].addSample ((*it)->getCounter(counter_e(c))->getValue());
|
||||
allCounters[c].addSample ((*it)->getCounter(c)->getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,13 +649,12 @@ void kmp_stats_output_module::outputStats(const char* heading)
|
||||
}
|
||||
|
||||
fprintf (statsOut, "Aggregate for all threads\n");
|
||||
printStats (statsOut, &allStats[0], true);
|
||||
printTimerStats (statsOut, &allStats[0], &totalStats[0]);
|
||||
fprintf (statsOut, "\n");
|
||||
printStats (statsOut, &allCounters[0], false);
|
||||
printCounterStats (statsOut, &allCounters[0]);
|
||||
|
||||
if (statsOut != stderr)
|
||||
fclose(statsOut);
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************** */
|
||||
@@ -581,11 +682,7 @@ void __kmp_reset_stats()
|
||||
|
||||
// reset the event vector so all previous events are "erased"
|
||||
(*it)->resetEventVector();
|
||||
|
||||
// May need to restart the explicit timers in thread zero?
|
||||
}
|
||||
KMP_START_EXPLICIT_TIMER(OMP_serial);
|
||||
KMP_START_EXPLICIT_TIMER(OMP_start_end);
|
||||
}
|
||||
|
||||
// This function will reset all stats and stop all threads' explicit timers if they haven't been stopped already.
|
||||
@@ -602,14 +699,11 @@ void __kmp_accumulate_stats_at_exit(void)
|
||||
return;
|
||||
|
||||
__kmp_output_stats("Statistics on exit");
|
||||
return;
|
||||
}
|
||||
|
||||
void __kmp_stats_init(void)
|
||||
void __kmp_stats_init(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
} // extern "C"
|
||||
|
||||
#endif // KMP_STATS_ENABLED
|
||||
|
||||
+293
-95
@@ -15,6 +15,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "kmp_config.h"
|
||||
|
||||
#if KMP_STATS_ENABLED
|
||||
/*
|
||||
@@ -26,24 +27,46 @@
|
||||
|
||||
#include <limits>
|
||||
#include <math.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include <new> // placement new
|
||||
#include "kmp_stats_timing.h"
|
||||
|
||||
/*
|
||||
* Enable developer statistics here if you want them. They are more detailed than is useful for application characterisation and
|
||||
* are intended for the runtime library developer.
|
||||
*/
|
||||
// #define KMP_DEVELOPER_STATS 1
|
||||
|
||||
/*!
|
||||
* @ingroup STATS_GATHERING
|
||||
* \brief flags to describe the statistic ( timers or counter )
|
||||
* \brief flags to describe the statistic (timer or counter)
|
||||
*
|
||||
*/
|
||||
class stats_flags_e {
|
||||
public:
|
||||
const static int onlyInMaster = 1<<0; //!< statistic is valid only for master
|
||||
const static int noUnits = 1<<1; //!< statistic doesn't need units printed next to it in output
|
||||
const static int synthesized = 1<<2; //!< statistic's value is created atexit time in the __kmp_output_stats function
|
||||
const static int notInMaster = 1<<3; //!< statistic is valid for non-master threads
|
||||
const static int logEvent = 1<<4; //!< statistic can be logged when KMP_STATS_EVENTS is on (valid only for timers)
|
||||
*/
|
||||
enum stats_flags_e {
|
||||
noTotal = 1<<0, //!< do not show a TOTAL_aggregation for this statistic
|
||||
onlyInMaster = 1<<1, //!< statistic is valid only for master
|
||||
noUnits = 1<<2, //!< statistic doesn't need units printed next to it in output
|
||||
notInMaster = 1<<3, //!< statistic is valid only for non-master threads
|
||||
logEvent = 1<<4 //!< statistic can be logged on the event timeline when KMP_STATS_EVENTS is on (valid only for timers)
|
||||
};
|
||||
|
||||
/*!
|
||||
* @ingroup STATS_GATHERING
|
||||
* \brief the states which a thread can be in
|
||||
*
|
||||
*/
|
||||
enum stats_state_e {
|
||||
IDLE,
|
||||
SERIAL_REGION,
|
||||
FORK_JOIN_BARRIER,
|
||||
PLAIN_BARRIER,
|
||||
TASKWAIT,
|
||||
TASKYIELD,
|
||||
TASKGROUP,
|
||||
IMPLICIT_TASK,
|
||||
EXPLICIT_TASK
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -56,27 +79,32 @@ class stats_flags_e {
|
||||
* Each thread accumulates its own count, at the end of execution the counts are aggregated treating each thread
|
||||
* as a separate measurement. (Unless onlyInMaster is set, in which case there's only a single measurement).
|
||||
* The min,mean,max are therefore the values for the threads.
|
||||
* Adding the counter here and then putting in a KMP_BLOCK_COUNTER(name) is all you need to do.
|
||||
* Adding the counter here and then putting a KMP_BLOCK_COUNTER(name) at the point you want to count is all you need to do.
|
||||
* All of the tables and printing is generated from this macro.
|
||||
* Format is "macro(name, flags, arg)"
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
*/
|
||||
#define KMP_FOREACH_COUNTER(macro, arg) \
|
||||
macro (OMP_PARALLEL, stats_flags_e::onlyInMaster, arg) \
|
||||
macro (OMP_PARALLEL, stats_flags_e::onlyInMaster | stats_flags_e::noTotal, arg) \
|
||||
macro (OMP_NESTED_PARALLEL, 0, arg) \
|
||||
macro (OMP_FOR_static, 0, arg) \
|
||||
macro (OMP_FOR_dynamic, 0, arg) \
|
||||
macro (OMP_DISTR_FOR_static, 0, arg) \
|
||||
macro (OMP_DISTR_FOR_dynamic, 0, arg) \
|
||||
macro (OMP_DISTRIBUTE, 0, arg) \
|
||||
macro (OMP_BARRIER, 0, arg) \
|
||||
macro (OMP_CRITICAL,0, arg) \
|
||||
macro (OMP_SINGLE, 0, arg) \
|
||||
macro (OMP_MASTER, 0, arg) \
|
||||
macro (OMP_TEAMS, 0, arg) \
|
||||
macro (OMP_set_lock, 0, arg) \
|
||||
macro (OMP_test_lock, 0, arg) \
|
||||
macro (OMP_test_lock_failure, 0, arg) \
|
||||
macro (REDUCE_wait, 0, arg) \
|
||||
macro (REDUCE_nowait, 0, arg) \
|
||||
macro (OMP_TASKYIELD, 0, arg) \
|
||||
macro (OMP_TASKLOOP, 0, arg) \
|
||||
macro (TASK_executed, 0, arg) \
|
||||
macro (TASK_cancelled, 0, arg) \
|
||||
macro (TASK_stolen, 0, arg) \
|
||||
macro (LAST,0,arg)
|
||||
|
||||
/*!
|
||||
@@ -85,74 +113,71 @@ class stats_flags_e {
|
||||
* @param macro a user defined macro that takes three arguments - macro(TIMER_NAME, flags, arg)
|
||||
* @param arg a user defined argument to send to the user defined macro
|
||||
*
|
||||
* \details A timer collects multiple samples of some count in each thread and then finally aggregates over all the threads.
|
||||
* \details A timer collects multiple samples of some count in each thread and then finally aggregates alll of the samples from all of the threads.
|
||||
* For most timers the printing code also provides an aggregation over the thread totals. These are printed as TOTAL_foo.
|
||||
* The count is normally a time (in ticks), hence the name "timer". (But can be any value, so we use this for "number of arguments passed to fork"
|
||||
* as well, or we could collect "loop iteration count" if we wanted to).
|
||||
* as well).
|
||||
* For timers the threads are not significant, it's the individual observations that count, so the statistics are at that level.
|
||||
* Format is "macro(name, flags, arg)"
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
* @ingroup STATS_GATHERING2
|
||||
*/
|
||||
#define KMP_FOREACH_TIMER(macro, arg) \
|
||||
macro (OMP_PARALLEL_args, stats_flags_e::onlyInMaster | stats_flags_e::noUnits, arg) \
|
||||
macro (FOR_static_iterations, stats_flags_e::onlyInMaster | stats_flags_e::noUnits, arg) \
|
||||
macro (FOR_dynamic_iterations, stats_flags_e::noUnits, arg) \
|
||||
macro (OMP_start_end, stats_flags_e::onlyInMaster, arg) \
|
||||
macro (OMP_serial, stats_flags_e::onlyInMaster, arg) \
|
||||
macro (OMP_work, 0, arg) \
|
||||
macro (Total_work, stats_flags_e::synthesized, arg) \
|
||||
macro (OMP_await_work, stats_flags_e::notInMaster, arg) \
|
||||
macro (Total_await_work, stats_flags_e::synthesized, arg) \
|
||||
macro (OMP_barrier, 0, arg) \
|
||||
macro (Total_barrier, stats_flags_e::synthesized, arg) \
|
||||
macro (OMP_test_lock, 0, arg) \
|
||||
macro (FOR_static_scheduling, 0, arg) \
|
||||
macro (FOR_dynamic_scheduling, 0, arg) \
|
||||
macro (KMP_fork_call, 0, arg) \
|
||||
macro (KMP_join_call, 0, arg) \
|
||||
macro (KMP_fork_barrier, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_join_barrier, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_barrier, 0, arg) \
|
||||
macro (KMP_end_split_barrier, 0, arg) \
|
||||
macro (KMP_wait_sleep, 0, arg) \
|
||||
macro (KMP_release, 0, arg) \
|
||||
macro (KMP_hier_gather, 0, arg) \
|
||||
macro (KMP_hier_release, 0, arg) \
|
||||
macro (KMP_hyper_gather, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_hyper_release, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_linear_gather, 0, arg) \
|
||||
macro (KMP_linear_release, 0, arg) \
|
||||
macro (KMP_tree_gather, 0, arg) \
|
||||
macro (KMP_tree_release, 0, arg) \
|
||||
macro (USER_master_invoke, stats_flags_e::logEvent, arg) \
|
||||
macro (USER_worker_invoke, stats_flags_e::logEvent, arg) \
|
||||
macro (USER_resume, stats_flags_e::logEvent, arg) \
|
||||
macro (USER_suspend, stats_flags_e::logEvent, arg) \
|
||||
macro (USER_launch_thread_loop, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_allocate_team, 0, arg) \
|
||||
macro (KMP_setup_icv_copy, 0, arg) \
|
||||
macro (USER_icv_copy, 0, arg) \
|
||||
#define KMP_FOREACH_TIMER(macro, arg) \
|
||||
macro (OMP_worker_thread_life, 0, arg) \
|
||||
macro (FOR_static_scheduling, 0, arg) \
|
||||
macro (FOR_dynamic_scheduling, 0, arg) \
|
||||
macro (OMP_critical, 0, arg) \
|
||||
macro (OMP_critical_wait, 0, arg) \
|
||||
macro (OMP_single, 0, arg) \
|
||||
macro (OMP_master, 0, arg) \
|
||||
macro (OMP_idle, 0, arg) \
|
||||
macro (OMP_plain_barrier, 0, arg) \
|
||||
macro (OMP_fork_join_barrier, 0, arg) \
|
||||
macro (OMP_parallel, 0, arg) \
|
||||
macro (OMP_task_immediate, 0, arg) \
|
||||
macro (OMP_task_taskwait, 0, arg) \
|
||||
macro (OMP_task_taskyield, 0, arg) \
|
||||
macro (OMP_task_taskgroup, 0, arg) \
|
||||
macro (OMP_task_join_bar, 0, arg) \
|
||||
macro (OMP_task_plain_bar, 0, arg) \
|
||||
macro (OMP_serial, 0, arg) \
|
||||
macro (OMP_taskloop_scheduling, 0, arg) \
|
||||
macro (OMP_set_numthreads, stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
|
||||
macro (OMP_PARALLEL_args, stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
|
||||
macro (FOR_static_iterations, stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
|
||||
macro (FOR_dynamic_iterations,stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
|
||||
KMP_FOREACH_DEVELOPER_TIMER(macro, arg) \
|
||||
macro (LAST,0, arg)
|
||||
|
||||
|
||||
|
||||
// OMP_PARALLEL_args -- the number of arguments passed to a fork
|
||||
// OMP_start_end -- Time from when OpenMP is initialized until the stats are printed at exit
|
||||
// OMP_serial -- Thread zero time executing serial code
|
||||
// OMP_work -- Elapsed time in code dispatched by a fork (measured in the thread)
|
||||
// OMP_barrier -- Time at "real" barriers (includes task time)
|
||||
// FOR_static_scheduling -- Time spent doing scheduling for a static "for"
|
||||
// FOR_dynamic_scheduling -- Time spent doing scheduling for a dynamic "for"
|
||||
// OMP_idle -- Worker threads time spent waiting for inclusion in a parallel region
|
||||
// OMP_plain_barrier -- Time spent in a barrier construct
|
||||
// OMP_fork_join_barrier -- Time spent in a the fork-join barrier surrounding a parallel region
|
||||
// OMP_parallel -- Time spent inside a parallel construct
|
||||
// OMP_task_immediate -- Time spent executing non-deferred tasks
|
||||
// OMP_task_taskwait -- Time spent executing tasks inside a taskwait construct
|
||||
// OMP_task_taskyield -- Time spent executing tasks inside a taskyield construct
|
||||
// OMP_task_taskgroup -- Time spent executing tasks inside a taskygroup construct
|
||||
// OMP_task_join_bar -- Time spent executing tasks inside a join barrier
|
||||
// OMP_task_plain_bar -- Time spent executing tasks inside a barrier construct
|
||||
// OMP_single -- Time spent executing a "single" region
|
||||
// OMP_master -- Time spent executing a "master" region
|
||||
// OMP_set_numthreads -- Values passed to omp_set_num_threads
|
||||
// OMP_PARALLEL_args -- Number of arguments passed to a parallel region
|
||||
// FOR_static_iterations -- Number of available parallel chunks of work in a static for
|
||||
// FOR_dynamic_iterations -- Number of available parallel chunks of work in a dynamic for
|
||||
// Both adjust for any chunking, so if there were an iteration count of 20 but a chunk size of 10, we'd record 2.
|
||||
// OMP_serial -- thread zero time executing serial code
|
||||
// OMP_start_end -- time from when OpenMP is initialized until the stats are printed at exit
|
||||
// OMP_work -- elapsed time in code dispatched by a fork (measured in the thread)
|
||||
// Total_work -- a synthesized statistic summarizing how much parallel work each thread executed.
|
||||
// OMP_barrier -- time at "real" barriers
|
||||
// Total_barrier -- a synthesized statistic summarizing how much time at real barriers in each thread
|
||||
// OMP_set_lock -- time in lock setting
|
||||
// OMP_test_lock -- time in testing a lock
|
||||
// LOCK_WAIT -- time waiting for a lock
|
||||
// FOR_static_scheduling -- time spent doing scheduling for a static "for"
|
||||
// FOR_dynamic_scheduling -- time spent doing scheduling for a dynamic "for"
|
||||
// KMP_wait_sleep -- time in __kmp_wait_sleep
|
||||
// KMP_release -- time in __kmp_release
|
||||
|
||||
#if (KMP_DEVELOPER_STATS)
|
||||
// Timers which are of interest to runtime library developers, not end users.
|
||||
// These have to be explicitly enabled in addition to the other stats.
|
||||
|
||||
// KMP_fork_barrier -- time in __kmp_fork_barrier
|
||||
// KMP_join_barrier -- time in __kmp_join_barrier
|
||||
// KMP_barrier -- time in __kmp_barrier
|
||||
@@ -165,6 +190,32 @@ class stats_flags_e {
|
||||
// KMP_tree_release -- time in __kmp_tree_barrier_release
|
||||
// KMP_hyper_gather -- time in __kmp_hyper_barrier_gather
|
||||
// KMP_hyper_release -- time in __kmp_hyper_barrier_release
|
||||
# define KMP_FOREACH_DEVELOPER_TIMER(macro, arg) \
|
||||
macro (KMP_fork_call, 0, arg) \
|
||||
macro (KMP_join_call, 0, arg) \
|
||||
macro (KMP_fork_barrier, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_join_barrier, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_barrier, 0, arg) \
|
||||
macro (KMP_end_split_barrier, 0, arg) \
|
||||
macro (KMP_hier_gather, 0, arg) \
|
||||
macro (KMP_hier_release, 0, arg) \
|
||||
macro (KMP_hyper_gather, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_hyper_release, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_linear_gather, 0, arg) \
|
||||
macro (KMP_linear_release, 0, arg) \
|
||||
macro (KMP_tree_gather, 0, arg) \
|
||||
macro (KMP_tree_release, 0, arg) \
|
||||
macro (USER_master_invoke, stats_flags_e::logEvent, arg) \
|
||||
macro (USER_worker_invoke, stats_flags_e::logEvent, arg) \
|
||||
macro (USER_resume, stats_flags_e::logEvent, arg) \
|
||||
macro (USER_suspend, stats_flags_e::logEvent, arg) \
|
||||
macro (USER_launch_thread_loop, stats_flags_e::logEvent, arg) \
|
||||
macro (KMP_allocate_team, 0, arg) \
|
||||
macro (KMP_setup_icv_copy, 0, arg) \
|
||||
macro (USER_icv_copy, 0, arg)
|
||||
#else
|
||||
# define KMP_FOREACH_DEVELOPER_TIMER(macro, arg)
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief Add new explicit timers under KMP_FOREACH_EXPLICIT_TIMER() macro.
|
||||
@@ -182,13 +233,36 @@ class stats_flags_e {
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_FOREACH_EXPLICIT_TIMER(macro, arg) \
|
||||
macro(OMP_serial, 0, arg) \
|
||||
macro(OMP_start_end, 0, arg) \
|
||||
macro(USER_icv_copy, 0, arg) \
|
||||
macro(USER_launch_thread_loop, stats_flags_e::logEvent, arg) \
|
||||
#define KMP_FOREACH_EXPLICIT_TIMER(macro, arg) \
|
||||
macro(OMP_worker_thread_life, 0, arg) \
|
||||
macro(FOR_static_scheduling, 0, arg) \
|
||||
macro(FOR_dynamic_scheduling, 0, arg) \
|
||||
macro(OMP_critical, 0, arg) \
|
||||
macro(OMP_critical_wait, 0, arg) \
|
||||
macro(OMP_single, 0, arg) \
|
||||
macro(OMP_master, 0, arg) \
|
||||
macro(OMP_idle, 0, arg) \
|
||||
macro(OMP_plain_barrier, 0, arg) \
|
||||
macro(OMP_fork_join_barrier, 0, arg) \
|
||||
macro(OMP_parallel, 0, arg) \
|
||||
macro(OMP_task_immediate, 0, arg) \
|
||||
macro(OMP_task_taskwait, 0, arg) \
|
||||
macro(OMP_task_taskyield, 0, arg) \
|
||||
macro(OMP_task_taskgroup, 0, arg) \
|
||||
macro(OMP_task_join_bar, 0, arg) \
|
||||
macro(OMP_task_plain_bar, 0, arg) \
|
||||
macro(OMP_serial, 0, arg) \
|
||||
macro(OMP_taskloop_scheduling, 0, arg) \
|
||||
KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro,arg) \
|
||||
macro(LAST, 0, arg)
|
||||
|
||||
#if (KMP_DEVELOPER_STATS)
|
||||
# define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg) \
|
||||
macro(USER_launch_thread_loop, stats_flags_e::logEvent, arg)
|
||||
#else
|
||||
# define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg)
|
||||
#endif
|
||||
|
||||
#define ENUMERATE(name,ignore,prefix) prefix##name,
|
||||
enum timer_e {
|
||||
KMP_FOREACH_TIMER(ENUMERATE, TIMER_)
|
||||
@@ -203,6 +277,21 @@ enum counter_e {
|
||||
};
|
||||
#undef ENUMERATE
|
||||
|
||||
class timerPair {
|
||||
explicit_timer_e timer_index;
|
||||
timer_e timer;
|
||||
public:
|
||||
timerPair(explicit_timer_e ti, timer_e t) : timer_index(ti), timer(t) {}
|
||||
inline explicit_timer_e get_index() const { return timer_index; }
|
||||
inline timer_e get_timer() const { return timer; }
|
||||
bool operator==(const timerPair & rhs) {
|
||||
return this->get_index() == rhs.get_index();
|
||||
}
|
||||
bool operator!=(const timerPair & rhs) {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
class statistic
|
||||
{
|
||||
double minVal;
|
||||
@@ -251,14 +340,13 @@ class timeStat : public statistic
|
||||
public:
|
||||
timeStat() : statistic() {}
|
||||
static const char * name(timer_e e) { return timerInfo[e].name; }
|
||||
static bool noTotal (timer_e e) { return timerInfo[e].flags & stats_flags_e::noTotal; }
|
||||
static bool masterOnly (timer_e e) { return timerInfo[e].flags & stats_flags_e::onlyInMaster; }
|
||||
static bool workerOnly (timer_e e) { return timerInfo[e].flags & stats_flags_e::notInMaster; }
|
||||
static bool noUnits (timer_e e) { return timerInfo[e].flags & stats_flags_e::noUnits; }
|
||||
static bool synthesized(timer_e e) { return timerInfo[e].flags & stats_flags_e::synthesized; }
|
||||
static bool logEvent (timer_e e) { return timerInfo[e].flags & stats_flags_e::logEvent; }
|
||||
static void clearEventFlags() {
|
||||
int i;
|
||||
for(i=0;i<TIMER_LAST;i++) {
|
||||
for(int i=0;i<TIMER_LAST;i++) {
|
||||
timerInfo[i].flags &= (~(stats_flags_e::logEvent));
|
||||
}
|
||||
}
|
||||
@@ -271,15 +359,19 @@ class explicitTimer
|
||||
{
|
||||
timeStat * stat;
|
||||
tsc_tick_count startTime;
|
||||
tsc_tick_count pauseStartTime;
|
||||
tsc_tick_count::tsc_interval_t totalPauseTime;
|
||||
|
||||
public:
|
||||
explicitTimer () : stat(0), startTime(0) { }
|
||||
explicitTimer (timeStat * s) : stat(s), startTime() { }
|
||||
explicitTimer () : stat(0), startTime(0), pauseStartTime(0), totalPauseTime() { }
|
||||
explicitTimer (timeStat * s) : stat(s), startTime(), pauseStartTime(0), totalPauseTime() { }
|
||||
|
||||
void setStat (timeStat *s) { stat = s; }
|
||||
void start(timer_e timerEnumValue);
|
||||
void pause() { pauseStartTime = tsc_tick_count::now(); }
|
||||
void resume() { totalPauseTime += (tsc_tick_count::now() - pauseStartTime); }
|
||||
void stop(timer_e timerEnumValue);
|
||||
void reset() { startTime = 0; }
|
||||
void reset() { startTime = 0; pauseStartTime = 0; totalPauseTime = 0; }
|
||||
};
|
||||
|
||||
// Where all you need is to time a block, this is enough.
|
||||
@@ -292,6 +384,49 @@ class blockTimer : public explicitTimer
|
||||
~blockTimer() { stop(timerEnumValue); }
|
||||
};
|
||||
|
||||
// Where you need to partition a threads clock ticks into separate states
|
||||
// e.g., a partitionedTimers class with two timers of EXECUTING_TASK, and
|
||||
// DOING_NOTHING would render these conditions:
|
||||
// time(EXECUTING_TASK) + time(DOING_NOTHING) = total time thread is alive
|
||||
// No clock tick in the EXECUTING_TASK is a member of DOING_NOTHING and vice versa
|
||||
class partitionedTimers
|
||||
{
|
||||
private:
|
||||
explicitTimer* timers[EXPLICIT_TIMER_LAST+1];
|
||||
std::vector<timerPair> timer_stack;
|
||||
public:
|
||||
partitionedTimers();
|
||||
void add_timer(explicit_timer_e timer_index, explicitTimer* timer_pointer);
|
||||
void init(timerPair timer_index);
|
||||
void push(timerPair timer_index);
|
||||
void pop();
|
||||
void windup();
|
||||
};
|
||||
|
||||
// Special wrapper around the partioned timers to aid timing code blocks
|
||||
// It avoids the need to have an explicit end, leaving the scope suffices.
|
||||
class blockPartitionedTimer
|
||||
{
|
||||
partitionedTimers* part_timers;
|
||||
timerPair timer_pair;
|
||||
public:
|
||||
blockPartitionedTimer(partitionedTimers* pt, timerPair tp) : part_timers(pt), timer_pair(tp) { part_timers->push(timer_pair); }
|
||||
~blockPartitionedTimer() { part_timers->pop(); }
|
||||
};
|
||||
|
||||
// Special wrapper around the thread state to aid in keeping state in code blocks
|
||||
// It avoids the need to have an explicit end, leaving the scope suffices.
|
||||
class blockThreadState
|
||||
{
|
||||
stats_state_e* state_pointer;
|
||||
stats_state_e old_state;
|
||||
public:
|
||||
blockThreadState(stats_state_e* thread_state_pointer, stats_state_e new_state) : state_pointer(thread_state_pointer), old_state(*thread_state_pointer) {
|
||||
*state_pointer = new_state;
|
||||
}
|
||||
~blockThreadState() { *state_pointer = old_state; }
|
||||
};
|
||||
|
||||
// If all you want is a count, then you can use this...
|
||||
// The individual per-thread counts will be aggregated into a statistic at program exit.
|
||||
class counter
|
||||
@@ -450,14 +585,19 @@ class kmp_stats_list {
|
||||
timeStat _timers[TIMER_LAST+1];
|
||||
counter _counters[COUNTER_LAST+1];
|
||||
explicitTimer _explicitTimers[EXPLICIT_TIMER_LAST+1];
|
||||
partitionedTimers _partitionedTimers;
|
||||
int _nestLevel; // one per thread
|
||||
kmp_stats_event_vector _event_vector;
|
||||
kmp_stats_list* next;
|
||||
kmp_stats_list* prev;
|
||||
stats_state_e state;
|
||||
int thread_is_idle_flag;
|
||||
public:
|
||||
kmp_stats_list() : next(this) , prev(this) , _event_vector(), _nestLevel(0) {
|
||||
kmp_stats_list() : _nestLevel(0), _event_vector(), next(this), prev(this),
|
||||
state(IDLE), thread_is_idle_flag(0) {
|
||||
#define doInit(name,ignore1,ignore2) \
|
||||
getExplicitTimer(EXPLICIT_TIMER_##name)->setStat(getTimer(TIMER_##name));
|
||||
getExplicitTimer(EXPLICIT_TIMER_##name)->setStat(getTimer(TIMER_##name)); \
|
||||
_partitionedTimers.add_timer(EXPLICIT_TIMER_##name, getExplicitTimer(EXPLICIT_TIMER_##name));
|
||||
KMP_FOREACH_EXPLICIT_TIMER(doInit,0);
|
||||
#undef doInit
|
||||
}
|
||||
@@ -465,6 +605,7 @@ class kmp_stats_list {
|
||||
inline timeStat * getTimer(timer_e idx) { return &_timers[idx]; }
|
||||
inline counter * getCounter(counter_e idx) { return &_counters[idx]; }
|
||||
inline explicitTimer * getExplicitTimer(explicit_timer_e idx) { return &_explicitTimers[idx]; }
|
||||
inline partitionedTimers * getPartitionedTimers() { return &_partitionedTimers; }
|
||||
inline timeStat * getTimers() { return _timers; }
|
||||
inline counter * getCounters() { return _counters; }
|
||||
inline explicitTimer * getExplicitTimers() { return _explicitTimers; }
|
||||
@@ -475,6 +616,12 @@ class kmp_stats_list {
|
||||
inline void decrementNestValue() { _nestLevel--; }
|
||||
inline int getGtid() const { return gtid; }
|
||||
inline void setGtid(int newgtid) { gtid = newgtid; }
|
||||
inline void setState(stats_state_e newstate) { state = newstate; }
|
||||
inline stats_state_e getState() const { return state; }
|
||||
inline stats_state_e * getStatePointer() { return &state; }
|
||||
inline bool isIdle() { return thread_is_idle_flag==1; }
|
||||
inline void setIdleFlag() { thread_is_idle_flag = 1; }
|
||||
inline void resetIdleFlag() { thread_is_idle_flag = 0; }
|
||||
kmp_stats_list* push_back(int gtid); // returns newly created list node
|
||||
inline void push_event(uint64_t start_time, uint64_t stop_time, int nest_level, timer_e name) {
|
||||
_event_vector.push_back(start_time, stop_time, nest_level, name);
|
||||
@@ -540,7 +687,7 @@ class kmp_stats_output_module {
|
||||
};
|
||||
|
||||
private:
|
||||
static const char* outputFileName;
|
||||
std::string outputFileName;
|
||||
static const char* eventsFileName;
|
||||
static const char* plotFileName;
|
||||
static int printPerThreadFlag;
|
||||
@@ -551,19 +698,14 @@ class kmp_stats_output_module {
|
||||
void init();
|
||||
static void setupEventColors();
|
||||
static void printPloticusFile();
|
||||
static void printStats(FILE *statsOut, statistic const * theStats, bool areTimers);
|
||||
static void printHeaderInfo(FILE *statsOut);
|
||||
static void printTimerStats(FILE *statsOut, statistic const * theStats, statistic const * totalStats);
|
||||
static void printCounterStats(FILE *statsOut, statistic const * theStats);
|
||||
static void printCounters(FILE * statsOut, counter const * theCounters);
|
||||
static void printEvents(FILE * eventsOut, kmp_stats_event_vector* theEvents, int gtid);
|
||||
static rgb_color getEventColor(timer_e e) { return timerColorInfo[e]; }
|
||||
static void windupExplicitTimers();
|
||||
bool eventPrintingEnabled() {
|
||||
if(printPerThreadEventsFlag) return true;
|
||||
else return false;
|
||||
}
|
||||
bool perThreadPrintingEnabled() {
|
||||
if(printPerThreadFlag) return true;
|
||||
else return false;
|
||||
}
|
||||
bool eventPrintingEnabled() const { return printPerThreadEventsFlag; }
|
||||
|
||||
public:
|
||||
kmp_stats_output_module() { init(); }
|
||||
@@ -680,6 +822,35 @@ extern kmp_stats_output_module __kmp_stats_output;
|
||||
#define KMP_OUTPUT_STATS(heading_string) \
|
||||
__kmp_output_stats(heading_string)
|
||||
|
||||
/*!
|
||||
* \brief Initializes the paritioned timers to begin with name.
|
||||
*
|
||||
* @param name timer which you want this thread to begin with
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_INIT_PARTITIONED_TIMERS(name) \
|
||||
__kmp_stats_thread_ptr->getPartitionedTimers()->init(timerPair(EXPLICIT_TIMER_##name, TIMER_##name))
|
||||
|
||||
#define KMP_TIME_PARTITIONED_BLOCK(name) \
|
||||
blockPartitionedTimer __PBLOCKTIME__(__kmp_stats_thread_ptr->getPartitionedTimers(), \
|
||||
timerPair(EXPLICIT_TIMER_##name, TIMER_##name))
|
||||
|
||||
#define KMP_PUSH_PARTITIONED_TIMER(name) \
|
||||
__kmp_stats_thread_ptr->getPartitionedTimers()->push(timerPair(EXPLICIT_TIMER_##name, TIMER_##name))
|
||||
|
||||
#define KMP_POP_PARTITIONED_TIMER() \
|
||||
__kmp_stats_thread_ptr->getPartitionedTimers()->pop()
|
||||
|
||||
#define KMP_SET_THREAD_STATE(state_name) \
|
||||
__kmp_stats_thread_ptr->setState(state_name)
|
||||
|
||||
#define KMP_GET_THREAD_STATE() \
|
||||
__kmp_stats_thread_ptr->getState()
|
||||
|
||||
#define KMP_SET_THREAD_STATE_BLOCK(state_name) \
|
||||
blockThreadState __BTHREADSTATE__(__kmp_stats_thread_ptr->getStatePointer(), state_name)
|
||||
|
||||
/*!
|
||||
* \brief resets all stats (counters to 0, timers to 0 elapsed ticks)
|
||||
*
|
||||
@@ -689,6 +860,21 @@ extern kmp_stats_output_module __kmp_stats_output;
|
||||
*/
|
||||
#define KMP_RESET_STATS() __kmp_reset_stats()
|
||||
|
||||
#if (KMP_DEVELOPER_STATS)
|
||||
# define KMP_TIME_DEVELOPER_BLOCK(n) KMP_TIME_BLOCK(n)
|
||||
# define KMP_COUNT_DEVELOPER_VALUE(n,v) KMP_COUNT_VALUE(n,v)
|
||||
# define KMP_COUNT_DEVELOPER_BLOCK(n) KMP_COUNT_BLOCK(n)
|
||||
# define KMP_START_DEVELOPER_EXPLICIT_TIMER(n) KMP_START_EXPLICIT_TIMER(n)
|
||||
# define KMP_STOP_DEVELOPER_EXPLICIT_TIMER(n) KMP_STOP_EXPLICIT_TIMER(n)
|
||||
#else
|
||||
// Null definitions
|
||||
# define KMP_TIME_DEVELOPER_BLOCK(n) ((void)0)
|
||||
# define KMP_COUNT_DEVELOPER_VALUE(n,v) ((void)0)
|
||||
# define KMP_COUNT_DEVELOPER_BLOCK(n) ((void)0)
|
||||
# define KMP_START_DEVELOPER_EXPLICIT_TIMER(n) ((void)0)
|
||||
# define KMP_STOP_DEVELOPER_EXPLICIT_TIMER(n) ((void)0)
|
||||
#endif
|
||||
|
||||
#else // KMP_STATS_ENABLED
|
||||
|
||||
// Null definitions
|
||||
@@ -701,6 +887,18 @@ extern kmp_stats_output_module __kmp_stats_output;
|
||||
#define KMP_OUTPUT_STATS(heading_string) ((void)0)
|
||||
#define KMP_RESET_STATS() ((void)0)
|
||||
|
||||
#define KMP_TIME_DEVELOPER_BLOCK(n) ((void)0)
|
||||
#define KMP_COUNT_DEVELOPER_VALUE(n,v) ((void)0)
|
||||
#define KMP_COUNT_DEVELOPER_BLOCK(n) ((void)0)
|
||||
#define KMP_START_DEVELOPER_EXPLICIT_TIMER(n) ((void)0)
|
||||
#define KMP_STOP_DEVELOPER_EXPLICIT_TIMER(n) ((void)0)
|
||||
#define KMP_INIT_PARTITIONED_TIMERS(name) ((void)0)
|
||||
#define KMP_TIME_PARTITIONED_BLOCK(name) ((void)0)
|
||||
#define KMP_PUSH_PARTITIONED_TIMER(name) ((void)0)
|
||||
#define KMP_POP_PARTITIONED_TIMER() ((void)0)
|
||||
#define KMP_SET_THREAD_STATE(state_name) ((void)0)
|
||||
#define KMP_GET_THREAD_STATE() ((void)0)
|
||||
#define KMP_SET_THREAD_STATE_BLOCK(state_name) ((void)0)
|
||||
#endif // KMP_STATS_ENABLED
|
||||
|
||||
#endif // KMP_STATS_H
|
||||
|
||||
@@ -20,18 +20,19 @@
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#include "kmp.h"
|
||||
#include "kmp_stats_timing.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#if KMP_OS_LINUX
|
||||
#if KMP_HAVE_TICK_TIME
|
||||
# if KMP_MIC
|
||||
double tsc_tick_count::tick_time()
|
||||
{
|
||||
// pretty bad assumption of 1GHz clock for MIC
|
||||
return 1/((double)1000*1.e6);
|
||||
}
|
||||
# else
|
||||
# elif KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||
# include <string.h>
|
||||
// Extract the value from the CPUID information
|
||||
double tsc_tick_count::tick_time()
|
||||
@@ -40,27 +41,27 @@ double tsc_tick_count::tick_time()
|
||||
|
||||
if (result == 0.0)
|
||||
{
|
||||
int cpuinfo[4];
|
||||
kmp_cpuid_t cpuinfo;
|
||||
char brand[256];
|
||||
|
||||
__cpuid(cpuinfo, 0x80000000);
|
||||
__kmp_x86_cpuid(0x80000000, 0, &cpuinfo);
|
||||
memset(brand, 0, sizeof(brand));
|
||||
int ids = cpuinfo[0];
|
||||
int ids = cpuinfo.eax;
|
||||
|
||||
for (unsigned int i=2; i<(ids^0x80000000)+2; i++)
|
||||
__cpuid(brand+(i-2)*sizeof(cpuinfo), i | 0x80000000);
|
||||
__kmp_x86_cpuid(i | 0x80000000, 0, (kmp_cpuid_t*)(brand+(i-2)*sizeof(kmp_cpuid_t)));
|
||||
|
||||
char * start = &brand[0];
|
||||
for (;*start == ' '; start++)
|
||||
;
|
||||
|
||||
|
||||
char * end = brand + KMP_STRLEN(brand) - 3;
|
||||
uint64_t multiplier;
|
||||
|
||||
if (*end == 'M') multiplier = 1000LL*1000LL;
|
||||
else if (*end == 'G') multiplier = 1000LL*1000LL*1000LL;
|
||||
else if (*end == 'T') multiplier = 1000LL*1000LL*1000LL*1000LL;
|
||||
else
|
||||
else
|
||||
{
|
||||
cout << "Error determining multiplier '" << *end << "'\n";
|
||||
exit (-1);
|
||||
@@ -68,9 +69,9 @@ double tsc_tick_count::tick_time()
|
||||
*end = 0;
|
||||
while (*end != ' ') end--;
|
||||
end++;
|
||||
|
||||
|
||||
double freq = strtod(end, &start);
|
||||
if (freq == 0.0)
|
||||
if (freq == 0.0)
|
||||
{
|
||||
cout << "Error calculating frequency " << end << "\n";
|
||||
exit (-1);
|
||||
@@ -94,7 +95,7 @@ std::string formatSI(double interval, int width, char unit)
|
||||
if (useSI)
|
||||
{
|
||||
// Preserve accuracy for small numbers, since we only multiply and the positive powers
|
||||
// of ten are precisely representable.
|
||||
// of ten are precisely representable.
|
||||
static struct { double scale; char prefix; } ranges[] = {
|
||||
{1.e12,'f'},
|
||||
{1.e9, 'p'},
|
||||
@@ -111,7 +112,7 @@ std::string formatSI(double interval, int width, char unit)
|
||||
{1.e-24,'Z'},
|
||||
{1.e-27,'Y'}
|
||||
};
|
||||
|
||||
|
||||
if (interval == 0.0)
|
||||
{
|
||||
os << std::setw(width-3) << std::right << "0.00" << std::setw(3) << unit;
|
||||
@@ -124,13 +125,13 @@ std::string formatSI(double interval, int width, char unit)
|
||||
negative = true;
|
||||
interval = -interval;
|
||||
}
|
||||
|
||||
|
||||
for (int i=0; i<(int)(sizeof(ranges)/sizeof(ranges[0])); i++)
|
||||
{
|
||||
if (interval*ranges[i].scale < 1.e0)
|
||||
{
|
||||
interval = interval * 1000.e0 * ranges[i].scale;
|
||||
os << std::fixed << std::setprecision(2) << std::setw(width-3) << std::right <<
|
||||
os << std::fixed << std::setprecision(2) << std::setw(width-3) << std::right <<
|
||||
(negative ? -interval : interval) << std::setw(2) << ranges[i].prefix << std::setw(1) << unit;
|
||||
|
||||
return os.str();
|
||||
@@ -141,27 +142,3 @@ std::string formatSI(double interval, int width, char unit)
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
tsc_tick_count::tsc_interval_t computeLastInLastOutInterval(timePair * times, int nTimes)
|
||||
{
|
||||
timePair lastTimes = times[0];
|
||||
tsc_tick_count * startp = lastTimes.get_startp();
|
||||
tsc_tick_count * endp = lastTimes.get_endp();
|
||||
|
||||
for (int i=1; i<nTimes; i++)
|
||||
{
|
||||
(*startp) = startp->later(times[i].get_start());
|
||||
(*endp) = endp->later (times[i].get_end());
|
||||
}
|
||||
|
||||
return lastTimes.duration();
|
||||
}
|
||||
|
||||
std::string timePair::format() const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
oss << start.getValue() << ":" << end.getValue() << " = " << (end-start).getValue();
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include "kmp_os.h"
|
||||
#if KMP_HAVE_X86INTRIN_H
|
||||
# include <x86intrin.h>
|
||||
#endif
|
||||
|
||||
class tsc_tick_count {
|
||||
private:
|
||||
@@ -32,39 +35,67 @@ class tsc_tick_count {
|
||||
explicit tsc_interval_t(int64_t _value) : value(_value) {}
|
||||
public:
|
||||
tsc_interval_t() : value(0) {}; // Construct 0 time duration
|
||||
#if KMP_HAVE_TICK_TIME
|
||||
double seconds() const; // Return the length of a time interval in seconds
|
||||
#endif
|
||||
double ticks() const { return double(value); }
|
||||
int64_t getValue() const { return value; }
|
||||
tsc_interval_t& operator=(int64_t nvalue) { value = nvalue; return *this; }
|
||||
|
||||
friend class tsc_tick_count;
|
||||
|
||||
friend tsc_interval_t operator-(
|
||||
const tsc_tick_count t1, const tsc_tick_count t0);
|
||||
friend tsc_interval_t operator-(const tsc_tick_count& t1,
|
||||
const tsc_tick_count& t0);
|
||||
friend tsc_interval_t operator-(const tsc_tick_count::tsc_interval_t& i1,
|
||||
const tsc_tick_count::tsc_interval_t& i0);
|
||||
friend tsc_interval_t& operator+=(tsc_tick_count::tsc_interval_t& i1,
|
||||
const tsc_tick_count::tsc_interval_t& i0);
|
||||
};
|
||||
|
||||
#if KMP_HAVE___BUILTIN_READCYCLECOUNTER
|
||||
tsc_tick_count() : my_count(static_cast<int64_t>(__builtin_readcyclecounter())) {}
|
||||
#elif KMP_HAVE___RDTSC
|
||||
tsc_tick_count() : my_count(static_cast<int64_t>(__rdtsc())) {};
|
||||
#else
|
||||
# error Must have high resolution timer defined
|
||||
#endif
|
||||
tsc_tick_count(int64_t value) : my_count(value) {};
|
||||
int64_t getValue() const { return my_count; }
|
||||
tsc_tick_count later (tsc_tick_count const other) const {
|
||||
return my_count > other.my_count ? (*this) : other;
|
||||
tsc_tick_count later (tsc_tick_count const other) const {
|
||||
return my_count > other.my_count ? (*this) : other;
|
||||
}
|
||||
tsc_tick_count earlier(tsc_tick_count const other) const {
|
||||
return my_count < other.my_count ? (*this) : other;
|
||||
tsc_tick_count earlier(tsc_tick_count const other) const {
|
||||
return my_count < other.my_count ? (*this) : other;
|
||||
}
|
||||
#if KMP_HAVE_TICK_TIME
|
||||
static double tick_time(); // returns seconds per cycle (period) of clock
|
||||
#endif
|
||||
static tsc_tick_count now() { return tsc_tick_count(); } // returns the rdtsc register value
|
||||
friend tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count t1, const tsc_tick_count t0);
|
||||
friend tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count& t1, const tsc_tick_count& t0);
|
||||
};
|
||||
|
||||
inline tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count t1, const tsc_tick_count t0)
|
||||
inline tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count& t1, const tsc_tick_count& t0)
|
||||
{
|
||||
return tsc_tick_count::tsc_interval_t( t1.my_count-t0.my_count );
|
||||
}
|
||||
|
||||
inline double tsc_tick_count::tsc_interval_t::seconds() const
|
||||
inline tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count::tsc_interval_t& i1, const tsc_tick_count::tsc_interval_t& i0)
|
||||
{
|
||||
return tsc_tick_count::tsc_interval_t( i1.value-i0.value );
|
||||
}
|
||||
|
||||
inline tsc_tick_count::tsc_interval_t& operator+=(tsc_tick_count::tsc_interval_t& i1, const tsc_tick_count::tsc_interval_t& i0)
|
||||
{
|
||||
i1.value += i0.value;
|
||||
return i1;
|
||||
}
|
||||
|
||||
#if KMP_HAVE_TICK_TIME
|
||||
inline double tsc_tick_count::tsc_interval_t::seconds() const
|
||||
{
|
||||
return value*tick_time();
|
||||
}
|
||||
#endif
|
||||
|
||||
extern std::string formatSI(double interval, int width, char unit);
|
||||
|
||||
@@ -78,27 +109,4 @@ inline std::string formatTicks(double interval, int width)
|
||||
return formatSI(interval, width, 'T');
|
||||
}
|
||||
|
||||
class timePair
|
||||
{
|
||||
tsc_tick_count KMP_ALIGN_CACHE start;
|
||||
tsc_tick_count end;
|
||||
|
||||
public:
|
||||
timePair() : start(-std::numeric_limits<int64_t>::max()), end(-std::numeric_limits<int64_t>::max()) {}
|
||||
tsc_tick_count get_start() const { return start; }
|
||||
tsc_tick_count get_end() const { return end; }
|
||||
tsc_tick_count * get_startp() { return &start; }
|
||||
tsc_tick_count * get_endp() { return &end; }
|
||||
|
||||
void markStart() { start = tsc_tick_count::now(); }
|
||||
void markEnd() { end = tsc_tick_count::now(); }
|
||||
void set_start(tsc_tick_count s) { start = s; }
|
||||
void set_end (tsc_tick_count e) { end = e; }
|
||||
|
||||
tsc_tick_count::tsc_interval_t duration() const { return end-start; }
|
||||
std::string format() const;
|
||||
|
||||
};
|
||||
|
||||
extern tsc_tick_count::tsc_interval_t computeLastInLastOutInterval(timePair * times, int nTimes);
|
||||
#endif // KMP_STATS_TIMING_H
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
#define kmp_set_blocktime kmpc_set_blocktime
|
||||
#define kmp_set_library kmpc_set_library
|
||||
#define kmp_set_defaults kmpc_set_defaults
|
||||
#define kmp_set_disp_num_buffers kmpc_set_disp_num_buffers
|
||||
#define kmp_malloc kmpc_malloc
|
||||
#define kmp_aligned_malloc kmpc_aligned_malloc
|
||||
#define kmp_calloc kmpc_calloc
|
||||
#define kmp_realloc kmpc_realloc
|
||||
#define kmp_free kmpc_free
|
||||
@@ -99,9 +101,25 @@ void kmp_set_stacksize_s( size_t arg ) { i; __kmps_set_stacksize( arg ); }
|
||||
void kmp_set_blocktime( omp_int_t arg ) { i; __kmps_set_blocktime( arg ); }
|
||||
void kmp_set_library( omp_int_t arg ) { i; __kmps_set_library( arg ); }
|
||||
void kmp_set_defaults( char const * str ) { i; }
|
||||
void kmp_set_disp_num_buffers( omp_int_t arg ) { i; }
|
||||
|
||||
/* KMP memory management functions. */
|
||||
void * kmp_malloc( size_t size ) { i; return malloc( size ); }
|
||||
void * kmp_aligned_malloc( size_t sz, size_t a ) {
|
||||
i;
|
||||
#if KMP_OS_WINDOWS
|
||||
errno = ENOSYS; // not supported
|
||||
return NULL; // no standard aligned allocator on Windows (pre - C11)
|
||||
#else
|
||||
void *res;
|
||||
int err;
|
||||
if( err = posix_memalign( &res, a, sz ) ) {
|
||||
errno = err; // can be EINVAL or ENOMEM
|
||||
return NULL;
|
||||
}
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
void * kmp_calloc( size_t nelem, size_t elsize ) { i; return calloc( nelem, elsize ); }
|
||||
void * kmp_realloc( void *ptr, size_t size ) { i; return realloc( ptr, size ); }
|
||||
void kmp_free( void * ptr ) { i; free( ptr ); }
|
||||
|
||||
+115
-32
@@ -73,47 +73,59 @@ __kmp_node_deref ( kmp_info_t *thread, kmp_depnode_t *node )
|
||||
static void
|
||||
__kmp_depnode_list_free ( kmp_info_t *thread, kmp_depnode_list *list );
|
||||
|
||||
static const kmp_int32 kmp_dephash_log2 = 6;
|
||||
static const kmp_int32 kmp_dephash_size = (1 << kmp_dephash_log2);
|
||||
enum {
|
||||
KMP_DEPHASH_OTHER_SIZE = 97,
|
||||
KMP_DEPHASH_MASTER_SIZE = 997
|
||||
};
|
||||
|
||||
static inline kmp_int32
|
||||
__kmp_dephash_hash ( kmp_intptr_t addr )
|
||||
__kmp_dephash_hash ( kmp_intptr_t addr, size_t hsize )
|
||||
{
|
||||
//TODO alternate to try: set = (((Addr64)(addrUsefulBits * 9.618)) % m_num_sets );
|
||||
return ((addr >> kmp_dephash_log2) ^ addr) % kmp_dephash_size;
|
||||
return ((addr >> 6) ^ (addr >> 2)) % hsize;
|
||||
}
|
||||
|
||||
static kmp_dephash_t *
|
||||
__kmp_dephash_create ( kmp_info_t *thread )
|
||||
__kmp_dephash_create ( kmp_info_t *thread, kmp_taskdata_t *current_task )
|
||||
{
|
||||
kmp_dephash_t *h;
|
||||
|
||||
kmp_int32 size = kmp_dephash_size * sizeof(kmp_dephash_entry_t) + sizeof(kmp_dephash_t);
|
||||
size_t h_size;
|
||||
|
||||
if ( current_task->td_flags.tasktype == TASK_IMPLICIT )
|
||||
h_size = KMP_DEPHASH_MASTER_SIZE;
|
||||
else
|
||||
h_size = KMP_DEPHASH_OTHER_SIZE;
|
||||
|
||||
kmp_int32 size =
|
||||
h_size * sizeof(kmp_dephash_entry_t *) + sizeof(kmp_dephash_t);
|
||||
|
||||
#if USE_FAST_MEMORY
|
||||
h = (kmp_dephash_t *) __kmp_fast_allocate( thread, size );
|
||||
#else
|
||||
h = (kmp_dephash_t *) __kmp_thread_malloc( thread, size );
|
||||
#endif
|
||||
h->size = h_size;
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
h->nelements = 0;
|
||||
h->nconflicts = 0;
|
||||
#endif
|
||||
h->buckets = (kmp_dephash_entry **)(h+1);
|
||||
|
||||
for ( kmp_int32 i = 0; i < kmp_dephash_size; i++ )
|
||||
for ( size_t i = 0; i < h_size; i++ )
|
||||
h->buckets[i] = 0;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
static void
|
||||
__kmp_dephash_free ( kmp_info_t *thread, kmp_dephash_t *h )
|
||||
void
|
||||
__kmp_dephash_free_entries(kmp_info_t *thread, kmp_dephash_t *h)
|
||||
{
|
||||
for ( kmp_int32 i=0; i < kmp_dephash_size; i++ ) {
|
||||
if ( h->buckets[i] ) {
|
||||
for (size_t i = 0; i < h->size; i++) {
|
||||
if (h->buckets[i]) {
|
||||
kmp_dephash_entry_t *next;
|
||||
for ( kmp_dephash_entry_t *entry = h->buckets[i]; entry; entry = next ) {
|
||||
for (kmp_dephash_entry_t *entry = h->buckets[i]; entry; entry = next) {
|
||||
next = entry->next_in_bucket;
|
||||
__kmp_depnode_list_free(thread,entry->last_ins);
|
||||
__kmp_node_deref(thread,entry->last_out);
|
||||
@@ -123,8 +135,15 @@ __kmp_dephash_free ( kmp_info_t *thread, kmp_dephash_t *h )
|
||||
__kmp_thread_free(thread,entry);
|
||||
#endif
|
||||
}
|
||||
h->buckets[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__kmp_dephash_free(kmp_info_t *thread, kmp_dephash_t *h)
|
||||
{
|
||||
__kmp_dephash_free_entries(thread, h);
|
||||
#if USE_FAST_MEMORY
|
||||
__kmp_fast_free(thread,h);
|
||||
#else
|
||||
@@ -135,7 +154,7 @@ __kmp_dephash_free ( kmp_info_t *thread, kmp_dephash_t *h )
|
||||
static kmp_dephash_entry *
|
||||
__kmp_dephash_find ( kmp_info_t *thread, kmp_dephash_t *h, kmp_intptr_t addr )
|
||||
{
|
||||
kmp_int32 bucket = __kmp_dephash_hash(addr);
|
||||
kmp_int32 bucket = __kmp_dephash_hash(addr,h->size);
|
||||
|
||||
kmp_dephash_entry_t *entry;
|
||||
for ( entry = h->buckets[bucket]; entry; entry = entry->next_in_bucket )
|
||||
@@ -196,7 +215,8 @@ __kmp_depnode_list_free ( kmp_info_t *thread, kmp_depnode_list *list )
|
||||
}
|
||||
|
||||
static inline void
|
||||
__kmp_track_dependence ( kmp_depnode_t *source, kmp_depnode_t *sink )
|
||||
__kmp_track_dependence ( kmp_depnode_t *source, kmp_depnode_t *sink,
|
||||
kmp_task_t *sink_task )
|
||||
{
|
||||
#ifdef KMP_SUPPORT_GRAPH_OUTPUT
|
||||
kmp_taskdata_t * task_source = KMP_TASK_TO_TASKDATA(source->dn.task);
|
||||
@@ -204,15 +224,30 @@ __kmp_track_dependence ( kmp_depnode_t *source, kmp_depnode_t *sink )
|
||||
|
||||
__kmp_printf("%d(%s) -> %d(%s)\n", source->dn.id, task_source->td_ident->psource, sink->dn.id, task_sink->td_ident->psource);
|
||||
#endif
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
/* OMPT tracks dependences between task (a=source, b=sink) in which
|
||||
task a blocks the execution of b through the ompt_new_dependence_callback */
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_task_dependence_pair))
|
||||
{
|
||||
kmp_taskdata_t * task_source = KMP_TASK_TO_TASKDATA(source->dn.task);
|
||||
kmp_taskdata_t * task_sink = KMP_TASK_TO_TASKDATA(sink_task);
|
||||
|
||||
ompt_callbacks.ompt_callback(ompt_event_task_dependence_pair)(
|
||||
task_source->ompt_task_info.task_id,
|
||||
task_sink->ompt_task_info.task_id);
|
||||
}
|
||||
#endif /* OMPT_SUPPORT && OMPT_TRACE */
|
||||
}
|
||||
|
||||
template< bool filter >
|
||||
static inline kmp_int32
|
||||
__kmp_process_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_dephash_t *hash,
|
||||
bool dep_barrier,kmp_int32 ndeps, kmp_depend_info_t *dep_list)
|
||||
bool dep_barrier,kmp_int32 ndeps, kmp_depend_info_t *dep_list,
|
||||
kmp_task_t *task )
|
||||
{
|
||||
KA_TRACE(30, ("__kmp_process_deps<%d>: T#%d processing %d depencies : dep_barrier = %d\n", filter, gtid, ndeps, dep_barrier ) );
|
||||
|
||||
|
||||
kmp_info_t *thread = __kmp_threads[ gtid ];
|
||||
kmp_int32 npredecessors=0;
|
||||
for ( kmp_int32 i = 0; i < ndeps ; i++ ) {
|
||||
@@ -231,9 +266,9 @@ __kmp_process_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_dephash_t *hash,
|
||||
if ( indep->dn.task ) {
|
||||
KMP_ACQUIRE_DEPNODE(gtid,indep);
|
||||
if ( indep->dn.task ) {
|
||||
__kmp_track_dependence(indep,node);
|
||||
__kmp_track_dependence(indep,node,task);
|
||||
indep->dn.successors = __kmp_add_node(thread, indep->dn.successors, node);
|
||||
KA_TRACE(40,("__kmp_process_deps<%d>: T#%d adding dependence from %p to %p",
|
||||
KA_TRACE(40,("__kmp_process_deps<%d>: T#%d adding dependence from %p to %p\n",
|
||||
filter,gtid, KMP_TASK_TO_TASKDATA(indep->dn.task), KMP_TASK_TO_TASKDATA(node->dn.task)));
|
||||
npredecessors++;
|
||||
}
|
||||
@@ -247,11 +282,11 @@ __kmp_process_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_dephash_t *hash,
|
||||
} else if ( last_out && last_out->dn.task ) {
|
||||
KMP_ACQUIRE_DEPNODE(gtid,last_out);
|
||||
if ( last_out->dn.task ) {
|
||||
__kmp_track_dependence(last_out,node);
|
||||
__kmp_track_dependence(last_out,node,task);
|
||||
last_out->dn.successors = __kmp_add_node(thread, last_out->dn.successors, node);
|
||||
KA_TRACE(40,("__kmp_process_deps<%d>: T#%d adding dependence from %p to %p",
|
||||
KA_TRACE(40,("__kmp_process_deps<%d>: T#%d adding dependence from %p to %p\n",
|
||||
filter,gtid, KMP_TASK_TO_TASKDATA(last_out->dn.task), KMP_TASK_TO_TASKDATA(node->dn.task)));
|
||||
|
||||
|
||||
npredecessors++;
|
||||
}
|
||||
KMP_RELEASE_DEPNODE(gtid,last_out);
|
||||
@@ -287,9 +322,10 @@ __kmp_check_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_task_t *task, kmp_de
|
||||
kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list )
|
||||
{
|
||||
int i;
|
||||
kmp_taskdata_t * taskdata;
|
||||
|
||||
taskdata = KMP_TASK_TO_TASKDATA(task);
|
||||
#if KMP_DEBUG
|
||||
kmp_taskdata_t * taskdata = KMP_TASK_TO_TASKDATA(task);
|
||||
#endif
|
||||
KA_TRACE(20, ("__kmp_check_deps: T#%d checking dependencies for task %p : %d possibly aliased dependencies, %d non-aliased depedencies : dep_barrier=%d .\n", gtid, taskdata, ndeps, ndeps_noalias, dep_barrier ) );
|
||||
|
||||
// Filter deps in dep_list
|
||||
@@ -311,8 +347,10 @@ __kmp_check_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_task_t *task, kmp_de
|
||||
// used to pack all npredecessors additions into a single atomic operation at the end
|
||||
int npredecessors;
|
||||
|
||||
npredecessors = __kmp_process_deps<true>(gtid, node, hash, dep_barrier, ndeps, dep_list);
|
||||
npredecessors += __kmp_process_deps<false>(gtid, node, hash, dep_barrier, ndeps_noalias, noalias_dep_list);
|
||||
npredecessors = __kmp_process_deps<true>(gtid, node, hash, dep_barrier,
|
||||
ndeps, dep_list, task);
|
||||
npredecessors += __kmp_process_deps<false>(gtid, node, hash, dep_barrier,
|
||||
ndeps_noalias, noalias_dep_list, task);
|
||||
|
||||
node->dn.task = task;
|
||||
KMP_MB();
|
||||
@@ -343,7 +381,7 @@ __kmp_release_deps ( kmp_int32 gtid, kmp_taskdata_t *task )
|
||||
if ( !node ) return;
|
||||
|
||||
KA_TRACE(20, ("__kmp_realease_deps: T#%d notifying succesors of task %p.\n", gtid, task ) );
|
||||
|
||||
|
||||
KMP_ACQUIRE_DEPNODE(gtid,node);
|
||||
node->dn.task = NULL; // mark this task as finished, so no new dependencies are generated
|
||||
KMP_RELEASE_DEPNODE(gtid,node);
|
||||
@@ -356,7 +394,7 @@ __kmp_release_deps ( kmp_int32 gtid, kmp_taskdata_t *task )
|
||||
// successor task can be NULL for wait_depends or because deps are still being processed
|
||||
if ( npredecessors == 0 ) {
|
||||
KMP_MB();
|
||||
if ( successor->dn.task ) {
|
||||
if ( successor->dn.task ) {
|
||||
KA_TRACE(20, ("__kmp_realease_deps: T#%d successor %p of %p scheduled for execution.\n", gtid, successor->dn.task, task ) );
|
||||
__kmp_omp_task(gtid,successor->dn.task,false);
|
||||
}
|
||||
@@ -403,15 +441,60 @@ __kmpc_omp_task_with_deps( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_ta
|
||||
kmp_info_t *thread = __kmp_threads[ gtid ];
|
||||
kmp_taskdata_t * current_task = thread->th.th_current_task;
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
/* OMPT grab all dependences if requested by the tool */
|
||||
if (ompt_enabled && ndeps+ndeps_noalias > 0 &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_task_dependences))
|
||||
{
|
||||
kmp_int32 i;
|
||||
|
||||
new_taskdata->ompt_task_info.ndeps = ndeps+ndeps_noalias;
|
||||
new_taskdata->ompt_task_info.deps = (ompt_task_dependence_t *)
|
||||
KMP_OMPT_DEPS_ALLOC(thread,
|
||||
(ndeps+ndeps_noalias)*sizeof(ompt_task_dependence_t));
|
||||
|
||||
KMP_ASSERT(new_taskdata->ompt_task_info.deps != NULL);
|
||||
|
||||
for (i = 0; i < ndeps; i++)
|
||||
{
|
||||
new_taskdata->ompt_task_info.deps[i].variable_addr =
|
||||
(void*) dep_list[i].base_addr;
|
||||
if (dep_list[i].flags.in && dep_list[i].flags.out)
|
||||
new_taskdata->ompt_task_info.deps[i].dependence_flags =
|
||||
ompt_task_dependence_type_inout;
|
||||
else if (dep_list[i].flags.out)
|
||||
new_taskdata->ompt_task_info.deps[i].dependence_flags =
|
||||
ompt_task_dependence_type_out;
|
||||
else if (dep_list[i].flags.in)
|
||||
new_taskdata->ompt_task_info.deps[i].dependence_flags =
|
||||
ompt_task_dependence_type_in;
|
||||
}
|
||||
for (i = 0; i < ndeps_noalias; i++)
|
||||
{
|
||||
new_taskdata->ompt_task_info.deps[ndeps+i].variable_addr =
|
||||
(void*) noalias_dep_list[i].base_addr;
|
||||
if (noalias_dep_list[i].flags.in && noalias_dep_list[i].flags.out)
|
||||
new_taskdata->ompt_task_info.deps[ndeps+i].dependence_flags =
|
||||
ompt_task_dependence_type_inout;
|
||||
else if (noalias_dep_list[i].flags.out)
|
||||
new_taskdata->ompt_task_info.deps[ndeps+i].dependence_flags =
|
||||
ompt_task_dependence_type_out;
|
||||
else if (noalias_dep_list[i].flags.in)
|
||||
new_taskdata->ompt_task_info.deps[ndeps+i].dependence_flags =
|
||||
ompt_task_dependence_type_in;
|
||||
}
|
||||
}
|
||||
#endif /* OMPT_SUPPORT && OMPT_TRACE */
|
||||
|
||||
bool serial = current_task->td_flags.team_serial || current_task->td_flags.tasking_ser || current_task->td_flags.final;
|
||||
#if OMP_41_ENABLED
|
||||
#if OMP_45_ENABLED
|
||||
serial = serial && !(new_taskdata->td_flags.proxy == TASK_PROXY);
|
||||
#endif
|
||||
|
||||
if ( !serial && ( ndeps > 0 || ndeps_noalias > 0 )) {
|
||||
/* if no dependencies have been tracked yet, create the dependence hash */
|
||||
if ( current_task->td_dephash == NULL )
|
||||
current_task->td_dephash = __kmp_dephash_create(thread);
|
||||
current_task->td_dephash = __kmp_dephash_create(thread, current_task);
|
||||
|
||||
#if USE_FAST_MEMORY
|
||||
kmp_depnode_t *node = (kmp_depnode_t *) __kmp_fast_allocate(thread,sizeof(kmp_depnode_t));
|
||||
@@ -430,7 +513,7 @@ __kmpc_omp_task_with_deps( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_ta
|
||||
return TASK_CURRENT_NOT_QUEUED;
|
||||
}
|
||||
} else {
|
||||
#if OMP_41_ENABLED
|
||||
#if OMP_45_ENABLED
|
||||
kmp_task_team_t * task_team = thread->th.th_task_team;
|
||||
if ( task_team && task_team->tt.tt_found_proxy_tasks )
|
||||
__kmpc_omp_wait_deps ( loc_ref, gtid, ndeps, dep_list, ndeps_noalias, noalias_dep_list );
|
||||
@@ -476,8 +559,8 @@ __kmpc_omp_wait_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps, kmp_de
|
||||
// - dependences are not computed in serial teams (except if we have proxy tasks)
|
||||
// - if the dephash is not yet created it means we have nothing to wait for
|
||||
bool ignore = current_task->td_flags.team_serial || current_task->td_flags.tasking_ser || current_task->td_flags.final;
|
||||
#if OMP_41_ENABLED
|
||||
ignore = ignore && thread->th.th_task_team->tt.tt_found_proxy_tasks == FALSE;
|
||||
#if OMP_45_ENABLED
|
||||
ignore = ignore && thread->th.th_task_team != NULL && thread->th.th_task_team->tt.tt_found_proxy_tasks == FALSE;
|
||||
#endif
|
||||
ignore = ignore || current_task->td_dephash == NULL;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user