Compare commits
146
Commits
release_35
...
release_37
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc10909fa8 | ||
|
|
8868d52f48 | ||
|
|
0b69f5609f | ||
|
|
686a5af3f8 | ||
|
|
0fb99c963e | ||
|
|
59b78cfe6b | ||
|
|
9b5fdcff1d | ||
|
|
42e8b4ba16 | ||
|
|
3bd0c945f1 | ||
|
|
0ce89f8efe | ||
|
|
b6f9ab4d7c | ||
|
|
39454f4614 | ||
|
|
dc3324f7ee | ||
|
|
7f88ff4ca8 | ||
|
|
c0d8cfddb6 | ||
|
|
219c0242d9 | ||
|
|
bb405b54c6 | ||
|
|
ffef79f8a4 | ||
|
|
0746d6010e | ||
|
|
316fcc308a | ||
|
|
a48c8b78c0 | ||
|
|
295dc6c4f3 | ||
|
|
d4c3a31f48 | ||
|
|
f2cc667b65 | ||
|
|
c4046a0728 | ||
|
|
a409d02503 | ||
|
|
5174723912 | ||
|
|
9015a0bc3e | ||
|
|
4c6ccfea87 | ||
|
|
ce39a6d2ca | ||
|
|
d6fcd063d4 | ||
|
|
a1bf3122c5 | ||
|
|
c6a79237e2 | ||
|
|
1b7b309815 | ||
|
|
5588286861 | ||
|
|
897380cff5 | ||
|
|
ef3f591ff4 | ||
|
|
9c97519f26 | ||
|
|
643e32e86a | ||
|
|
df46ccc9e9 | ||
|
|
3c63973a53 | ||
|
|
8d85f8eca1 | ||
|
|
705074b169 | ||
|
|
d03bb79e0c | ||
|
|
6d330264cc | ||
|
|
5f4fa366ad | ||
|
|
532a5c62ee | ||
|
|
c9239bc64a | ||
|
|
bbb8bf893d | ||
|
|
29ed987b04 | ||
|
|
0b4c1d5ffa | ||
|
|
ae9c8b86e4 | ||
|
|
066dde2994 | ||
|
|
030d077d4b | ||
|
|
336e25ce53 | ||
|
|
6590b366d3 | ||
|
|
b9f584cb60 | ||
|
|
78445f97d8 | ||
|
|
3913441f89 | ||
|
|
97212dc34e | ||
|
|
02f4d88433 | ||
|
|
3a7707192b | ||
|
|
8e7493dbf1 | ||
|
|
be30a9edec | ||
|
|
95876670b8 | ||
|
|
784d89cf28 | ||
|
|
41ab51f237 | ||
|
|
a6bafed791 | ||
|
|
d4f09d3c11 | ||
|
|
1fd47b8943 | ||
|
|
4af0f3a6a7 | ||
|
|
941ff3cfec | ||
|
|
d3bad19554 | ||
|
|
1cbd964ba5 | ||
|
|
efb6bb2106 | ||
|
|
730074da8d | ||
|
|
08a240ddea | ||
|
|
00a59d4327 | ||
|
|
80ba310a1f | ||
|
|
afd2c6c3fd | ||
|
|
98270aa879 | ||
|
|
7866075b26 | ||
|
|
107fb0e39e | ||
|
|
1d0ad7f8a7 | ||
|
|
0c6d80bd14 | ||
|
|
97f7eb4877 | ||
|
|
8c2806cda5 | ||
|
|
1e585c2e08 | ||
|
|
03e9d1a623 | ||
|
|
de7026a553 | ||
|
|
37d0af3296 | ||
|
|
890e8fd276 | ||
|
|
f2d8bd6591 | ||
|
|
24a57ca394 | ||
|
|
20b8da7236 | ||
|
|
8b78c4a5dc | ||
|
|
3fa7333224 | ||
|
|
137f02169d | ||
|
|
1f60457c77 | ||
|
|
f22e087f7c | ||
|
|
893d25d72c | ||
|
|
45ed5c3e63 | ||
|
|
6c8cce6f8b | ||
|
|
b4d5def747 | ||
|
|
53e806cdc1 | ||
|
|
032f90ffc6 | ||
|
|
5356a729f1 | ||
|
|
195acc9c80 | ||
|
|
19b619330a | ||
|
|
0fb8c1581f | ||
|
|
65e9157ebc | ||
|
|
50cba614b0 | ||
|
|
f23bef7fdc | ||
|
|
143c590366 | ||
|
|
2ce31a0c3a | ||
|
|
8afa9cc53a | ||
|
|
d6f9c6363f | ||
|
|
cf569cf54a | ||
|
|
fe92d4cfd7 | ||
|
|
ba07f9b3fe | ||
|
|
0c9c540c0d | ||
|
|
94f826e819 | ||
|
|
9236d9713a | ||
|
|
50e77e281c | ||
|
|
e6f5cf8f18 | ||
|
|
fea0d84adf | ||
|
|
75159bfdee | ||
|
|
7ab6f4b7f9 | ||
|
|
79a76a5520 | ||
|
|
0a2bac028a | ||
|
|
b8903bff6a | ||
|
|
3be2e89b5f | ||
|
|
1ad88fa8d4 | ||
|
|
b67ee8b7ec | ||
|
|
50c666a9bd | ||
|
|
7680d2964f | ||
|
|
9dd2dbbb70 | ||
|
|
cc78b24209 | ||
|
|
889547d589 | ||
|
|
8e3bb6f34d | ||
|
|
f12a6547f0 | ||
|
|
e3de784d57 | ||
|
|
70f731d6bc | ||
|
|
f780f5d995 | ||
|
|
eb0d2c2faa | ||
|
|
8e8c442780 |
@@ -0,0 +1,2 @@
|
||||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||
add_subdirectory(runtime)
|
||||
+13
@@ -8,6 +8,10 @@ beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||
(S).
|
||||
|
||||
N: Carlo Bertolli
|
||||
W: http://ibm.com
|
||||
D: IBM contributor to PowerPC support in CMake files and elsewhere.
|
||||
|
||||
N: Sunita Chandrasekaran
|
||||
D: Contributor to testsuite from OpenUH
|
||||
|
||||
@@ -22,9 +26,18 @@ N: Intel Corporation OpenMP runtime team
|
||||
W: http://openmprtl.org
|
||||
D: Created the runtime.
|
||||
|
||||
N: John Mellor-Crummey and other members of the OpenMP Tools Working Group
|
||||
E: johnmc@rice.edu
|
||||
D: OpenMP Tools Interface (OMPT)
|
||||
|
||||
N: Matthias Muller
|
||||
D: Contributor to testsuite from OpenUH
|
||||
|
||||
N: Tal Nevo
|
||||
E: tal@scalemp.com
|
||||
D: ScaleMP contributor to improve runtime performance there.
|
||||
W: http://scalemp.com
|
||||
|
||||
N: Pavel Neytchev
|
||||
D: Contributor to testsuite from OpenUH
|
||||
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ software contained in this directory tree is included below.
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 1997-2013 Intel Corporation
|
||||
Copyright (c) 1997-2015 Intel Corporation
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -51,7 +51,7 @@ SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 1997-2013 Intel Corporation
|
||||
Copyright (c) 1997-2014 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
|
||||
|
||||
+21
-5
@@ -14,6 +14,7 @@
|
||||
# root_dir - path to root directory of liboffload
|
||||
# build_dir - path to build directory
|
||||
# mpss_dir - path to root directory of mpss
|
||||
# mpss_version - version of the mpss (e.g., version "3.3.x" would be "33")
|
||||
# libiomp_host_dir - path to host libiomp directory (unnecessary if compiler_host is icc)
|
||||
# libiomp_target_dir - path to target libiomp directory (unnecesarry if compiler_target is icc)
|
||||
# omp_header_dir - path to omp.h (unnecessary if compiler_host and compiler_target are icc)
|
||||
@@ -47,13 +48,24 @@ compiler_host?=gcc
|
||||
compiler_target?=gcc
|
||||
|
||||
# MPSS
|
||||
mpss_version?=30
|
||||
mpss_dir?=/
|
||||
mpss_present=$(shell if test -d $(mpss_dir); then echo OK; else echo KO; fi)
|
||||
ifneq ($(mpss_present), OK)
|
||||
$(error "Cannot find MPSS directory $(mpss_dir)")
|
||||
endif
|
||||
|
||||
coi_dir=$(mpss_dir)/opt/intel/mic/coi
|
||||
ifeq ($(shell test $(mpss_version) -gt 33; echo $$?), 0)
|
||||
coi_dir=$(mpss_dir)/sysroots/k1om-mpss-linux/usr
|
||||
coi_include=$(coi_dir)/include/intel-coi
|
||||
coi_lib_host=$(mpss_dir)/lib64
|
||||
coi_lib_device=$(coi_dir)/lib64
|
||||
else
|
||||
coi_dir=$(mpss_dir)/opt/intel/mic/coi
|
||||
coi_include=$(coi_dir)/include
|
||||
coi_lib_host=$(coi_dir)/host-linux-release/lib
|
||||
coi_lib_device=$(coi_dir)/device-linux-release/lib
|
||||
endif
|
||||
myo_dir=$(mpss_dir)/opt/intel/mic/myo
|
||||
|
||||
# Sources
|
||||
@@ -90,25 +102,25 @@ obj_ofld_host=$(foreach file,$(obj_ofld),$(build_host_dir)/$(file))
|
||||
obj_ofld_target=$(foreach file,$(obj_ofld),$(build_target_dir)/$(file))
|
||||
|
||||
# Options
|
||||
opts_common=-O2 -w -fpic -c -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -I$(coi_dir)/include -I$(myo_dir)/include -I$(source_dir)
|
||||
opts_common=-O2 -w -fpic -c -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -I$(coi_include) -I$(myo_dir)/include -I$(source_dir)
|
||||
ifneq ($(omp_header_dir), )
|
||||
opts_common+=-I$(imported_dir)
|
||||
endif
|
||||
|
||||
opts_liboffload=-shared -Wl,-soname,liboffload.so.5 -ldl -lstdc++ -liomp5
|
||||
|
||||
opts_liboffload_host=$(opts_liboffload) -L$(coi_dir)/host-linux-release/lib -lcoi_host -L$(myo_dir)/lib -lmyo-client
|
||||
opts_liboffload_host=$(opts_liboffload) -L$(coi_lib_host) -lcoi_host -L$(myo_dir)/lib -lmyo-client
|
||||
ifneq ($(libiomp_host_dir), )
|
||||
opts_liboffload_host+=-L$(libiomp_host_dir)
|
||||
endif
|
||||
|
||||
opts_liboffload_target=$(opts_liboffload) -L$(coi_dir)/device-linux-release/lib -lcoi_device -L$(myo_dir)/lib -lmyo-service
|
||||
opts_liboffload_target=$(opts_liboffload) -L$(coi_lib_device) -lcoi_device -L$(myo_dir)/lib -lmyo-service
|
||||
ifneq ($(libiomp_target_dir), )
|
||||
opts_liboffload_target+=-L$(libiomp_target_dir)
|
||||
endif
|
||||
|
||||
options_host?=
|
||||
opts_host=$(options_host) -DHOST_LIBRARY=1
|
||||
opts_host=$(options_host) -DHOST_LIBRARY=1 -DMPSS_VERSION=$(mpss_version)
|
||||
ifeq ($(os_host), linux)
|
||||
opts_host+=-DLINUX
|
||||
endif
|
||||
@@ -118,6 +130,9 @@ opts_target=$(options_target) -DHOST_LIBRARY=0
|
||||
ifeq ($(os_target), linux)
|
||||
opts_target+=-DLINUX
|
||||
endif
|
||||
ifeq ($(compiler_target), icc)
|
||||
opts_target+=-mmic
|
||||
endif
|
||||
|
||||
# Make targets
|
||||
.PHONY: all clean info
|
||||
@@ -196,6 +211,7 @@ info:
|
||||
@echo "root_dir = $(root_dir)"
|
||||
@echo "build_dir = $(build_dir)"
|
||||
@echo "mpss_dir = $(mpss_dir)"
|
||||
@echo "mpss_version = $(mpss_version)"
|
||||
@echo "libiomp_host_dir = $(libiomp_host_dir)"
|
||||
@echo "libiomp_target_dir = $(libiomp_target_dir)"
|
||||
@echo "omp_header_dir = $(omp_header_dir)"
|
||||
|
||||
@@ -11,8 +11,12 @@
|
||||
#ifndef CEAN_UTIL_H_INCLUDED
|
||||
#define CEAN_UTIL_H_INCLUDED
|
||||
|
||||
#if MPSS_VERSION > 33
|
||||
#include <source/COIBuffer_source.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
#if MPSS_VERSION <= 33
|
||||
// CEAN expression representation
|
||||
struct dim_desc {
|
||||
int64_t size; // Length of data type
|
||||
@@ -27,6 +31,7 @@ struct arr_desc {
|
||||
int64_t rank; // Rank of array
|
||||
dim_desc dim[1];
|
||||
};
|
||||
#endif
|
||||
|
||||
struct CeanReadDim {
|
||||
int64_t count; // The number of elements in this dimension
|
||||
|
||||
@@ -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.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
==========================================================
|
||||
How to Build the LLVM* OpenMP* Runtime Library using CMake
|
||||
==========================================================
|
||||
|
||||
==== Version of CMake required: v2.8.0 or above ====
|
||||
|
||||
============================================
|
||||
How to call cmake initially, then repeatedly
|
||||
============================================
|
||||
- When calling cmake for the first time, all needed compiler options
|
||||
must be specified on the command line. After this initial call to
|
||||
cmake, the compiler definitions must not be included for further calls
|
||||
to cmake. Other options can be specified on the command line multiple
|
||||
times including all definitions in the Build options section below.
|
||||
- Example of configuring, building, reconfiguring, rebuilding:
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=i386 .. # Initial configuration
|
||||
$ make
|
||||
...
|
||||
$ make clean
|
||||
$ 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=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
|
||||
CMakeCache.txt as opposed to using definitions on the command line.
|
||||
- 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
|
||||
no arguments and a list will be printed.
|
||||
|
||||
=====================
|
||||
Instructions to Build
|
||||
=====================
|
||||
$ cd libomp_top_level/ [ directory with src/ , exports/ , tools/ , etc. ]
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
|
||||
[ 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 <Generator Type> -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -DCMAKE_ASM_MASM_COMPILER=[ml | ml64] -DCMAKE_BUILD_TYPE=Release ..
|
||||
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
==================
|
||||
Mac* Fat Libraries
|
||||
==================
|
||||
On OS X* machines, it is possible to build universal (or fat) libraries which
|
||||
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
|
||||
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.
|
||||
|
||||
===========
|
||||
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>
|
||||
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
|
||||
|
||||
-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?).
|
||||
|
||||
==== 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 major version can be 5 or 4.
|
||||
|
||||
-DLIBOMP_OMP_VERSION=41|40|30
|
||||
OpenMP version can be either 41, 40 or 30.
|
||||
|
||||
-DLIBOMP_MIC_ARCH=knc|knf
|
||||
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_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_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=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_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?
|
||||
|
||||
================================
|
||||
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 i386 Linux library using GCC*
|
||||
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=i386 ..
|
||||
|
||||
- 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.
|
||||
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='-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 ..
|
||||
|
||||
=========
|
||||
Footnotes
|
||||
=========
|
||||
[*] Other names and brands may be claimed as the property of others.
|
||||
+308
-5
@@ -1,8 +1,311 @@
|
||||
project(openmp)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// 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.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
set(VERSION 5)
|
||||
set(OMP_VERSION "201107")
|
||||
set(OMP_VERSION_NUM "40")
|
||||
# CMAKE libomp
|
||||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||
|
||||
# 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
|
||||
"${CMAKE_SOURCE_DIR}/runtime" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
project(libomp C CXX)
|
||||
set(LIBOMP_STANDALONE_BUILD TRUE)
|
||||
endif()
|
||||
|
||||
# These include files are in the cmake/ subdirectory
|
||||
include(LibompUtils)
|
||||
include(LibompGetArchitecture)
|
||||
include(LibompHandleFlags)
|
||||
include(LibompDefinitions)
|
||||
|
||||
# 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)
|
||||
|
||||
set(LIBOMP_LIB_TYPE normal CACHE STRING
|
||||
"Performance,Profiling,Stubs library (normal/profile/stubs)")
|
||||
libomp_check_variable(LIBOMP_LIB_TYPE 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)")
|
||||
libomp_check_variable(LIBOMP_OMP_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.")
|
||||
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
|
||||
# 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.")
|
||||
set(CMAKE_OSX_ARCHITECTURES ${LIBOMP_OSX_ARCHITECTURES})
|
||||
|
||||
# User specified flags. These are appended to the configured flags.
|
||||
set(LIBOMP_CFLAGS "" CACHE STRING
|
||||
"Appended user specified C compiler flags.")
|
||||
set(LIBOMP_CXXFLAGS "" CACHE STRING
|
||||
"Appended user specified C++ compiler flags.")
|
||||
set(LIBOMP_CPPFLAGS "" CACHE STRING
|
||||
"Appended user specified C preprocessor flags.")
|
||||
set(LIBOMP_ASMFLAGS "" CACHE STRING
|
||||
"Appended user specified assembler flags.")
|
||||
set(LIBOMP_LDFLAGS "" CACHE STRING
|
||||
"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.")
|
||||
|
||||
# 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.
|
||||
# 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?")
|
||||
|
||||
# Get the build number from kmp_version.c
|
||||
libomp_get_build_number("${CMAKE_CURRENT_SOURCE_DIR}" LIBOMP_BUILD_NUMBER)
|
||||
|
||||
# Currently don't record any timestamps
|
||||
set(LIBOMP_DATE "No_Timestamp")
|
||||
|
||||
# Architecture
|
||||
set(IA32 FALSE)
|
||||
set(INTEL64 FALSE)
|
||||
set(ARM FALSE)
|
||||
set(AARCH64 FALSE)
|
||||
set(PPC64BE FALSE)
|
||||
set(PPC64LE FALSE)
|
||||
set(PPC64 FALSE)
|
||||
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)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "ppc64") # PPC64BE architecture
|
||||
set(PPC64BE TRUE)
|
||||
set(PPC64 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "ppc64le") # PPC64LE architecture
|
||||
set(PPC64LE TRUE)
|
||||
set(PPC64 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "aarch64") # AARCH64 architecture
|
||||
set(AARCH64 TRUE)
|
||||
elseif("${LIBOMP_ARCH}" STREQUAL "mic") # Intel(R) Many Integrated Core Architecture
|
||||
set(MIC TRUE)
|
||||
endif()
|
||||
|
||||
# Set some flags based on build_type
|
||||
set(RELEASE_BUILD FALSE)
|
||||
set(DEBUG_BUILD FALSE)
|
||||
set(RELWITHDEBINFO_BUILD FALSE)
|
||||
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)
|
||||
|
||||
# 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)
|
||||
elseif("${LIBOMP_LIB_TYPE}" STREQUAL "profile")
|
||||
set(PROFILE_LIBRARY TRUE)
|
||||
elseif("${LIBOMP_LIB_TYPE}" STREQUAL "stubs")
|
||||
set(STUBS_LIBRARY TRUE)
|
||||
endif()
|
||||
|
||||
# Setting directory names
|
||||
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})
|
||||
|
||||
# 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.
|
||||
# TODO: Make this a real feature check
|
||||
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()
|
||||
|
||||
# OMPT-support
|
||||
# TODO: Make this a real feature check
|
||||
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()
|
||||
|
||||
# Setting final library name
|
||||
set(LIBOMP_DEFAULT_LIB_NAME libomp)
|
||||
if(${PROFILE_LIBRARY})
|
||||
set(LIBOMP_DEFAULT_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME}prof)
|
||||
endif()
|
||||
if(${STUBS_LIBRARY})
|
||||
set(LIBOMP_DEFAULT_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME}stubs)
|
||||
endif()
|
||||
set(LIBOMP_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME} CACHE STRING "Base OMP library name")
|
||||
set(LIBOMP_LIB_FILE ${LIBOMP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
|
||||
# Print configuration after all variables are set.
|
||||
if(${LIBOMP_STANDALONE_BUILD})
|
||||
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("Lib Type -- ${LIBOMP_LIB_TYPE}")
|
||||
libomp_say("Fortran Modules -- ${LIBOMP_FORTRAN_MODULES}")
|
||||
# will say development if all zeros
|
||||
if(${LIBOMP_BUILD_NUMBER} STREQUAL 00000000)
|
||||
set(LIBOMP_BUILD Development)
|
||||
else()
|
||||
set(LIBOMP_BUILD ${LIBOMP_BUILD_NUMBER})
|
||||
endif()
|
||||
libomp_say("Build -- ${LIBOMP_BUILD}")
|
||||
libomp_say("Use Stats-gathering -- ${LIBOMP_STATS}")
|
||||
libomp_say("Use Debugger-support -- ${LIBOMP_USE_DEBUGGER}")
|
||||
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}")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
|
||||
+37
-4
@@ -18,12 +18,12 @@ default: omp
|
||||
all: omp stubs
|
||||
|
||||
omp: info mkdir
|
||||
@echo $(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) lib inc common
|
||||
$(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) lib inc common
|
||||
@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
|
||||
$(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) --stubs lib inc common
|
||||
@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
|
||||
|
||||
@@ -39,7 +39,40 @@ 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
|
||||
|
||||
|
||||
|
||||
+47
-21
@@ -1,6 +1,6 @@
|
||||
|
||||
README for Intel(R) OpenMP* Runtime Library
|
||||
===========================================
|
||||
README for the LLVM* OpenMP* Runtime Library
|
||||
============================================
|
||||
|
||||
How to Build Documentation
|
||||
==========================
|
||||
@@ -11,7 +11,7 @@ However, an HTML version can be built by executing:
|
||||
|
||||
% doxygen doc/doxygen/config
|
||||
|
||||
in this directory.
|
||||
in the runtime directory.
|
||||
|
||||
That will produce HTML documentation in the doc/doxygen/generated
|
||||
directory, which can be accessed by pointing a web browser at the
|
||||
@@ -21,11 +21,23 @@ If you don't have Doxygen installed, you can download it from
|
||||
www.doxygen.org.
|
||||
|
||||
|
||||
How to Build the Intel(R) OpenMP* Runtime Library
|
||||
=================================================
|
||||
How to Build the LLVM* OpenMP* Runtime Library
|
||||
==============================================
|
||||
|
||||
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.
|
||||
|
||||
Building with CMake
|
||||
===================
|
||||
The runtime/Build_With_CMake.txt file has a description of how to
|
||||
build with Cmake.
|
||||
|
||||
Building with the Makefile
|
||||
==========================
|
||||
The Makefile at the top-level will attempt to detect what it needs to
|
||||
build the Intel(R) OpenMP* Runtime Library. To see the default settings,
|
||||
build the LLVM* OpenMP* Runtime Library. To see the default settings,
|
||||
type:
|
||||
|
||||
make info
|
||||
@@ -46,6 +58,10 @@ arch: Architecture. By default, the build will attempt to
|
||||
"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
|
||||
@@ -63,14 +79,21 @@ compiler: Which compiler to use for the build. Defaults to "icc"
|
||||
|
||||
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
|
||||
|
||||
There is also an experimental CMake build system. This is *not* yet
|
||||
supported for production use and resulting binaries have not been checked
|
||||
for compatibility.
|
||||
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
|
||||
|
||||
Supported RTL Build Configurations
|
||||
==================================
|
||||
@@ -78,36 +101,39 @@ Supported RTL Build Configurations
|
||||
Supported Architectures: IA-32 architecture, Intel(R) 64, and
|
||||
Intel(R) Many Integrated Core Architecture
|
||||
|
||||
--------------------------------------------
|
||||
| icc/icl | gcc | clang |
|
||||
--------------|---------------|--------------------------|
|
||||
| Linux* OS | Yes(1,5) | Yes(2,4) | Yes(4,6,7) |
|
||||
| FreeBSD* | No | No | Yes(4,6,7) |
|
||||
| OS X* | Yes(1,3,4) | No | Yes(4,6,7) |
|
||||
| Windows* OS | Yes(1,4) | No | No |
|
||||
----------------------------------------------------------
|
||||
----------------------------------------------
|
||||
| icc/icl | gcc | clang |
|
||||
--------------|---------------|----------------------------|
|
||||
| Linux* OS | Yes(1,5) | Yes(2,4) | Yes(4,6,7) |
|
||||
| FreeBSD* | No | No | Yes(4,6,7,8) |
|
||||
| OS X* | Yes(1,3,4) | No | Yes(4,6,7) |
|
||||
| Windows* OS | Yes(1,4) | No | No |
|
||||
------------------------------------------------------------
|
||||
|
||||
(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.6.2 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
|
||||
or later are required.
|
||||
(6) clang version 3.3 is supported.
|
||||
(7) clang currently does not offer a software-implemented 128 bit extended
|
||||
(6) Clang* version 3.3 is supported.
|
||||
(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:
|
||||
__kmpc_atomic_cmplx16_*
|
||||
__kmpc_atomic_float16_*
|
||||
__kmpc_atomic_*_fp
|
||||
(8) Community contribution provided AS IS, not tested by Intel.
|
||||
|
||||
Front-end Compilers that work with this RTL
|
||||
===========================================
|
||||
|
||||
The following compilers are known to do compatible code generation for
|
||||
this RTL: icc/icl, gcc. See the documentation for more detail.
|
||||
this RTL: clang (from the OpenMP development branch at
|
||||
http://clang-omp.github.io/ ), Intel compilers, GCC. See the documentation
|
||||
for more details.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -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,100 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// 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)
|
||||
libomp_append(cppflags_local "-D USE_ITT_BUILD")
|
||||
# yes... you need 5 backslashes...
|
||||
libomp_append(cppflags_local "-D KMP_ARCH_STR=\"\\\\\"${LIBOMP_LEGAL_ARCH}\\\\\"\"")
|
||||
libomp_append(cppflags_local "-D BUILD_I8")
|
||||
libomp_append(cppflags_local "-D KMP_LIBRARY_FILE=\\\\\"${LIBOMP_LIB_FILE}\\\\\"")
|
||||
libomp_append(cppflags_local "-D KMP_VERSION_MAJOR=${LIBOMP_VERSION}")
|
||||
libomp_append(cppflags_local "-D KMP_NESTED_HOT_TEAMS")
|
||||
|
||||
# customize to 128 bytes for ppc64
|
||||
if(${PPC64})
|
||||
libomp_append(cppflags_local "-D CACHE_LINE=128")
|
||||
else()
|
||||
libomp_append(cppflags_local "-D CACHE_LINE=64")
|
||||
endif()
|
||||
|
||||
libomp_append(cppflags_local "-D KMP_ADJUST_BLOCKTIME=1")
|
||||
libomp_append(cppflags_local "-D BUILD_PARALLEL_ORDERED")
|
||||
libomp_append(cppflags_local "-D KMP_ASM_INTRINS")
|
||||
libomp_append(cppflags_local "-D USE_ITT_NOTIFY" IF_TRUE_1_0 LIBOMP_USE_ITT_NOTIFY)
|
||||
libomp_append(cppflags_local "-D INTEL_NO_ITTNOTIFY_API" IF_FALSE LIBOMP_USE_ITT_NOTIFY)
|
||||
libomp_append(cppflags_local "-D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_")
|
||||
libomp_append(cppflags_local "-D KMP_USE_VERSION_SYMBOLS" IF_TRUE LIBOMP_USE_VERSION_SYMBOLS)
|
||||
|
||||
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 KMP_WIN_CDECL")
|
||||
libomp_append(cppflags_local "-D _USRDLL")
|
||||
libomp_append(cppflags_local "-D _ITERATOR_DEBUG_LEVEL=0" IF_TRUE DEBUG_BUILD)
|
||||
else()
|
||||
libomp_append(cppflags_local "-D _GNU_SOURCE")
|
||||
libomp_append(cppflags_local "-D _REENTRANT")
|
||||
libomp_append(cppflags_local "-D BUILD_TV")
|
||||
libomp_append(cppflags_local "-D USE_CBLKDATA")
|
||||
libomp_append(cppflags_local "-D KMP_GOMP_COMPAT")
|
||||
endif()
|
||||
|
||||
libomp_append(cppflags_local "-D USE_LOAD_BALANCE" IF_FALSE MIC)
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
libomp_append(cppflags_local "-D KMP_TDATA_GTID")
|
||||
endif()
|
||||
libomp_append(cppflags_local "-D KMP_USE_ASSERT" IF_TRUE LIBOMP_ENABLE_ASSERTIONS)
|
||||
libomp_append(cppflags_local "-D KMP_DYNAMIC_LIB")
|
||||
libomp_append(cppflags_local "-D KMP_STUB" IF_TRUE STUBS_LIBRARY)
|
||||
|
||||
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
libomp_append(cppflags_local "-D KMP_DEBUG")
|
||||
endif()
|
||||
libomp_append(cppflags_local "-D _DEBUG" IF_TRUE DEBUG_BUILD)
|
||||
libomp_append(cppflags_local "-D BUILD_DEBUG" IF_TRUE DEBUG_BUILD)
|
||||
libomp_append(cppflags_local "-D KMP_STATS_ENABLED" IF_TRUE_1_0 LIBOMP_STATS)
|
||||
libomp_append(cppflags_local "-D USE_DEBUGGER" IF_TRUE_1_0 LIBOMP_USE_DEBUGGER)
|
||||
libomp_append(cppflags_local "-D OMPT_SUPPORT" IF_TRUE_1_0 LIBOMP_OMPT_SUPPORT)
|
||||
libomp_append(cppflags_local "-D OMPT_BLAME" IF_TRUE_1_0 LIBOMP_OMPT_BLAME)
|
||||
libomp_append(cppflags_local "-D OMPT_TRACE" IF_TRUE_1_0 LIBOMP_OMPT_TRACE)
|
||||
|
||||
# OpenMP version flags
|
||||
set(libomp_have_omp_50 0)
|
||||
set(libomp_have_omp_41 0)
|
||||
set(libomp_have_omp_40 0)
|
||||
set(libomp_have_omp_30 0)
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 50 OR ${LIBOMP_OMP_VERSION} GREATER 50)
|
||||
set(libomp_have_omp_50 1)
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 41 OR ${LIBOMP_OMP_VERSION} GREATER 41)
|
||||
set(libomp_have_omp_41 1)
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 40 OR ${LIBOMP_OMP_VERSION} GREATER 40)
|
||||
set(libomp_have_omp_40 1)
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 30 OR ${LIBOMP_OMP_VERSION} GREATER 30)
|
||||
set(libomp_have_omp_30 1)
|
||||
endif()
|
||||
libomp_append(cppflags_local "-D OMP_50_ENABLED=${libomp_have_omp_50}")
|
||||
libomp_append(cppflags_local "-D OMP_41_ENABLED=${libomp_have_omp_41}")
|
||||
libomp_append(cppflags_local "-D OMP_40_ENABLED=${libomp_have_omp_40}")
|
||||
libomp_append(cppflags_local "-D OMP_30_ENABLED=${libomp_have_omp_30}")
|
||||
libomp_append(cppflags_local "-D KMP_USE_ADAPTIVE_LOCKS" IF_TRUE_1_0 LIBOMP_USE_ADAPTIVE_LOCKS)
|
||||
libomp_append(cppflags_local "-D KMP_DEBUG_ADAPTIVE_LOCKS=0")
|
||||
libomp_append(cppflags_local "-D KMP_USE_INTERNODE_ALIGNMENT" IF_TRUE_1_0 LIBOMP_USE_INTERNODE_ALIGNMENT)
|
||||
# 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 "41")
|
||||
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()
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// 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.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# Determine the architecture from predefined compiler macros
|
||||
# The architecture name can only contain alphanumeric characters and underscores (i.e., C identifier)
|
||||
|
||||
# void get_architecture(string* return_arch)
|
||||
# - Returns the architecture in return_arch
|
||||
function(libomp_get_architecture return_arch)
|
||||
set(detect_arch_src_txt "
|
||||
#if defined(__KNC__)
|
||||
#error ARCHITECTURE=mic
|
||||
#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
|
||||
#error ARCHITECTURE=x86_64
|
||||
#elif defined(__i386) || defined(__i386__) || defined(__IA32__) || defined(_M_I86) || defined(_M_IX86) || defined(__X86__) || defined(_X86_)
|
||||
#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
|
||||
#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
|
||||
#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
|
||||
#elif defined(__ARM_ARCH_3__) || defined(__ARM_ARCH_3M__)
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__ARM_ARCH_2__)
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__arm__) || defined(_M_ARM) || defined(_ARM)
|
||||
#error ARCHITECTURE=arm
|
||||
#elif defined(__aarch64__)
|
||||
#error ARCHITECTURE=aarch64
|
||||
#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
|
||||
#error ARCHITECTURE=ppc64le
|
||||
#elif defined(__powerpc64__)
|
||||
#error ARCHITECTURE=ppc64
|
||||
#else
|
||||
#error ARCHITECTURE=UnknownArchitecture
|
||||
#endif
|
||||
")
|
||||
# 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}/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}")
|
||||
|
||||
# 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)
|
||||
|
||||
# Remove ${detect_arch_src_txt} from cmake/ subdirectory
|
||||
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/libomp_detect_arch.c")
|
||||
endfunction()
|
||||
@@ -0,0 +1,228 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// 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}.0"
|
||||
IF_DEFINED CMAKE_C_OSX_CURRENT_VERSION_FLAG)
|
||||
libomp_append(ldflags_local "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${LIBOMP_VERSION}.0"
|
||||
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}")
|
||||
if(${IA32})
|
||||
libomp_append(libflags_local -lirc_pic LIBOMP_HAVE_IRC_PIC_LIBRARY)
|
||||
endif()
|
||||
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 expand-vars.pl flags
|
||||
function(libomp_get_evflags evflags)
|
||||
set(evflags_local)
|
||||
libomp_append(evflags_local "-D KMP_TYPE=\"${LIBOMP_LEGAL_TYPE}\"")
|
||||
libomp_append(evflags_local "-D KMP_ARCH=\"${LIBOMP_LEGAL_ARCH}\"")
|
||||
libomp_append(evflags_local "-D KMP_VERSION_MAJOR=${LIBOMP_VERSION}")
|
||||
libomp_append(evflags_local "-D KMP_VERSION_MINOR=0")
|
||||
libomp_append(evflags_local "-D KMP_VERSION_BUILD=${LIBOMP_BUILD_NUMBER}")
|
||||
libomp_append(evflags_local "-D KMP_BUILD_DATE=\"${LIBOMP_DATE}\"")
|
||||
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
|
||||
libomp_append(evflags_local "-D KMP_DIAG=1")
|
||||
libomp_append(evflags_local "-D KMP_DEBUG_INFO=1")
|
||||
else()
|
||||
libomp_append(evflags_local "-D KMP_DIAG=0")
|
||||
libomp_append(evflags_local "-D KMP_DEBUG_INFO=0")
|
||||
endif()
|
||||
if(${LIBOMP_OMP_VERSION} EQUAL 40 OR ${LIBOMP_OMP_VERSION} GREATER 40)
|
||||
libomp_append(evflags_local "-D OMP_VERSION=201307")
|
||||
elseif(${LIBOMP_OMP_VERSION} EQUAL 30 OR ${LIBOMP_OMP_VERSION} GREATER 30)
|
||||
libomp_append(evflags_local "-D OMP_VERSION=201107")
|
||||
else()
|
||||
libomp_append(evflags_local "-D OMP_VERSION=200505")
|
||||
endif()
|
||||
set(${evflags} ${evflags_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)
|
||||
if(${LIBOMP_OMP_VERSION} GREATER 41 OR ${LIBOMP_OMP_VERSION} EQUAL 41)
|
||||
libomp_append(gdflags_local "-D OMP_41")
|
||||
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,215 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// 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})
|
||||
if(APPLE)
|
||||
set(libomp_test_touch_env "DYLD_LIBRARY_PATH=.:${LIBOMP_OUTPUT_DIRECTORY}:$ENV{DYLD_LIBRARY_PATH}")
|
||||
else()
|
||||
set(libomp_test_touch_env "LD_LIBRARY_PATH=.:${LIBOMP_OUTPUT_DIRECTORY}:$ENV{LD_LIBRARY_PATH}")
|
||||
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 --os=${LIBOMP_PERL_SCRIPT_OS}
|
||||
--arch=${LIBOMP_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_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)
|
||||
elseif(APPLE)
|
||||
set(libomp_expected_library_deps /usr/lib/libSystem.B.dylib)
|
||||
elseif(WIN32)
|
||||
set(libomp_expected_library_deps kernel32.dll)
|
||||
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)
|
||||
endif()
|
||||
libomp_append(libomp_expected_library_deps libstdc++.so.6 LIBOMP_USE_STDCPPLIB)
|
||||
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_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()
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// 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(CheckLibraryExists)
|
||||
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= flag which expects a certain format for operating systems. 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()
|
||||
|
||||
# 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(NOT (WIN32 OR APPLE) AND (${IA32} OR ${INTEL64} OR ${MIC}))
|
||||
set(LIBOMP_HAVE_STATS TRUE)
|
||||
else()
|
||||
set(LIBOMP_HAVE_STATS FALSE)
|
||||
endif()
|
||||
|
||||
# Check if OMPT support is available
|
||||
if(NOT WIN32)
|
||||
set(LIBOMP_HAVE_OMPT_SUPPORT TRUE)
|
||||
else()
|
||||
set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)
|
||||
endif()
|
||||
+11239
-8092
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
|
||||
# identify the project. Note that if you do not use Doxywizard you need
|
||||
# to put quotes around the project name if it contains spaces.
|
||||
|
||||
PROJECT_NAME = "Intel® OpenMP* Runtime Library"
|
||||
PROJECT_NAME = "LLVM OpenMP* Runtime Library"
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
||||
# This could be handy for archiving the generated documentation or
|
||||
@@ -1539,7 +1539,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# undefined via #undef or recursively expanded use the := operator
|
||||
# instead of the = operator.
|
||||
|
||||
PREDEFINED = OMP_30_ENABLED=1, OMP_40_ENABLED=1
|
||||
PREDEFINED = OMP_30_ENABLED=1, OMP_40_ENABLED=1, KMP_STATS_ENABLED=1
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||
# this tag can be used to specify a list of macro names that should be expanded.
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
\begin{titlepage}
|
||||
\vspace*{7cm}
|
||||
\begin{center}
|
||||
{\Large Intel\textsuperscript{\textregistered} OpenMP\textsuperscript{*} Runtime Library }\\
|
||||
{\Large LLVM OpenMP\textsuperscript{*} Runtime Library }\\
|
||||
\vspace*{1cm}
|
||||
{\large Generated by Doxygen $doxygenversion }\\
|
||||
\vspace*{0.5cm}
|
||||
@@ -59,31 +59,16 @@
|
||||
\end{center}
|
||||
\end{titlepage}
|
||||
|
||||
{\bf FTC Optimization Notice}
|
||||
\\
|
||||
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for
|
||||
optimizations that are not unique to Intel microprocessors. These optimizations include SSE2,
|
||||
SSE3, and SSE3 instruction sets and other optimizations. Intel does not guarantee the
|
||||
availability, functionality, or effectiveness of any optimization on microprocessors not
|
||||
manufactured by Intel.
|
||||
|
||||
Microprocessor-dependent optimizations in this product are intended for use with Intel
|
||||
microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for
|
||||
Intel microprocessors. Please refer to the applicable product User and Reference Guides for
|
||||
more information regarding the specific instruction sets covered by this notice.
|
||||
|
||||
Notice revision \#20110804
|
||||
|
||||
{\bf Trademarks}
|
||||
\\
|
||||
Intel, Xeon, and Intel Xeon Phi are trademarks of Intel Corporation in the U.S. and/or other countries.
|
||||
|
||||
\textsuperscript{*} Other names and brands may be claimed as the property of others.
|
||||
|
||||
The OpenMP name and the OpenMP logo are registered trademarks of the OpenMP Architecture Review Board.
|
||||
|
||||
This document is Copyright \textcopyright 2013, Intel Corporation. All rights reserved.
|
||||
Intel, Xeon, and Intel Xeon Phi are trademarks of Intel Corporation in the U.S. and/or other countries.
|
||||
|
||||
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
|
||||
\pagenumbering{roman}
|
||||
\tableofcontents
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
/*! @mainpage Intel® OpenMP* Runtime Library Interface
|
||||
/*! @mainpage LLVM OpenMP* Runtime Library Interface
|
||||
@section sec_intro Introduction
|
||||
|
||||
This document describes the interface provided by the
|
||||
Intel® OpenMP\other runtime library to the compiler.
|
||||
LLVM OpenMP\other runtime library to the compiler.
|
||||
Routines that are directly called as simple functions by user code are
|
||||
not currently described here, since their definition is in the OpenMP
|
||||
specification available from http://openmp.org
|
||||
@@ -208,6 +208,7 @@ are documented in different modules.
|
||||
- @ref THREADPRIVATE functions to support thread private data, copyin etc
|
||||
- @ref SYNCHRONIZATION functions to support `omp critical`, `omp barrier`, `omp master`, reductions etc
|
||||
- @ref ATOMIC_OPS functions to support atomic operations
|
||||
- @ref STATS_GATHERING macros to support developer profiling of libomp
|
||||
- Documentation on tasking has still to be written...
|
||||
|
||||
@section SEC_EXAMPLES Examples
|
||||
@@ -319,8 +320,29 @@ These functions are used for implementing barriers.
|
||||
@defgroup THREADPRIVATE Thread private data support
|
||||
These functions support copyin/out and thread private data.
|
||||
|
||||
@defgroup STATS_GATHERING Statistics Gathering from OMPTB
|
||||
These macros support profiling the libomp library. Use --stats=on when building with build.pl to enable
|
||||
and then use the KMP_* macros to profile (through counts or clock ticks) libomp during execution of an OpenMP program.
|
||||
|
||||
@section sec_stats_env_vars Environment Variables
|
||||
|
||||
This section describes the environment variables relevent to stats-gathering in libomp
|
||||
|
||||
@code
|
||||
KMP_STATS_FILE
|
||||
@endcode
|
||||
This environment variable is set to an output filename that will be appended *NOT OVERWRITTEN* if it exists. If this environment variable is undefined, the statistics will be output to stderr
|
||||
|
||||
@code
|
||||
KMP_STATS_THREADS
|
||||
@endcode
|
||||
This environment variable indicates to print thread-specific statistics as well as aggregate statistics. Each thread's statistics will be shown as well as the collective sum of all threads. The values "true", "on", "1", "yes" will all indicate to print per thread statistics.
|
||||
|
||||
@defgroup TASKING Tasking support
|
||||
These functions support are used to implement tasking constructs.
|
||||
These functions support tasking constructs.
|
||||
|
||||
@defgroup USER User visible functions
|
||||
These functions can be called directly by the user, but are runtime library specific, rather than being OpenMP interfaces.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
+297
-119
@@ -1,137 +1,315 @@
|
||||
set(OMP_SHLIBEXT "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#//
|
||||
#// 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.
|
||||
#//
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
execute_process(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE BUILD_TIME)
|
||||
string(REGEX REPLACE "\n" "" BUILD_TIME ${BUILD_TIME})
|
||||
# Using expand-vars.pl to generate files
|
||||
# - 'file' is generated using expand-vars.pl and 'file'.var
|
||||
# - Any .var file should use this recipe
|
||||
# TODO: Use CMake's configure_file() instead
|
||||
macro(libomp_expand_vars_recipe file_dir filename)
|
||||
get_source_file_property(libomp_extra_evflags ${filename} EV_COMPILE_DEFINITIONS)
|
||||
if("${libomp_extra_evflags}" MATCHES "NOTFOUND")
|
||||
set(libomp_extra_evflags)
|
||||
else()
|
||||
libomp_string_to_list("${libomp_extra_evflags}" libomp_extra_evflags)
|
||||
endif()
|
||||
if(NOT "${filename}" STREQUAL "")
|
||||
add_custom_command(
|
||||
OUTPUT ${filename}
|
||||
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/expand-vars.pl
|
||||
--strict ${LIBOMP_EVFLAGS} ${libomp_extra_evflags} ${file_dir}/${filename}.var ${filename}
|
||||
DEPENDS ${file_dir}/${filename}.var kmp_version.c ${LIBOMP_TOOLS_DIR}/expand-vars.pl
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
libomp_get_evflags(LIBOMP_EVFLAGS)
|
||||
libomp_string_to_list("${LIBOMP_EVFLAGS}" LIBOMP_EVFLAGS)
|
||||
set_source_files_properties(omp_lib.h PROPERTIES EV_COMPILE_DEFINITIONS "-D KMP_INT_PTR_KIND=\"int_ptr_kind()\"")
|
||||
set_source_files_properties(libomp.rc PROPERTIES EV_COMPILE_DEFINITIONS "-D KMP_FILE=${LIBOMP_LIB_FILE}" GENERATED TRUE)
|
||||
libomp_expand_vars_recipe(${LIBOMP_INC_DIR} omp.h)
|
||||
libomp_expand_vars_recipe(${LIBOMP_INC_DIR} ompt.h)
|
||||
libomp_expand_vars_recipe(${LIBOMP_INC_DIR} omp_lib.h)
|
||||
libomp_expand_vars_recipe(${LIBOMP_INC_DIR} omp_lib.f)
|
||||
libomp_expand_vars_recipe(${LIBOMP_INC_DIR} omp_lib.f90)
|
||||
libomp_expand_vars_recipe(${LIBOMP_SRC_DIR} libomp.rc)
|
||||
|
||||
# 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}
|
||||
--arch=${LIBOMP_ARCH} --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}
|
||||
--arch=${LIBOMP_ARCH} --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
|
||||
)
|
||||
|
||||
# Set the -D definitions for all sources
|
||||
libomp_get_definitions_flags(LIBOMP_CONFIGURED_DEFINITIONS_FLAGS)
|
||||
add_definitions(${LIBOMP_CONFIGURED_DEFINITIONS_FLAGS})
|
||||
|
||||
# Set the -I includes for all sources
|
||||
include_directories(
|
||||
.
|
||||
include
|
||||
include/${OMP_VERSION}
|
||||
i18n
|
||||
thirdparty/ittnotify
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${LIBOMP_SRC_DIR}
|
||||
${LIBOMP_SRC_DIR}/i18n
|
||||
${LIBOMP_INC_DIR}
|
||||
${LIBOMP_SRC_DIR}/thirdparty/ittnotify
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(OS_GEN "win")
|
||||
elseif(APPLE)
|
||||
set(OS_GEN "mac")
|
||||
elseif(UNIX)
|
||||
set(OS_GEN "lin")
|
||||
# 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()
|
||||
message(FATAL_ERROR "Unsupported OS")
|
||||
# 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)
|
||||
|
||||
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()
|
||||
|
||||
if("${ARCH}" STREQUAL "")
|
||||
set(ARCH "32e")
|
||||
# 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(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
|
||||
endif()
|
||||
|
||||
set(ARCH_STR "Intel(R) 64")
|
||||
|
||||
set(FEATURE_FLAGS "-D USE_ITT_BUILD")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D NDEBUG")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_ARCH_STR=\"\\\"${ARCH_STR}\\\"\"")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D _GNU_SOURCE")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D _REENTRANT")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ASSERT")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D BUILD_I8")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D BUILD_TV")
|
||||
if(APPLE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -current_version 5.0")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -compatibility_version 5.0")
|
||||
endif()
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_LIBRARY_FILE=\\\"libiomp5.${OMP_SHLIBEXT}\\\"")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_VERSION_MAJOR=${VERSION}")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D CACHE_LINE=64")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_ADJUST_BLOCKTIME=1")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D BUILD_PARALLEL_ORDERED")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_ASM_INTRINS")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_LOAD_BALANCE")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_CBLKDATA")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D GUIDEDLL_EXPORTS")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_GOMP_COMPAT")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ADAPTIVE_LOCKS=1")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_DEBUG_ADAPTIVE_LOCKS=0")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_50_ENABLED=0")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_41_ENABLED=0")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_40_ENABLED=1")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_30_ENABLED=1")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_ITT_NOTIFY=1")
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_")
|
||||
if (NOT APPLE)
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_TDATA_GTID")
|
||||
endif()
|
||||
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D _KMP_BUILD_TIME=\"\\\"${BUILD_TIME} UTC\\\"\"")
|
||||
|
||||
set(COMMON_FLAGS "-fPIC")
|
||||
set(COMMON_FLAGS "${COMMON_FLAGS} -Wno-unused-value")
|
||||
set(COMMON_FLAGS "${COMMON_FLAGS} -Wno-switch")
|
||||
set(COMMON_FLAGS "${COMMON_FLAGS} -Wno-deprecated-register")
|
||||
set(COMMON_FLAGS "${COMMON_FLAGS} -fno-exceptions")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FEATURE_FLAGS} ${COMMON_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FEATURE_FLAGS} ${COMMON_FLAGS}")
|
||||
|
||||
set(ASM_SOURCES
|
||||
z_Linux_asm.s
|
||||
)
|
||||
set(SOURCES
|
||||
thirdparty/ittnotify/ittnotify_static.c
|
||||
kmp_affinity.cpp
|
||||
kmp_alloc.c
|
||||
kmp_atomic.c
|
||||
kmp_cancel.cpp
|
||||
kmp_csupport.c
|
||||
kmp_debug.c
|
||||
kmp_dispatch.cpp
|
||||
kmp_environment.c
|
||||
kmp_error.c
|
||||
kmp_ftn_cdecl.c
|
||||
kmp_ftn_extra.c
|
||||
kmp_global.c
|
||||
kmp_gsupport.c
|
||||
kmp_i18n.c
|
||||
kmp_io.c
|
||||
kmp_itt.c
|
||||
kmp_lock.cpp
|
||||
kmp_runtime.c
|
||||
kmp_sched.cpp
|
||||
kmp_settings.c
|
||||
kmp_str.c
|
||||
kmp_taskdeps.cpp
|
||||
kmp_tasking.c
|
||||
kmp_taskq.c
|
||||
kmp_threadprivate.c
|
||||
kmp_utility.c
|
||||
kmp_version.c
|
||||
z_Linux_util.c
|
||||
# Add the OpenMP library
|
||||
libomp_get_ldflags(LIBOMP_CONFIGURED_LDFLAGS)
|
||||
add_library(omp SHARED ${LIBOMP_SOURCE_FILES})
|
||||
set_target_properties(omp PROPERTIES
|
||||
PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_LIB_FILE}"
|
||||
LINK_FLAGS "${LIBOMP_CONFIGURED_LDFLAGS}"
|
||||
LINKER_LANGUAGE C # use C Compiler for linking step
|
||||
SKIP_BUILD_RPATH true # have Mac linker -install_name just be "-install_name libomp.dylib"
|
||||
)
|
||||
|
||||
set_source_files_properties(${SOURCES} PROPERTIES LANGUAGE CXX)
|
||||
set_source_files_properties(${ASM_SOURCES} PROPERTIES LANGUAGE CXX)
|
||||
# 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})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT kmp_i18n_id.inc
|
||||
COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/../tools/message-converter.pl --os=${OS_GEN} --arch=${ARCH} --prefix=kmp_i18n --enum=kmp_i18n_id.inc ${CMAKE_CURRENT_SOURCE_DIR}/i18n/en_US.txt
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT kmp_i18n_default.inc
|
||||
COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/../tools/message-converter.pl --os=${OS_GEN} --arch=${ARCH} --prefix=kmp_i18n --default=kmp_i18n_default.inc ${CMAKE_CURRENT_SOURCE_DIR}/i18n/en_US.txt
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT omp.h
|
||||
COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/../tools/expand-vars.pl --strict -D Revision=\"\\$$Revision\" -D Date=\"\\$$Date\" -D KMP_TYPE=\"Performance\" -D KMP_ARCH=\"\\\"${ARCH_STR}\\\"\" -D KMP_VERSION_MAJOR=${VERSION} -D KMP_VERSION_MINOR=0 -D KMP_VERSION_BUILD=00000000 -D KMP_BUILD_DATE=\"${BUILD_TIME} UTC\" -D KMP_TARGET_COMPILER=12 -D KMP_DIAG=0 -D KMP_DEBUG_INFO=0 -D OMP_VERSION=${OMP_VERSION} ${CMAKE_CURRENT_SOURCE_DIR}/include/${OMP_VERSION_NUM}/omp.h.var omp.h
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT z_Linux_asm.o
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -c -o z_Linux_asm.o -D KMP_ASM_INTRINS -D KMP_GOMP_COMPAT -D KMP_ARCH_X86_64 -x assembler-with-cpp ${CMAKE_CURRENT_SOURCE_DIR}/${ASM_SOURCES}
|
||||
)
|
||||
# Create *.inc and omp.h before compiling any sources
|
||||
# objects depend on : .inc files and omp.h (and ompt.h if LIBOMP_OMPT_SUPPORT is on)
|
||||
# This way the *.inc and omp.h are generated before any compilations take place
|
||||
set(LIBOMP_NEEDED_HEADERS kmp_i18n_id.inc kmp_i18n_default.inc omp.h)
|
||||
libomp_append(LIBOMP_NEEDED_HEADERS ompt.h LIBOMP_OMPT_SUPPORT)
|
||||
add_custom_target(libomp-needed-headers DEPENDS ${LIBOMP_NEEDED_HEADERS})
|
||||
add_dependencies(omp libomp-needed-headers)
|
||||
|
||||
add_custom_target(gen_kmp_i18n DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc omp.h z_Linux_asm.o)
|
||||
# Windows specific build rules
|
||||
if(WIN32)
|
||||
# Create .def and .rc file before compiling any sources
|
||||
add_custom_target(libomp-needed-windows-files DEPENDS ${LIBOMP_LIB_NAME}.def libomp.rc)
|
||||
add_dependencies(omp libomp-needed-windows-files)
|
||||
# z_Windows_NT-586_asm.asm (masm file) send it i386 or x86_64 architecture definition flag
|
||||
if(${IA32})
|
||||
set_source_files_properties(z_Windows_NT-586_asm.asm PROPERTIES COMPILE_DEFINITIONS "_M_IA32")
|
||||
elseif(${INTEL64})
|
||||
set_source_files_properties(z_Windows_NT-586_asm.asm PROPERTIES COMPILE_DEFINITIONS "_M_AMD64")
|
||||
endif()
|
||||
set_source_files_properties(thirdparty/ittnotify/ittnotify_static.c PROPERTIES COMPILE_DEFINITIONS "UNICODE")
|
||||
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt")
|
||||
# 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}.0 # 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
|
||||
SKIP_BUILD_RPATH true
|
||||
)
|
||||
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()
|
||||
|
||||
# Building the Fortran module files
|
||||
# One compilation step creates both omp_lib.mod and omp_lib_kinds.mod
|
||||
if(${LIBOMP_FORTRAN_MODULES})
|
||||
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 ${LIBOMP_FORTRAN_SOURCE_FILE} omp_lib.h
|
||||
)
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES omp_lib${CMAKE_C_OUTPUT_EXTENSION})
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
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)
|
||||
endif()
|
||||
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}${CMAKE_SHARED_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)")
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\"
|
||||
\"${alias}${CMAKE_STATIC_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 \"${LIBOMP_LIB_FILE}\"
|
||||
\"${alias}${CMAKE_SHARED_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}
|
||||
)
|
||||
if(${LIBOMP_OMPT_SUPPORT})
|
||||
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()
|
||||
|
||||
add_library(iomp5 SHARED ${SOURCES} z_Linux_asm.o)
|
||||
add_dependencies(iomp5 gen_kmp_i18n)
|
||||
|
||||
+4
-2
@@ -1,6 +1,4 @@
|
||||
# defs.mk
|
||||
# $Revision: 42061 $
|
||||
# $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
@@ -41,7 +39,11 @@ 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))
|
||||
|
||||
+66
-5
@@ -161,10 +161,8 @@
|
||||
# Regular entry points
|
||||
__kmp_wait_yield_4
|
||||
__kmp_wait_yield_8
|
||||
__kmp_wait_sleep
|
||||
__kmp_fork_call
|
||||
__kmp_invoke_microtask
|
||||
__kmp_release
|
||||
__kmp_launch_monitor
|
||||
__kmp_launch_worker
|
||||
__kmp_reap_monitor
|
||||
@@ -184,6 +182,10 @@
|
||||
%endif
|
||||
|
||||
|
||||
#if USE_DEBUGGER
|
||||
__kmp_debugging DATA
|
||||
__kmp_omp_debug_struct_info DATA
|
||||
#endif /* USE_DEBUGGER */
|
||||
|
||||
# Symbols for MS mutual detection:
|
||||
_You_must_link_with_exactly_one_OpenMP_library DATA
|
||||
@@ -192,6 +194,14 @@
|
||||
_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
|
||||
|
||||
|
||||
# VT_getthid 1
|
||||
# vtgthid 2
|
||||
|
||||
@@ -360,9 +370,29 @@ kmpc_set_defaults 224
|
||||
__kmpc_cancel 244
|
||||
__kmpc_cancellationpoint 245
|
||||
__kmpc_cancel_barrier 246
|
||||
__kmpc_dist_for_static_init_4 247
|
||||
__kmpc_dist_for_static_init_4u 248
|
||||
__kmpc_dist_for_static_init_8 249
|
||||
__kmpc_dist_for_static_init_8u 250
|
||||
__kmpc_dist_dispatch_init_4 251
|
||||
__kmpc_dist_dispatch_init_4u 252
|
||||
__kmpc_dist_dispatch_init_8 253
|
||||
__kmpc_dist_dispatch_init_8u 254
|
||||
__kmpc_team_static_init_4 255
|
||||
__kmpc_team_static_init_4u 256
|
||||
__kmpc_team_static_init_8 257
|
||||
__kmpc_team_static_init_8u 258
|
||||
%endif # OMP_40
|
||||
%endif
|
||||
|
||||
# OpenMP 4.1 entry points
|
||||
%ifndef stub
|
||||
%ifdef OMP_41
|
||||
__kmpc_proxy_task_completed 259
|
||||
__kmpc_proxy_task_completed_ooo 260
|
||||
%endif
|
||||
%endif
|
||||
|
||||
# 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.
|
||||
# User API entry points are entry points that start with 'kmp_' or 'omp_'.
|
||||
@@ -460,6 +490,7 @@ kmp_set_warnings_off 780
|
||||
omp_get_team_num 866
|
||||
omp_get_cancellation 867
|
||||
kmp_get_cancellation_status 868
|
||||
omp_is_initial_device 869
|
||||
%endif # OMP_40
|
||||
|
||||
%ifndef stub
|
||||
@@ -471,7 +502,9 @@ kmp_set_warnings_off 780
|
||||
|
||||
# ATOMIC entries
|
||||
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_cmplx16_div 2000
|
||||
%endif
|
||||
|
||||
__kmpc_atomic_fixed1_add 2001
|
||||
__kmpc_atomic_fixed1_andb 2002
|
||||
@@ -577,6 +610,7 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_cmplx10_sub 2094
|
||||
__kmpc_atomic_cmplx10_mul 2095
|
||||
__kmpc_atomic_cmplx10_div 2096
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_cmplx16_add 2097
|
||||
__kmpc_atomic_cmplx16_sub 2098
|
||||
__kmpc_atomic_cmplx16_mul 2099
|
||||
@@ -627,6 +661,7 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_float10_sub_fp 2136
|
||||
__kmpc_atomic_float10_mul_fp 2137
|
||||
__kmpc_atomic_float10_div_fp 2138
|
||||
%endif
|
||||
|
||||
__kmpc_atomic_fixed1_mul_float8 2169
|
||||
__kmpc_atomic_fixed1_div_float8 2170
|
||||
@@ -661,6 +696,7 @@ kmp_set_warnings_off 780
|
||||
|
||||
%ifdef arch_32
|
||||
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_float16_add_a16 2255
|
||||
__kmpc_atomic_float16_sub_a16 2256
|
||||
__kmpc_atomic_float16_mul_a16 2257
|
||||
@@ -672,6 +708,7 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_cmplx16_sub_a16 2262
|
||||
__kmpc_atomic_cmplx16_mul_a16 2263
|
||||
__kmpc_atomic_cmplx16_div_a16 2264
|
||||
%endif
|
||||
|
||||
%endif
|
||||
|
||||
@@ -686,14 +723,18 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_float4_rd 2269
|
||||
__kmpc_atomic_float8_rd 2270
|
||||
__kmpc_atomic_float10_rd 2271
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_float16_rd 2272
|
||||
%endif
|
||||
__kmpc_atomic_cmplx4_rd 2273
|
||||
__kmpc_atomic_cmplx8_rd 2274
|
||||
__kmpc_atomic_cmplx10_rd 2275
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_cmplx16_rd 2276
|
||||
%ifdef arch_32
|
||||
__kmpc_atomic_float16_a16_rd 2277
|
||||
__kmpc_atomic_cmplx16_a16_rd 2278
|
||||
%ifdef arch_32
|
||||
__kmpc_atomic_float16_a16_rd 2277
|
||||
__kmpc_atomic_cmplx16_a16_rd 2278
|
||||
%endif
|
||||
%endif
|
||||
__kmpc_atomic_fixed1_wr 2279
|
||||
__kmpc_atomic_fixed2_wr 2280
|
||||
@@ -702,15 +743,19 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_float4_wr 2283
|
||||
__kmpc_atomic_float8_wr 2284
|
||||
__kmpc_atomic_float10_wr 2285
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_float16_wr 2286
|
||||
%endif
|
||||
__kmpc_atomic_cmplx4_wr 2287
|
||||
__kmpc_atomic_cmplx8_wr 2288
|
||||
__kmpc_atomic_cmplx10_wr 2289
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_cmplx16_wr 2290
|
||||
%ifdef arch_32
|
||||
__kmpc_atomic_float16_a16_wr 2291
|
||||
__kmpc_atomic_cmplx16_a16_wr 2292
|
||||
%endif
|
||||
%endif
|
||||
__kmpc_atomic_fixed1_add_cpt 2293
|
||||
__kmpc_atomic_fixed1_andb_cpt 2294
|
||||
__kmpc_atomic_fixed1_div_cpt 2295
|
||||
@@ -783,8 +828,10 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_float4_min_cpt 2362
|
||||
__kmpc_atomic_float8_max_cpt 2363
|
||||
__kmpc_atomic_float8_min_cpt 2364
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_float16_max_cpt 2365
|
||||
__kmpc_atomic_float16_min_cpt 2366
|
||||
%endif
|
||||
__kmpc_atomic_fixed1_neqv_cpt 2367
|
||||
__kmpc_atomic_fixed2_neqv_cpt 2368
|
||||
__kmpc_atomic_fixed4_neqv_cpt 2369
|
||||
@@ -797,10 +844,12 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_float10_sub_cpt 2376
|
||||
__kmpc_atomic_float10_mul_cpt 2377
|
||||
__kmpc_atomic_float10_div_cpt 2378
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_float16_add_cpt 2379
|
||||
__kmpc_atomic_float16_sub_cpt 2380
|
||||
__kmpc_atomic_float16_mul_cpt 2381
|
||||
__kmpc_atomic_float16_div_cpt 2382
|
||||
%endif
|
||||
__kmpc_atomic_cmplx4_add_cpt 2383
|
||||
__kmpc_atomic_cmplx4_sub_cpt 2384
|
||||
__kmpc_atomic_cmplx4_mul_cpt 2385
|
||||
@@ -813,13 +862,16 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_cmplx10_sub_cpt 2392
|
||||
__kmpc_atomic_cmplx10_mul_cpt 2393
|
||||
__kmpc_atomic_cmplx10_div_cpt 2394
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_cmplx16_add_cpt 2395
|
||||
__kmpc_atomic_cmplx16_sub_cpt 2396
|
||||
__kmpc_atomic_cmplx16_mul_cpt 2397
|
||||
__kmpc_atomic_cmplx16_div_cpt 2398
|
||||
%endif
|
||||
#__kmpc_atomic_cmplx4_add_cpt_tmp 2409
|
||||
|
||||
%ifdef arch_32
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_float16_add_a16_cpt 2399
|
||||
__kmpc_atomic_float16_sub_a16_cpt 2400
|
||||
__kmpc_atomic_float16_mul_a16_cpt 2401
|
||||
@@ -831,6 +883,7 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_cmplx16_mul_a16_cpt 2407
|
||||
__kmpc_atomic_cmplx16_div_a16_cpt 2408
|
||||
%endif
|
||||
%endif
|
||||
|
||||
__kmpc_atomic_start 2410
|
||||
__kmpc_atomic_end 2411
|
||||
@@ -846,16 +899,20 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_float4_swp 2416
|
||||
__kmpc_atomic_float8_swp 2417
|
||||
__kmpc_atomic_float10_swp 2418
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_float16_swp 2419
|
||||
%endif
|
||||
__kmpc_atomic_cmplx4_swp 2420
|
||||
__kmpc_atomic_cmplx8_swp 2421
|
||||
__kmpc_atomic_cmplx10_swp 2422
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_cmplx16_swp 2423
|
||||
|
||||
%ifdef arch_32
|
||||
__kmpc_atomic_float16_a16_swp 2424
|
||||
__kmpc_atomic_cmplx16_a16_swp 2425
|
||||
%endif
|
||||
%endif
|
||||
|
||||
__kmpc_atomic_fixed1_sub_cpt_rev 2426
|
||||
__kmpc_atomic_fixed1_div_cpt_rev 2427
|
||||
@@ -887,14 +944,17 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_float8_div_cpt_rev 2453
|
||||
__kmpc_atomic_float10_sub_cpt_rev 2454
|
||||
__kmpc_atomic_float10_div_cpt_rev 2455
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_float16_sub_cpt_rev 2456
|
||||
__kmpc_atomic_float16_div_cpt_rev 2457
|
||||
%endif
|
||||
__kmpc_atomic_cmplx4_sub_cpt_rev 2458
|
||||
__kmpc_atomic_cmplx4_div_cpt_rev 2459
|
||||
__kmpc_atomic_cmplx8_sub_cpt_rev 2460
|
||||
__kmpc_atomic_cmplx8_div_cpt_rev 2461
|
||||
__kmpc_atomic_cmplx10_sub_cpt_rev 2462
|
||||
__kmpc_atomic_cmplx10_div_cpt_rev 2463
|
||||
%ifdef HAVE_QUAD
|
||||
__kmpc_atomic_cmplx16_sub_cpt_rev 2464
|
||||
__kmpc_atomic_cmplx16_div_cpt_rev 2465
|
||||
|
||||
@@ -904,6 +964,7 @@ kmp_set_warnings_off 780
|
||||
__kmpc_atomic_cmplx16_sub_a16_cpt_rev 2468
|
||||
__kmpc_atomic_cmplx16_div_a16_cpt_rev 2469
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%endif # OMP_40
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
# This is version script for OMP RTL shared library (libiomp5*.so)
|
||||
# This is version script for OMP RTL shared library (libomp*.so)
|
||||
|
||||
VERSION {
|
||||
|
||||
@@ -21,6 +21,18 @@ VERSION {
|
||||
# "Normal" symbols.
|
||||
#
|
||||
omp_*; # Standard OpenMP functions.
|
||||
ompt_initialize; # OMPT initialization interface
|
||||
ompt_control; # OMPT control interface
|
||||
|
||||
#
|
||||
# OMPT state placeholders
|
||||
#
|
||||
ompt_idle;
|
||||
ompt_overhead;
|
||||
ompt_barrier_wait;
|
||||
ompt_task_wait;
|
||||
ompt_mutex_wait;
|
||||
|
||||
ompc_*; # omp.h renames some standard functions to ompc_*.
|
||||
kmp_*; # Intel extensions.
|
||||
kmpc_*; # Intel extensions.
|
||||
@@ -30,6 +42,13 @@ VERSION {
|
||||
_You_must_link_with_*; # Mutual detection/MS compatibility symbols.
|
||||
|
||||
|
||||
#
|
||||
# Debugger support.
|
||||
#
|
||||
#if USE_DEBUGGER
|
||||
__kmp_debugging;
|
||||
__kmp_omp_debug_struct_info;
|
||||
#endif /* USE_DEBUGGER */
|
||||
|
||||
#
|
||||
# Internal functions exported for testing purposes.
|
||||
@@ -40,6 +59,8 @@ VERSION {
|
||||
__kmp_thread_pool;
|
||||
__kmp_thread_pool_nth;
|
||||
|
||||
__kmp_reset_stats;
|
||||
|
||||
#if USE_ITT_BUILD
|
||||
#
|
||||
# ITT support.
|
||||
@@ -64,8 +85,12 @@ VERSION {
|
||||
__kmp_launch_worker;
|
||||
__kmp_reap_monitor;
|
||||
__kmp_reap_worker;
|
||||
__kmp_release;
|
||||
__kmp_wait_sleep;
|
||||
__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;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* extractExternal.cpp
|
||||
* $Revision: 42181 $
|
||||
* $Date: 2013-03-26 15:04:45 -0500 (Tue, 26 Mar 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -141,8 +139,8 @@ private:
|
||||
data = new char[length = _length];
|
||||
}
|
||||
*(unsigned*)data = length;
|
||||
memcpy(data + sizeof(unsigned), _data + sizeof(unsigned),
|
||||
length - sizeof(unsigned));
|
||||
KMP_MEMCPY(data + sizeof(unsigned), _data + sizeof(unsigned),
|
||||
length - sizeof(unsigned));
|
||||
makeDirectory();
|
||||
}
|
||||
public:
|
||||
@@ -194,7 +192,7 @@ public:
|
||||
size_t l = str.size();
|
||||
if(l > 8) {
|
||||
directory.insert(make_pair(str, p - data));
|
||||
memcpy(p, str.c_str(), l);
|
||||
KMP_MEMCPY(p, str.c_str(), l);
|
||||
p[l] = 0;
|
||||
p += l + 1;
|
||||
}
|
||||
@@ -213,7 +211,7 @@ public:
|
||||
if(str.size() <= 8) {
|
||||
// encoded directly
|
||||
((char*)&r)[7] = 0;
|
||||
strncpy((char*)&r, str.c_str(), 8);
|
||||
KMP_STRNCPY_S((char*)&r, sizeof(r), str.c_str(), 8);
|
||||
return r;
|
||||
} else {
|
||||
// represented as index into table
|
||||
|
||||
+25
-20
@@ -1,6 +1,4 @@
|
||||
# en_US.txt #
|
||||
# $Revision: 42659 $
|
||||
# $Date: 2013-09-12 09:22:48 -0500 (Thu, 12 Sep 2013) $
|
||||
|
||||
#
|
||||
#//===----------------------------------------------------------------------===//
|
||||
@@ -40,7 +38,7 @@ Language "English"
|
||||
Country "USA"
|
||||
LangId "1033"
|
||||
Version "2"
|
||||
Revision "20130911"
|
||||
Revision "20140827"
|
||||
|
||||
|
||||
|
||||
@@ -137,7 +135,6 @@ Pragma "%1$s pragma (at %2$s:%3$s():%4$s)"
|
||||
# Aff -- Affinity messages.
|
||||
# Cns -- Consistency check failures (KMP_CONSISTENCY_CHECK).
|
||||
# Itt -- ITT Notify-related messages.
|
||||
# Rml -- RML-related messages.
|
||||
|
||||
LibraryIsSerial "Library is \"serial\"."
|
||||
CantOpenMessageCatalog "Cannot open message catalog \"%1$s\":"
|
||||
@@ -290,7 +287,7 @@ ChangeThreadAffMaskError "Cannot change thread affinity mask."
|
||||
ThreadsMigrate "%1$s: Threads may migrate across %2$d innermost levels of machine"
|
||||
DecreaseToThreads "%1$s: decrease to %2$d threads"
|
||||
IncreaseToThreads "%1$s: increase to %2$d threads"
|
||||
BoundToOSProcSet "%1$s: Internal thread %2$d bound to OS proc set %3$s"
|
||||
OBSOLETE "%1$s: Internal thread %2$d bound to OS proc set %3$s"
|
||||
AffCapableUseCpuinfo "%1$s: Affinity capable, using cpuinfo file"
|
||||
AffUseGlobCpuid "%1$s: Affinity capable, using global cpuid info"
|
||||
AffCapableUseFlat "%1$s: Affinity capable, using default \"flat\" topology"
|
||||
@@ -315,7 +312,7 @@ OBSOLETE "%1$s: OS proc %2$d maps to package %3$d core %4$d
|
||||
OBSOLETE "%1$s: OS proc %2$d maps to package %3$d [core %4$d] thread %5$d"
|
||||
OBSOLETE "%1$s: OS proc %2$d maps to package %3$d core %4$d thread %5$d"
|
||||
OSProcMapToPack "%1$s: OS proc %2$d maps to %3$s"
|
||||
ChangeAffMask "%1$s: Internal thread %2$d changed affinity mask from %3$s to %4$s"
|
||||
OBSOLETE "%1$s: Internal thread %2$d changed affinity mask from %3$s to %4$s"
|
||||
OBSOLETE "%1$s: OS proc %2$d maps to package %3$d, CPU %4$d, TPU %5$d"
|
||||
OBSOLETE "%1$s: OS proc %2$d maps to package %3$d, CPU %4$d"
|
||||
OBSOLETE "%1$s: HT enabled; %2$d packages; %3$d TPU; %4$d TPUs per package"
|
||||
@@ -324,8 +321,8 @@ BarriersInDifferentOrder "Threads encountered barriers in different order. "
|
||||
FunctionError "Function %1$s failed:"
|
||||
TopologyExtra "%1$s: %2$s packages x %3$d cores/pkg x %4$d threads/core (%5$d total cores)"
|
||||
WrongMessageCatalog "Incompatible message catalog \"%1$s\": Version \"%2$s\" found, version \"%3$s\" expected."
|
||||
StgIgnored "%1$s: ignored because %3$s has been defined"
|
||||
# %1, %2 -- name and value of ignored variable, %3 -- name of variable with higher priority.
|
||||
StgIgnored "%1$s: ignored because %2$s has been defined"
|
||||
# %1, -- name of ignored variable, %2 -- name of variable with higher priority.
|
||||
OBSOLETE "%1$s: overrides %3$s specified before"
|
||||
# %1, %2 -- name and value of the overriding variable, %3 -- name of overriden variable.
|
||||
|
||||
@@ -354,7 +351,7 @@ CantConnectUsing "Cannot connect to %1$s - Using %2$s"
|
||||
LibNotSupport "%1$s does not support %2$s. Continuing without using %2$s."
|
||||
LibNotSupportFor "%1$s does not support %2$s for %3$s. Continuing without using %2$s."
|
||||
StaticLibNotSupport "Static %1$s does not support %2$s. Continuing without using %2$s."
|
||||
DynIRMLwoUseIrml "KMP_DYNAMIC_MODE=irml cannot be used with KMP_USE_IRML=0"
|
||||
OBSOLETE "KMP_DYNAMIC_MODE=irml cannot be used with KMP_USE_IRML=0"
|
||||
IttUnknownGroup "ittnotify: Unknown group \"%2$s\" specified in environment variable \"%1$s\"."
|
||||
IttEnvVarTooLong "ittnotify: Environment variable \"%1$s\" too long: Actual lengths is %2$lu, max allowed length is %3$lu."
|
||||
AffUseGlobCpuidL11 "%1$s: Affinity capable, using global cpuid leaf 11 info"
|
||||
@@ -369,15 +366,15 @@ IncompatibleLibrary "Incompatible %1$s library with version %2$s found.
|
||||
IttFunctionError "ittnotify: Function %1$s failed:"
|
||||
IttUnknownError "ittnofify: Error #%1$d."
|
||||
EnvMiddleWarn "%1$s must be set prior to first parallel region or certain API calls; ignored."
|
||||
CnsLockNotDestroyed "Lock initialized at %1$s(%3$d) was not destroyed"
|
||||
# %1, %2, %3, %4 -- file, func, line, col
|
||||
CnsLockNotDestroyed "Lock initialized at %1$s(%2$d) was not destroyed"
|
||||
# %1, %2, %3, %4 -- file, line, func, col
|
||||
CantLoadBalUsing "Cannot determine machine load balance - Using %1$s"
|
||||
AffNotCapableUsePthread "%1$s: Affinity not capable, using pthread info"
|
||||
AffUsePthread "%1$s: Affinity capable, using pthread info"
|
||||
RmlLoadLibFailed "Loading \"%1$s\" library failed:"
|
||||
RmlLookupFailed "Lookup of \"%1$s\" function failed:"
|
||||
RmlBufferTooSmall "Buffer too small."
|
||||
RmlUnknownError "Error #%1$d."
|
||||
OBSOLETE "Loading \"%1$s\" library failed:"
|
||||
OBSOLETE "Lookup of \"%1$s\" function failed:"
|
||||
OBSOLETE "Buffer too small."
|
||||
OBSOLETE "Error #%1$d."
|
||||
NthSyntaxError "%1$s: Invalid symbols found. Check the value \"%2$s\"."
|
||||
NthSpacesNotAllowed "%1$s: Spaces between digits are not allowed \"%2$s\"."
|
||||
AffStrParseFilename "%1$s: %2$s - parsing %3$s."
|
||||
@@ -395,9 +392,17 @@ AffThrPlaceInvalid "%1$s: invalid value \"%2$s\", valid format is \"nC
|
||||
AffThrPlaceUnsupported "KMP_PLACE_THREADS ignored: unsupported architecture."
|
||||
AffThrPlaceManyCores "KMP_PLACE_THREADS 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\"."
|
||||
EnvSpacesNotAllowed "%1$s: Spaces between digits are not allowed \"%2$s\"."
|
||||
AdaptiveNotSupported "%1$s: Adaptive locks are not supported; using queuing."
|
||||
EnvSyntaxError "%1$s: Invalid symbols found. Check the value \"%2$s\"."
|
||||
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."
|
||||
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\"."
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
-*- HINTS -*-
|
||||
@@ -448,8 +453,8 @@ GetNewerLibrary "It could be a result of using an older OMP library
|
||||
"compiler or memory corruption. You may check the proper OMP library "
|
||||
"is linked to the application."
|
||||
CheckEnvVar "Check %1$s environment variable, its value is \"%2$s\"."
|
||||
GetNewerIOMPLibrary "You may want to use an %1$s library that supports %2$s interface with version %3$s."
|
||||
GetNewerIRMLLibrary "You may want to use an %1$s library with version %2$s."
|
||||
OBSOLETE "You may want to use an %1$s library that supports %2$s interface with version %3$s."
|
||||
OBSOLETE "You may want to use an %1$s library with version %2$s."
|
||||
BadExeFormat "System error #193 is \"Bad format of EXE or DLL file\". "
|
||||
"Usually it means the file is found, but it is corrupted or "
|
||||
"a file for another architecture. "
|
||||
|
||||
@@ -1,256 +0,0 @@
|
||||
! include/25/omp_lib.f90.var
|
||||
! $Revision: 42061 $
|
||||
! $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!//
|
||||
!// 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.
|
||||
!//
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!
|
||||
|
||||
module omp_lib_kinds
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
|
||||
integer, parameter :: omp_integer_kind = c_int
|
||||
integer, parameter :: omp_logical_kind = 4
|
||||
integer, parameter :: omp_real_kind = c_float
|
||||
integer, parameter :: kmp_double_kind = c_double
|
||||
integer, parameter :: omp_lock_kind = c_intptr_t
|
||||
integer, parameter :: omp_nest_lock_kind = c_intptr_t
|
||||
integer, parameter :: kmp_pointer_kind = c_intptr_t
|
||||
integer, parameter :: kmp_size_t_kind = c_size_t
|
||||
|
||||
end module omp_lib_kinds
|
||||
|
||||
module omp_lib
|
||||
|
||||
use omp_lib_kinds
|
||||
|
||||
integer, parameter :: openmp_version = 200505
|
||||
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' )
|
||||
|
||||
interface
|
||||
|
||||
! ***
|
||||
! *** omp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine omp_set_num_threads(nthreads) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: nthreads
|
||||
end subroutine omp_set_num_threads
|
||||
|
||||
subroutine omp_set_dynamic(enable) bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
end subroutine omp_set_dynamic
|
||||
|
||||
subroutine omp_set_nested(enable) bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
end subroutine omp_set_nested
|
||||
|
||||
function omp_get_num_threads() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_threads
|
||||
end function omp_get_num_threads
|
||||
|
||||
function omp_get_max_threads() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_max_threads
|
||||
end function omp_get_max_threads
|
||||
|
||||
function omp_get_thread_num() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_thread_num
|
||||
end function omp_get_thread_num
|
||||
|
||||
function omp_get_num_procs() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_procs
|
||||
end function omp_get_num_procs
|
||||
|
||||
function omp_in_parallel() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_in_parallel
|
||||
end function omp_in_parallel
|
||||
|
||||
function omp_get_dynamic() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_get_dynamic
|
||||
end function omp_get_dynamic
|
||||
|
||||
function omp_get_nested() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_get_nested
|
||||
end function omp_get_nested
|
||||
|
||||
function omp_get_wtime() bind(c)
|
||||
use omp_lib_kinds
|
||||
real (kind=kmp_double_kind) omp_get_wtime
|
||||
end function omp_get_wtime
|
||||
|
||||
function omp_get_wtick() bind(c)
|
||||
use omp_lib_kinds
|
||||
real (kind=kmp_double_kind) omp_get_wtick
|
||||
end function omp_get_wtick
|
||||
|
||||
subroutine omp_init_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_init_lock
|
||||
|
||||
subroutine omp_destroy_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_destroy_lock
|
||||
|
||||
subroutine omp_set_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_set_lock
|
||||
|
||||
subroutine omp_unset_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_unset_lock
|
||||
|
||||
function omp_test_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_test_lock
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end function omp_test_lock
|
||||
|
||||
subroutine omp_init_nest_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end subroutine omp_init_nest_lock
|
||||
|
||||
subroutine omp_destroy_nest_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end subroutine omp_destroy_nest_lock
|
||||
|
||||
subroutine omp_set_nest_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end subroutine omp_set_nest_lock
|
||||
|
||||
subroutine omp_unset_nest_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end subroutine omp_unset_nest_lock
|
||||
|
||||
function omp_test_nest_lock(lockvar) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_test_nest_lock
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end function omp_test_nest_lock
|
||||
|
||||
! ***
|
||||
! *** kmp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine kmp_set_stacksize(size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: size
|
||||
end subroutine kmp_set_stacksize
|
||||
|
||||
subroutine kmp_set_stacksize_s(size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end subroutine kmp_set_stacksize_s
|
||||
|
||||
subroutine kmp_set_blocktime(msec) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: msec
|
||||
end subroutine kmp_set_blocktime
|
||||
|
||||
subroutine kmp_set_library_serial() bind(c)
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_library_serial
|
||||
|
||||
subroutine kmp_set_library_turnaround() bind(c)
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_library_turnaround
|
||||
|
||||
subroutine kmp_set_library_throughput() bind(c)
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_library_throughput
|
||||
|
||||
subroutine kmp_set_library(libnum) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: libnum
|
||||
end subroutine kmp_set_library
|
||||
|
||||
subroutine kmp_set_defaults(string) bind(c)
|
||||
use, intrinsic :: iso_c_binding
|
||||
character (kind=c_char) :: string(*)
|
||||
end subroutine kmp_set_defaults
|
||||
|
||||
function kmp_get_stacksize() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_stacksize
|
||||
end function kmp_get_stacksize
|
||||
|
||||
function kmp_get_stacksize_s() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
|
||||
end function kmp_get_stacksize_s
|
||||
|
||||
function kmp_get_blocktime() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_blocktime
|
||||
end function kmp_get_blocktime
|
||||
|
||||
function kmp_get_library() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_library
|
||||
end function kmp_get_library
|
||||
|
||||
function kmp_malloc(size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_malloc
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
integer (kind=kmp_size_t_kind), value :: nelem
|
||||
integer (kind=kmp_size_t_kind), value :: elsize
|
||||
end function kmp_calloc
|
||||
|
||||
function kmp_realloc(ptr, size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_realloc
|
||||
integer (kind=kmp_pointer_kind), value :: ptr
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_realloc
|
||||
|
||||
subroutine kmp_free(ptr) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind), value :: ptr
|
||||
end subroutine kmp_free
|
||||
|
||||
subroutine kmp_set_warnings_on() bind(c)
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_warnings_on
|
||||
|
||||
subroutine kmp_set_warnings_off() bind(c)
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_warnings_off
|
||||
|
||||
end interface
|
||||
|
||||
end module omp_lib
|
||||
@@ -1,460 +0,0 @@
|
||||
! include/25/omp_lib.h.var
|
||||
! $Revision: 42181 $
|
||||
! $Date: 2013-03-26 15:04:45 -0500 (Tue, 26 Mar 2013) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!//
|
||||
!// 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.
|
||||
!//
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!
|
||||
|
||||
!***
|
||||
!*** Some of the directives for the following routine extend past column 72,
|
||||
!*** so process this file in 132-column mode.
|
||||
!***
|
||||
|
||||
!dec$ fixedformlinesize:132
|
||||
|
||||
include 'omp_lib_kinds.h'
|
||||
|
||||
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(*), parameter :: kmp_build_date = '$KMP_BUILD_DATE'
|
||||
integer, parameter :: openmp_version = 200505
|
||||
|
||||
interface
|
||||
|
||||
! ***
|
||||
! *** omp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine omp_set_num_threads(nthreads)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) nthreads
|
||||
end subroutine omp_set_num_threads
|
||||
|
||||
subroutine omp_set_dynamic(enable)
|
||||
include 'omp_lib_kinds.h'
|
||||
logical (kind=omp_logical_kind) enable
|
||||
end subroutine omp_set_dynamic
|
||||
|
||||
subroutine omp_set_nested(enable)
|
||||
include 'omp_lib_kinds.h'
|
||||
logical (kind=omp_logical_kind) enable
|
||||
end subroutine omp_set_nested
|
||||
|
||||
function omp_get_num_threads()
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) omp_get_num_threads
|
||||
end function omp_get_num_threads
|
||||
|
||||
function omp_get_max_threads()
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) omp_get_max_threads
|
||||
end function omp_get_max_threads
|
||||
|
||||
function omp_get_thread_num()
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) omp_get_thread_num
|
||||
end function omp_get_thread_num
|
||||
|
||||
function omp_get_num_procs()
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) omp_get_num_procs
|
||||
end function omp_get_num_procs
|
||||
|
||||
function omp_in_parallel()
|
||||
include 'omp_lib_kinds.h'
|
||||
logical (kind=omp_logical_kind) omp_in_parallel
|
||||
end function omp_in_parallel
|
||||
|
||||
function omp_get_dynamic()
|
||||
include 'omp_lib_kinds.h'
|
||||
logical (kind=omp_logical_kind) omp_get_dynamic
|
||||
end function omp_get_dynamic
|
||||
|
||||
function omp_get_nested()
|
||||
include 'omp_lib_kinds.h'
|
||||
logical (kind=omp_logical_kind) omp_get_nested
|
||||
end function omp_get_nested
|
||||
|
||||
function omp_get_wtime()
|
||||
include 'omp_lib_kinds.h'
|
||||
double precision omp_get_wtime
|
||||
end function omp_get_wtime
|
||||
|
||||
function omp_get_wtick ()
|
||||
include 'omp_lib_kinds.h'
|
||||
double precision omp_get_wtick
|
||||
end function omp_get_wtick
|
||||
|
||||
subroutine omp_init_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_init_lock
|
||||
|
||||
subroutine omp_destroy_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_destroy_lock
|
||||
|
||||
subroutine omp_set_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_set_lock
|
||||
|
||||
subroutine omp_unset_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_unset_lock
|
||||
|
||||
function omp_test_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
logical (kind=omp_logical_kind) omp_test_lock
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end function omp_test_lock
|
||||
|
||||
subroutine omp_init_nest_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end subroutine omp_init_nest_lock
|
||||
|
||||
subroutine omp_destroy_nest_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end subroutine omp_destroy_nest_lock
|
||||
|
||||
subroutine omp_set_nest_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end subroutine omp_set_nest_lock
|
||||
|
||||
subroutine omp_unset_nest_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end subroutine omp_unset_nest_lock
|
||||
|
||||
function omp_test_nest_lock(lockvar)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) omp_test_nest_lock
|
||||
integer (kind=omp_nest_lock_kind) lockvar
|
||||
end function omp_test_nest_lock
|
||||
|
||||
! ***
|
||||
! *** kmp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine kmp_set_stacksize(size)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) size
|
||||
end subroutine kmp_set_stacksize
|
||||
|
||||
subroutine kmp_set_stacksize_s(size)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
end subroutine kmp_set_stacksize_s
|
||||
|
||||
subroutine kmp_set_blocktime(msec)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) msec
|
||||
end subroutine kmp_set_blocktime
|
||||
|
||||
subroutine kmp_set_library_serial()
|
||||
include 'omp_lib_kinds.h'
|
||||
end subroutine kmp_set_library_serial
|
||||
|
||||
subroutine kmp_set_library_turnaround()
|
||||
include 'omp_lib_kinds.h'
|
||||
end subroutine kmp_set_library_turnaround
|
||||
|
||||
subroutine kmp_set_library_throughput()
|
||||
include 'omp_lib_kinds.h'
|
||||
end subroutine kmp_set_library_throughput
|
||||
|
||||
subroutine kmp_set_library(libnum)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) libnum
|
||||
end subroutine kmp_set_library
|
||||
|
||||
subroutine kmp_set_defaults(string)
|
||||
character*(*) string
|
||||
end subroutine kmp_set_defaults
|
||||
|
||||
function kmp_get_stacksize()
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) kmp_get_stacksize
|
||||
end function kmp_get_stacksize
|
||||
|
||||
function kmp_get_stacksize_s()
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
|
||||
end function kmp_get_stacksize_s
|
||||
|
||||
function kmp_get_blocktime()
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) kmp_get_blocktime
|
||||
end function kmp_get_blocktime
|
||||
|
||||
function kmp_get_library()
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=omp_integer_kind) kmp_get_library
|
||||
end function kmp_get_library
|
||||
|
||||
function kmp_malloc(size)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=kmp_pointer_kind) kmp_malloc
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
integer (kind=kmp_size_t_kind) nelem
|
||||
integer (kind=kmp_size_t_kind) elsize
|
||||
end function kmp_calloc
|
||||
|
||||
function kmp_realloc(ptr, size)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=kmp_pointer_kind) kmp_realloc
|
||||
integer (kind=kmp_pointer_kind) ptr
|
||||
integer (kind=kmp_size_t_kind) size
|
||||
end function kmp_realloc
|
||||
|
||||
subroutine kmp_free(ptr)
|
||||
include 'omp_lib_kinds.h'
|
||||
integer (kind=kmp_pointer_kind) ptr
|
||||
end subroutine kmp_free
|
||||
|
||||
subroutine kmp_set_warnings_on()
|
||||
include 'omp_lib_kinds.h'
|
||||
end subroutine kmp_set_warnings_on
|
||||
|
||||
subroutine kmp_set_warnings_off()
|
||||
include 'omp_lib_kinds.h'
|
||||
end subroutine kmp_set_warnings_off
|
||||
|
||||
end interface
|
||||
|
||||
!dec$ if defined(_WIN32)
|
||||
!dec$ if defined(_WIN64) .or. defined(_M_AMD64)
|
||||
|
||||
!***
|
||||
!*** The Fortran entry points must be in uppercase, even if the /Qlowercase
|
||||
!*** option is specified. The alias attribute ensures that the specified
|
||||
!*** string is used as the entry point.
|
||||
!***
|
||||
!*** On the Windows* OS IA-32 architecture, the Fortran entry points have an
|
||||
!*** underscore prepended. On the Windows* OS Intel(R) 64
|
||||
!*** architecture, no underscore is prepended.
|
||||
!***
|
||||
|
||||
!dec$ attributes alias:'OMP_SET_NUM_THREADS'::omp_set_num_threads
|
||||
!dec$ attributes alias:'OMP_SET_DYNAMIC'::omp_set_dynamic
|
||||
!dec$ attributes alias:'OMP_SET_NESTED'::omp_set_nested
|
||||
!dec$ attributes alias:'OMP_GET_NUM_THREADS'::omp_get_num_threads
|
||||
!dec$ attributes alias:'OMP_GET_MAX_THREADS'::omp_get_max_threads
|
||||
!dec$ attributes alias:'OMP_GET_THREAD_NUM'::omp_get_thread_num
|
||||
!dec$ attributes alias:'OMP_GET_NUM_PROCS'::omp_get_num_procs
|
||||
!dec$ attributes alias:'OMP_IN_PARALLEL'::omp_in_parallel
|
||||
!dec$ attributes alias:'OMP_GET_DYNAMIC'::omp_get_dynamic
|
||||
!dec$ attributes alias:'OMP_GET_NESTED'::omp_get_nested
|
||||
!dec$ attributes alias:'OMP_GET_WTIME'::omp_get_wtime
|
||||
!dec$ attributes alias:'OMP_GET_WTICK'::omp_get_wtick
|
||||
|
||||
!dec$ attributes alias:'omp_init_lock'::omp_init_lock
|
||||
!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_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
|
||||
!dec$ attributes alias:'omp_test_nest_lock'::omp_test_nest_lock
|
||||
|
||||
!dec$ attributes alias:'KMP_SET_STACKSIZE'::kmp_set_stacksize
|
||||
!dec$ attributes alias:'KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
|
||||
!dec$ attributes alias:'KMP_SET_BLOCKTIME'::kmp_set_blocktime
|
||||
!dec$ attributes alias:'KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
|
||||
!dec$ attributes alias:'KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
|
||||
!dec$ attributes alias:'KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
|
||||
!dec$ attributes alias:'KMP_SET_LIBRARY'::kmp_set_library
|
||||
!dec$ attributes alias:'KMP_SET_DEFAULTS'::kmp_set_defaults
|
||||
!dec$ attributes alias:'KMP_GET_STACKSIZE'::kmp_get_stacksize
|
||||
!dec$ attributes alias:'KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
|
||||
!dec$ attributes alias:'KMP_GET_BLOCKTIME'::kmp_get_blocktime
|
||||
!dec$ attributes alias:'KMP_GET_LIBRARY'::kmp_get_library
|
||||
!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'KMP_FREE'::kmp_free
|
||||
|
||||
!dec$ attributes alias:'KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
|
||||
!dec$ attributes alias:'KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
|
||||
|
||||
!dec$ else
|
||||
|
||||
!***
|
||||
!*** On Windows* OS IA-32 architecture, the Fortran entry points have an
|
||||
!*** underscore prepended.
|
||||
!***
|
||||
|
||||
!dec$ attributes alias:'_OMP_SET_NUM_THREADS'::omp_set_num_threads
|
||||
!dec$ attributes alias:'_OMP_SET_DYNAMIC'::omp_set_dynamic
|
||||
!dec$ attributes alias:'_OMP_SET_NESTED'::omp_set_nested
|
||||
!dec$ attributes alias:'_OMP_GET_NUM_THREADS'::omp_get_num_threads
|
||||
!dec$ attributes alias:'_OMP_GET_MAX_THREADS'::omp_get_max_threads
|
||||
!dec$ attributes alias:'_OMP_GET_THREAD_NUM'::omp_get_thread_num
|
||||
!dec$ attributes alias:'_OMP_GET_NUM_PROCS'::omp_get_num_procs
|
||||
!dec$ attributes alias:'_OMP_IN_PARALLEL'::omp_in_parallel
|
||||
!dec$ attributes alias:'_OMP_GET_DYNAMIC'::omp_get_dynamic
|
||||
!dec$ attributes alias:'_OMP_GET_NESTED'::omp_get_nested
|
||||
!dec$ attributes alias:'_OMP_GET_WTIME'::omp_get_wtime
|
||||
!dec$ attributes alias:'_OMP_GET_WTICK'::omp_get_wtick
|
||||
|
||||
!dec$ attributes alias:'_omp_init_lock'::omp_init_lock
|
||||
!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_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
|
||||
!dec$ attributes alias:'_omp_test_nest_lock'::omp_test_nest_lock
|
||||
|
||||
!dec$ attributes alias:'_KMP_SET_STACKSIZE'::kmp_set_stacksize
|
||||
!dec$ attributes alias:'_KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
|
||||
!dec$ attributes alias:'_KMP_SET_BLOCKTIME'::kmp_set_blocktime
|
||||
!dec$ attributes alias:'_KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
|
||||
!dec$ attributes alias:'_KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
|
||||
!dec$ attributes alias:'_KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
|
||||
!dec$ attributes alias:'_KMP_SET_LIBRARY'::kmp_set_library
|
||||
!dec$ attributes alias:'_KMP_SET_DEFAULTS'::kmp_set_defaults
|
||||
!dec$ attributes alias:'_KMP_GET_STACKSIZE'::kmp_get_stacksize
|
||||
!dec$ attributes alias:'_KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
|
||||
!dec$ attributes alias:'_KMP_GET_BLOCKTIME'::kmp_get_blocktime
|
||||
!dec$ attributes alias:'_KMP_GET_LIBRARY'::kmp_get_library
|
||||
!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
|
||||
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
|
||||
!dec$ attributes alias:'_KMP_FREE'::kmp_free
|
||||
|
||||
!dec$ attributes alias:'_KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
|
||||
!dec$ attributes alias:'_KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
|
||||
|
||||
!dec$ endif
|
||||
!dec$ endif
|
||||
|
||||
!dec$ if defined(__linux)
|
||||
|
||||
!***
|
||||
!*** The Linux* OS entry points are in lowercase, with an underscore appended.
|
||||
!***
|
||||
|
||||
!dec$ attributes alias:'omp_set_num_threads_'::omp_set_num_threads
|
||||
!dec$ attributes alias:'omp_set_dynamic_'::omp_set_dynamic
|
||||
!dec$ attributes alias:'omp_set_nested_'::omp_set_nested
|
||||
!dec$ attributes alias:'omp_get_num_threads_'::omp_get_num_threads
|
||||
!dec$ attributes alias:'omp_get_max_threads_'::omp_get_max_threads
|
||||
!dec$ attributes alias:'omp_get_thread_num_'::omp_get_thread_num
|
||||
!dec$ attributes alias:'omp_get_num_procs_'::omp_get_num_procs
|
||||
!dec$ attributes alias:'omp_in_parallel_'::omp_in_parallel
|
||||
!dec$ attributes alias:'omp_get_dynamic_'::omp_get_dynamic
|
||||
!dec$ attributes alias:'omp_get_nested_'::omp_get_nested
|
||||
!dec$ attributes alias:'omp_get_wtime_'::omp_get_wtime
|
||||
!dec$ attributes alias:'omp_get_wtick_'::omp_get_wtick
|
||||
|
||||
!dec$ attributes alias:'omp_init_lock_'::omp_init_lock
|
||||
!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_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
|
||||
!dec$ attributes alias:'omp_test_nest_lock_'::omp_test_nest_lock
|
||||
|
||||
!dec$ attributes alias:'kmp_set_stacksize_'::kmp_set_stacksize
|
||||
!dec$ attributes alias:'kmp_set_stacksize_s_'::kmp_set_stacksize_s
|
||||
!dec$ attributes alias:'kmp_set_blocktime_'::kmp_set_blocktime
|
||||
!dec$ attributes alias:'kmp_set_library_serial_'::kmp_set_library_serial
|
||||
!dec$ attributes alias:'kmp_set_library_turnaround_'::kmp_set_library_turnaround
|
||||
!dec$ attributes alias:'kmp_set_library_throughput_'::kmp_set_library_throughput
|
||||
!dec$ attributes alias:'kmp_set_library_'::kmp_set_library
|
||||
!dec$ attributes alias:'kmp_set_defaults_'::kmp_set_defaults
|
||||
!dec$ attributes alias:'kmp_get_stacksize_'::kmp_get_stacksize
|
||||
!dec$ attributes alias:'kmp_get_stacksize_s_'::kmp_get_stacksize_s
|
||||
!dec$ attributes alias:'kmp_get_blocktime_'::kmp_get_blocktime
|
||||
!dec$ attributes alias:'kmp_get_library_'::kmp_get_library
|
||||
!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'kmp_free_'::kmp_free
|
||||
|
||||
!dec$ attributes alias:'kmp_set_warnings_on_'::kmp_set_warnings_on
|
||||
!dec$ attributes alias:'kmp_set_warnings_off_'::kmp_set_warnings_off
|
||||
|
||||
!dec$ endif
|
||||
|
||||
!dec$ if defined(__APPLE__)
|
||||
|
||||
!***
|
||||
!*** The Mac entry points are in lowercase, with an both an underscore
|
||||
!*** appended and an underscore prepended.
|
||||
!***
|
||||
|
||||
!dec$ attributes alias:'_omp_set_num_threads_'::omp_set_num_threads
|
||||
!dec$ attributes alias:'_omp_set_dynamic_'::omp_set_dynamic
|
||||
!dec$ attributes alias:'_omp_set_nested_'::omp_set_nested
|
||||
!dec$ attributes alias:'_omp_get_num_threads_'::omp_get_num_threads
|
||||
!dec$ attributes alias:'_omp_get_max_threads_'::omp_get_max_threads
|
||||
!dec$ attributes alias:'_omp_get_thread_num_'::omp_get_thread_num
|
||||
!dec$ attributes alias:'_omp_get_num_procs_'::omp_get_num_procs
|
||||
!dec$ attributes alias:'_omp_in_parallel_'::omp_in_parallel
|
||||
!dec$ attributes alias:'_omp_get_dynamic_'::omp_get_dynamic
|
||||
!dec$ attributes alias:'_omp_get_nested_'::omp_get_nested
|
||||
!dec$ attributes alias:'_omp_get_wtime_'::omp_get_wtime
|
||||
!dec$ attributes alias:'_omp_get_wtick_'::omp_get_wtick
|
||||
|
||||
!dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
|
||||
!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_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
|
||||
!dec$ attributes alias:'_omp_test_nest_lock_'::omp_test_nest_lock
|
||||
|
||||
!dec$ attributes alias:'_kmp_set_stacksize_'::kmp_set_stacksize
|
||||
!dec$ attributes alias:'_kmp_set_stacksize_s_'::kmp_set_stacksize_s
|
||||
!dec$ attributes alias:'_kmp_set_blocktime_'::kmp_set_blocktime
|
||||
!dec$ attributes alias:'_kmp_set_library_serial_'::kmp_set_library_serial
|
||||
!dec$ attributes alias:'_kmp_set_library_turnaround_'::kmp_set_library_turnaround
|
||||
!dec$ attributes alias:'_kmp_set_library_throughput_'::kmp_set_library_throughput
|
||||
!dec$ attributes alias:'_kmp_set_library_'::kmp_set_library
|
||||
!dec$ attributes alias:'_kmp_set_defaults_'::kmp_set_defaults
|
||||
!dec$ attributes alias:'_kmp_get_stacksize_'::kmp_get_stacksize
|
||||
!dec$ attributes alias:'_kmp_get_stacksize_s_'::kmp_get_stacksize_s
|
||||
!dec$ attributes alias:'_kmp_get_blocktime_'::kmp_get_blocktime
|
||||
!dec$ attributes alias:'_kmp_get_library_'::kmp_get_library
|
||||
!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
|
||||
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
|
||||
!dec$ attributes alias:'_kmp_free_'::kmp_free
|
||||
|
||||
!dec$ attributes alias:'_kmp_set_warnings_on_'::kmp_set_warnings_on
|
||||
!dec$ attributes alias:'_kmp_set_warnings_off_'::kmp_set_warnings_off
|
||||
|
||||
!dec$ endif
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* include/30/iomp.h.var
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/30/iomp_lib.h.var
|
||||
! $Revision: 42061 $
|
||||
! $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* include/30/omp.h.var
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -80,6 +78,7 @@
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_in_parallel (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_in_final (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_active_level (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_level (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/30/omp_lib.f.var
|
||||
! $Revision: 42181 $
|
||||
! $Date: 2013-03-26 15:04:45 -0500 (Tue, 26 Mar 2013) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/30/omp_lib.f90.var
|
||||
! $Revision: 42061 $
|
||||
! $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -92,6 +90,11 @@
|
||||
logical (kind=omp_logical_kind) omp_in_parallel
|
||||
end function omp_in_parallel
|
||||
|
||||
function omp_in_final() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_in_final
|
||||
end function omp_in_final
|
||||
|
||||
function omp_get_dynamic() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_get_dynamic
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/30/omp_lib.h.var
|
||||
! $Revision: 42181 $
|
||||
! $Date: 2013-03-26 15:04:45 -0500 (Tue, 26 Mar 2013) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -88,6 +86,11 @@
|
||||
logical (kind=omp_logical_kind) omp_in_parallel
|
||||
end function omp_in_parallel
|
||||
|
||||
function omp_in_final()
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_in_final
|
||||
end function omp_in_final
|
||||
|
||||
function omp_get_dynamic()
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_get_dynamic
|
||||
@@ -366,6 +369,7 @@
|
||||
!dec$ attributes alias:'OMP_GET_THREAD_NUM'::omp_get_thread_num
|
||||
!dec$ attributes alias:'OMP_GET_NUM_PROCS'::omp_get_num_procs
|
||||
!dec$ attributes alias:'OMP_IN_PARALLEL'::omp_in_parallel
|
||||
!dec$ attributes alias:'OMP_IN_FINAL'::omp_in_final
|
||||
!dec$ attributes alias:'OMP_GET_DYNAMIC'::omp_get_dynamic
|
||||
!dec$ attributes alias:'OMP_GET_NESTED'::omp_get_nested
|
||||
!dec$ attributes alias:'OMP_GET_THREAD_LIMIT'::omp_get_thread_limit
|
||||
@@ -433,6 +437,7 @@
|
||||
!dec$ attributes alias:'_OMP_GET_THREAD_NUM'::omp_get_thread_num
|
||||
!dec$ attributes alias:'_OMP_GET_NUM_PROCS'::omp_get_num_procs
|
||||
!dec$ attributes alias:'_OMP_IN_PARALLEL'::omp_in_parallel
|
||||
!dec$ attributes alias:'_OMP_IN_FINAL'::omp_in_final
|
||||
!dec$ attributes alias:'_OMP_GET_DYNAMIC'::omp_get_dynamic
|
||||
!dec$ attributes alias:'_OMP_GET_NESTED'::omp_get_nested
|
||||
!dec$ attributes alias:'_OMP_GET_THREAD_LIMIT'::omp_get_thread_limit
|
||||
@@ -503,6 +508,7 @@
|
||||
!dec$ attributes alias:'omp_get_thread_num_'::omp_get_thread_num
|
||||
!dec$ attributes alias:'omp_get_num_procs_'::omp_get_num_procs
|
||||
!dec$ attributes alias:'omp_in_parallel_'::omp_in_parallel
|
||||
!dec$ attributes alias:'omp_in_final_'::omp_in_final
|
||||
!dec$ attributes alias:'omp_get_dynamic_'::omp_get_dynamic
|
||||
!dec$ attributes alias:'omp_get_nested_'::omp_get_nested
|
||||
!dec$ attributes alias:'omp_get_thread_limit_'::omp_get_thread_limit
|
||||
@@ -573,6 +579,7 @@
|
||||
!dec$ attributes alias:'_omp_get_thread_num_'::omp_get_thread_num
|
||||
!dec$ attributes alias:'_omp_get_num_procs_'::omp_get_num_procs
|
||||
!dec$ attributes alias:'_omp_in_parallel_'::omp_in_parallel
|
||||
!dec$ attributes alias:'_omp_in_final_'::omp_in_final
|
||||
!dec$ attributes alias:'_omp_get_dynamic_'::omp_get_dynamic
|
||||
!dec$ attributes alias:'_omp_get_nested_'::omp_get_nested
|
||||
!dec$ attributes alias:'_omp_get_thread_limit_'::omp_get_thread_limit
|
||||
|
||||
@@ -0,0 +1,472 @@
|
||||
/*
|
||||
* include/30/ompt.h.var
|
||||
*/
|
||||
|
||||
#ifndef __OMPT__
|
||||
#define __OMPT__
|
||||
|
||||
/*****************************************************************************
|
||||
* system include files
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* iteration macros
|
||||
*****************************************************************************/
|
||||
|
||||
#define FOREACH_OMPT_INQUIRY_FN(macro) \
|
||||
macro (ompt_enumerate_state) \
|
||||
\
|
||||
macro (ompt_set_callback) \
|
||||
macro (ompt_get_callback) \
|
||||
\
|
||||
macro (ompt_get_idle_frame) \
|
||||
macro (ompt_get_task_frame) \
|
||||
\
|
||||
macro (ompt_get_state) \
|
||||
\
|
||||
macro (ompt_get_parallel_id) \
|
||||
macro (ompt_get_parallel_team_size) \
|
||||
macro (ompt_get_task_id) \
|
||||
macro (ompt_get_thread_id)
|
||||
|
||||
#define FOREACH_OMPT_PLACEHOLDER_FN(macro) \
|
||||
macro (ompt_idle) \
|
||||
macro (ompt_overhead) \
|
||||
macro (ompt_barrier_wait) \
|
||||
macro (ompt_task_wait) \
|
||||
macro (ompt_mutex_wait)
|
||||
|
||||
#define FOREACH_OMPT_STATE(macro) \
|
||||
\
|
||||
/* first */ \
|
||||
macro (ompt_state_first, 0x71) /* initial enumeration state */ \
|
||||
\
|
||||
/* work states (0..15) */ \
|
||||
macro (ompt_state_work_serial, 0x00) /* working outside parallel */ \
|
||||
macro (ompt_state_work_parallel, 0x01) /* working within parallel */ \
|
||||
macro (ompt_state_work_reduction, 0x02) /* performing a reduction */ \
|
||||
\
|
||||
/* idle (16..31) */ \
|
||||
macro (ompt_state_idle, 0x10) /* waiting for work */ \
|
||||
\
|
||||
/* overhead states (32..63) */ \
|
||||
macro (ompt_state_overhead, 0x20) /* overhead excluding wait states */ \
|
||||
\
|
||||
/* barrier wait states (64..79) */ \
|
||||
macro (ompt_state_wait_barrier, 0x40) /* waiting at a barrier */ \
|
||||
macro (ompt_state_wait_barrier_implicit, 0x41) /* implicit barrier */ \
|
||||
macro (ompt_state_wait_barrier_explicit, 0x42) /* explicit barrier */ \
|
||||
\
|
||||
/* task wait states (80..95) */ \
|
||||
macro (ompt_state_wait_taskwait, 0x50) /* waiting at a taskwait */ \
|
||||
macro (ompt_state_wait_taskgroup, 0x51) /* waiting at a taskgroup */ \
|
||||
\
|
||||
/* mutex wait states (96..111) */ \
|
||||
macro (ompt_state_wait_lock, 0x60) /* waiting for lock */ \
|
||||
macro (ompt_state_wait_nest_lock, 0x61) /* waiting for nest lock */ \
|
||||
macro (ompt_state_wait_critical, 0x62) /* waiting for critical */ \
|
||||
macro (ompt_state_wait_atomic, 0x63) /* waiting for atomic */ \
|
||||
macro (ompt_state_wait_ordered, 0x64) /* waiting for ordered */ \
|
||||
macro (ompt_state_wait_single, 0x6F) /* waiting for single region (non-standard!) */ \
|
||||
\
|
||||
/* misc (112..127) */ \
|
||||
macro (ompt_state_undefined, 0x70) /* undefined thread state */
|
||||
|
||||
|
||||
#define FOREACH_OMPT_EVENT(macro) \
|
||||
\
|
||||
/*--- 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_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
|
||||
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
|
||||
\
|
||||
macro (ompt_event_thread_begin, ompt_thread_type_callback_t, 5) /* thread begin */ \
|
||||
macro (ompt_event_thread_end, ompt_thread_type_callback_t, 6) /* thread end */ \
|
||||
\
|
||||
macro (ompt_event_control, ompt_control_callback_t, 7) /* support control calls */ \
|
||||
\
|
||||
macro (ompt_event_runtime_shutdown, ompt_callback_t, 8) /* runtime shutdown */ \
|
||||
\
|
||||
/*--- Optional Events (blame shifting, ompt_event_unimplemented) ---*/ \
|
||||
macro (ompt_event_idle_begin, ompt_thread_callback_t, 9) /* begin idle state */ \
|
||||
macro (ompt_event_idle_end, ompt_thread_callback_t, 10) /* end idle state */ \
|
||||
\
|
||||
macro (ompt_event_wait_barrier_begin, ompt_parallel_callback_t, 11) /* begin wait at barrier */ \
|
||||
macro (ompt_event_wait_barrier_end, ompt_parallel_callback_t, 12) /* end wait at barrier */ \
|
||||
\
|
||||
macro (ompt_event_wait_taskwait_begin, ompt_parallel_callback_t, 13) /* begin wait at taskwait */ \
|
||||
macro (ompt_event_wait_taskwait_end, ompt_parallel_callback_t, 14) /* end wait at taskwait */ \
|
||||
\
|
||||
macro (ompt_event_wait_taskgroup_begin, ompt_parallel_callback_t, 15) /* begin wait at taskgroup */\
|
||||
macro (ompt_event_wait_taskgroup_end, ompt_parallel_callback_t, 16) /* end wait at taskgroup */ \
|
||||
\
|
||||
macro (ompt_event_release_lock, ompt_wait_callback_t, 17) /* lock release */ \
|
||||
macro (ompt_event_release_nest_lock_last, ompt_wait_callback_t, 18) /* last nest lock release */ \
|
||||
macro (ompt_event_release_critical, ompt_wait_callback_t, 19) /* critical release */ \
|
||||
\
|
||||
macro (ompt_event_release_atomic, ompt_wait_callback_t, 20) /* atomic release */ \
|
||||
\
|
||||
macro (ompt_event_release_ordered, ompt_wait_callback_t, 21) /* ordered release */ \
|
||||
\
|
||||
/*--- Optional Events (synchronous events, ompt_event_unimplemented) --- */ \
|
||||
macro (ompt_event_implicit_task_begin, ompt_parallel_callback_t, 22) /* implicit task begin */ \
|
||||
macro (ompt_event_implicit_task_end, ompt_parallel_callback_t, 23) /* implicit task end */ \
|
||||
\
|
||||
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_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 */ \
|
||||
\
|
||||
macro (ompt_event_sections_begin, ompt_new_workshare_callback_t, 29) /* task at sections begin */\
|
||||
macro (ompt_event_sections_end, ompt_parallel_callback_t, 30) /* task at sections end */ \
|
||||
\
|
||||
macro (ompt_event_single_in_block_begin, ompt_new_workshare_callback_t, 31) /* task at single begin*/ \
|
||||
macro (ompt_event_single_in_block_end, ompt_parallel_callback_t, 32) /* task at single end */ \
|
||||
\
|
||||
macro (ompt_event_single_others_begin, ompt_parallel_callback_t, 33) /* task at single begin */ \
|
||||
macro (ompt_event_single_others_end, ompt_parallel_callback_t, 34) /* task at single end */ \
|
||||
\
|
||||
macro (ompt_event_workshare_begin, ompt_new_workshare_callback_t, 35) /* task at workshare begin */\
|
||||
macro (ompt_event_workshare_end, ompt_parallel_callback_t, 36) /* task at workshare end */ \
|
||||
\
|
||||
macro (ompt_event_master_begin, ompt_parallel_callback_t, 37) /* task at master begin */ \
|
||||
macro (ompt_event_master_end, ompt_parallel_callback_t, 38) /* task at master end */ \
|
||||
\
|
||||
macro (ompt_event_barrier_begin, ompt_parallel_callback_t, 39) /* task at barrier begin */ \
|
||||
macro (ompt_event_barrier_end, ompt_parallel_callback_t, 40) /* task at barrier end */ \
|
||||
\
|
||||
macro (ompt_event_taskwait_begin, ompt_parallel_callback_t, 41) /* task at taskwait begin */ \
|
||||
macro (ompt_event_taskwait_end, ompt_parallel_callback_t, 42) /* task at task wait end */ \
|
||||
\
|
||||
macro (ompt_event_taskgroup_begin, ompt_parallel_callback_t, 43) /* task at taskgroup begin */\
|
||||
macro (ompt_event_taskgroup_end, ompt_parallel_callback_t, 44) /* task at taskgroup end */ \
|
||||
\
|
||||
macro (ompt_event_release_nest_lock_prev, ompt_wait_callback_t, 45) /* prev nest lock release */ \
|
||||
\
|
||||
macro (ompt_event_wait_lock, ompt_wait_callback_t, 46) /* lock wait */ \
|
||||
macro (ompt_event_wait_nest_lock, ompt_wait_callback_t, 47) /* nest lock wait */ \
|
||||
macro (ompt_event_wait_critical, ompt_wait_callback_t, 48) /* critical wait */ \
|
||||
macro (ompt_event_wait_atomic, ompt_wait_callback_t, 49) /* atomic wait */ \
|
||||
macro (ompt_event_wait_ordered, ompt_wait_callback_t, 50) /* ordered wait */ \
|
||||
\
|
||||
macro (ompt_event_acquired_lock, ompt_wait_callback_t, 51) /* lock acquired */ \
|
||||
macro (ompt_event_acquired_nest_lock_first, ompt_wait_callback_t, 52) /* 1st nest lock acquired */ \
|
||||
macro (ompt_event_acquired_nest_lock_next, ompt_wait_callback_t, 53) /* next nest lock acquired*/ \
|
||||
macro (ompt_event_acquired_critical, ompt_wait_callback_t, 54) /* critical acquired */ \
|
||||
macro (ompt_event_acquired_atomic, ompt_wait_callback_t, 55) /* atomic acquired */ \
|
||||
macro (ompt_event_acquired_ordered, ompt_wait_callback_t, 56) /* ordered acquired */ \
|
||||
\
|
||||
macro (ompt_event_init_lock, ompt_wait_callback_t, 57) /* lock init */ \
|
||||
macro (ompt_event_init_nest_lock, ompt_wait_callback_t, 58) /* nest lock init */ \
|
||||
\
|
||||
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 */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* data types
|
||||
*****************************************************************************/
|
||||
|
||||
/*---------------------
|
||||
* identifiers
|
||||
*---------------------*/
|
||||
|
||||
typedef uint64_t ompt_thread_id_t;
|
||||
#define ompt_thread_id_none ((ompt_thread_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_task_id_t;
|
||||
#define ompt_task_id_none ((ompt_task_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_parallel_id_t;
|
||||
#define ompt_parallel_id_none ((ompt_parallel_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_wait_id_t;
|
||||
#define ompt_wait_id_none ((ompt_wait_id_t) 0) /* non-standard */
|
||||
|
||||
|
||||
/*---------------------
|
||||
* ompt_frame_t
|
||||
*---------------------*/
|
||||
|
||||
typedef struct ompt_frame_s {
|
||||
void *exit_runtime_frame; /* next frame is user code */
|
||||
void *reenter_runtime_frame; /* previous frame is user code */
|
||||
} ompt_frame_t;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* enumerations for thread states and runtime events
|
||||
*****************************************************************************/
|
||||
|
||||
/*---------------------
|
||||
* runtime states
|
||||
*---------------------*/
|
||||
|
||||
typedef enum {
|
||||
#define ompt_state_macro(state, code) state = code,
|
||||
FOREACH_OMPT_STATE(ompt_state_macro)
|
||||
#undef ompt_state_macro
|
||||
} ompt_state_t;
|
||||
|
||||
|
||||
/*---------------------
|
||||
* runtime events
|
||||
*---------------------*/
|
||||
|
||||
typedef enum {
|
||||
#define ompt_event_macro(event, callback, eventid) event = eventid,
|
||||
FOREACH_OMPT_EVENT(ompt_event_macro)
|
||||
#undef ompt_event_macro
|
||||
} ompt_event_t;
|
||||
|
||||
|
||||
/*---------------------
|
||||
* set callback results
|
||||
*---------------------*/
|
||||
typedef enum {
|
||||
ompt_set_result_registration_error = 0,
|
||||
ompt_set_result_event_may_occur_no_callback = 1,
|
||||
ompt_set_result_event_never_occurs = 2,
|
||||
ompt_set_result_event_may_occur_callback_some = 3,
|
||||
ompt_set_result_event_may_occur_callback_always = 4,
|
||||
} ompt_set_result_t;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* callback signatures
|
||||
*****************************************************************************/
|
||||
|
||||
/* initialization */
|
||||
typedef void (*ompt_interface_fn_t)(void);
|
||||
|
||||
typedef ompt_interface_fn_t (*ompt_function_lookup_t)(
|
||||
const char * /* entry point to look up */
|
||||
);
|
||||
|
||||
/* threads */
|
||||
typedef void (*ompt_thread_callback_t) (
|
||||
ompt_thread_id_t thread_id /* ID of thread */
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
ompt_thread_initial = 1, // start the enumeration at 1
|
||||
ompt_thread_worker = 2,
|
||||
ompt_thread_other = 3
|
||||
} ompt_thread_type_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 */
|
||||
);
|
||||
|
||||
typedef void (*ompt_wait_callback_t) (
|
||||
ompt_wait_id_t wait_id /* wait id */
|
||||
);
|
||||
|
||||
/* parallel and workshares */
|
||||
typedef void (*ompt_parallel_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t task_id /* id of task */
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_workshare_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
void *workshare_function /* pointer to outlined function */
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_parallel_callback_t) (
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
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 */
|
||||
);
|
||||
|
||||
/* tasks */
|
||||
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_new_task_callback_t) (
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
ompt_frame_t *parent_task_frame, /* frame data for parent task */
|
||||
ompt_task_id_t new_task_id, /* id of created task */
|
||||
void *task_function /* pointer to outlined function */
|
||||
);
|
||||
|
||||
/* program */
|
||||
typedef void (*ompt_control_callback_t) (
|
||||
uint64_t command, /* command of control call */
|
||||
uint64_t modifier /* modifier of control call */
|
||||
);
|
||||
|
||||
typedef void (*ompt_callback_t)(void);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* ompt API
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OMPT_API_FNTYPE(fn) fn##_t
|
||||
|
||||
#define OMPT_API_FUNCTION(return_type, fn, args) \
|
||||
typedef return_type (*OMPT_API_FNTYPE(fn)) args
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* INQUIRY FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* state */
|
||||
OMPT_API_FUNCTION(ompt_state_t, ompt_get_state, (
|
||||
ompt_wait_id_t *ompt_wait_id
|
||||
));
|
||||
|
||||
/* thread */
|
||||
OMPT_API_FUNCTION(ompt_thread_id_t, ompt_get_thread_id, (void));
|
||||
|
||||
OMPT_API_FUNCTION(void *, ompt_get_idle_frame, (void));
|
||||
|
||||
/* parallel region */
|
||||
OMPT_API_FUNCTION(ompt_parallel_id_t, ompt_get_parallel_id, (
|
||||
int ancestor_level
|
||||
));
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_get_parallel_team_size, (
|
||||
int ancestor_level
|
||||
));
|
||||
|
||||
/* task */
|
||||
OMPT_API_FUNCTION(ompt_task_id_t, ompt_get_task_id, (
|
||||
int depth
|
||||
));
|
||||
|
||||
OMPT_API_FUNCTION(ompt_frame_t *, ompt_get_task_frame, (
|
||||
int depth
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* PLACEHOLDERS FOR PERFORMANCE REPORTING
|
||||
***************************************************************************/
|
||||
|
||||
/* idle */
|
||||
OMPT_API_FUNCTION(void, ompt_idle, (
|
||||
void
|
||||
));
|
||||
|
||||
/* overhead */
|
||||
OMPT_API_FUNCTION(void, ompt_overhead, (
|
||||
void
|
||||
));
|
||||
|
||||
/* barrier wait */
|
||||
OMPT_API_FUNCTION(void, ompt_barrier_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
/* task wait */
|
||||
OMPT_API_FUNCTION(void, ompt_task_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
/* mutex wait */
|
||||
OMPT_API_FUNCTION(void, ompt_mutex_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* INITIALIZATION FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
int ompt_initialize(
|
||||
ompt_function_lookup_t ompt_fn_lookup,
|
||||
const char *runtime_version,
|
||||
unsigned int ompt_version
|
||||
);
|
||||
|
||||
typedef enum opt_init_mode_e {
|
||||
ompt_init_mode_never = 0,
|
||||
ompt_init_mode_false = 1,
|
||||
ompt_init_mode_true = 2,
|
||||
ompt_init_mode_always = 3
|
||||
} ompt_init_mode_t;
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_set_callback, (
|
||||
ompt_event_t event,
|
||||
ompt_callback_t callback
|
||||
));
|
||||
|
||||
typedef enum ompt_set_callback_rc_e { /* non-standard */
|
||||
ompt_set_callback_error = 0,
|
||||
ompt_has_event_no_callback = 1,
|
||||
ompt_no_event_no_callback = 2,
|
||||
ompt_has_event_may_callback = 3,
|
||||
ompt_has_event_must_callback = 4,
|
||||
} ompt_set_callback_rc_t;
|
||||
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_get_callback, (
|
||||
ompt_event_t event,
|
||||
ompt_callback_t *callback
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* MISCELLANEOUS FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* control */
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp declare target
|
||||
#endif
|
||||
void ompt_control(
|
||||
uint64_t command,
|
||||
uint64_t modifier
|
||||
);
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp end declare target
|
||||
#endif
|
||||
|
||||
/* state enumeration */
|
||||
OMPT_API_FUNCTION(int, ompt_enumerate_state, (
|
||||
int current_state,
|
||||
int *next_state,
|
||||
const char **next_state_name
|
||||
));
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* include/40/iomp.h.var
|
||||
* $Revision: 41674 $
|
||||
* $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -91,7 +89,7 @@
|
||||
} kmp_cancel_kind_t;
|
||||
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_cancellation_status(kmp_cancel_kind_t);
|
||||
|
||||
|
||||
# undef __KAI_KMPC_CONVENTION
|
||||
|
||||
/* Warning:
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/40/iomp_lib.h.var
|
||||
! $Revision: 41674 $
|
||||
! $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* include/40/omp.h.var
|
||||
* $Revision: 41674 $
|
||||
* $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -56,6 +54,7 @@
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_in_parallel (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_in_final (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_active_level (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_level (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int);
|
||||
@@ -86,6 +85,20 @@
|
||||
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);
|
||||
@@ -93,6 +106,7 @@
|
||||
/* OpenMP 4.0 */
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_default_device (void);
|
||||
extern void __KAI_KMPC_CONVENTION omp_set_default_device (int);
|
||||
extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_team_num (void);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/40/omp_lib.f.var
|
||||
! $Revision: 41674 $
|
||||
! $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -33,6 +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
|
||||
|
||||
end module omp_lib_kinds
|
||||
|
||||
@@ -62,6 +61,13 @@
|
||||
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
|
||||
|
||||
! ***
|
||||
@@ -210,6 +216,11 @@
|
||||
integer (kind=omp_integer_kind) omp_get_cancellation
|
||||
end function omp_get_cancellation
|
||||
|
||||
function omp_is_initial_device()
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_is_initial_device
|
||||
end function omp_is_initial_device
|
||||
|
||||
subroutine omp_init_lock(lockvar)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_init_lock
|
||||
@@ -433,6 +444,19 @@
|
||||
integer (kind=kmp_cancel_kind) cancelkind
|
||||
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)
|
||||
@@ -476,6 +500,7 @@
|
||||
!dec$ attributes alias:'OMP_GET_NUM_TEAMS' :: omp_get_num_teams
|
||||
!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_init_lock' :: omp_init_lock
|
||||
!dec$ attributes alias:'omp_destroy_lock' :: omp_destroy_lock
|
||||
@@ -517,6 +542,9 @@
|
||||
|
||||
!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
|
||||
|
||||
!***
|
||||
@@ -551,6 +579,7 @@
|
||||
!dec$ attributes alias:'_OMP_GET_NUM_TEAMS' :: omp_get_num_teams
|
||||
!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_init_lock' :: omp_init_lock
|
||||
!dec$ attributes alias:'_omp_destroy_lock' :: omp_destroy_lock
|
||||
@@ -592,6 +621,9 @@
|
||||
|
||||
!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
|
||||
|
||||
@@ -629,6 +661,7 @@
|
||||
!dec$ attributes alias:'omp_get_num_teams_'::omp_get_num_teams
|
||||
!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_init_lock_'::omp_init_lock
|
||||
!dec$ attributes alias:'omp_destroy_lock_'::omp_destroy_lock
|
||||
@@ -669,6 +702,9 @@
|
||||
!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__)
|
||||
@@ -703,6 +739,7 @@
|
||||
!dec$ attributes alias:'_omp_get_num_teams_'::omp_get_num_teams
|
||||
!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_init_lock_'::omp_init_lock
|
||||
!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
|
||||
@@ -744,6 +781,9 @@
|
||||
|
||||
!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,6 +1,4 @@
|
||||
! include/40/omp_lib.f90.var
|
||||
! $Revision: 41674 $
|
||||
! $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -29,6 +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
|
||||
|
||||
end module omp_lib_kinds
|
||||
|
||||
@@ -60,6 +59,13 @@
|
||||
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
|
||||
|
||||
! ***
|
||||
@@ -106,6 +112,11 @@
|
||||
logical (kind=omp_logical_kind) omp_in_parallel
|
||||
end function omp_in_parallel
|
||||
|
||||
function omp_in_final() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_in_final
|
||||
end function omp_in_final
|
||||
|
||||
function omp_get_dynamic() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_get_dynamic
|
||||
@@ -210,6 +221,11 @@
|
||||
integer (kind=omp_integer_kind) omp_get_cancellation
|
||||
end function omp_get_cancellation
|
||||
|
||||
function omp_is_initial_device() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_is_initial_device
|
||||
end function omp_is_initial_device
|
||||
|
||||
subroutine omp_init_lock(lockvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_init_lock
|
||||
@@ -435,6 +451,18 @@
|
||||
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
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/40/omp_lib.h.var
|
||||
! $Revision: 41674 $
|
||||
! $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -30,6 +28,7 @@
|
||||
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
|
||||
@@ -49,6 +48,13 @@
|
||||
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
|
||||
|
||||
! ***
|
||||
@@ -95,6 +101,11 @@
|
||||
logical (kind=omp_logical_kind) omp_in_parallel
|
||||
end function omp_in_parallel
|
||||
|
||||
function omp_in_final() bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_in_final
|
||||
end function omp_in_final
|
||||
|
||||
function omp_get_dynamic() bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_get_dynamic
|
||||
@@ -192,6 +203,11 @@
|
||||
integer (kind=omp_integer_kind) omp_get_team_num
|
||||
end function omp_get_team_num
|
||||
|
||||
function omp_is_initial_device() bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_is_initial_device
|
||||
end function omp_is_initial_device
|
||||
|
||||
subroutine omp_init_lock(lockvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_init_lock
|
||||
@@ -410,6 +426,18 @@
|
||||
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)
|
||||
@@ -421,6 +449,7 @@
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_thread_num
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_procs
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_in_parallel
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_in_final
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_dynamic
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_nested
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_thread_limit
|
||||
@@ -437,6 +466,7 @@
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_wtick
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_default_device
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_default_device
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_is_initial_device
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_devices
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_teams
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_num
|
||||
@@ -476,6 +506,8 @@
|
||||
!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 )
|
||||
@@ -486,6 +518,7 @@
|
||||
!$omp declare target(omp_get_thread_num )
|
||||
!$omp declare target(omp_get_num_procs )
|
||||
!$omp declare target(omp_in_parallel )
|
||||
!$omp declare target(omp_in_final )
|
||||
!$omp declare target(omp_get_dynamic )
|
||||
!$omp declare target(omp_get_nested )
|
||||
!$omp declare target(omp_get_thread_limit )
|
||||
@@ -502,6 +535,7 @@
|
||||
!$omp declare target(omp_get_wtick )
|
||||
!$omp declare target(omp_get_default_device )
|
||||
!$omp declare target(omp_set_default_device )
|
||||
!$omp declare target(omp_is_initial_device )
|
||||
!$omp declare target(omp_get_num_devices )
|
||||
!$omp declare target(omp_get_num_teams )
|
||||
!$omp declare target(omp_get_team_num )
|
||||
@@ -541,6 +575,8 @@
|
||||
!$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
|
||||
|
||||
|
||||
@@ -0,0 +1,472 @@
|
||||
/*
|
||||
* include/40/ompt.h.var
|
||||
*/
|
||||
|
||||
#ifndef __OMPT__
|
||||
#define __OMPT__
|
||||
|
||||
/*****************************************************************************
|
||||
* system include files
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* iteration macros
|
||||
*****************************************************************************/
|
||||
|
||||
#define FOREACH_OMPT_INQUIRY_FN(macro) \
|
||||
macro (ompt_enumerate_state) \
|
||||
\
|
||||
macro (ompt_set_callback) \
|
||||
macro (ompt_get_callback) \
|
||||
\
|
||||
macro (ompt_get_idle_frame) \
|
||||
macro (ompt_get_task_frame) \
|
||||
\
|
||||
macro (ompt_get_state) \
|
||||
\
|
||||
macro (ompt_get_parallel_id) \
|
||||
macro (ompt_get_parallel_team_size) \
|
||||
macro (ompt_get_task_id) \
|
||||
macro (ompt_get_thread_id)
|
||||
|
||||
#define FOREACH_OMPT_PLACEHOLDER_FN(macro) \
|
||||
macro (ompt_idle) \
|
||||
macro (ompt_overhead) \
|
||||
macro (ompt_barrier_wait) \
|
||||
macro (ompt_task_wait) \
|
||||
macro (ompt_mutex_wait)
|
||||
|
||||
#define FOREACH_OMPT_STATE(macro) \
|
||||
\
|
||||
/* first */ \
|
||||
macro (ompt_state_first, 0x71) /* initial enumeration state */ \
|
||||
\
|
||||
/* work states (0..15) */ \
|
||||
macro (ompt_state_work_serial, 0x00) /* working outside parallel */ \
|
||||
macro (ompt_state_work_parallel, 0x01) /* working within parallel */ \
|
||||
macro (ompt_state_work_reduction, 0x02) /* performing a reduction */ \
|
||||
\
|
||||
/* idle (16..31) */ \
|
||||
macro (ompt_state_idle, 0x10) /* waiting for work */ \
|
||||
\
|
||||
/* overhead states (32..63) */ \
|
||||
macro (ompt_state_overhead, 0x20) /* overhead excluding wait states */ \
|
||||
\
|
||||
/* barrier wait states (64..79) */ \
|
||||
macro (ompt_state_wait_barrier, 0x40) /* waiting at a barrier */ \
|
||||
macro (ompt_state_wait_barrier_implicit, 0x41) /* implicit barrier */ \
|
||||
macro (ompt_state_wait_barrier_explicit, 0x42) /* explicit barrier */ \
|
||||
\
|
||||
/* task wait states (80..95) */ \
|
||||
macro (ompt_state_wait_taskwait, 0x50) /* waiting at a taskwait */ \
|
||||
macro (ompt_state_wait_taskgroup, 0x51) /* waiting at a taskgroup */ \
|
||||
\
|
||||
/* mutex wait states (96..111) */ \
|
||||
macro (ompt_state_wait_lock, 0x60) /* waiting for lock */ \
|
||||
macro (ompt_state_wait_nest_lock, 0x61) /* waiting for nest lock */ \
|
||||
macro (ompt_state_wait_critical, 0x62) /* waiting for critical */ \
|
||||
macro (ompt_state_wait_atomic, 0x63) /* waiting for atomic */ \
|
||||
macro (ompt_state_wait_ordered, 0x64) /* waiting for ordered */ \
|
||||
macro (ompt_state_wait_single, 0x6F) /* waiting for single region (non-standard!) */ \
|
||||
\
|
||||
/* misc (112..127) */ \
|
||||
macro (ompt_state_undefined, 0x70) /* undefined thread state */
|
||||
|
||||
|
||||
#define FOREACH_OMPT_EVENT(macro) \
|
||||
\
|
||||
/*--- 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_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
|
||||
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
|
||||
\
|
||||
macro (ompt_event_thread_begin, ompt_thread_type_callback_t, 5) /* thread begin */ \
|
||||
macro (ompt_event_thread_end, ompt_thread_type_callback_t, 6) /* thread end */ \
|
||||
\
|
||||
macro (ompt_event_control, ompt_control_callback_t, 7) /* support control calls */ \
|
||||
\
|
||||
macro (ompt_event_runtime_shutdown, ompt_callback_t, 8) /* runtime shutdown */ \
|
||||
\
|
||||
/*--- Optional Events (blame shifting, ompt_event_unimplemented) ---*/ \
|
||||
macro (ompt_event_idle_begin, ompt_thread_callback_t, 9) /* begin idle state */ \
|
||||
macro (ompt_event_idle_end, ompt_thread_callback_t, 10) /* end idle state */ \
|
||||
\
|
||||
macro (ompt_event_wait_barrier_begin, ompt_parallel_callback_t, 11) /* begin wait at barrier */ \
|
||||
macro (ompt_event_wait_barrier_end, ompt_parallel_callback_t, 12) /* end wait at barrier */ \
|
||||
\
|
||||
macro (ompt_event_wait_taskwait_begin, ompt_parallel_callback_t, 13) /* begin wait at taskwait */ \
|
||||
macro (ompt_event_wait_taskwait_end, ompt_parallel_callback_t, 14) /* end wait at taskwait */ \
|
||||
\
|
||||
macro (ompt_event_wait_taskgroup_begin, ompt_parallel_callback_t, 15) /* begin wait at taskgroup */\
|
||||
macro (ompt_event_wait_taskgroup_end, ompt_parallel_callback_t, 16) /* end wait at taskgroup */ \
|
||||
\
|
||||
macro (ompt_event_release_lock, ompt_wait_callback_t, 17) /* lock release */ \
|
||||
macro (ompt_event_release_nest_lock_last, ompt_wait_callback_t, 18) /* last nest lock release */ \
|
||||
macro (ompt_event_release_critical, ompt_wait_callback_t, 19) /* critical release */ \
|
||||
\
|
||||
macro (ompt_event_release_atomic, ompt_wait_callback_t, 20) /* atomic release */ \
|
||||
\
|
||||
macro (ompt_event_release_ordered, ompt_wait_callback_t, 21) /* ordered release */ \
|
||||
\
|
||||
/*--- Optional Events (synchronous events, ompt_event_unimplemented) --- */ \
|
||||
macro (ompt_event_implicit_task_begin, ompt_parallel_callback_t, 22) /* implicit task begin */ \
|
||||
macro (ompt_event_implicit_task_end, ompt_parallel_callback_t, 23) /* implicit task end */ \
|
||||
\
|
||||
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_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 */ \
|
||||
\
|
||||
macro (ompt_event_sections_begin, ompt_new_workshare_callback_t, 29) /* task at sections begin */\
|
||||
macro (ompt_event_sections_end, ompt_parallel_callback_t, 30) /* task at sections end */ \
|
||||
\
|
||||
macro (ompt_event_single_in_block_begin, ompt_new_workshare_callback_t, 31) /* task at single begin*/ \
|
||||
macro (ompt_event_single_in_block_end, ompt_parallel_callback_t, 32) /* task at single end */ \
|
||||
\
|
||||
macro (ompt_event_single_others_begin, ompt_parallel_callback_t, 33) /* task at single begin */ \
|
||||
macro (ompt_event_single_others_end, ompt_parallel_callback_t, 34) /* task at single end */ \
|
||||
\
|
||||
macro (ompt_event_workshare_begin, ompt_new_workshare_callback_t, 35) /* task at workshare begin */\
|
||||
macro (ompt_event_workshare_end, ompt_parallel_callback_t, 36) /* task at workshare end */ \
|
||||
\
|
||||
macro (ompt_event_master_begin, ompt_parallel_callback_t, 37) /* task at master begin */ \
|
||||
macro (ompt_event_master_end, ompt_parallel_callback_t, 38) /* task at master end */ \
|
||||
\
|
||||
macro (ompt_event_barrier_begin, ompt_parallel_callback_t, 39) /* task at barrier begin */ \
|
||||
macro (ompt_event_barrier_end, ompt_parallel_callback_t, 40) /* task at barrier end */ \
|
||||
\
|
||||
macro (ompt_event_taskwait_begin, ompt_parallel_callback_t, 41) /* task at taskwait begin */ \
|
||||
macro (ompt_event_taskwait_end, ompt_parallel_callback_t, 42) /* task at task wait end */ \
|
||||
\
|
||||
macro (ompt_event_taskgroup_begin, ompt_parallel_callback_t, 43) /* task at taskgroup begin */\
|
||||
macro (ompt_event_taskgroup_end, ompt_parallel_callback_t, 44) /* task at taskgroup end */ \
|
||||
\
|
||||
macro (ompt_event_release_nest_lock_prev, ompt_wait_callback_t, 45) /* prev nest lock release */ \
|
||||
\
|
||||
macro (ompt_event_wait_lock, ompt_wait_callback_t, 46) /* lock wait */ \
|
||||
macro (ompt_event_wait_nest_lock, ompt_wait_callback_t, 47) /* nest lock wait */ \
|
||||
macro (ompt_event_wait_critical, ompt_wait_callback_t, 48) /* critical wait */ \
|
||||
macro (ompt_event_wait_atomic, ompt_wait_callback_t, 49) /* atomic wait */ \
|
||||
macro (ompt_event_wait_ordered, ompt_wait_callback_t, 50) /* ordered wait */ \
|
||||
\
|
||||
macro (ompt_event_acquired_lock, ompt_wait_callback_t, 51) /* lock acquired */ \
|
||||
macro (ompt_event_acquired_nest_lock_first, ompt_wait_callback_t, 52) /* 1st nest lock acquired */ \
|
||||
macro (ompt_event_acquired_nest_lock_next, ompt_wait_callback_t, 53) /* next nest lock acquired*/ \
|
||||
macro (ompt_event_acquired_critical, ompt_wait_callback_t, 54) /* critical acquired */ \
|
||||
macro (ompt_event_acquired_atomic, ompt_wait_callback_t, 55) /* atomic acquired */ \
|
||||
macro (ompt_event_acquired_ordered, ompt_wait_callback_t, 56) /* ordered acquired */ \
|
||||
\
|
||||
macro (ompt_event_init_lock, ompt_wait_callback_t, 57) /* lock init */ \
|
||||
macro (ompt_event_init_nest_lock, ompt_wait_callback_t, 58) /* nest lock init */ \
|
||||
\
|
||||
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 */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* data types
|
||||
*****************************************************************************/
|
||||
|
||||
/*---------------------
|
||||
* identifiers
|
||||
*---------------------*/
|
||||
|
||||
typedef uint64_t ompt_thread_id_t;
|
||||
#define ompt_thread_id_none ((ompt_thread_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_task_id_t;
|
||||
#define ompt_task_id_none ((ompt_task_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_parallel_id_t;
|
||||
#define ompt_parallel_id_none ((ompt_parallel_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_wait_id_t;
|
||||
#define ompt_wait_id_none ((ompt_wait_id_t) 0) /* non-standard */
|
||||
|
||||
|
||||
/*---------------------
|
||||
* ompt_frame_t
|
||||
*---------------------*/
|
||||
|
||||
typedef struct ompt_frame_s {
|
||||
void *exit_runtime_frame; /* next frame is user code */
|
||||
void *reenter_runtime_frame; /* previous frame is user code */
|
||||
} ompt_frame_t;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* enumerations for thread states and runtime events
|
||||
*****************************************************************************/
|
||||
|
||||
/*---------------------
|
||||
* runtime states
|
||||
*---------------------*/
|
||||
|
||||
typedef enum {
|
||||
#define ompt_state_macro(state, code) state = code,
|
||||
FOREACH_OMPT_STATE(ompt_state_macro)
|
||||
#undef ompt_state_macro
|
||||
} ompt_state_t;
|
||||
|
||||
|
||||
/*---------------------
|
||||
* runtime events
|
||||
*---------------------*/
|
||||
|
||||
typedef enum {
|
||||
#define ompt_event_macro(event, callback, eventid) event = eventid,
|
||||
FOREACH_OMPT_EVENT(ompt_event_macro)
|
||||
#undef ompt_event_macro
|
||||
} ompt_event_t;
|
||||
|
||||
|
||||
/*---------------------
|
||||
* set callback results
|
||||
*---------------------*/
|
||||
typedef enum {
|
||||
ompt_set_result_registration_error = 0,
|
||||
ompt_set_result_event_may_occur_no_callback = 1,
|
||||
ompt_set_result_event_never_occurs = 2,
|
||||
ompt_set_result_event_may_occur_callback_some = 3,
|
||||
ompt_set_result_event_may_occur_callback_always = 4,
|
||||
} ompt_set_result_t;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* callback signatures
|
||||
*****************************************************************************/
|
||||
|
||||
/* initialization */
|
||||
typedef void (*ompt_interface_fn_t)(void);
|
||||
|
||||
typedef ompt_interface_fn_t (*ompt_function_lookup_t)(
|
||||
const char * /* entry point to look up */
|
||||
);
|
||||
|
||||
/* threads */
|
||||
typedef void (*ompt_thread_callback_t) (
|
||||
ompt_thread_id_t thread_id /* ID of thread */
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
ompt_thread_initial = 1, // start the enumeration at 1
|
||||
ompt_thread_worker = 2,
|
||||
ompt_thread_other = 3
|
||||
} ompt_thread_type_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 */
|
||||
);
|
||||
|
||||
typedef void (*ompt_wait_callback_t) (
|
||||
ompt_wait_id_t wait_id /* wait id */
|
||||
);
|
||||
|
||||
/* parallel and workshares */
|
||||
typedef void (*ompt_parallel_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t task_id /* id of task */
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_workshare_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
void *workshare_function /* pointer to outlined function */
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_parallel_callback_t) (
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
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 */
|
||||
);
|
||||
|
||||
/* tasks */
|
||||
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_new_task_callback_t) (
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
ompt_frame_t *parent_task_frame, /* frame data for parent task */
|
||||
ompt_task_id_t new_task_id, /* id of created task */
|
||||
void *task_function /* pointer to outlined function */
|
||||
);
|
||||
|
||||
/* program */
|
||||
typedef void (*ompt_control_callback_t) (
|
||||
uint64_t command, /* command of control call */
|
||||
uint64_t modifier /* modifier of control call */
|
||||
);
|
||||
|
||||
typedef void (*ompt_callback_t)(void);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* ompt API
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OMPT_API_FNTYPE(fn) fn##_t
|
||||
|
||||
#define OMPT_API_FUNCTION(return_type, fn, args) \
|
||||
typedef return_type (*OMPT_API_FNTYPE(fn)) args
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* INQUIRY FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* state */
|
||||
OMPT_API_FUNCTION(ompt_state_t, ompt_get_state, (
|
||||
ompt_wait_id_t *ompt_wait_id
|
||||
));
|
||||
|
||||
/* thread */
|
||||
OMPT_API_FUNCTION(ompt_thread_id_t, ompt_get_thread_id, (void));
|
||||
|
||||
OMPT_API_FUNCTION(void *, ompt_get_idle_frame, (void));
|
||||
|
||||
/* parallel region */
|
||||
OMPT_API_FUNCTION(ompt_parallel_id_t, ompt_get_parallel_id, (
|
||||
int ancestor_level
|
||||
));
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_get_parallel_team_size, (
|
||||
int ancestor_level
|
||||
));
|
||||
|
||||
/* task */
|
||||
OMPT_API_FUNCTION(ompt_task_id_t, ompt_get_task_id, (
|
||||
int depth
|
||||
));
|
||||
|
||||
OMPT_API_FUNCTION(ompt_frame_t *, ompt_get_task_frame, (
|
||||
int depth
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* PLACEHOLDERS FOR PERFORMANCE REPORTING
|
||||
***************************************************************************/
|
||||
|
||||
/* idle */
|
||||
OMPT_API_FUNCTION(void, ompt_idle, (
|
||||
void
|
||||
));
|
||||
|
||||
/* overhead */
|
||||
OMPT_API_FUNCTION(void, ompt_overhead, (
|
||||
void
|
||||
));
|
||||
|
||||
/* barrier wait */
|
||||
OMPT_API_FUNCTION(void, ompt_barrier_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
/* task wait */
|
||||
OMPT_API_FUNCTION(void, ompt_task_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
/* mutex wait */
|
||||
OMPT_API_FUNCTION(void, ompt_mutex_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* INITIALIZATION FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
int ompt_initialize(
|
||||
ompt_function_lookup_t ompt_fn_lookup,
|
||||
const char *runtime_version,
|
||||
unsigned int ompt_version
|
||||
);
|
||||
|
||||
typedef enum opt_init_mode_e {
|
||||
ompt_init_mode_never = 0,
|
||||
ompt_init_mode_false = 1,
|
||||
ompt_init_mode_true = 2,
|
||||
ompt_init_mode_always = 3
|
||||
} ompt_init_mode_t;
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_set_callback, (
|
||||
ompt_event_t event,
|
||||
ompt_callback_t callback
|
||||
));
|
||||
|
||||
typedef enum ompt_set_callback_rc_e { /* non-standard */
|
||||
ompt_set_callback_error = 0,
|
||||
ompt_has_event_no_callback = 1,
|
||||
ompt_no_event_no_callback = 2,
|
||||
ompt_has_event_may_callback = 3,
|
||||
ompt_has_event_must_callback = 4,
|
||||
} ompt_set_callback_rc_t;
|
||||
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_get_callback, (
|
||||
ompt_event_t event,
|
||||
ompt_callback_t *callback
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* MISCELLANEOUS FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* control */
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp declare target
|
||||
#endif
|
||||
void ompt_control(
|
||||
uint64_t command,
|
||||
uint64_t modifier
|
||||
);
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp end declare target
|
||||
#endif
|
||||
|
||||
/* state enumeration */
|
||||
OMPT_API_FUNCTION(int, ompt_enumerate_state, (
|
||||
int current_state,
|
||||
int *next_state,
|
||||
const char **next_state_name
|
||||
));
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* include/25/iomp.h.var
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
* include/41/iomp.h.var
|
||||
*/
|
||||
|
||||
|
||||
@@ -27,16 +25,19 @@
|
||||
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_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
|
||||
# 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
|
||||
@@ -59,6 +60,18 @@
|
||||
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);
|
||||
@@ -67,6 +80,16 @@
|
||||
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:
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/25/iomp_lib.h.var
|
||||
! $Revision: 42061 $
|
||||
! $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
! include/41/iomp_lib.h.var
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -31,8 +29,9 @@
|
||||
!*** 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_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
|
||||
@@ -54,6 +53,20 @@
|
||||
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
|
||||
@@ -61,6 +74,8 @@
|
||||
external kmp_realloc
|
||||
integer (kind = kmp_pointer_kind) kmp_realloc
|
||||
external kmp_free
|
||||
|
||||
external kmp_set_warnings_on
|
||||
external kmp_set_warnings_off
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* include/25/omp.h.var
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
* include/41/omp.h.var
|
||||
*/
|
||||
|
||||
|
||||
@@ -27,32 +25,26 @@
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define omp_set_num_threads ompc_set_num_threads
|
||||
# define omp_set_dynamic ompc_set_dynamic
|
||||
# define omp_set_nested ompc_set_nested
|
||||
|
||||
# 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_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
|
||||
|
||||
/* schedule kind constants */
|
||||
typedef enum omp_sched_t {
|
||||
omp_sched_static = 1,
|
||||
omp_sched_dynamic = 2,
|
||||
omp_sched_guided = 3,
|
||||
omp_sched_auto = 4
|
||||
} omp_sched_t;
|
||||
|
||||
/* set API functions */
|
||||
extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int);
|
||||
extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int);
|
||||
extern void __KAI_KMPC_CONVENTION omp_set_nested (int);
|
||||
extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int);
|
||||
extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int);
|
||||
|
||||
/* query API functions */
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void);
|
||||
@@ -62,6 +54,14 @@
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_in_parallel (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_in_final (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_active_level (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_level (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_team_size (int);
|
||||
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 *);
|
||||
|
||||
/* lock API functions */
|
||||
typedef struct omp_lock_t {
|
||||
@@ -85,10 +85,33 @@
|
||||
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);
|
||||
|
||||
/* OpenMP 4.0 */
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_default_device (void);
|
||||
extern void __KAI_KMPC_CONVENTION omp_set_default_device (int);
|
||||
extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_team_num (void);
|
||||
extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void);
|
||||
|
||||
# include <stdlib.h>
|
||||
/* kmp API functions */
|
||||
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
|
||||
@@ -104,6 +127,29 @@
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
|
||||
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
|
||||
|
||||
/* Intel affinity API */
|
||||
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 *);
|
||||
|
||||
/* OpenMP 4.0 affinity API */
|
||||
typedef enum omp_proc_bind_t {
|
||||
omp_proc_bind_false = 0,
|
||||
omp_proc_bind_true = 1,
|
||||
omp_proc_bind_master = 2,
|
||||
omp_proc_bind_close = 3,
|
||||
omp_proc_bind_spread = 4
|
||||
} omp_proc_bind_t;
|
||||
|
||||
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_calloc (size_t, size_t);
|
||||
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
|
||||
@@ -1,6 +1,4 @@
|
||||
! include/25/omp_lib.f.var
|
||||
! $Revision: 42181 $
|
||||
! $Date: 2013-03-26 15:04:45 -0500 (Tue, 26 Mar 2013) $
|
||||
! include/41/omp_lib.f.var
|
||||
|
||||
!
|
||||
!//===----------------------------------------------------------------------===//
|
||||
@@ -22,13 +20,18 @@
|
||||
|
||||
module omp_lib_kinds
|
||||
|
||||
integer, parameter :: omp_integer_kind = 4
|
||||
integer, parameter :: omp_logical_kind = 4
|
||||
integer, parameter :: omp_real_kind = 4
|
||||
integer, parameter :: omp_lock_kind = int_ptr_kind()
|
||||
integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_pointer_kind = int_ptr_kind()
|
||||
integer, parameter :: kmp_size_t_kind = int_ptr_kind()
|
||||
integer, parameter :: omp_integer_kind = 4
|
||||
integer, parameter :: omp_logical_kind = 4
|
||||
integer, parameter :: omp_real_kind = 4
|
||||
integer, parameter :: omp_lock_kind = int_ptr_kind()
|
||||
integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
|
||||
integer, parameter :: omp_sched_kind = omp_integer_kind
|
||||
integer, parameter :: omp_proc_bind_kind = omp_integer_kind
|
||||
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_cancel_kind = omp_integer_kind
|
||||
integer, parameter :: kmp_lock_hint_kind = omp_integer_kind
|
||||
|
||||
end module omp_lib_kinds
|
||||
|
||||
@@ -36,11 +39,34 @@
|
||||
|
||||
use omp_lib_kinds
|
||||
|
||||
integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR
|
||||
integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR
|
||||
integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD
|
||||
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, parameter :: openmp_version = 200505
|
||||
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
|
||||
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
|
||||
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_cancel_kind), parameter :: kmp_cancel_parallel = 1
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_loop = 2
|
||||
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
|
||||
|
||||
@@ -98,63 +124,180 @@
|
||||
logical (kind=omp_logical_kind) omp_get_nested
|
||||
end function omp_get_nested
|
||||
|
||||
function omp_get_wtime()
|
||||
function omp_get_thread_limit()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_thread_limit
|
||||
end function omp_get_thread_limit
|
||||
|
||||
subroutine omp_set_max_active_levels(max_levels)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) max_levels
|
||||
end subroutine omp_set_max_active_levels
|
||||
|
||||
function omp_get_max_active_levels()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_max_active_levels
|
||||
end function omp_get_max_active_levels
|
||||
|
||||
function omp_get_level()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_level
|
||||
end function omp_get_level
|
||||
|
||||
function omp_get_active_level()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_active_level
|
||||
end function omp_get_active_level
|
||||
|
||||
function omp_get_ancestor_thread_num(level)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) level
|
||||
integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
|
||||
end function omp_get_ancestor_thread_num
|
||||
|
||||
function omp_get_team_size(level)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) level
|
||||
integer (kind=omp_integer_kind) omp_get_team_size
|
||||
end function omp_get_team_size
|
||||
|
||||
subroutine omp_set_schedule(kind, modifier)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_sched_kind) kind
|
||||
integer (kind=omp_integer_kind) modifier
|
||||
end subroutine omp_set_schedule
|
||||
|
||||
subroutine omp_get_schedule(kind, modifier)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_sched_kind) kind
|
||||
integer (kind=omp_integer_kind) modifier
|
||||
end subroutine omp_get_schedule
|
||||
|
||||
function omp_get_proc_bind()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_proc_bind_kind) omp_get_proc_bind
|
||||
end function omp_get_proc_bind
|
||||
|
||||
function omp_get_wtime()
|
||||
double precision omp_get_wtime
|
||||
end function omp_get_wtime
|
||||
|
||||
function omp_get_wtick ()
|
||||
use omp_lib_kinds
|
||||
double precision omp_get_wtick
|
||||
end function omp_get_wtick
|
||||
|
||||
function omp_get_default_device()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_default_device
|
||||
end function omp_get_default_device
|
||||
|
||||
subroutine omp_set_default_device(dflt_device)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) dflt_device
|
||||
end subroutine omp_set_default_device
|
||||
|
||||
function omp_get_num_devices()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_devices
|
||||
end function omp_get_num_devices
|
||||
|
||||
function omp_get_num_teams()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_teams
|
||||
end function omp_get_num_teams
|
||||
|
||||
function omp_get_team_num()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_team_num
|
||||
end function omp_get_team_num
|
||||
|
||||
function omp_get_cancellation()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_cancellation
|
||||
end function omp_get_cancellation
|
||||
|
||||
function omp_is_initial_device()
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_is_initial_device
|
||||
end function omp_is_initial_device
|
||||
|
||||
subroutine omp_init_lock(lockvar)
|
||||
!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
|
||||
end subroutine omp_init_lock
|
||||
|
||||
subroutine omp_destroy_lock(lockvar)
|
||||
!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
|
||||
end subroutine omp_destroy_lock
|
||||
|
||||
subroutine omp_set_lock(lockvar)
|
||||
!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
|
||||
end subroutine omp_set_lock
|
||||
|
||||
subroutine omp_unset_lock(lockvar)
|
||||
!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
|
||||
end subroutine omp_unset_lock
|
||||
|
||||
function omp_test_lock(lockvar)
|
||||
!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
|
||||
end function omp_test_lock
|
||||
|
||||
subroutine omp_init_nest_lock(lockvar)
|
||||
!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
|
||||
end subroutine omp_init_nest_lock
|
||||
|
||||
subroutine omp_destroy_nest_lock(lockvar)
|
||||
!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
|
||||
end subroutine omp_destroy_nest_lock
|
||||
|
||||
subroutine omp_set_nest_lock(lockvar)
|
||||
!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
|
||||
end subroutine omp_set_nest_lock
|
||||
|
||||
subroutine omp_unset_nest_lock(lockvar)
|
||||
!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
|
||||
end subroutine omp_unset_nest_lock
|
||||
|
||||
function omp_test_nest_lock(lockvar)
|
||||
!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
|
||||
@@ -180,15 +323,12 @@
|
||||
end subroutine kmp_set_blocktime
|
||||
|
||||
subroutine kmp_set_library_serial()
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_library_serial
|
||||
|
||||
subroutine kmp_set_library_turnaround()
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_library_turnaround
|
||||
|
||||
subroutine kmp_set_library_throughput()
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_library_throughput
|
||||
|
||||
subroutine kmp_set_library(libnum)
|
||||
@@ -220,6 +360,54 @@
|
||||
integer (kind=omp_integer_kind) kmp_get_library
|
||||
end function kmp_get_library
|
||||
|
||||
function kmp_set_affinity(mask)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_set_affinity
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_set_affinity
|
||||
|
||||
function kmp_get_affinity(mask)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_get_affinity
|
||||
|
||||
function kmp_get_affinity_max_proc()
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
|
||||
end function kmp_get_affinity_max_proc
|
||||
|
||||
subroutine kmp_create_affinity_mask(mask)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end subroutine kmp_create_affinity_mask
|
||||
|
||||
subroutine kmp_destroy_affinity_mask(mask)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end subroutine kmp_destroy_affinity_mask
|
||||
|
||||
function kmp_set_affinity_mask_proc(proc, mask)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind) proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_set_affinity_mask_proc
|
||||
|
||||
function kmp_unset_affinity_mask_proc(proc, mask)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind) proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_unset_affinity_mask_proc
|
||||
|
||||
function kmp_get_affinity_mask_proc(proc, mask)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind) proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_get_affinity_mask_proc
|
||||
|
||||
function kmp_malloc(size)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_malloc
|
||||
@@ -246,14 +434,30 @@
|
||||
end subroutine kmp_free
|
||||
|
||||
subroutine kmp_set_warnings_on()
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_warnings_on
|
||||
|
||||
subroutine kmp_set_warnings_off()
|
||||
use omp_lib_kinds
|
||||
end subroutine kmp_set_warnings_off
|
||||
|
||||
end interface
|
||||
function kmp_get_cancellation_status(cancelkind)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_cancel_kind) cancelkind
|
||||
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)
|
||||
!dec$ if defined(_WIN64) .or. defined(_M_AMD64)
|
||||
@@ -278,8 +482,25 @@
|
||||
!dec$ attributes alias:'OMP_IN_PARALLEL' :: omp_in_parallel
|
||||
!dec$ attributes alias:'OMP_GET_DYNAMIC' :: omp_get_dynamic
|
||||
!dec$ attributes alias:'OMP_GET_NESTED' :: omp_get_nested
|
||||
!dec$ attributes alias:'OMP_GET_THREAD_LIMIT' :: omp_get_thread_limit
|
||||
!dec$ attributes alias:'OMP_SET_MAX_ACTIVE_LEVELS' :: omp_set_max_active_levels
|
||||
!dec$ attributes alias:'OMP_GET_MAX_ACTIVE_LEVELS' :: omp_get_max_active_levels
|
||||
!dec$ attributes alias:'OMP_GET_LEVEL' :: omp_get_level
|
||||
!dec$ attributes alias:'OMP_GET_ACTIVE_LEVEL' :: omp_get_active_level
|
||||
!dec$ attributes alias:'OMP_GET_ANCESTOR_THREAD_NUM' :: omp_get_ancestor_thread_num
|
||||
!dec$ attributes alias:'OMP_GET_TEAM_SIZE' :: omp_get_team_size
|
||||
!dec$ attributes alias:'OMP_SET_SCHEDULE' :: omp_set_schedule
|
||||
!dec$ attributes alias:'OMP_GET_SCHEDULE' :: omp_get_schedule
|
||||
!dec$ attributes alias:'OMP_GET_PROC_BIND' :: omp_get_proc_bind
|
||||
!dec$ attributes alias:'OMP_GET_WTIME' :: omp_get_wtime
|
||||
!dec$ attributes alias:'OMP_GET_WTICK' :: omp_get_wtick
|
||||
!dec$ attributes alias:'OMP_GET_DEFAULT_DEVICE' :: omp_get_default_device
|
||||
!dec$ attributes alias:'OMP_SET_DEFAULT_DEVICE' :: omp_set_default_device
|
||||
!dec$ attributes alias:'OMP_GET_NUM_DEVICES' :: omp_get_num_devices
|
||||
!dec$ attributes alias:'OMP_GET_NUM_TEAMS' :: omp_get_num_teams
|
||||
!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_init_lock' :: omp_init_lock
|
||||
!dec$ attributes alias:'omp_destroy_lock' :: omp_destroy_lock
|
||||
@@ -303,6 +524,14 @@
|
||||
!dec$ attributes alias:'KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
|
||||
!dec$ attributes alias:'KMP_GET_BLOCKTIME'::kmp_get_blocktime
|
||||
!dec$ attributes alias:'KMP_GET_LIBRARY'::kmp_get_library
|
||||
!dec$ attributes alias:'KMP_SET_AFFINITY'::kmp_set_affinity
|
||||
!dec$ attributes alias:'KMP_GET_AFFINITY'::kmp_get_affinity
|
||||
!dec$ attributes alias:'KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
|
||||
!dec$ attributes alias:'KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
|
||||
!dec$ attributes alias:'KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
|
||||
!dec$ attributes alias:'KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
|
||||
!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_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
|
||||
@@ -311,11 +540,15 @@
|
||||
!dec$ attributes alias:'KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
|
||||
!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$ else
|
||||
|
||||
!***
|
||||
!*** On Windows* OS IA-32 architecture, the Fortran entry points have an
|
||||
!*** underscore prepended.
|
||||
!*** On Windows* OS IA-32 architecture, the Fortran entry points have an underscore prepended.
|
||||
!***
|
||||
|
||||
!dec$ attributes alias:'_OMP_SET_NUM_THREADS' :: omp_set_num_threads
|
||||
@@ -328,8 +561,25 @@
|
||||
!dec$ attributes alias:'_OMP_IN_PARALLEL' :: omp_in_parallel
|
||||
!dec$ attributes alias:'_OMP_GET_DYNAMIC' :: omp_get_dynamic
|
||||
!dec$ attributes alias:'_OMP_GET_NESTED' :: omp_get_nested
|
||||
!dec$ attributes alias:'_OMP_GET_THREAD_LIMIT' :: omp_get_thread_limit
|
||||
!dec$ attributes alias:'_OMP_SET_MAX_ACTIVE_LEVELS' :: omp_set_max_active_levels
|
||||
!dec$ attributes alias:'_OMP_GET_MAX_ACTIVE_LEVELS' :: omp_get_max_active_levels
|
||||
!dec$ attributes alias:'_OMP_GET_LEVEL' :: omp_get_level
|
||||
!dec$ attributes alias:'_OMP_GET_ACTIVE_LEVEL' :: omp_get_active_level
|
||||
!dec$ attributes alias:'_OMP_GET_ANCESTOR_THREAD_NUM' :: omp_get_ancestor_thread_num
|
||||
!dec$ attributes alias:'_OMP_GET_TEAM_SIZE' :: omp_get_team_size
|
||||
!dec$ attributes alias:'_OMP_SET_SCHEDULE' :: omp_set_schedule
|
||||
!dec$ attributes alias:'_OMP_GET_SCHEDULE' :: omp_get_schedule
|
||||
!dec$ attributes alias:'_OMP_GET_PROC_BIND' :: omp_get_proc_bind
|
||||
!dec$ attributes alias:'_OMP_GET_WTIME' :: omp_get_wtime
|
||||
!dec$ attributes alias:'_OMP_GET_WTICK' :: omp_get_wtick
|
||||
!dec$ attributes alias:'_OMP_GET_DEFAULT_DEVICE' :: omp_get_default_device
|
||||
!dec$ attributes alias:'_OMP_SET_DEFAULT_DEVICE' :: omp_set_default_device
|
||||
!dec$ attributes alias:'_OMP_GET_NUM_DEVICES' :: omp_get_num_devices
|
||||
!dec$ attributes alias:'_OMP_GET_NUM_TEAMS' :: omp_get_num_teams
|
||||
!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_init_lock' :: omp_init_lock
|
||||
!dec$ attributes alias:'_omp_destroy_lock' :: omp_destroy_lock
|
||||
@@ -353,6 +603,14 @@
|
||||
!dec$ attributes alias:'_KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
|
||||
!dec$ attributes alias:'_KMP_GET_BLOCKTIME'::kmp_get_blocktime
|
||||
!dec$ attributes alias:'_KMP_GET_LIBRARY'::kmp_get_library
|
||||
!dec$ attributes alias:'_KMP_SET_AFFINITY'::kmp_set_affinity
|
||||
!dec$ attributes alias:'_KMP_GET_AFFINITY'::kmp_get_affinity
|
||||
!dec$ attributes alias:'_KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
|
||||
!dec$ attributes alias:'_KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
|
||||
!dec$ attributes alias:'_KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
|
||||
!dec$ attributes alias:'_KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
|
||||
!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_CALLOC'::kmp_calloc
|
||||
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
|
||||
@@ -361,6 +619,11 @@
|
||||
!dec$ attributes alias:'_KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
|
||||
!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$ endif
|
||||
|
||||
@@ -380,8 +643,25 @@
|
||||
!dec$ attributes alias:'omp_in_parallel_'::omp_in_parallel
|
||||
!dec$ attributes alias:'omp_get_dynamic_'::omp_get_dynamic
|
||||
!dec$ attributes alias:'omp_get_nested_'::omp_get_nested
|
||||
!dec$ attributes alias:'omp_get_thread_limit_'::omp_get_thread_limit
|
||||
!dec$ attributes alias:'omp_set_max_active_levels_'::omp_set_max_active_levels
|
||||
!dec$ attributes alias:'omp_get_max_active_levels_'::omp_get_max_active_levels
|
||||
!dec$ attributes alias:'omp_get_level_'::omp_get_level
|
||||
!dec$ attributes alias:'omp_get_active_level_'::omp_get_active_level
|
||||
!dec$ attributes alias:'omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
|
||||
!dec$ attributes alias:'omp_get_team_size_'::omp_get_team_size
|
||||
!dec$ attributes alias:'omp_set_schedule_'::omp_set_schedule
|
||||
!dec$ attributes alias:'omp_get_schedule_'::omp_get_schedule
|
||||
!dec$ attributes alias:'omp_get_proc_bind_' :: omp_get_proc_bind
|
||||
!dec$ attributes alias:'omp_get_wtime_'::omp_get_wtime
|
||||
!dec$ attributes alias:'omp_get_wtick_'::omp_get_wtick
|
||||
!dec$ attributes alias:'omp_get_default_device_'::omp_get_default_device
|
||||
!dec$ attributes alias:'omp_set_default_device_'::omp_set_default_device
|
||||
!dec$ attributes alias:'omp_get_num_devices_'::omp_get_num_devices
|
||||
!dec$ attributes alias:'omp_get_num_teams_'::omp_get_num_teams
|
||||
!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_init_lock_'::omp_init_lock
|
||||
!dec$ attributes alias:'omp_destroy_lock_'::omp_destroy_lock
|
||||
@@ -405,6 +685,14 @@
|
||||
!dec$ attributes alias:'kmp_get_stacksize_s_'::kmp_get_stacksize_s
|
||||
!dec$ attributes alias:'kmp_get_blocktime_'::kmp_get_blocktime
|
||||
!dec$ attributes alias:'kmp_get_library_'::kmp_get_library
|
||||
!dec$ attributes alias:'kmp_set_affinity_'::kmp_set_affinity
|
||||
!dec$ attributes alias:'kmp_get_affinity_'::kmp_get_affinity
|
||||
!dec$ attributes alias:'kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
|
||||
!dec$ attributes alias:'kmp_create_affinity_mask_'::kmp_create_affinity_mask
|
||||
!dec$ attributes alias:'kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
|
||||
!dec$ attributes alias:'kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
|
||||
!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_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
|
||||
@@ -412,6 +700,10 @@
|
||||
|
||||
!dec$ attributes alias:'kmp_set_warnings_on_'::kmp_set_warnings_on
|
||||
!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
|
||||
|
||||
@@ -432,8 +724,22 @@
|
||||
!dec$ attributes alias:'_omp_in_parallel_'::omp_in_parallel
|
||||
!dec$ attributes alias:'_omp_get_dynamic_'::omp_get_dynamic
|
||||
!dec$ attributes alias:'_omp_get_nested_'::omp_get_nested
|
||||
!dec$ attributes alias:'_omp_get_thread_limit_'::omp_get_thread_limit
|
||||
!dec$ attributes alias:'_omp_set_max_active_levels_'::omp_set_max_active_levels
|
||||
!dec$ attributes alias:'_omp_get_max_active_levels_'::omp_get_max_active_levels
|
||||
!dec$ attributes alias:'_omp_get_level_'::omp_get_level
|
||||
!dec$ attributes alias:'_omp_get_active_level_'::omp_get_active_level
|
||||
!dec$ attributes alias:'_omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
|
||||
!dec$ attributes alias:'_omp_get_team_size_'::omp_get_team_size
|
||||
!dec$ attributes alias:'_omp_set_schedule_'::omp_set_schedule
|
||||
!dec$ attributes alias:'_omp_get_schedule_'::omp_get_schedule
|
||||
!dec$ attributes alias:'_omp_get_proc_bind_' :: omp_get_proc_bind
|
||||
!dec$ attributes alias:'_omp_get_wtime_'::omp_get_wtime
|
||||
!dec$ attributes alias:'_omp_get_wtick_'::omp_get_wtick
|
||||
!dec$ attributes alias:'_omp_get_num_teams_'::omp_get_num_teams
|
||||
!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_init_lock_'::omp_init_lock
|
||||
!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
|
||||
@@ -457,6 +763,14 @@
|
||||
!dec$ attributes alias:'_kmp_get_stacksize_s_'::kmp_get_stacksize_s
|
||||
!dec$ attributes alias:'_kmp_get_blocktime_'::kmp_get_blocktime
|
||||
!dec$ attributes alias:'_kmp_get_library_'::kmp_get_library
|
||||
!dec$ attributes alias:'_kmp_set_affinity_'::kmp_set_affinity
|
||||
!dec$ attributes alias:'_kmp_get_affinity_'::kmp_get_affinity
|
||||
!dec$ attributes alias:'_kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
|
||||
!dec$ attributes alias:'_kmp_create_affinity_mask_'::kmp_create_affinity_mask
|
||||
!dec$ attributes alias:'_kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
|
||||
!dec$ attributes alias:'_kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
|
||||
!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_calloc_'::kmp_calloc
|
||||
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
|
||||
@@ -465,8 +779,12 @@
|
||||
!dec$ attributes alias:'_kmp_set_warnings_on_'::kmp_set_warnings_on
|
||||
!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
|
||||
|
||||
end module omp_lib
|
||||
|
||||
|
||||
@@ -0,0 +1,468 @@
|
||||
! include/41/omp_lib.f90.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.
|
||||
!//
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!
|
||||
|
||||
module omp_lib_kinds
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
|
||||
integer, parameter :: omp_integer_kind = c_int
|
||||
integer, parameter :: omp_logical_kind = 4
|
||||
integer, parameter :: omp_real_kind = c_float
|
||||
integer, parameter :: kmp_double_kind = c_double
|
||||
integer, parameter :: omp_lock_kind = c_intptr_t
|
||||
integer, parameter :: omp_nest_lock_kind = c_intptr_t
|
||||
integer, parameter :: omp_sched_kind = omp_integer_kind
|
||||
integer, parameter :: omp_proc_bind_kind = omp_integer_kind
|
||||
integer, parameter :: kmp_pointer_kind = c_intptr_t
|
||||
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
|
||||
|
||||
module omp_lib
|
||||
|
||||
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
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
|
||||
|
||||
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
|
||||
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_cancel_kind), parameter :: kmp_cancel_parallel = 1
|
||||
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_loop = 2
|
||||
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
|
||||
|
||||
! ***
|
||||
! *** omp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine omp_set_num_threads(nthreads) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: nthreads
|
||||
end subroutine omp_set_num_threads
|
||||
|
||||
subroutine omp_set_dynamic(enable) bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
end subroutine omp_set_dynamic
|
||||
|
||||
subroutine omp_set_nested(enable) bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
end subroutine omp_set_nested
|
||||
|
||||
function omp_get_num_threads() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_threads
|
||||
end function omp_get_num_threads
|
||||
|
||||
function omp_get_max_threads() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_max_threads
|
||||
end function omp_get_max_threads
|
||||
|
||||
function omp_get_thread_num() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_thread_num
|
||||
end function omp_get_thread_num
|
||||
|
||||
function omp_get_num_procs() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_procs
|
||||
end function omp_get_num_procs
|
||||
|
||||
function omp_in_parallel() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_in_parallel
|
||||
end function omp_in_parallel
|
||||
|
||||
function omp_in_final() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_in_final
|
||||
end function omp_in_final
|
||||
|
||||
function omp_get_dynamic() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_get_dynamic
|
||||
end function omp_get_dynamic
|
||||
|
||||
function omp_get_nested() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_get_nested
|
||||
end function omp_get_nested
|
||||
|
||||
function omp_get_thread_limit() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_thread_limit
|
||||
end function omp_get_thread_limit
|
||||
|
||||
subroutine omp_set_max_active_levels(max_levels) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: max_levels
|
||||
end subroutine omp_set_max_active_levels
|
||||
|
||||
function omp_get_max_active_levels() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_max_active_levels
|
||||
end function omp_get_max_active_levels
|
||||
|
||||
function omp_get_level() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_level
|
||||
end function omp_get_level
|
||||
|
||||
function omp_get_active_level() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_active_level
|
||||
end function omp_get_active_level
|
||||
|
||||
function omp_get_ancestor_thread_num(level) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
|
||||
integer (kind=omp_integer_kind), value :: level
|
||||
end function omp_get_ancestor_thread_num
|
||||
|
||||
function omp_get_team_size(level) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_team_size
|
||||
integer (kind=omp_integer_kind), value :: level
|
||||
end function omp_get_team_size
|
||||
|
||||
subroutine omp_set_schedule(kind, modifier) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_sched_kind), value :: kind
|
||||
integer (kind=omp_integer_kind), value :: modifier
|
||||
end subroutine omp_set_schedule
|
||||
|
||||
subroutine omp_get_schedule(kind, modifier) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_sched_kind) kind
|
||||
integer (kind=omp_integer_kind) modifier
|
||||
end subroutine omp_get_schedule
|
||||
|
||||
function omp_get_proc_bind() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_proc_bind_kind) omp_get_proc_bind
|
||||
end function omp_get_proc_bind
|
||||
|
||||
function omp_get_wtime() bind(c)
|
||||
use omp_lib_kinds
|
||||
real (kind=kmp_double_kind) omp_get_wtime
|
||||
end function omp_get_wtime
|
||||
|
||||
function omp_get_wtick() bind(c)
|
||||
use omp_lib_kinds
|
||||
real (kind=kmp_double_kind) omp_get_wtick
|
||||
end function omp_get_wtick
|
||||
|
||||
function omp_get_default_device() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_default_device
|
||||
end function omp_get_default_device
|
||||
|
||||
subroutine omp_set_default_device(dflt_device) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: dflt_device
|
||||
end subroutine omp_set_default_device
|
||||
|
||||
function omp_get_num_devices() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_devices
|
||||
end function omp_get_num_devices
|
||||
|
||||
function omp_get_num_teams() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_num_teams
|
||||
end function omp_get_num_teams
|
||||
|
||||
function omp_get_team_num() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_team_num
|
||||
end function omp_get_team_num
|
||||
|
||||
function omp_get_cancellation() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) omp_get_cancellation
|
||||
end function omp_get_cancellation
|
||||
|
||||
function omp_is_initial_device() bind(c)
|
||||
use omp_lib_kinds
|
||||
logical (kind=omp_logical_kind) omp_is_initial_device
|
||||
end function omp_is_initial_device
|
||||
|
||||
subroutine omp_init_lock(lockvar) 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
|
||||
end subroutine omp_init_lock
|
||||
|
||||
subroutine omp_destroy_lock(lockvar) 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
|
||||
end subroutine omp_destroy_lock
|
||||
|
||||
subroutine omp_set_lock(lockvar) 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
|
||||
end subroutine omp_set_lock
|
||||
|
||||
subroutine omp_unset_lock(lockvar) 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
|
||||
end subroutine omp_unset_lock
|
||||
|
||||
function omp_test_lock(lockvar) 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
|
||||
end function omp_test_lock
|
||||
|
||||
subroutine omp_init_nest_lock(lockvar) 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
|
||||
end subroutine omp_init_nest_lock
|
||||
|
||||
subroutine omp_destroy_nest_lock(lockvar) 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
|
||||
end subroutine omp_destroy_nest_lock
|
||||
|
||||
subroutine omp_set_nest_lock(lockvar) 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
|
||||
end subroutine omp_set_nest_lock
|
||||
|
||||
subroutine omp_unset_nest_lock(lockvar) 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
|
||||
end subroutine omp_unset_nest_lock
|
||||
|
||||
function omp_test_nest_lock(lockvar) 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
|
||||
end function omp_test_nest_lock
|
||||
|
||||
! ***
|
||||
! *** kmp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine kmp_set_stacksize(size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: size
|
||||
end subroutine kmp_set_stacksize
|
||||
|
||||
subroutine kmp_set_stacksize_s(size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end subroutine kmp_set_stacksize_s
|
||||
|
||||
subroutine kmp_set_blocktime(msec) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: msec
|
||||
end subroutine kmp_set_blocktime
|
||||
|
||||
subroutine kmp_set_library_serial() bind(c)
|
||||
end subroutine kmp_set_library_serial
|
||||
|
||||
subroutine kmp_set_library_turnaround() bind(c)
|
||||
end subroutine kmp_set_library_turnaround
|
||||
|
||||
subroutine kmp_set_library_throughput() bind(c)
|
||||
end subroutine kmp_set_library_throughput
|
||||
|
||||
subroutine kmp_set_library(libnum) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind), value :: libnum
|
||||
end subroutine kmp_set_library
|
||||
|
||||
subroutine kmp_set_defaults(string) bind(c)
|
||||
use, intrinsic :: iso_c_binding
|
||||
character (kind=c_char) :: string(*)
|
||||
end subroutine kmp_set_defaults
|
||||
|
||||
function kmp_get_stacksize() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_stacksize
|
||||
end function kmp_get_stacksize
|
||||
|
||||
function kmp_get_stacksize_s() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
|
||||
end function kmp_get_stacksize_s
|
||||
|
||||
function kmp_get_blocktime() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_blocktime
|
||||
end function kmp_get_blocktime
|
||||
|
||||
function kmp_get_library() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_library
|
||||
end function kmp_get_library
|
||||
|
||||
function kmp_set_affinity(mask) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_set_affinity
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_set_affinity
|
||||
|
||||
function kmp_get_affinity(mask) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_get_affinity
|
||||
|
||||
function kmp_get_affinity_max_proc() bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
|
||||
end function kmp_get_affinity_max_proc
|
||||
|
||||
subroutine kmp_create_affinity_mask(mask) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end subroutine kmp_create_affinity_mask
|
||||
|
||||
subroutine kmp_destroy_affinity_mask(mask) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end subroutine kmp_destroy_affinity_mask
|
||||
|
||||
function kmp_set_affinity_mask_proc(proc, mask) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind), value :: proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_set_affinity_mask_proc
|
||||
|
||||
function kmp_unset_affinity_mask_proc(proc, mask) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind), value :: proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_unset_affinity_mask_proc
|
||||
|
||||
function kmp_get_affinity_mask_proc(proc, mask) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind), value :: proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_get_affinity_mask_proc
|
||||
|
||||
function kmp_malloc(size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_malloc
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
integer (kind=kmp_size_t_kind), value :: nelem
|
||||
integer (kind=kmp_size_t_kind), value :: elsize
|
||||
end function kmp_calloc
|
||||
|
||||
function kmp_realloc(ptr, size) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind) kmp_realloc
|
||||
integer (kind=kmp_pointer_kind), value :: ptr
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_realloc
|
||||
|
||||
subroutine kmp_free(ptr) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_pointer_kind), value :: ptr
|
||||
end subroutine kmp_free
|
||||
|
||||
subroutine kmp_set_warnings_on() bind(c)
|
||||
end subroutine kmp_set_warnings_on
|
||||
|
||||
subroutine kmp_set_warnings_off() bind(c)
|
||||
end subroutine kmp_set_warnings_off
|
||||
|
||||
function kmp_get_cancellation_status(cancelkind) bind(c)
|
||||
use omp_lib_kinds
|
||||
integer (kind=kmp_cancel_kind), value :: cancelkind
|
||||
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
|
||||
@@ -0,0 +1,582 @@
|
||||
! include/41/omp_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.
|
||||
!//
|
||||
!//===----------------------------------------------------------------------===//
|
||||
!
|
||||
|
||||
!***
|
||||
!*** Some of the directives for the following routine extend past column 72,
|
||||
!*** so process this file in 132-column mode.
|
||||
!***
|
||||
|
||||
!DIR$ fixedformlinesize:132
|
||||
|
||||
integer, parameter :: omp_integer_kind = 4
|
||||
integer, parameter :: omp_logical_kind = 4
|
||||
integer, parameter :: omp_real_kind = 4
|
||||
integer, parameter :: omp_lock_kind = int_ptr_kind()
|
||||
integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
|
||||
integer, parameter :: omp_sched_kind = omp_integer_kind
|
||||
integer, parameter :: omp_proc_bind_kind = omp_integer_kind
|
||||
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
|
||||
character(*) kmp_build_date
|
||||
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
|
||||
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
|
||||
integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
|
||||
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
|
||||
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
|
||||
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
|
||||
|
||||
! ***
|
||||
! *** omp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine omp_set_num_threads(nthreads) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: nthreads
|
||||
end subroutine omp_set_num_threads
|
||||
|
||||
subroutine omp_set_dynamic(enable) bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
end subroutine omp_set_dynamic
|
||||
|
||||
subroutine omp_set_nested(enable) bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind), value :: enable
|
||||
end subroutine omp_set_nested
|
||||
|
||||
function omp_get_num_threads() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_num_threads
|
||||
end function omp_get_num_threads
|
||||
|
||||
function omp_get_max_threads() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_max_threads
|
||||
end function omp_get_max_threads
|
||||
|
||||
function omp_get_thread_num() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_thread_num
|
||||
end function omp_get_thread_num
|
||||
|
||||
function omp_get_num_procs() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_num_procs
|
||||
end function omp_get_num_procs
|
||||
|
||||
function omp_in_parallel() bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_in_parallel
|
||||
end function omp_in_parallel
|
||||
|
||||
function omp_in_final() bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_in_final
|
||||
end function omp_in_final
|
||||
|
||||
function omp_get_dynamic() bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_get_dynamic
|
||||
end function omp_get_dynamic
|
||||
|
||||
function omp_get_nested() bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_get_nested
|
||||
end function omp_get_nested
|
||||
|
||||
function omp_get_thread_limit() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_thread_limit
|
||||
end function omp_get_thread_limit
|
||||
|
||||
subroutine omp_set_max_active_levels(max_levels) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: max_levels
|
||||
end subroutine omp_set_max_active_levels
|
||||
|
||||
function omp_get_max_active_levels() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_max_active_levels
|
||||
end function omp_get_max_active_levels
|
||||
|
||||
function omp_get_level() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_level
|
||||
end function omp_get_level
|
||||
|
||||
function omp_get_active_level() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_active_level
|
||||
end function omp_get_active_level
|
||||
|
||||
function omp_get_ancestor_thread_num(level) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
|
||||
integer (kind=omp_integer_kind), value :: level
|
||||
end function omp_get_ancestor_thread_num
|
||||
|
||||
function omp_get_team_size(level) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_team_size
|
||||
integer (kind=omp_integer_kind), value :: level
|
||||
end function omp_get_team_size
|
||||
|
||||
subroutine omp_set_schedule(kind, modifier) bind(c)
|
||||
import
|
||||
integer (kind=omp_sched_kind), value :: kind
|
||||
integer (kind=omp_integer_kind), value :: modifier
|
||||
end subroutine omp_set_schedule
|
||||
|
||||
subroutine omp_get_schedule(kind, modifier) bind(c)
|
||||
import
|
||||
integer (kind=omp_sched_kind) kind
|
||||
integer (kind=omp_integer_kind) modifier
|
||||
end subroutine omp_get_schedule
|
||||
|
||||
function omp_get_proc_bind() bind(c)
|
||||
import
|
||||
integer (kind=omp_proc_bind_kind) omp_get_proc_bind
|
||||
end function omp_get_proc_bind
|
||||
|
||||
function omp_get_wtime() bind(c)
|
||||
double precision omp_get_wtime
|
||||
end function omp_get_wtime
|
||||
|
||||
function omp_get_wtick() bind(c)
|
||||
double precision omp_get_wtick
|
||||
end function omp_get_wtick
|
||||
|
||||
function omp_get_default_device() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_default_device
|
||||
end function omp_get_default_device
|
||||
|
||||
subroutine omp_set_default_device(dflt_device) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: dflt_device
|
||||
end subroutine omp_set_default_device
|
||||
|
||||
function omp_get_num_devices() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_num_devices
|
||||
end function omp_get_num_devices
|
||||
|
||||
function omp_get_num_teams() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_num_teams
|
||||
end function omp_get_num_teams
|
||||
|
||||
function omp_get_team_num() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) omp_get_team_num
|
||||
end function omp_get_team_num
|
||||
|
||||
function omp_is_initial_device() bind(c)
|
||||
import
|
||||
logical (kind=omp_logical_kind) omp_is_initial_device
|
||||
end function omp_is_initial_device
|
||||
|
||||
subroutine omp_init_lock(lockvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_init_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_init_lock
|
||||
|
||||
subroutine omp_destroy_lock(lockvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_destroy_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_destroy_lock
|
||||
|
||||
subroutine omp_set_lock(lockvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_set_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_set_lock
|
||||
|
||||
subroutine omp_unset_lock(lockvar) bind(c)
|
||||
!DIR$ IF(__INTEL_COMPILER.GE.1400)
|
||||
!DIR$ attributes known_intrinsic :: omp_unset_lock
|
||||
!DIR$ ENDIF
|
||||
import
|
||||
integer (kind=omp_lock_kind) lockvar
|
||||
end subroutine omp_unset_lock
|
||||
|
||||
function omp_test_lock(lockvar) 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
|
||||
end function omp_test_lock
|
||||
|
||||
subroutine omp_init_nest_lock(lockvar) 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
|
||||
end subroutine omp_init_nest_lock
|
||||
|
||||
subroutine omp_destroy_nest_lock(lockvar) 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
|
||||
end subroutine omp_destroy_nest_lock
|
||||
|
||||
subroutine omp_set_nest_lock(lockvar) 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
|
||||
end subroutine omp_set_nest_lock
|
||||
|
||||
subroutine omp_unset_nest_lock(lockvar) 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
|
||||
end subroutine omp_unset_nest_lock
|
||||
|
||||
function omp_test_nest_lock(lockvar) 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
|
||||
end function omp_test_nest_lock
|
||||
|
||||
! ***
|
||||
! *** kmp_* entry points
|
||||
! ***
|
||||
|
||||
subroutine kmp_set_stacksize(size) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: size
|
||||
end subroutine kmp_set_stacksize
|
||||
|
||||
subroutine kmp_set_stacksize_s(size) bind(c)
|
||||
import
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end subroutine kmp_set_stacksize_s
|
||||
|
||||
subroutine kmp_set_blocktime(msec) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: msec
|
||||
end subroutine kmp_set_blocktime
|
||||
|
||||
subroutine kmp_set_library_serial() bind(c)
|
||||
end subroutine kmp_set_library_serial
|
||||
|
||||
subroutine kmp_set_library_turnaround() bind(c)
|
||||
end subroutine kmp_set_library_turnaround
|
||||
|
||||
subroutine kmp_set_library_throughput() bind(c)
|
||||
end subroutine kmp_set_library_throughput
|
||||
|
||||
subroutine kmp_set_library(libnum) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind), value :: libnum
|
||||
end subroutine kmp_set_library
|
||||
|
||||
subroutine kmp_set_defaults(string) bind(c)
|
||||
character string(*)
|
||||
end subroutine kmp_set_defaults
|
||||
|
||||
function kmp_get_stacksize() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_get_stacksize
|
||||
end function kmp_get_stacksize
|
||||
|
||||
function kmp_get_stacksize_s() bind(c)
|
||||
import
|
||||
integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
|
||||
end function kmp_get_stacksize_s
|
||||
|
||||
function kmp_get_blocktime() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_get_blocktime
|
||||
end function kmp_get_blocktime
|
||||
|
||||
function kmp_get_library() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_get_library
|
||||
end function kmp_get_library
|
||||
|
||||
function kmp_set_affinity(mask) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_set_affinity
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_set_affinity
|
||||
|
||||
function kmp_get_affinity(mask) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_get_affinity
|
||||
|
||||
function kmp_get_affinity_max_proc() bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
|
||||
end function kmp_get_affinity_max_proc
|
||||
|
||||
subroutine kmp_create_affinity_mask(mask) bind(c)
|
||||
import
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end subroutine kmp_create_affinity_mask
|
||||
|
||||
subroutine kmp_destroy_affinity_mask(mask) bind(c)
|
||||
import
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end subroutine kmp_destroy_affinity_mask
|
||||
|
||||
function kmp_set_affinity_mask_proc(proc, mask) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind), value :: proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_set_affinity_mask_proc
|
||||
|
||||
function kmp_unset_affinity_mask_proc(proc, mask) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind), value :: proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_unset_affinity_mask_proc
|
||||
|
||||
function kmp_get_affinity_mask_proc(proc, mask) bind(c)
|
||||
import
|
||||
integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
|
||||
integer (kind=omp_integer_kind), value :: proc
|
||||
integer (kind=kmp_affinity_mask_kind) mask
|
||||
end function kmp_get_affinity_mask_proc
|
||||
|
||||
function kmp_malloc(size) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_malloc
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_malloc
|
||||
|
||||
function kmp_calloc(nelem, elsize) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_calloc
|
||||
integer (kind=kmp_size_t_kind), value :: nelem
|
||||
integer (kind=kmp_size_t_kind), value :: elsize
|
||||
end function kmp_calloc
|
||||
|
||||
function kmp_realloc(ptr, size) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind) kmp_realloc
|
||||
integer (kind=kmp_pointer_kind), value :: ptr
|
||||
integer (kind=kmp_size_t_kind), value :: size
|
||||
end function kmp_realloc
|
||||
|
||||
subroutine kmp_free(ptr) bind(c)
|
||||
import
|
||||
integer (kind=kmp_pointer_kind), value :: ptr
|
||||
end subroutine kmp_free
|
||||
|
||||
subroutine kmp_set_warnings_on() bind(c)
|
||||
end subroutine kmp_set_warnings_on
|
||||
|
||||
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)
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_num_threads
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_dynamic
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_nested
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_threads
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_max_threads
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_thread_num
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_procs
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_in_parallel
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_in_final
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_dynamic
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_nested
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_thread_limit
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_max_active_levels
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_max_active_levels
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_level
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_active_level
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_ancestor_thread_num
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_size
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_schedule
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_schedule
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_proc_bind
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_wtime
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_wtick
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_default_device
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_default_device
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_is_initial_device
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_devices
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_teams
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_num
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_destroy_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_unset_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_test_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_nest_lock
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_destroy_nest_lock
|
||||
!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 :: kmp_set_stacksize
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize_s
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_blocktime
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_serial
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_turnaround
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_throughput
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_defaults
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_stacksize
|
||||
!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_affinity
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_max_proc
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_create_affinity_mask
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_destroy_affinity_mask
|
||||
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_affinity_mask_proc
|
||||
!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_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 )
|
||||
!$omp declare target(omp_set_dynamic )
|
||||
!$omp declare target(omp_set_nested )
|
||||
!$omp declare target(omp_get_num_threads )
|
||||
!$omp declare target(omp_get_max_threads )
|
||||
!$omp declare target(omp_get_thread_num )
|
||||
!$omp declare target(omp_get_num_procs )
|
||||
!$omp declare target(omp_in_parallel )
|
||||
!$omp declare target(omp_in_final )
|
||||
!$omp declare target(omp_get_dynamic )
|
||||
!$omp declare target(omp_get_nested )
|
||||
!$omp declare target(omp_get_thread_limit )
|
||||
!$omp declare target(omp_set_max_active_levels )
|
||||
!$omp declare target(omp_get_max_active_levels )
|
||||
!$omp declare target(omp_get_level )
|
||||
!$omp declare target(omp_get_active_level )
|
||||
!$omp declare target(omp_get_ancestor_thread_num )
|
||||
!$omp declare target(omp_get_team_size )
|
||||
!$omp declare target(omp_set_schedule )
|
||||
!$omp declare target(omp_get_schedule )
|
||||
!$omp declare target(omp_get_proc_bind )
|
||||
!$omp declare target(omp_get_wtime )
|
||||
!$omp declare target(omp_get_wtick )
|
||||
!$omp declare target(omp_get_default_device )
|
||||
!$omp declare target(omp_set_default_device )
|
||||
!$omp declare target(omp_is_initial_device )
|
||||
!$omp declare target(omp_get_num_devices )
|
||||
!$omp declare target(omp_get_num_teams )
|
||||
!$omp declare target(omp_get_team_num )
|
||||
!$omp declare target(omp_init_lock )
|
||||
!$omp declare target(omp_destroy_lock )
|
||||
!$omp declare target(omp_set_lock )
|
||||
!$omp declare target(omp_unset_lock )
|
||||
!$omp declare target(omp_test_lock )
|
||||
!$omp declare target(omp_init_nest_lock )
|
||||
!$omp declare target(omp_destroy_nest_lock )
|
||||
!$omp declare target(omp_set_nest_lock )
|
||||
!$omp declare target(omp_unset_nest_lock )
|
||||
!$omp declare target(omp_test_nest_lock )
|
||||
!$omp declare target(kmp_set_stacksize )
|
||||
!$omp declare target(kmp_set_stacksize_s )
|
||||
!$omp declare target(kmp_set_blocktime )
|
||||
!$omp declare target(kmp_set_library_serial )
|
||||
!$omp declare target(kmp_set_library_turnaround )
|
||||
!$omp declare target(kmp_set_library_throughput )
|
||||
!$omp declare target(kmp_set_library )
|
||||
!$omp declare target(kmp_set_defaults )
|
||||
!$omp declare target(kmp_get_stacksize )
|
||||
!$omp declare target(kmp_get_stacksize_s )
|
||||
!$omp declare target(kmp_get_blocktime )
|
||||
!$omp declare target(kmp_get_library )
|
||||
!$omp declare target(kmp_set_affinity )
|
||||
!$omp declare target(kmp_get_affinity )
|
||||
!$omp declare target(kmp_get_affinity_max_proc )
|
||||
!$omp declare target(kmp_create_affinity_mask )
|
||||
!$omp declare target(kmp_destroy_affinity_mask )
|
||||
!$omp declare target(kmp_set_affinity_mask_proc )
|
||||
!$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_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
|
||||
|
||||
@@ -0,0 +1,472 @@
|
||||
/*
|
||||
* include/41/ompt.h.var
|
||||
*/
|
||||
|
||||
#ifndef __OMPT__
|
||||
#define __OMPT__
|
||||
|
||||
/*****************************************************************************
|
||||
* system include files
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* iteration macros
|
||||
*****************************************************************************/
|
||||
|
||||
#define FOREACH_OMPT_INQUIRY_FN(macro) \
|
||||
macro (ompt_enumerate_state) \
|
||||
\
|
||||
macro (ompt_set_callback) \
|
||||
macro (ompt_get_callback) \
|
||||
\
|
||||
macro (ompt_get_idle_frame) \
|
||||
macro (ompt_get_task_frame) \
|
||||
\
|
||||
macro (ompt_get_state) \
|
||||
\
|
||||
macro (ompt_get_parallel_id) \
|
||||
macro (ompt_get_parallel_team_size) \
|
||||
macro (ompt_get_task_id) \
|
||||
macro (ompt_get_thread_id)
|
||||
|
||||
#define FOREACH_OMPT_PLACEHOLDER_FN(macro) \
|
||||
macro (ompt_idle) \
|
||||
macro (ompt_overhead) \
|
||||
macro (ompt_barrier_wait) \
|
||||
macro (ompt_task_wait) \
|
||||
macro (ompt_mutex_wait)
|
||||
|
||||
#define FOREACH_OMPT_STATE(macro) \
|
||||
\
|
||||
/* first */ \
|
||||
macro (ompt_state_first, 0x71) /* initial enumeration state */ \
|
||||
\
|
||||
/* work states (0..15) */ \
|
||||
macro (ompt_state_work_serial, 0x00) /* working outside parallel */ \
|
||||
macro (ompt_state_work_parallel, 0x01) /* working within parallel */ \
|
||||
macro (ompt_state_work_reduction, 0x02) /* performing a reduction */ \
|
||||
\
|
||||
/* idle (16..31) */ \
|
||||
macro (ompt_state_idle, 0x10) /* waiting for work */ \
|
||||
\
|
||||
/* overhead states (32..63) */ \
|
||||
macro (ompt_state_overhead, 0x20) /* overhead excluding wait states */ \
|
||||
\
|
||||
/* barrier wait states (64..79) */ \
|
||||
macro (ompt_state_wait_barrier, 0x40) /* waiting at a barrier */ \
|
||||
macro (ompt_state_wait_barrier_implicit, 0x41) /* implicit barrier */ \
|
||||
macro (ompt_state_wait_barrier_explicit, 0x42) /* explicit barrier */ \
|
||||
\
|
||||
/* task wait states (80..95) */ \
|
||||
macro (ompt_state_wait_taskwait, 0x50) /* waiting at a taskwait */ \
|
||||
macro (ompt_state_wait_taskgroup, 0x51) /* waiting at a taskgroup */ \
|
||||
\
|
||||
/* mutex wait states (96..111) */ \
|
||||
macro (ompt_state_wait_lock, 0x60) /* waiting for lock */ \
|
||||
macro (ompt_state_wait_nest_lock, 0x61) /* waiting for nest lock */ \
|
||||
macro (ompt_state_wait_critical, 0x62) /* waiting for critical */ \
|
||||
macro (ompt_state_wait_atomic, 0x63) /* waiting for atomic */ \
|
||||
macro (ompt_state_wait_ordered, 0x64) /* waiting for ordered */ \
|
||||
macro (ompt_state_wait_single, 0x6F) /* waiting for single region (non-standard!) */ \
|
||||
\
|
||||
/* misc (112..127) */ \
|
||||
macro (ompt_state_undefined, 0x70) /* undefined thread state */
|
||||
|
||||
|
||||
#define FOREACH_OMPT_EVENT(macro) \
|
||||
\
|
||||
/*--- 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_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
|
||||
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
|
||||
\
|
||||
macro (ompt_event_thread_begin, ompt_thread_type_callback_t, 5) /* thread begin */ \
|
||||
macro (ompt_event_thread_end, ompt_thread_type_callback_t, 6) /* thread end */ \
|
||||
\
|
||||
macro (ompt_event_control, ompt_control_callback_t, 7) /* support control calls */ \
|
||||
\
|
||||
macro (ompt_event_runtime_shutdown, ompt_callback_t, 8) /* runtime shutdown */ \
|
||||
\
|
||||
/*--- Optional Events (blame shifting, ompt_event_unimplemented) ---*/ \
|
||||
macro (ompt_event_idle_begin, ompt_thread_callback_t, 9) /* begin idle state */ \
|
||||
macro (ompt_event_idle_end, ompt_thread_callback_t, 10) /* end idle state */ \
|
||||
\
|
||||
macro (ompt_event_wait_barrier_begin, ompt_parallel_callback_t, 11) /* begin wait at barrier */ \
|
||||
macro (ompt_event_wait_barrier_end, ompt_parallel_callback_t, 12) /* end wait at barrier */ \
|
||||
\
|
||||
macro (ompt_event_wait_taskwait_begin, ompt_parallel_callback_t, 13) /* begin wait at taskwait */ \
|
||||
macro (ompt_event_wait_taskwait_end, ompt_parallel_callback_t, 14) /* end wait at taskwait */ \
|
||||
\
|
||||
macro (ompt_event_wait_taskgroup_begin, ompt_parallel_callback_t, 15) /* begin wait at taskgroup */\
|
||||
macro (ompt_event_wait_taskgroup_end, ompt_parallel_callback_t, 16) /* end wait at taskgroup */ \
|
||||
\
|
||||
macro (ompt_event_release_lock, ompt_wait_callback_t, 17) /* lock release */ \
|
||||
macro (ompt_event_release_nest_lock_last, ompt_wait_callback_t, 18) /* last nest lock release */ \
|
||||
macro (ompt_event_release_critical, ompt_wait_callback_t, 19) /* critical release */ \
|
||||
\
|
||||
macro (ompt_event_release_atomic, ompt_wait_callback_t, 20) /* atomic release */ \
|
||||
\
|
||||
macro (ompt_event_release_ordered, ompt_wait_callback_t, 21) /* ordered release */ \
|
||||
\
|
||||
/*--- Optional Events (synchronous events, ompt_event_unimplemented) --- */ \
|
||||
macro (ompt_event_implicit_task_begin, ompt_parallel_callback_t, 22) /* implicit task begin */ \
|
||||
macro (ompt_event_implicit_task_end, ompt_parallel_callback_t, 23) /* implicit task end */ \
|
||||
\
|
||||
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_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 */ \
|
||||
\
|
||||
macro (ompt_event_sections_begin, ompt_new_workshare_callback_t, 29) /* task at sections begin */\
|
||||
macro (ompt_event_sections_end, ompt_parallel_callback_t, 30) /* task at sections end */ \
|
||||
\
|
||||
macro (ompt_event_single_in_block_begin, ompt_new_workshare_callback_t, 31) /* task at single begin*/ \
|
||||
macro (ompt_event_single_in_block_end, ompt_parallel_callback_t, 32) /* task at single end */ \
|
||||
\
|
||||
macro (ompt_event_single_others_begin, ompt_parallel_callback_t, 33) /* task at single begin */ \
|
||||
macro (ompt_event_single_others_end, ompt_parallel_callback_t, 34) /* task at single end */ \
|
||||
\
|
||||
macro (ompt_event_workshare_begin, ompt_new_workshare_callback_t, 35) /* task at workshare begin */\
|
||||
macro (ompt_event_workshare_end, ompt_parallel_callback_t, 36) /* task at workshare end */ \
|
||||
\
|
||||
macro (ompt_event_master_begin, ompt_parallel_callback_t, 37) /* task at master begin */ \
|
||||
macro (ompt_event_master_end, ompt_parallel_callback_t, 38) /* task at master end */ \
|
||||
\
|
||||
macro (ompt_event_barrier_begin, ompt_parallel_callback_t, 39) /* task at barrier begin */ \
|
||||
macro (ompt_event_barrier_end, ompt_parallel_callback_t, 40) /* task at barrier end */ \
|
||||
\
|
||||
macro (ompt_event_taskwait_begin, ompt_parallel_callback_t, 41) /* task at taskwait begin */ \
|
||||
macro (ompt_event_taskwait_end, ompt_parallel_callback_t, 42) /* task at task wait end */ \
|
||||
\
|
||||
macro (ompt_event_taskgroup_begin, ompt_parallel_callback_t, 43) /* task at taskgroup begin */\
|
||||
macro (ompt_event_taskgroup_end, ompt_parallel_callback_t, 44) /* task at taskgroup end */ \
|
||||
\
|
||||
macro (ompt_event_release_nest_lock_prev, ompt_wait_callback_t, 45) /* prev nest lock release */ \
|
||||
\
|
||||
macro (ompt_event_wait_lock, ompt_wait_callback_t, 46) /* lock wait */ \
|
||||
macro (ompt_event_wait_nest_lock, ompt_wait_callback_t, 47) /* nest lock wait */ \
|
||||
macro (ompt_event_wait_critical, ompt_wait_callback_t, 48) /* critical wait */ \
|
||||
macro (ompt_event_wait_atomic, ompt_wait_callback_t, 49) /* atomic wait */ \
|
||||
macro (ompt_event_wait_ordered, ompt_wait_callback_t, 50) /* ordered wait */ \
|
||||
\
|
||||
macro (ompt_event_acquired_lock, ompt_wait_callback_t, 51) /* lock acquired */ \
|
||||
macro (ompt_event_acquired_nest_lock_first, ompt_wait_callback_t, 52) /* 1st nest lock acquired */ \
|
||||
macro (ompt_event_acquired_nest_lock_next, ompt_wait_callback_t, 53) /* next nest lock acquired*/ \
|
||||
macro (ompt_event_acquired_critical, ompt_wait_callback_t, 54) /* critical acquired */ \
|
||||
macro (ompt_event_acquired_atomic, ompt_wait_callback_t, 55) /* atomic acquired */ \
|
||||
macro (ompt_event_acquired_ordered, ompt_wait_callback_t, 56) /* ordered acquired */ \
|
||||
\
|
||||
macro (ompt_event_init_lock, ompt_wait_callback_t, 57) /* lock init */ \
|
||||
macro (ompt_event_init_nest_lock, ompt_wait_callback_t, 58) /* nest lock init */ \
|
||||
\
|
||||
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 */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* data types
|
||||
*****************************************************************************/
|
||||
|
||||
/*---------------------
|
||||
* identifiers
|
||||
*---------------------*/
|
||||
|
||||
typedef uint64_t ompt_thread_id_t;
|
||||
#define ompt_thread_id_none ((ompt_thread_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_task_id_t;
|
||||
#define ompt_task_id_none ((ompt_task_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_parallel_id_t;
|
||||
#define ompt_parallel_id_none ((ompt_parallel_id_t) 0) /* non-standard */
|
||||
|
||||
typedef uint64_t ompt_wait_id_t;
|
||||
#define ompt_wait_id_none ((ompt_wait_id_t) 0) /* non-standard */
|
||||
|
||||
|
||||
/*---------------------
|
||||
* ompt_frame_t
|
||||
*---------------------*/
|
||||
|
||||
typedef struct ompt_frame_s {
|
||||
void *exit_runtime_frame; /* next frame is user code */
|
||||
void *reenter_runtime_frame; /* previous frame is user code */
|
||||
} ompt_frame_t;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* enumerations for thread states and runtime events
|
||||
*****************************************************************************/
|
||||
|
||||
/*---------------------
|
||||
* runtime states
|
||||
*---------------------*/
|
||||
|
||||
typedef enum {
|
||||
#define ompt_state_macro(state, code) state = code,
|
||||
FOREACH_OMPT_STATE(ompt_state_macro)
|
||||
#undef ompt_state_macro
|
||||
} ompt_state_t;
|
||||
|
||||
|
||||
/*---------------------
|
||||
* runtime events
|
||||
*---------------------*/
|
||||
|
||||
typedef enum {
|
||||
#define ompt_event_macro(event, callback, eventid) event = eventid,
|
||||
FOREACH_OMPT_EVENT(ompt_event_macro)
|
||||
#undef ompt_event_macro
|
||||
} ompt_event_t;
|
||||
|
||||
|
||||
/*---------------------
|
||||
* set callback results
|
||||
*---------------------*/
|
||||
typedef enum {
|
||||
ompt_set_result_registration_error = 0,
|
||||
ompt_set_result_event_may_occur_no_callback = 1,
|
||||
ompt_set_result_event_never_occurs = 2,
|
||||
ompt_set_result_event_may_occur_callback_some = 3,
|
||||
ompt_set_result_event_may_occur_callback_always = 4,
|
||||
} ompt_set_result_t;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* callback signatures
|
||||
*****************************************************************************/
|
||||
|
||||
/* initialization */
|
||||
typedef void (*ompt_interface_fn_t)(void);
|
||||
|
||||
typedef ompt_interface_fn_t (*ompt_function_lookup_t)(
|
||||
const char * /* entry point to look up */
|
||||
);
|
||||
|
||||
/* threads */
|
||||
typedef void (*ompt_thread_callback_t) (
|
||||
ompt_thread_id_t thread_id /* ID of thread */
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
ompt_thread_initial = 1, // start the enumeration at 1
|
||||
ompt_thread_worker = 2,
|
||||
ompt_thread_other = 3
|
||||
} ompt_thread_type_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 */
|
||||
);
|
||||
|
||||
typedef void (*ompt_wait_callback_t) (
|
||||
ompt_wait_id_t wait_id /* wait id */
|
||||
);
|
||||
|
||||
/* parallel and workshares */
|
||||
typedef void (*ompt_parallel_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t task_id /* id of task */
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_workshare_callback_t) (
|
||||
ompt_parallel_id_t parallel_id, /* id of parallel region */
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
void *workshare_function /* pointer to outlined function */
|
||||
);
|
||||
|
||||
typedef void (*ompt_new_parallel_callback_t) (
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
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 */
|
||||
);
|
||||
|
||||
/* tasks */
|
||||
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_new_task_callback_t) (
|
||||
ompt_task_id_t parent_task_id, /* id of parent task */
|
||||
ompt_frame_t *parent_task_frame, /* frame data for parent task */
|
||||
ompt_task_id_t new_task_id, /* id of created task */
|
||||
void *task_function /* pointer to outlined function */
|
||||
);
|
||||
|
||||
/* program */
|
||||
typedef void (*ompt_control_callback_t) (
|
||||
uint64_t command, /* command of control call */
|
||||
uint64_t modifier /* modifier of control call */
|
||||
);
|
||||
|
||||
typedef void (*ompt_callback_t)(void);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* ompt API
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OMPT_API_FNTYPE(fn) fn##_t
|
||||
|
||||
#define OMPT_API_FUNCTION(return_type, fn, args) \
|
||||
typedef return_type (*OMPT_API_FNTYPE(fn)) args
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* INQUIRY FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* state */
|
||||
OMPT_API_FUNCTION(ompt_state_t, ompt_get_state, (
|
||||
ompt_wait_id_t *ompt_wait_id
|
||||
));
|
||||
|
||||
/* thread */
|
||||
OMPT_API_FUNCTION(ompt_thread_id_t, ompt_get_thread_id, (void));
|
||||
|
||||
OMPT_API_FUNCTION(void *, ompt_get_idle_frame, (void));
|
||||
|
||||
/* parallel region */
|
||||
OMPT_API_FUNCTION(ompt_parallel_id_t, ompt_get_parallel_id, (
|
||||
int ancestor_level
|
||||
));
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_get_parallel_team_size, (
|
||||
int ancestor_level
|
||||
));
|
||||
|
||||
/* task */
|
||||
OMPT_API_FUNCTION(ompt_task_id_t, ompt_get_task_id, (
|
||||
int depth
|
||||
));
|
||||
|
||||
OMPT_API_FUNCTION(ompt_frame_t *, ompt_get_task_frame, (
|
||||
int depth
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* PLACEHOLDERS FOR PERFORMANCE REPORTING
|
||||
***************************************************************************/
|
||||
|
||||
/* idle */
|
||||
OMPT_API_FUNCTION(void, ompt_idle, (
|
||||
void
|
||||
));
|
||||
|
||||
/* overhead */
|
||||
OMPT_API_FUNCTION(void, ompt_overhead, (
|
||||
void
|
||||
));
|
||||
|
||||
/* barrier wait */
|
||||
OMPT_API_FUNCTION(void, ompt_barrier_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
/* task wait */
|
||||
OMPT_API_FUNCTION(void, ompt_task_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
/* mutex wait */
|
||||
OMPT_API_FUNCTION(void, ompt_mutex_wait, (
|
||||
void
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* INITIALIZATION FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* initialization interface to be defined by tool */
|
||||
int ompt_initialize(
|
||||
ompt_function_lookup_t ompt_fn_lookup,
|
||||
const char *runtime_version,
|
||||
unsigned int ompt_version
|
||||
);
|
||||
|
||||
typedef enum opt_init_mode_e {
|
||||
ompt_init_mode_never = 0,
|
||||
ompt_init_mode_false = 1,
|
||||
ompt_init_mode_true = 2,
|
||||
ompt_init_mode_always = 3
|
||||
} ompt_init_mode_t;
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_set_callback, (
|
||||
ompt_event_t event,
|
||||
ompt_callback_t callback
|
||||
));
|
||||
|
||||
typedef enum ompt_set_callback_rc_e { /* non-standard */
|
||||
ompt_set_callback_error = 0,
|
||||
ompt_has_event_no_callback = 1,
|
||||
ompt_no_event_no_callback = 2,
|
||||
ompt_has_event_may_callback = 3,
|
||||
ompt_has_event_must_callback = 4,
|
||||
} ompt_set_callback_rc_t;
|
||||
|
||||
|
||||
OMPT_API_FUNCTION(int, ompt_get_callback, (
|
||||
ompt_event_t event,
|
||||
ompt_callback_t *callback
|
||||
));
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* MISCELLANEOUS FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* control */
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp declare target
|
||||
#endif
|
||||
void ompt_control(
|
||||
uint64_t command,
|
||||
uint64_t modifier
|
||||
);
|
||||
#if defined(_OPENMP) && (_OPENMP >= 201307)
|
||||
#pragma omp end declare target
|
||||
#endif
|
||||
|
||||
/* state enumeration */
|
||||
OMPT_API_FUNCTION(int, ompt_enumerate_state, (
|
||||
int current_state,
|
||||
int *next_state,
|
||||
const char **next_state_name
|
||||
));
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+431
-398
File diff suppressed because it is too large
Load Diff
+430
-226
File diff suppressed because it is too large
Load Diff
+10
-8
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_alloc.c -- private/shared dyanmic memory allocation and management
|
||||
* $Revision: 42810 $
|
||||
* $Date: 2013-11-07 12:06:33 -0600 (Thu, 07 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -787,7 +785,7 @@ bgetr( kmp_info_t *th, void *buf, bufsize size)
|
||||
|
||||
KMP_DEBUG_ASSERT(osize > 0);
|
||||
|
||||
(void) memcpy((char *) nbuf, (char *) buf, /* Copy the data */
|
||||
(void) KMP_MEMCPY((char *) nbuf, (char *) buf, /* Copy the data */
|
||||
(size_t) ((size < osize) ? size : osize));
|
||||
brel( th, buf );
|
||||
|
||||
@@ -880,7 +878,7 @@ brel( kmp_info_t *th, void *buf )
|
||||
}
|
||||
else {
|
||||
/* The previous buffer isn't allocated. Mark this buffer
|
||||
size as positive (i.e. free) and fall throught to place
|
||||
size as positive (i.e. free) and fall through to place
|
||||
the buffer on the free list as an isolated free block. */
|
||||
|
||||
b->bh.bb.bsize = -b->bh.bb.bsize;
|
||||
@@ -1180,7 +1178,7 @@ bufdump( kmp_info_t *th, void *buf )
|
||||
}
|
||||
|
||||
for (i = 0; i < l; i++) {
|
||||
(void) sprintf(bhex + i * 3, "%02X ", bdump[i]);
|
||||
(void) KMP_SNPRINTF(bhex + i * 3, sizeof(bhex), "%02X ", bdump[i]);
|
||||
if (bdump[i] > 0x20 && bdump[i] < 0x7F)
|
||||
bascii[ i ] = bdump[ i ];
|
||||
else
|
||||
@@ -1228,7 +1226,7 @@ bpoold( kmp_info_t *th, void *buf, int dumpalloc, int dumpfree)
|
||||
bufdump( th, (void *) (((char *) b) + sizeof(bhead_t)));
|
||||
}
|
||||
} else {
|
||||
char *lerr = "";
|
||||
const char *lerr = "";
|
||||
|
||||
KMP_DEBUG_ASSERT(bs > 0);
|
||||
if ((b->ql.blink->ql.flink != b) || (b->ql.flink->ql.blink != b)) {
|
||||
@@ -1772,7 +1770,11 @@ ___kmp_free( void * ptr KMP_SRC_LOC_DECL )
|
||||
|
||||
#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();
|
||||
@@ -1790,7 +1792,7 @@ ___kmp_free( void * ptr KMP_SRC_LOC_DECL )
|
||||
// Otherwise allocate normally using kmp_thread_malloc.
|
||||
|
||||
// AC: How to choose the limit? Just get 16 for now...
|
||||
static int const __kmp_free_list_limit = 16;
|
||||
#define KMP_FREE_LIST_LIMIT 16
|
||||
|
||||
// Always use 128 bytes for determining buckets for caching memory blocks
|
||||
#define DCACHE_LINE 128
|
||||
@@ -1932,7 +1934,7 @@ ___kmp_fast_free( kmp_info_t *this_thr, void * ptr KMP_SRC_LOC_DECL )
|
||||
kmp_mem_descr_t * dsc = (kmp_mem_descr_t *)( (char*)head - sizeof(kmp_mem_descr_t) );
|
||||
kmp_info_t * q_th = (kmp_info_t *)(dsc->ptr_aligned); // allocating thread, same for all queue nodes
|
||||
size_t q_sz = dsc->size_allocated + 1; // new size in case we add current task
|
||||
if ( q_th == alloc_thr && q_sz <= __kmp_free_list_limit ) {
|
||||
if ( q_th == alloc_thr && q_sz <= KMP_FREE_LIST_LIMIT ) {
|
||||
// we can add current task to "other" list, no sync needed
|
||||
*((void **)ptr) = head;
|
||||
descr->size_allocated = q_sz;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_atomic.c -- ATOMIC implementation routines
|
||||
* $Revision: 42810 $
|
||||
* $Date: 2013-11-07 12:06:33 -0600 (Thu, 07 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -690,7 +688,7 @@ RET_TYPE __kmpc_atomic_##TYPE_ID##_##OP_ID( ident_t *id_ref, int gtid, TYPE * lh
|
||||
#endif /* KMP_GOMP_COMPAT */
|
||||
|
||||
#if KMP_MIC
|
||||
# define KMP_DO_PAUSE _mm_delay_32( 30 )
|
||||
# define KMP_DO_PAUSE _mm_delay_32( 1 )
|
||||
#else
|
||||
# define KMP_DO_PAUSE KMP_CPU_PAUSE()
|
||||
#endif /* KMP_MIC */
|
||||
@@ -700,14 +698,10 @@ RET_TYPE __kmpc_atomic_##TYPE_ID##_##OP_ID( ident_t *id_ref, int gtid, TYPE * lh
|
||||
// TYPE - operands' type
|
||||
// BITS - size in bits, used to distinguish low level calls
|
||||
// OP - operator
|
||||
// Note: temp_val introduced in order to force the compiler to read
|
||||
// *lhs only once (w/o it the compiler reads *lhs twice)
|
||||
#define OP_CMPXCHG(TYPE,BITS,OP) \
|
||||
{ \
|
||||
TYPE KMP_ATOMIC_VOLATILE temp_val; \
|
||||
TYPE old_value, new_value; \
|
||||
temp_val = *lhs; \
|
||||
old_value = temp_val; \
|
||||
old_value = *(TYPE volatile *)lhs; \
|
||||
new_value = old_value OP rhs; \
|
||||
while ( ! KMP_COMPARE_AND_STORE_ACQ##BITS( (kmp_int##BITS *) lhs, \
|
||||
*VOLATILE_CAST(kmp_int##BITS *) &old_value, \
|
||||
@@ -715,8 +709,7 @@ RET_TYPE __kmpc_atomic_##TYPE_ID##_##OP_ID( ident_t *id_ref, int gtid, TYPE * lh
|
||||
{ \
|
||||
KMP_DO_PAUSE; \
|
||||
\
|
||||
temp_val = *lhs; \
|
||||
old_value = temp_val; \
|
||||
old_value = *(TYPE volatile *)lhs; \
|
||||
new_value = old_value OP rhs; \
|
||||
} \
|
||||
}
|
||||
@@ -731,7 +724,6 @@ RET_TYPE __kmpc_atomic_##TYPE_ID##_##OP_ID( ident_t *id_ref, int gtid, TYPE * lh
|
||||
// I verified the asm of the workaround.
|
||||
#define OP_CMPXCHG_WORKAROUND(TYPE,BITS,OP) \
|
||||
{ \
|
||||
char anonym[ ( sizeof( TYPE ) == sizeof( kmp_int##BITS ) ) ? ( 1 ) : ( 0 ) ] = { 1 }; \
|
||||
struct _sss { \
|
||||
TYPE cmp; \
|
||||
kmp_int##BITS *vvv; \
|
||||
@@ -765,13 +757,6 @@ ATOMIC_BEGIN(TYPE_ID,OP_ID,TYPE,void) \
|
||||
KMP_TEST_THEN_ADD##BITS( lhs, OP rhs ); \
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
#define ATOMIC_FLOAT_ADD(TYPE_ID,OP_ID,TYPE,BITS,OP,LCK_ID,MASK,GOMP_FLAG) \
|
||||
ATOMIC_BEGIN(TYPE_ID,OP_ID,TYPE,void) \
|
||||
OP_GOMP_CRITICAL(OP##=,GOMP_FLAG) \
|
||||
/* OP used as a sign for subtraction: (lhs-rhs) --> (lhs+-rhs) */ \
|
||||
KMP_TEST_THEN_ADD_REAL##BITS( lhs, OP rhs ); \
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
#define ATOMIC_CMPXCHG(TYPE_ID,OP_ID,TYPE,BITS,OP,LCK_ID,MASK,GOMP_FLAG) \
|
||||
ATOMIC_BEGIN(TYPE_ID,OP_ID,TYPE,void) \
|
||||
OP_GOMP_CRITICAL(OP##=,GOMP_FLAG) \
|
||||
@@ -803,17 +788,6 @@ ATOMIC_BEGIN(TYPE_ID,OP_ID,TYPE,void) \
|
||||
} \
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
#define ATOMIC_FLOAT_ADD(TYPE_ID,OP_ID,TYPE,BITS,OP,LCK_ID,MASK,GOMP_FLAG) \
|
||||
ATOMIC_BEGIN(TYPE_ID,OP_ID,TYPE,void) \
|
||||
OP_GOMP_CRITICAL(OP##=,GOMP_FLAG) \
|
||||
if ( ! ( (kmp_uintptr_t) lhs & 0x##MASK) ) { \
|
||||
OP_CMPXCHG(TYPE,BITS,OP) /* aligned address */ \
|
||||
} else { \
|
||||
KMP_CHECK_GTID; \
|
||||
OP_CRITICAL(OP##=,LCK_ID) /* unaligned address - use critical */ \
|
||||
} \
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
#define ATOMIC_CMPXCHG(TYPE_ID,OP_ID,TYPE,BITS,OP,LCK_ID,MASK,GOMP_FLAG) \
|
||||
ATOMIC_BEGIN(TYPE_ID,OP_ID,TYPE,void) \
|
||||
OP_GOMP_CRITICAL(OP##=,GOMP_FLAG) \
|
||||
@@ -845,25 +819,15 @@ ATOMIC_BEGIN(TYPE_ID,OP_ID,TYPE,void)
|
||||
ATOMIC_FIXED_ADD( fixed4, add, kmp_int32, 32, +, 4i, 3, 0 ) // __kmpc_atomic_fixed4_add
|
||||
ATOMIC_FIXED_ADD( fixed4, sub, kmp_int32, 32, -, 4i, 3, 0 ) // __kmpc_atomic_fixed4_sub
|
||||
|
||||
#if KMP_MIC
|
||||
ATOMIC_CMPXCHG( float4, add, kmp_real32, 32, +, 4r, 3, KMP_ARCH_X86 ) // __kmpc_atomic_float4_add
|
||||
ATOMIC_CMPXCHG( float4, sub, kmp_real32, 32, -, 4r, 3, KMP_ARCH_X86 ) // __kmpc_atomic_float4_sub
|
||||
#else
|
||||
ATOMIC_FLOAT_ADD( float4, add, kmp_real32, 32, +, 4r, 3, KMP_ARCH_X86 ) // __kmpc_atomic_float4_add
|
||||
ATOMIC_FLOAT_ADD( float4, sub, kmp_real32, 32, -, 4r, 3, KMP_ARCH_X86 ) // __kmpc_atomic_float4_sub
|
||||
#endif // KMP_MIC
|
||||
|
||||
// Routines for ATOMIC 8-byte operands addition and subtraction
|
||||
ATOMIC_FIXED_ADD( fixed8, add, kmp_int64, 64, +, 8i, 7, KMP_ARCH_X86 ) // __kmpc_atomic_fixed8_add
|
||||
ATOMIC_FIXED_ADD( fixed8, sub, kmp_int64, 64, -, 8i, 7, KMP_ARCH_X86 ) // __kmpc_atomic_fixed8_sub
|
||||
|
||||
#if KMP_MIC
|
||||
ATOMIC_CMPXCHG( float8, add, kmp_real64, 64, +, 8r, 7, KMP_ARCH_X86 ) // __kmpc_atomic_float8_add
|
||||
ATOMIC_CMPXCHG( float8, sub, kmp_real64, 64, -, 8r, 7, KMP_ARCH_X86 ) // __kmpc_atomic_float8_sub
|
||||
#else
|
||||
ATOMIC_FLOAT_ADD( float8, add, kmp_real64, 64, +, 8r, 7, KMP_ARCH_X86 ) // __kmpc_atomic_float8_add
|
||||
ATOMIC_FLOAT_ADD( float8, sub, kmp_real64, 64, -, 8r, 7, KMP_ARCH_X86 ) // __kmpc_atomic_float8_sub
|
||||
#endif // KMP_MIC
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Entries definition for integer operands
|
||||
@@ -1867,35 +1831,16 @@ ATOMIC_BEGIN_CPT(TYPE_ID,OP_ID,TYPE,TYPE) \
|
||||
return old_value; \
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
#define ATOMIC_FLOAT_ADD_CPT(TYPE_ID,OP_ID,TYPE,BITS,OP,GOMP_FLAG) \
|
||||
ATOMIC_BEGIN_CPT(TYPE_ID,OP_ID,TYPE,TYPE) \
|
||||
TYPE old_value, new_value; \
|
||||
OP_GOMP_CRITICAL_CPT(OP,GOMP_FLAG) \
|
||||
/* OP used as a sign for subtraction: (lhs-rhs) --> (lhs+-rhs) */ \
|
||||
old_value = KMP_TEST_THEN_ADD_REAL##BITS( lhs, OP rhs ); \
|
||||
if( flag ) { \
|
||||
return old_value OP rhs; \
|
||||
} else \
|
||||
return old_value; \
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
ATOMIC_FIXED_ADD_CPT( fixed4, add_cpt, kmp_int32, 32, +, 0 ) // __kmpc_atomic_fixed4_add_cpt
|
||||
ATOMIC_FIXED_ADD_CPT( fixed4, sub_cpt, kmp_int32, 32, -, 0 ) // __kmpc_atomic_fixed4_sub_cpt
|
||||
ATOMIC_FIXED_ADD_CPT( fixed8, add_cpt, kmp_int64, 64, +, KMP_ARCH_X86 ) // __kmpc_atomic_fixed8_add_cpt
|
||||
ATOMIC_FIXED_ADD_CPT( fixed8, sub_cpt, kmp_int64, 64, -, KMP_ARCH_X86 ) // __kmpc_atomic_fixed8_sub_cpt
|
||||
|
||||
#if KMP_MIC
|
||||
ATOMIC_CMPXCHG_CPT( float4, add_cpt, kmp_real32, 32, +, KMP_ARCH_X86 ) // __kmpc_atomic_float4_add_cpt
|
||||
ATOMIC_CMPXCHG_CPT( float4, sub_cpt, kmp_real32, 32, -, KMP_ARCH_X86 ) // __kmpc_atomic_float4_sub_cpt
|
||||
ATOMIC_CMPXCHG_CPT( float8, add_cpt, kmp_real64, 64, +, KMP_ARCH_X86 ) // __kmpc_atomic_float8_add_cpt
|
||||
ATOMIC_CMPXCHG_CPT( float8, sub_cpt, kmp_real64, 64, -, KMP_ARCH_X86 ) // __kmpc_atomic_float8_sub_cpt
|
||||
#else
|
||||
ATOMIC_FLOAT_ADD_CPT( float4, add_cpt, kmp_real32, 32, +, KMP_ARCH_X86 ) // __kmpc_atomic_float4_add_cpt
|
||||
ATOMIC_FLOAT_ADD_CPT( float4, sub_cpt, kmp_real32, 32, -, KMP_ARCH_X86 ) // __kmpc_atomic_float4_sub_cpt
|
||||
ATOMIC_FLOAT_ADD_CPT( float8, add_cpt, kmp_real64, 64, +, KMP_ARCH_X86 ) // __kmpc_atomic_float8_add_cpt
|
||||
ATOMIC_FLOAT_ADD_CPT( float8, sub_cpt, kmp_real64, 64, -, KMP_ARCH_X86 ) // __kmpc_atomic_float8_sub_cpt
|
||||
#endif // KMP_MIC
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Entries definition for integer operands
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_atomic.h - ATOMIC header file
|
||||
* $Revision: 42810 $
|
||||
* $Date: 2013-11-07 12:06:33 -0600 (Thu, 07 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -21,6 +19,10 @@
|
||||
#include "kmp_os.h"
|
||||
#include "kmp_lock.h"
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
#include "ompt-specific.h"
|
||||
#endif
|
||||
|
||||
// C++ build port.
|
||||
// Intel compiler does not support _Complex datatype on win.
|
||||
// Intel compiler supports _Complex datatype on lin and mac.
|
||||
@@ -33,7 +35,7 @@
|
||||
#if defined( __cplusplus ) && ( KMP_OS_WINDOWS )
|
||||
// create shortcuts for c99 complex types
|
||||
|
||||
#ifdef _DEBUG
|
||||
#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
|
||||
// compiled with /MDd option (the library itself built with /MTd),
|
||||
@@ -368,7 +370,23 @@ typedef kmp_queuing_lock_t kmp_atomic_lock_t;
|
||||
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) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_wait_atomic)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_wait_atomic)(
|
||||
(ompt_wait_id_t) lck);
|
||||
}
|
||||
#endif
|
||||
|
||||
__kmp_acquire_queuing_lock( lck, gtid );
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_acquired_atomic)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_acquired_atomic)(
|
||||
(ompt_wait_id_t) lck);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int
|
||||
@@ -381,6 +399,13 @@ static inline void
|
||||
__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) &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_release_atomic)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_release_atomic)(
|
||||
(ompt_wait_id_t) lck);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+869
-416
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_debug.c -- debug utilities for the Guide library
|
||||
* $Revision: 42150 $
|
||||
* $Date: 2013-03-15 15:40:38 -0500 (Fri, 15 Mar 2013) $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_debug.h -- debug / assertion code for Assure library
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -42,9 +40,13 @@
|
||||
Do not use _KMP_BUILD_ASSERT and __KMP_BUILD_ASSERT directly, it is working guts.
|
||||
*/
|
||||
|
||||
#define __KMP_BUILD_ASSERT( expr, suffix ) static char __kmp_build_check_##suffix[ (expr) ? 1 : -1 ]
|
||||
#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 )
|
||||
#define KMP_BUILD_ASSERT( expr ) _KMP_BUILD_ASSERT( (expr), __LINE__ )
|
||||
#ifdef KMP_USE_ASSERT
|
||||
#define KMP_BUILD_ASSERT( expr ) _KMP_BUILD_ASSERT( (expr), __LINE__ )
|
||||
#else
|
||||
#define KMP_BUILD_ASSERT( expr ) /* nothing to do */
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// Run-time assertions.
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
#if USE_DEBUGGER
|
||||
/*
|
||||
* kmp_debugger.c -- debugger support.
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 "kmp.h"
|
||||
#include "kmp_lock.h"
|
||||
#include "kmp_omp.h"
|
||||
#include "kmp_str.h"
|
||||
|
||||
/*
|
||||
NOTE: All variable names are known to the debugger, do not change!
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern kmp_omp_struct_info_t __kmp_omp_debug_struct_info;
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
int __kmp_debugging = FALSE; // Boolean whether currently debugging OpenMP RTL.
|
||||
|
||||
#define offset_and_size_of( structure, field ) \
|
||||
{ \
|
||||
offsetof( structure, field ), \
|
||||
sizeof( ( (structure *) NULL)->field ) \
|
||||
}
|
||||
|
||||
#define offset_and_size_not_available \
|
||||
{ -1, -1 }
|
||||
|
||||
#define addr_and_size_of( var ) \
|
||||
{ \
|
||||
(kmp_uint64)( & var ), \
|
||||
sizeof( var ) \
|
||||
}
|
||||
|
||||
#define nthr_buffer_size 1024
|
||||
static kmp_int32
|
||||
kmp_omp_nthr_info_buffer[ nthr_buffer_size ] =
|
||||
{ nthr_buffer_size * sizeof( kmp_int32 ) };
|
||||
|
||||
/* TODO: Check punctuation for various platforms here */
|
||||
static char func_microtask[] = "__kmp_invoke_microtask";
|
||||
static char func_fork[] = "__kmpc_fork_call";
|
||||
static char func_fork_teams[] = "__kmpc_fork_teams";
|
||||
|
||||
|
||||
// Various info about runtime structures: addresses, field offsets, sizes, etc.
|
||||
kmp_omp_struct_info_t
|
||||
__kmp_omp_debug_struct_info = {
|
||||
|
||||
/* Change this only if you make a fundamental data structure change here */
|
||||
KMP_OMP_VERSION,
|
||||
|
||||
/* sanity check. Only should be checked if versions are identical
|
||||
* This is also used for backward compatibility to get the runtime
|
||||
* structure size if it the runtime is older than the interface */
|
||||
sizeof( kmp_omp_struct_info_t ),
|
||||
|
||||
/* OpenMP RTL version info. */
|
||||
addr_and_size_of( __kmp_version_major ),
|
||||
addr_and_size_of( __kmp_version_minor ),
|
||||
addr_and_size_of( __kmp_version_build ),
|
||||
addr_and_size_of( __kmp_openmp_version ),
|
||||
{ (kmp_uint64)( __kmp_copyright ) + KMP_VERSION_MAGIC_LEN, 0 }, // Skip magic prefix.
|
||||
|
||||
/* Various globals. */
|
||||
addr_and_size_of( __kmp_threads ),
|
||||
addr_and_size_of( __kmp_root ),
|
||||
addr_and_size_of( __kmp_threads_capacity ),
|
||||
addr_and_size_of( __kmp_monitor ),
|
||||
#if ! KMP_USE_DYNAMIC_LOCK
|
||||
addr_and_size_of( __kmp_user_lock_table ),
|
||||
#endif
|
||||
addr_and_size_of( func_microtask ),
|
||||
addr_and_size_of( func_fork ),
|
||||
addr_and_size_of( func_fork_teams ),
|
||||
addr_and_size_of( __kmp_team_counter ),
|
||||
addr_and_size_of( __kmp_task_counter ),
|
||||
addr_and_size_of( kmp_omp_nthr_info_buffer ),
|
||||
sizeof( void * ),
|
||||
OMP_LOCK_T_SIZE < sizeof(void *),
|
||||
bs_last_barrier,
|
||||
TASK_DEQUE_SIZE,
|
||||
|
||||
// thread structure information
|
||||
sizeof( kmp_base_info_t ),
|
||||
offset_and_size_of( kmp_base_info_t, th_info ),
|
||||
offset_and_size_of( kmp_base_info_t, th_team ),
|
||||
offset_and_size_of( kmp_base_info_t, th_root ),
|
||||
offset_and_size_of( kmp_base_info_t, th_serial_team ),
|
||||
offset_and_size_of( kmp_base_info_t, th_ident ),
|
||||
offset_and_size_of( kmp_base_info_t, th_spin_here ),
|
||||
offset_and_size_of( kmp_base_info_t, th_next_waiting ),
|
||||
offset_and_size_of( kmp_base_info_t, th_task_team ),
|
||||
offset_and_size_of( kmp_base_info_t, th_current_task ),
|
||||
offset_and_size_of( kmp_base_info_t, th_task_state ),
|
||||
offset_and_size_of( kmp_base_info_t, th_bar ),
|
||||
offset_and_size_of( kmp_bstate_t, b_worker_arrived ),
|
||||
|
||||
// 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 ),
|
||||
|
||||
// kmp_desc structure (for info field above)
|
||||
sizeof( kmp_desc_base_t ),
|
||||
offset_and_size_of( kmp_desc_base_t, ds_tid ),
|
||||
offset_and_size_of( kmp_desc_base_t, ds_gtid ),
|
||||
// On Windows* OS, ds_thread contains a thread /handle/, which is not usable, while thread /id/
|
||||
// is in ds_thread_id.
|
||||
#if KMP_OS_WINDOWS
|
||||
offset_and_size_of( kmp_desc_base_t, ds_thread_id),
|
||||
#else
|
||||
offset_and_size_of( kmp_desc_base_t, ds_thread),
|
||||
#endif
|
||||
|
||||
// team structure information
|
||||
sizeof( kmp_base_team_t ),
|
||||
offset_and_size_of( kmp_base_team_t, t_master_tid ),
|
||||
offset_and_size_of( kmp_base_team_t, t_ident ),
|
||||
offset_and_size_of( kmp_base_team_t, t_parent ),
|
||||
offset_and_size_of( kmp_base_team_t, t_nproc ),
|
||||
offset_and_size_of( kmp_base_team_t, t_threads ),
|
||||
offset_and_size_of( kmp_base_team_t, t_serialized ),
|
||||
offset_and_size_of( kmp_base_team_t, t_id ),
|
||||
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 ),
|
||||
offset_and_size_of( kmp_base_team_t, t_cancel_request ),
|
||||
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 ),
|
||||
|
||||
// root structure information
|
||||
sizeof( kmp_base_root_t ),
|
||||
offset_and_size_of( kmp_base_root_t, r_root_team ),
|
||||
offset_and_size_of( kmp_base_root_t, r_hot_team ),
|
||||
offset_and_size_of( kmp_base_root_t, r_uber_thread ),
|
||||
offset_and_size_not_available,
|
||||
|
||||
// ident structure information
|
||||
sizeof( ident_t ),
|
||||
offset_and_size_of( ident_t, psource ),
|
||||
offset_and_size_of( ident_t, flags ),
|
||||
|
||||
// lock structure information
|
||||
sizeof( kmp_base_queuing_lock_t ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, initialized ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, location ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, tail_id ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, head_id ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, next_ticket ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, now_serving ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, owner_id ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, depth_locked ),
|
||||
offset_and_size_of( kmp_base_queuing_lock_t, flags ),
|
||||
|
||||
#if ! KMP_USE_DYNAMIC_LOCK
|
||||
/* Lock table. */
|
||||
sizeof( kmp_lock_table_t ),
|
||||
offset_and_size_of( kmp_lock_table_t, used ),
|
||||
offset_and_size_of( kmp_lock_table_t, allocated ),
|
||||
offset_and_size_of( kmp_lock_table_t, table ),
|
||||
#endif
|
||||
|
||||
// Task team structure information.
|
||||
sizeof( kmp_base_task_team_t ),
|
||||
offset_and_size_of( kmp_base_task_team_t, tt_threads_data ),
|
||||
offset_and_size_of( kmp_base_task_team_t, tt_found_tasks ),
|
||||
offset_and_size_of( kmp_base_task_team_t, tt_nproc ),
|
||||
offset_and_size_of( kmp_base_task_team_t, tt_unfinished_threads ),
|
||||
offset_and_size_of( kmp_base_task_team_t, tt_active ),
|
||||
|
||||
// task_data_t.
|
||||
sizeof( kmp_taskdata_t ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_task_id ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_flags ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_team ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_parent ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_level ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_ident ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_allocated_child_tasks ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_incomplete_child_tasks ),
|
||||
|
||||
offset_and_size_of( kmp_taskdata_t, td_taskwait_ident ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_taskwait_counter ),
|
||||
offset_and_size_of( kmp_taskdata_t, td_taskwait_thread ),
|
||||
|
||||
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 ),
|
||||
|
||||
offset_and_size_of( kmp_taskdata_t, td_depnode ),
|
||||
offset_and_size_of( kmp_depnode_list_t, node ),
|
||||
offset_and_size_of( kmp_depnode_list_t, next ),
|
||||
offset_and_size_of( kmp_base_depnode_t, successors ),
|
||||
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 ),
|
||||
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_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 ),
|
||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_last_stolen ),
|
||||
|
||||
// The last field.
|
||||
KMP_OMP_VERSION,
|
||||
|
||||
}; // __kmp_omp_debug_struct_info
|
||||
|
||||
#undef offset_and_size_of
|
||||
#undef addr_and_size_of
|
||||
|
||||
/*
|
||||
Intel compiler on IA-32 architecture issues a warning "conversion
|
||||
from "unsigned long long" to "char *" may lose significant bits"
|
||||
when 64-bit value is assigned to 32-bit pointer. Use this function
|
||||
to suppress the warning.
|
||||
*/
|
||||
static inline
|
||||
void *
|
||||
__kmp_convert_to_ptr(
|
||||
kmp_uint64 addr
|
||||
) {
|
||||
#if KMP_COMPILER_ICC
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 810 ) // conversion from "unsigned long long" to "char *" may lose significant bits
|
||||
#pragma warning( disable: 1195 ) // conversion from integer to smaller pointer
|
||||
#endif // KMP_COMPILER_ICC
|
||||
return (void *) addr;
|
||||
#if KMP_COMPILER_ICC
|
||||
#pragma warning( pop )
|
||||
#endif // KMP_COMPILER_ICC
|
||||
} // __kmp_convert_to_ptr
|
||||
|
||||
|
||||
static int
|
||||
kmp_location_match(
|
||||
kmp_str_loc_t * loc,
|
||||
kmp_omp_nthr_item_t * item
|
||||
) {
|
||||
|
||||
int file_match = 0;
|
||||
int func_match = 0;
|
||||
int line_match = 0;
|
||||
|
||||
char * file = (char *) __kmp_convert_to_ptr( item->file );
|
||||
char * func = (char *) __kmp_convert_to_ptr( item->func );
|
||||
file_match = __kmp_str_fname_match( & loc->fname, file );
|
||||
func_match =
|
||||
item->func == 0 // If item->func is NULL, it allows any func name.
|
||||
||
|
||||
strcmp( func, "*" ) == 0
|
||||
||
|
||||
( loc->func != NULL && strcmp( loc->func, func ) == 0 );
|
||||
line_match =
|
||||
item->begin <= loc->line
|
||||
&&
|
||||
( item->end <= 0 || loc->line <= item->end ); // if item->end <= 0, it means "end of file".
|
||||
|
||||
return ( file_match && func_match && line_match );
|
||||
|
||||
} // kmp_location_match
|
||||
|
||||
|
||||
int
|
||||
__kmp_omp_num_threads(
|
||||
ident_t const * ident
|
||||
) {
|
||||
|
||||
int num_threads = 0;
|
||||
|
||||
kmp_omp_nthr_info_t * info =
|
||||
(kmp_omp_nthr_info_t *) __kmp_convert_to_ptr( __kmp_omp_debug_struct_info.nthr_info.addr );
|
||||
if ( info->num > 0 && info->array != 0 ) {
|
||||
kmp_omp_nthr_item_t * items = (kmp_omp_nthr_item_t *) __kmp_convert_to_ptr( info->array );
|
||||
kmp_str_loc_t loc = __kmp_str_loc_init( ident->psource, 1 );
|
||||
int i;
|
||||
for ( i = 0; i < info->num; ++ i ) {
|
||||
if ( kmp_location_match( & loc, & items[ i ] ) ) {
|
||||
num_threads = items[ i ].num_threads;
|
||||
}; // if
|
||||
}; // for
|
||||
__kmp_str_loc_free( & loc );
|
||||
}; // if
|
||||
|
||||
return num_threads;;
|
||||
|
||||
} // __kmp_omp_num_threads
|
||||
#endif /* USE_DEBUGGER */
|
||||
@@ -0,0 +1,51 @@
|
||||
#if USE_DEBUGGER
|
||||
/*
|
||||
* kmp_debugger.h -- debugger support.
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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_DEBUGGER_H
|
||||
#define KMP_DEBUGGER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/* * 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
|
||||
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
|
||||
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
|
||||
location ident. This way, specific parallel regions' number of threads can be changed
|
||||
at the debugger's request.
|
||||
*/
|
||||
int __kmp_omp_num_threads( ident_t const * ident );
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
#endif // KMP_DEBUGGER_H
|
||||
|
||||
#endif // USE_DEBUGGER
|
||||
+342
-87
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_dispatch.cpp: dynamic scheduling - iteration initialization and dispatch.
|
||||
* $Revision: 42674 $
|
||||
* $Date: 2013-09-18 11:12:49 -0500 (Wed, 18 Sep 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -32,13 +30,47 @@
|
||||
#include "kmp_itt.h"
|
||||
#include "kmp_str.h"
|
||||
#include "kmp_error.h"
|
||||
#include "kmp_stats.h"
|
||||
#if KMP_OS_WINDOWS && KMP_ARCH_X86
|
||||
#include <float.h>
|
||||
#endif
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
#include "ompt-internal.h"
|
||||
#include "ompt-specific.h"
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
// template for type limits
|
||||
template< typename T >
|
||||
struct i_maxmin {
|
||||
static const T mx;
|
||||
static const T mn;
|
||||
};
|
||||
template<>
|
||||
struct i_maxmin< int > {
|
||||
static const int mx = 0x7fffffff;
|
||||
static const int mn = 0x80000000;
|
||||
};
|
||||
template<>
|
||||
struct i_maxmin< unsigned int > {
|
||||
static const unsigned int mx = 0xffffffff;
|
||||
static const unsigned int mn = 0x00000000;
|
||||
};
|
||||
template<>
|
||||
struct i_maxmin< long long > {
|
||||
static const long long mx = 0x7fffffffffffffffLL;
|
||||
static const long long mn = 0x8000000000000000LL;
|
||||
};
|
||||
template<>
|
||||
struct i_maxmin< unsigned long long > {
|
||||
static const unsigned long long mx = 0xffffffffffffffffLL;
|
||||
static const unsigned long long mn = 0x0000000000000000LL;
|
||||
};
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifdef KMP_STATIC_STEAL_ENABLED
|
||||
|
||||
// replaces dispatch_private_info{32,64} structures and dispatch_private_info{32,64}_t types
|
||||
@@ -148,22 +180,6 @@ struct dispatch_shared_info_template {
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static void
|
||||
__kmp_static_delay( int arg )
|
||||
{
|
||||
/* Work around weird code-gen bug that causes assert to trip */
|
||||
#if KMP_ARCH_X86_64 && KMP_OS_LINUX
|
||||
#else
|
||||
KMP_ASSERT( arg >= 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
__kmp_static_yield( int arg )
|
||||
{
|
||||
__kmp_yield( arg );
|
||||
}
|
||||
|
||||
#undef USE_TEST_LOCKS
|
||||
|
||||
// test_then_add template (general template should NOT be used)
|
||||
@@ -294,8 +310,6 @@ __kmp_wait_yield( volatile UT * spinner,
|
||||
/* if ( TCR_4(__kmp_global.g.g_done) && __kmp_global.g.g_abort)
|
||||
__kmp_abort_thread(); */
|
||||
|
||||
__kmp_static_delay(TRUE);
|
||||
|
||||
// if we are oversubscribed,
|
||||
// or have waited a bit (and KMP_LIBRARY=throughput, then yield
|
||||
// pause is in the following code
|
||||
@@ -346,7 +360,11 @@ __kmp_dispatch_deo_error( int *gtid_ref, int *cid_ref, ident_t *loc_ref )
|
||||
th = __kmp_threads[*gtid_ref];
|
||||
if ( th -> th.th_root -> r.r_active
|
||||
&& ( th -> th.th_dispatch -> th_dispatch_pr_current -> pushed_ws != ct_none ) ) {
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
__kmp_push_sync( *gtid_ref, ct_ordered_in_pdo, loc_ref, NULL, 0 );
|
||||
#else
|
||||
__kmp_push_sync( *gtid_ref, ct_ordered_in_pdo, loc_ref, NULL );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -368,7 +386,11 @@ __kmp_dispatch_deo( int *gtid_ref, int *cid_ref, ident_t *loc_ref )
|
||||
pr = reinterpret_cast< dispatch_private_info_template< UT >* >
|
||||
( th -> th.th_dispatch -> th_dispatch_pr_current );
|
||||
if ( pr -> pushed_ws != ct_none ) {
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
__kmp_push_sync( gtid, ct_ordered_in_pdo, loc_ref, NULL, 0 );
|
||||
#else
|
||||
__kmp_push_sync( gtid, ct_ordered_in_pdo, loc_ref, NULL );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,6 +611,9 @@ __kmp_dispatch_init(
|
||||
if ( ! TCR_4( __kmp_init_parallel ) )
|
||||
__kmp_parallel_initialize();
|
||||
|
||||
#if INCLUDE_SSC_MARKS
|
||||
SSC_MARK_DISPATCH_INIT();
|
||||
#endif
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
@@ -606,6 +631,15 @@ __kmp_dispatch_init(
|
||||
active = ! team -> t.t_serialized;
|
||||
th->th.th_ident = loc;
|
||||
|
||||
#if USE_ITT_BUILD
|
||||
kmp_uint64 cur_chunk = chunk;
|
||||
int itt_need_metadata_reporting = __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
|
||||
KMP_MASTER_GTID(gtid) &&
|
||||
#if OMP_40_ENABLED
|
||||
th->th.th_teams_microtask == NULL &&
|
||||
#endif
|
||||
team->t.t_active_level == 1;
|
||||
#endif
|
||||
if ( ! active ) {
|
||||
pr = reinterpret_cast< dispatch_private_info_template< T >* >
|
||||
( th -> th.th_dispatch -> th_disp_buffer ); /* top of the stack */
|
||||
@@ -640,23 +674,16 @@ __kmp_dispatch_init(
|
||||
schedule = __kmp_static;
|
||||
} else {
|
||||
if ( schedule == kmp_sch_runtime ) {
|
||||
#if OMP_30_ENABLED
|
||||
// Use the scheduling specified by OMP_SCHEDULE (or __kmp_sch_default if not specified)
|
||||
schedule = team -> t.t_sched.r_sched_type;
|
||||
// Detail the schedule if needed (global controls are differentiated appropriately)
|
||||
if ( schedule == kmp_sch_guided_chunked ) {
|
||||
schedule = __kmp_guided;
|
||||
} else if ( schedule == kmp_sch_static ) {
|
||||
schedule = __kmp_static;
|
||||
}
|
||||
// Use the chunk size specified by OMP_SCHEDULE (or default if not specified)
|
||||
chunk = team -> t.t_sched.chunk;
|
||||
#else
|
||||
kmp_r_sched_t r_sched = __kmp_get_schedule_global();
|
||||
// Use the scheduling specified by OMP_SCHEDULE and/or KMP_SCHEDULE or default
|
||||
schedule = r_sched.r_sched_type;
|
||||
chunk = r_sched.chunk;
|
||||
#endif
|
||||
// Use the scheduling specified by OMP_SCHEDULE (or __kmp_sch_default if not specified)
|
||||
schedule = team -> t.t_sched.r_sched_type;
|
||||
// Detail the schedule if needed (global controls are differentiated appropriately)
|
||||
if ( schedule == kmp_sch_guided_chunked ) {
|
||||
schedule = __kmp_guided;
|
||||
} else if ( schedule == kmp_sch_static ) {
|
||||
schedule = __kmp_static;
|
||||
}
|
||||
// Use the chunk size specified by OMP_SCHEDULE (or default if not specified)
|
||||
chunk = team -> t.t_sched.chunk;
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
@@ -678,7 +705,6 @@ __kmp_dispatch_init(
|
||||
}
|
||||
}
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
if ( schedule == kmp_sch_auto ) {
|
||||
// mapping and differentiation: in the __kmp_do_serial_initialize()
|
||||
schedule = __kmp_auto;
|
||||
@@ -694,7 +720,6 @@ __kmp_dispatch_init(
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // OMP_30_ENABLED
|
||||
|
||||
/* guided analytical not safe for too many threads */
|
||||
if ( team->t.t_nproc > 1<<20 && schedule == kmp_sch_guided_analytical_chunked ) {
|
||||
@@ -848,6 +873,11 @@ __kmp_dispatch_init(
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if USE_ITT_BUILD
|
||||
// Calculate chunk for metadata report
|
||||
if ( itt_need_metadata_reporting )
|
||||
cur_chunk = limit - init + 1;
|
||||
#endif
|
||||
if ( st == 1 ) {
|
||||
pr->u.p.lb = lb + init;
|
||||
pr->u.p.ub = lb + limit;
|
||||
@@ -1099,8 +1129,35 @@ __kmp_dispatch_init(
|
||||
if ( pr->ordered ) {
|
||||
__kmp_itt_ordered_init( gtid );
|
||||
}; // if
|
||||
// Report loop metadata
|
||||
if ( itt_need_metadata_reporting ) {
|
||||
// Only report metadata by master of active team at level 1
|
||||
kmp_uint64 schedtype = 0;
|
||||
switch ( schedule ) {
|
||||
case kmp_sch_static_chunked:
|
||||
case kmp_sch_static_balanced:// Chunk is calculated in the switch above
|
||||
break;
|
||||
case kmp_sch_static_greedy:
|
||||
cur_chunk = pr->u.p.parm1;
|
||||
break;
|
||||
case kmp_sch_dynamic_chunked:
|
||||
schedtype = 1;
|
||||
break;
|
||||
case kmp_sch_guided_iterative_chunked:
|
||||
case kmp_sch_guided_analytical_chunked:
|
||||
schedtype = 2;
|
||||
break;
|
||||
default:
|
||||
// Should we put this case under "static"?
|
||||
// case kmp_sch_static_steal:
|
||||
schedtype = 3;
|
||||
break;
|
||||
}
|
||||
__kmp_itt_metadata_loop(loc, schedtype, tc, cur_chunk);
|
||||
}
|
||||
#endif /* USE_ITT_BUILD */
|
||||
}; // if
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
@@ -1136,6 +1193,16 @@ __kmp_dispatch_init(
|
||||
}
|
||||
}
|
||||
#endif // ( KMP_STATIC_STEAL_ENABLED && USE_STEALING )
|
||||
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
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);
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_begin)(
|
||||
team_info->parallel_id, task_info->task_id, team_info->microtask);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1286,6 +1353,24 @@ __kmp_dispatch_finish_chunk( int gtid, ident_t *loc )
|
||||
|
||||
#endif /* KMP_GOMP_COMPAT */
|
||||
|
||||
/* Define a macro for exiting __kmp_dispatch_next(). If status is 0
|
||||
* (no more work), then tell OMPT the loop is over. In some cases
|
||||
* kmp_dispatch_fini() is not called. */
|
||||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
#define OMPT_LOOP_END \
|
||||
if (status == 0) { \
|
||||
if ((ompt_status == ompt_status_track_callback) && \
|
||||
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); \
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_end)( \
|
||||
team_info->parallel_id, task_info->task_id); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define OMPT_LOOP_END // no-op
|
||||
#endif
|
||||
|
||||
template< typename T >
|
||||
static int
|
||||
__kmp_dispatch_next(
|
||||
@@ -1295,13 +1380,16 @@ __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 )
|
||||
static const int ___kmp_size_type = sizeof( UT );
|
||||
#endif
|
||||
|
||||
int status;
|
||||
dispatch_private_info_template< T > * pr;
|
||||
kmp_info_t * th = __kmp_threads[ gtid ];
|
||||
kmp_team_t * team = th -> th.th_team;
|
||||
|
||||
KMP_DEBUG_ASSERT( p_lb && p_ub && p_st ); // AC: these cannot be NULL
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
@@ -1323,9 +1411,10 @@ __kmp_dispatch_next(
|
||||
if ( (status = (pr->u.p.tc != 0)) == 0 ) {
|
||||
*p_lb = 0;
|
||||
*p_ub = 0;
|
||||
if ( p_st != 0 ) {
|
||||
// if ( p_last != NULL )
|
||||
// *p_last = 0;
|
||||
if ( p_st != NULL )
|
||||
*p_st = 0;
|
||||
}
|
||||
if ( __kmp_env_consistency_check ) {
|
||||
if ( pr->pushed_ws != ct_none ) {
|
||||
pr->pushed_ws = __kmp_pop_workshare( gtid, pr->pushed_ws, loc );
|
||||
@@ -1346,7 +1435,10 @@ __kmp_dispatch_next(
|
||||
if ( (status = (init <= trip)) == 0 ) {
|
||||
*p_lb = 0;
|
||||
*p_ub = 0;
|
||||
if ( p_st != 0 ) *p_st = 0;
|
||||
// if ( p_last != NULL )
|
||||
// *p_last = 0;
|
||||
if ( p_st != NULL )
|
||||
*p_st = 0;
|
||||
if ( __kmp_env_consistency_check ) {
|
||||
if ( pr->pushed_ws != ct_none ) {
|
||||
pr->pushed_ws = __kmp_pop_workshare( gtid, pr->pushed_ws, loc );
|
||||
@@ -1363,12 +1455,10 @@ __kmp_dispatch_next(
|
||||
pr->u.p.last_upper = pr->u.p.ub;
|
||||
#endif /* KMP_OS_WINDOWS */
|
||||
}
|
||||
if ( p_last ) {
|
||||
if ( p_last != NULL )
|
||||
*p_last = last;
|
||||
}
|
||||
if ( p_st != 0 ) {
|
||||
if ( p_st != NULL )
|
||||
*p_st = incr;
|
||||
}
|
||||
if ( incr == 1 ) {
|
||||
*p_lb = start + init;
|
||||
*p_ub = start + limit;
|
||||
@@ -1395,19 +1485,15 @@ __kmp_dispatch_next(
|
||||
} // if
|
||||
} else {
|
||||
pr->u.p.tc = 0;
|
||||
|
||||
*p_lb = pr->u.p.lb;
|
||||
*p_ub = pr->u.p.ub;
|
||||
#if KMP_OS_WINDOWS
|
||||
pr->u.p.last_upper = *p_ub;
|
||||
#endif /* KMP_OS_WINDOWS */
|
||||
|
||||
if ( p_st != 0 ) {
|
||||
*p_st = pr->u.p.st;
|
||||
}
|
||||
if ( p_last ) {
|
||||
if ( p_last != NULL )
|
||||
*p_last = TRUE;
|
||||
}
|
||||
if ( p_st != NULL )
|
||||
*p_st = pr->u.p.st;
|
||||
} // if
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
@@ -1415,12 +1501,16 @@ __kmp_dispatch_next(
|
||||
// create format specifiers before the debug output
|
||||
buff = __kmp_str_format(
|
||||
"__kmp_dispatch_next: T#%%d serialized case: p_lb:%%%s " \
|
||||
"p_ub:%%%s p_st:%%%s p_last:%%p returning:%%d\n",
|
||||
"p_ub:%%%s p_st:%%%s p_last:%%p %%d returning:%%d\n",
|
||||
traits_t< T >::spec, traits_t< T >::spec, traits_t< ST >::spec );
|
||||
KD_TRACE(10, ( buff, gtid, *p_lb, *p_ub, *p_st, p_last, status) );
|
||||
KD_TRACE(10, ( buff, gtid, *p_lb, *p_ub, *p_st, p_last, *p_last, status) );
|
||||
__kmp_str_free( &buff );
|
||||
}
|
||||
#endif
|
||||
#if INCLUDE_SSC_MARKS
|
||||
SSC_MARK_DISPATCH_NEXT();
|
||||
#endif
|
||||
OMPT_LOOP_END;
|
||||
return status;
|
||||
} else {
|
||||
kmp_int32 last = 0;
|
||||
@@ -1572,7 +1662,7 @@ __kmp_dispatch_next(
|
||||
if ( !status ) {
|
||||
*p_lb = 0;
|
||||
*p_ub = 0;
|
||||
if ( p_st != 0 ) *p_st = 0;
|
||||
if ( p_st != NULL ) *p_st = 0;
|
||||
} else {
|
||||
start = pr->u.p.parm2;
|
||||
init *= chunk;
|
||||
@@ -1582,10 +1672,7 @@ __kmp_dispatch_next(
|
||||
KMP_DEBUG_ASSERT(init <= trip);
|
||||
if ( (last = (limit >= trip)) != 0 )
|
||||
limit = trip;
|
||||
if ( p_last ) {
|
||||
*p_last = last;
|
||||
}
|
||||
if ( p_st != 0 ) *p_st = incr;
|
||||
if ( p_st != NULL ) *p_st = incr;
|
||||
|
||||
if ( incr == 1 ) {
|
||||
*p_lb = start + init;
|
||||
@@ -1622,10 +1709,7 @@ __kmp_dispatch_next(
|
||||
*p_lb = pr->u.p.lb;
|
||||
*p_ub = pr->u.p.ub;
|
||||
last = pr->u.p.parm1;
|
||||
if ( p_last ) {
|
||||
*p_last = last;
|
||||
}
|
||||
if ( p_st )
|
||||
if ( p_st != NULL )
|
||||
*p_st = pr->u.p.st;
|
||||
} else { /* no iterations to do */
|
||||
pr->u.p.lb = pr->u.p.ub + pr->u.p.st;
|
||||
@@ -1665,10 +1749,7 @@ __kmp_dispatch_next(
|
||||
if ( (last = (limit >= trip)) != 0 )
|
||||
limit = trip;
|
||||
|
||||
if ( p_last ) {
|
||||
*p_last = last;
|
||||
}
|
||||
if ( p_st != 0 ) *p_st = incr;
|
||||
if ( p_st != NULL ) *p_st = incr;
|
||||
|
||||
pr->u.p.count += team->t.t_nproc;
|
||||
|
||||
@@ -1713,7 +1794,7 @@ __kmp_dispatch_next(
|
||||
if ( (status = (init <= trip)) == 0 ) {
|
||||
*p_lb = 0;
|
||||
*p_ub = 0;
|
||||
if ( p_st != 0 ) *p_st = 0;
|
||||
if ( p_st != NULL ) *p_st = 0;
|
||||
} else {
|
||||
start = pr->u.p.lb;
|
||||
limit = chunk + init - 1;
|
||||
@@ -1721,10 +1802,8 @@ __kmp_dispatch_next(
|
||||
|
||||
if ( (last = (limit >= trip)) != 0 )
|
||||
limit = trip;
|
||||
if ( p_last ) {
|
||||
*p_last = last;
|
||||
}
|
||||
if ( p_st != 0 ) *p_st = incr;
|
||||
|
||||
if ( p_st != NULL ) *p_st = incr;
|
||||
|
||||
if ( incr == 1 ) {
|
||||
*p_lb = start + init;
|
||||
@@ -1801,8 +1880,6 @@ __kmp_dispatch_next(
|
||||
incr = pr->u.p.st;
|
||||
if ( p_st != NULL )
|
||||
*p_st = incr;
|
||||
if ( p_last != NULL )
|
||||
*p_last = last;
|
||||
*p_lb = start + init * incr;
|
||||
*p_ub = start + limit * incr;
|
||||
if ( pr->ordered ) {
|
||||
@@ -1906,8 +1983,6 @@ __kmp_dispatch_next(
|
||||
incr = pr->u.p.st;
|
||||
if ( p_st != NULL )
|
||||
*p_st = incr;
|
||||
if ( p_last != NULL )
|
||||
*p_last = last;
|
||||
*p_lb = start + init * incr;
|
||||
*p_ub = start + limit * incr;
|
||||
if ( pr->ordered ) {
|
||||
@@ -1951,7 +2026,7 @@ __kmp_dispatch_next(
|
||||
if ( (status = ((T)index < parm3 && init <= trip)) == 0 ) {
|
||||
*p_lb = 0;
|
||||
*p_ub = 0;
|
||||
if ( p_st != 0 ) *p_st = 0;
|
||||
if ( p_st != NULL ) *p_st = 0;
|
||||
} else {
|
||||
start = pr->u.p.lb;
|
||||
limit = ( (index+1) * ( 2*parm2 - index*parm4 ) ) / 2 - 1;
|
||||
@@ -1960,10 +2035,7 @@ __kmp_dispatch_next(
|
||||
if ( (last = (limit >= trip)) != 0 )
|
||||
limit = trip;
|
||||
|
||||
if ( p_last != 0 ) {
|
||||
*p_last = last;
|
||||
}
|
||||
if ( p_st != 0 ) *p_st = incr;
|
||||
if ( p_st != NULL ) *p_st = incr;
|
||||
|
||||
if ( incr == 1 ) {
|
||||
*p_lb = start + init;
|
||||
@@ -1991,6 +2063,17 @@ __kmp_dispatch_next(
|
||||
} // if
|
||||
} // case
|
||||
break;
|
||||
default:
|
||||
{
|
||||
status = 0; // to avoid complaints on uninitialized variable use
|
||||
__kmp_msg(
|
||||
kmp_ms_fatal, // Severity
|
||||
KMP_MSG( UnknownSchedTypeDetected ), // Primary message
|
||||
KMP_HNT( GetNewerLibrary ), // Hint
|
||||
__kmp_msg_null // Variadic argument list terminator
|
||||
);
|
||||
}
|
||||
break;
|
||||
} // switch
|
||||
} // if tc == 0;
|
||||
|
||||
@@ -2010,7 +2093,7 @@ __kmp_dispatch_next(
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( num_done == team->t.t_nproc-1 ) {
|
||||
if ( (ST)num_done == team->t.t_nproc-1 ) {
|
||||
/* NOTE: release this buffer to be reused */
|
||||
|
||||
KMP_MB(); /* Flush all pending memory write invalidates. */
|
||||
@@ -2048,6 +2131,8 @@ __kmp_dispatch_next(
|
||||
pr->u.p.last_upper = pr->u.p.ub;
|
||||
}
|
||||
#endif /* KMP_OS_WINDOWS */
|
||||
if ( p_last != NULL && status != 0 )
|
||||
*p_last = last;
|
||||
} // if
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
@@ -2062,9 +2147,130 @@ __kmp_dispatch_next(
|
||||
__kmp_str_free( &buff );
|
||||
}
|
||||
#endif
|
||||
#if INCLUDE_SSC_MARKS
|
||||
SSC_MARK_DISPATCH_NEXT();
|
||||
#endif
|
||||
OMPT_LOOP_END;
|
||||
return status;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static void
|
||||
__kmp_dist_get_bounds(
|
||||
ident_t *loc,
|
||||
kmp_int32 gtid,
|
||||
kmp_int32 *plastiter,
|
||||
T *plower,
|
||||
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;
|
||||
register kmp_uint32 nteams;
|
||||
register UT trip_count;
|
||||
register kmp_team_t *team;
|
||||
kmp_info_t * th;
|
||||
|
||||
KMP_DEBUG_ASSERT( plastiter && plower && pupper );
|
||||
KE_TRACE( 10, ("__kmpc_dist_get_bounds called (%d)\n", gtid));
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
// create format specifiers before the debug output
|
||||
buff = __kmp_str_format( "__kmpc_dist_get_bounds: T#%%d liter=%%d "\
|
||||
"iter=(%%%s, %%%s, %%%s) signed?<%s>\n",
|
||||
traits_t< T >::spec, traits_t< T >::spec, traits_t< ST >::spec,
|
||||
traits_t< T >::spec );
|
||||
KD_TRACE(100, ( buff, gtid, *plastiter, *plower, *pupper, incr ) );
|
||||
__kmp_str_free( &buff );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( __kmp_env_consistency_check ) {
|
||||
if( incr == 0 ) {
|
||||
__kmp_error_construct( kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo, loc );
|
||||
}
|
||||
if( incr > 0 ? (*pupper < *plower) : (*plower < *pupper) ) {
|
||||
// The loop is illegal.
|
||||
// Some zero-trip loops maintained by compiler, e.g.:
|
||||
// for(i=10;i<0;++i) // lower >= upper - run-time check
|
||||
// for(i=0;i>10;--i) // lower <= upper - run-time check
|
||||
// for(i=0;i>10;++i) // incr > 0 - compile-time check
|
||||
// for(i=10;i<0;--i) // incr < 0 - compile-time check
|
||||
// Compiler does not check the following illegal loops:
|
||||
// for(i=0;i<10;i+=incr) // where incr<0
|
||||
// for(i=10;i>0;i-=incr) // where incr<0
|
||||
__kmp_error_construct( kmp_i18n_msg_CnsLoopIncrIllegal, ct_pdo, loc );
|
||||
}
|
||||
}
|
||||
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
|
||||
nteams = th->th.th_teams_size.nteams;
|
||||
#endif
|
||||
team_id = team->t.t_master_tid;
|
||||
KMP_DEBUG_ASSERT(nteams == team->t.t_parent->t.t_nproc);
|
||||
|
||||
// compute global trip count
|
||||
if( incr == 1 ) {
|
||||
trip_count = *pupper - *plower + 1;
|
||||
} else if(incr == -1) {
|
||||
trip_count = *plower - *pupper + 1;
|
||||
} else {
|
||||
trip_count = (ST)(*pupper - *plower) / incr + 1; // cast to signed to cover incr<0 case
|
||||
}
|
||||
if( trip_count <= nteams ) {
|
||||
KMP_DEBUG_ASSERT(
|
||||
__kmp_static == kmp_sch_static_greedy || \
|
||||
__kmp_static == kmp_sch_static_balanced
|
||||
); // Unknown static scheduling type.
|
||||
// only some teams get single iteration, others get nothing
|
||||
if( team_id < trip_count ) {
|
||||
*pupper = *plower = *plower + team_id * incr;
|
||||
} else {
|
||||
*plower = *pupper + incr; // zero-trip loop
|
||||
}
|
||||
if( plastiter != NULL )
|
||||
*plastiter = ( team_id == trip_count - 1 );
|
||||
} else {
|
||||
if( __kmp_static == kmp_sch_static_balanced ) {
|
||||
register UT chunk = trip_count / nteams;
|
||||
register UT extras = trip_count % nteams;
|
||||
*plower += incr * ( team_id * chunk + ( team_id < extras ? team_id : extras ) );
|
||||
*pupper = *plower + chunk * incr - ( team_id < extras ? 0 : incr );
|
||||
if( plastiter != NULL )
|
||||
*plastiter = ( team_id == nteams - 1 );
|
||||
} else {
|
||||
register T chunk_inc_count =
|
||||
( trip_count / nteams + ( ( trip_count % nteams ) ? 1 : 0) ) * incr;
|
||||
register T upper = *pupper;
|
||||
KMP_DEBUG_ASSERT( __kmp_static == kmp_sch_static_greedy );
|
||||
// Unknown static scheduling type.
|
||||
*plower += team_id * chunk_inc_count;
|
||||
*pupper = *plower + chunk_inc_count - incr;
|
||||
// Check/correct bounds if needed
|
||||
if( incr > 0 ) {
|
||||
if( *pupper < *plower )
|
||||
*pupper = i_maxmin< T >::mx;
|
||||
if( plastiter != NULL )
|
||||
*plastiter = *plower <= upper && *pupper > upper - incr;
|
||||
if( *pupper > upper )
|
||||
*pupper = upper; // tracker C73258
|
||||
} else {
|
||||
if( *pupper > *plower )
|
||||
*pupper = i_maxmin< T >::mn;
|
||||
if( plastiter != NULL )
|
||||
*plastiter = *plower >= upper && *pupper < upper - incr;
|
||||
if( *pupper < upper )
|
||||
*pupper = upper; // tracker C73258
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// Dispatch routines
|
||||
// Transfer call to template< type T >
|
||||
@@ -2091,6 +2297,7 @@ 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 );
|
||||
}
|
||||
@@ -2101,6 +2308,7 @@ 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 );
|
||||
}
|
||||
@@ -2113,6 +2321,7 @@ __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 );
|
||||
}
|
||||
@@ -2125,10 +2334,60 @@ __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 );
|
||||
}
|
||||
|
||||
/*!
|
||||
See @ref __kmpc_dispatch_init_4
|
||||
|
||||
Difference from __kmpc_dispatch_init set of functions is these functions
|
||||
are called for composite distribute parallel for construct. Thus before
|
||||
regular iterations dispatching we need to calc per-team iteration space.
|
||||
|
||||
These functions are all identical apart from the types of the arguments.
|
||||
*/
|
||||
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 );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
/*!
|
||||
@param loc Source code location
|
||||
@param gtid Global thread id
|
||||
@@ -2284,8 +2543,6 @@ __kmp_wait_yield_4(volatile kmp_uint32 * spinner,
|
||||
/* if ( TCR_4(__kmp_global.g.g_done) && __kmp_global.g.g_abort)
|
||||
__kmp_abort_thread(); */
|
||||
|
||||
__kmp_static_delay(TRUE);
|
||||
|
||||
/* 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 );
|
||||
@@ -2320,8 +2577,6 @@ __kmp_wait_yield_8( volatile kmp_uint64 * spinner,
|
||||
/* if ( TCR_4(__kmp_global.g.g_done) && __kmp_global.g.g_abort)
|
||||
__kmp_abort_thread(); */
|
||||
|
||||
__kmp_static_delay(TRUE);
|
||||
|
||||
// if we are oversubscribed,
|
||||
// or have waited a bit (and KMP_LIBARRY=throughput, then yield
|
||||
// pause is in the following code
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_environment.c -- Handle environment variables OS-independently.
|
||||
* $Revision: 42263 $
|
||||
* $Date: 2013-04-04 11:03:19 -0500 (Thu, 04 Apr 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -104,12 +102,12 @@ __kmp_env_get( char const * name ) {
|
||||
#if KMP_OS_UNIX
|
||||
char const * value = getenv( name );
|
||||
if ( value != NULL ) {
|
||||
size_t len = strlen( value ) + 1;
|
||||
size_t len = KMP_STRLEN( value ) + 1;
|
||||
result = (char *) KMP_INTERNAL_MALLOC( len );
|
||||
if ( result == NULL ) {
|
||||
KMP_FATAL( MemoryAllocFailed );
|
||||
}; // if
|
||||
strncpy( result, value, len );
|
||||
KMP_STRNCPY_S( result, len, value, len );
|
||||
}; // if
|
||||
#elif KMP_OS_WINDOWS
|
||||
/*
|
||||
@@ -372,6 +370,7 @@ ___kmp_env_blk_parse_string(
|
||||
It is not clear how empty environment is represented. "\x00\x00"?
|
||||
*/
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
static
|
||||
void
|
||||
___kmp_env_blk_parse_windows(
|
||||
@@ -395,19 +394,19 @@ ___kmp_env_blk_parse_windows(
|
||||
int len; // Length of variable.
|
||||
count = 0;
|
||||
var = env; // The first variable starts and beginning of environment block.
|
||||
len = strlen( var );
|
||||
len = KMP_STRLEN( var );
|
||||
while ( len != 0 ) {
|
||||
++ count;
|
||||
size = size + len + 1;
|
||||
var = var + len + 1; // Move pointer to the beginning of the next variable.
|
||||
len = strlen( var );
|
||||
len = KMP_STRLEN( var );
|
||||
}; // while
|
||||
size = size + 1; // Total size of env block, including terminating zero byte.
|
||||
}
|
||||
|
||||
// Copy original block to bulk, we will modify bulk, not original block.
|
||||
bulk = (char *) allocate( size );
|
||||
memcpy( bulk, env, size );
|
||||
KMP_MEMCPY_S( bulk, size, env, size );
|
||||
// Allocate vars array.
|
||||
vars = (kmp_env_var_t *) allocate( count * sizeof( kmp_env_var_t ) );
|
||||
|
||||
@@ -417,7 +416,7 @@ ___kmp_env_blk_parse_windows(
|
||||
int len; // Length of variable.
|
||||
count = 0;
|
||||
var = bulk;
|
||||
len = strlen( var );
|
||||
len = KMP_STRLEN( var );
|
||||
while ( len != 0 ) {
|
||||
// Save variable in vars array.
|
||||
__kmp_str_split( var, '=', & name, & value );
|
||||
@@ -426,7 +425,7 @@ ___kmp_env_blk_parse_windows(
|
||||
++ count;
|
||||
// Get the next var.
|
||||
var = var + len + 1;
|
||||
len = strlen( var );
|
||||
len = KMP_STRLEN( var );
|
||||
}; // while
|
||||
}
|
||||
|
||||
@@ -438,7 +437,7 @@ ___kmp_env_blk_parse_windows(
|
||||
block->count = count;
|
||||
|
||||
}; // ___kmp_env_blk_parse_windows
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -464,7 +463,7 @@ ___kmp_env_blk_parse_unix(
|
||||
count = 0;
|
||||
size = 0;
|
||||
while ( env[ count ] != NULL ) {
|
||||
size += strlen( env[ count ] ) + 1;
|
||||
size += KMP_STRLEN( env[ count ] ) + 1;
|
||||
++ count;
|
||||
}; // while
|
||||
}
|
||||
@@ -483,8 +482,8 @@ ___kmp_env_blk_parse_unix(
|
||||
var = bulk;
|
||||
for ( i = 0; i < count; ++ i ) {
|
||||
// Copy variable to bulk.
|
||||
len = strlen( env[ i ] );
|
||||
memcpy( var, env[ i ], len + 1 );
|
||||
len = KMP_STRLEN( env[ i ] );
|
||||
KMP_MEMCPY_S( var, size, env[ i ], len + 1 );
|
||||
// Save found variable in vars array.
|
||||
__kmp_str_split( var, '=', & name, & value );
|
||||
vars[ i ].name = name;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_environment.h -- Handle environment varoiables OS-independently.
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
+21
-24
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
/*
|
||||
* kmp_error.c -- KPTS functions for error checking at runtime
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -25,24 +23,6 @@
|
||||
|
||||
#define MIN_STACK 100
|
||||
|
||||
static char const * cons_text_fort[] = {
|
||||
"(none)",
|
||||
"PARALLEL",
|
||||
"work-sharing", /* this is not called DO because of lowering of SECTIONS and WORKSHARE directives */
|
||||
"ORDERED work-sharing", /* this is not called DO ORDERED because of lowering of SECTIONS directives */
|
||||
"SECTIONS",
|
||||
"work-sharing", /* this is not called SINGLE because of lowering of SECTIONS and WORKSHARE directives */
|
||||
"TASKQ",
|
||||
"TASKQ",
|
||||
"TASKQ ORDERED",
|
||||
"CRITICAL",
|
||||
"ORDERED", /* in PARALLEL */
|
||||
"ORDERED", /* in PDO */
|
||||
"ORDERED", /* in TASKQ */
|
||||
"MASTER",
|
||||
"REDUCE",
|
||||
"BARRIER"
|
||||
};
|
||||
|
||||
static char const * cons_text_c[] = {
|
||||
"(none)",
|
||||
@@ -72,7 +52,6 @@ static char const * cons_text_c[] = {
|
||||
cons_text_c[ (p)->stack_data[ tos ].type ], \
|
||||
get_src( (p)->stack_data[ tos ].ident )
|
||||
|
||||
static int const cons_text_fort_num = sizeof( cons_text_fort ) / sizeof( char const * );
|
||||
static int const cons_text_c_num = sizeof( cons_text_c ) / sizeof( char const * );
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -113,7 +92,7 @@ __kmp_expand_cons_stack( int gtid, struct cons_header *p )
|
||||
// NOTE: Function returns allocated memory, caller must free it!
|
||||
static char const *
|
||||
__kmp_pragma(
|
||||
enum cons_type ct,
|
||||
int ct,
|
||||
ident_t const * ident
|
||||
) {
|
||||
char const * cons = NULL; // Construct name.
|
||||
@@ -123,7 +102,7 @@ __kmp_pragma(
|
||||
kmp_str_buf_t buffer;
|
||||
kmp_msg_t prgm;
|
||||
__kmp_str_buf_init( & buffer );
|
||||
if ( 0 < ct && ct <= cons_text_c_num ) {;
|
||||
if ( 0 < ct && ct < cons_text_c_num ) {
|
||||
cons = cons_text_c[ ct ];
|
||||
} else {
|
||||
KMP_DEBUG_ASSERT( 0 );
|
||||
@@ -208,6 +187,7 @@ __kmp_free_cons_stack( void * ptr ) {
|
||||
}
|
||||
|
||||
|
||||
#if KMP_DEBUG
|
||||
static void
|
||||
dump_cons_stack( int gtid, struct cons_header * p ) {
|
||||
int i;
|
||||
@@ -226,6 +206,7 @@ dump_cons_stack( int gtid, struct cons_header * p ) {
|
||||
__kmp_debug_printf( "%s", buffer.str );
|
||||
__kmp_str_buf_free( & buffer );
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
__kmp_push_parallel( int gtid, ident_t const * ident )
|
||||
@@ -289,7 +270,11 @@ __kmp_push_workshare( int gtid, enum cons_type ct, ident_t const * ident )
|
||||
}
|
||||
|
||||
void
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
__kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck, kmp_uint32 seq )
|
||||
#else
|
||||
__kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck )
|
||||
#endif
|
||||
{
|
||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
||||
|
||||
@@ -347,7 +332,11 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
|
||||
}
|
||||
}
|
||||
} else if ( ct == ct_critical ) {
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
if ( lck != NULL && __kmp_get_user_lock_owner( lck, seq ) == gtid ) { /* this same thread already has lock for this critical section */
|
||||
#else
|
||||
if ( lck != NULL && __kmp_get_user_lock_owner( lck ) == gtid ) { /* this same thread already has lock for this critical section */
|
||||
#endif
|
||||
int index = p->s_top;
|
||||
struct cons_data cons = { NULL, ct_critical, 0, NULL };
|
||||
/* walk up construct stack and try to find critical with matching name */
|
||||
@@ -382,14 +371,22 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
|
||||
}
|
||||
|
||||
void
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
__kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck, kmp_uint32 seq )
|
||||
#else
|
||||
__kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck )
|
||||
#endif
|
||||
{
|
||||
int tos;
|
||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
||||
|
||||
KMP_ASSERT( gtid == __kmp_get_gtid() );
|
||||
KE_TRACE( 10, ("__kmp_push_sync (gtid=%d)\n", gtid ) );
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
__kmp_check_sync( gtid, ct, ident, lck, seq );
|
||||
#else
|
||||
__kmp_check_sync( gtid, ct, ident, lck );
|
||||
#endif
|
||||
KE_TRACE( 100, ( PUSH_MSG( ct, ident ) ) );
|
||||
tos = ++ p->stack_top;
|
||||
p->stack_data[ tos ].type = ct;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_error.h -- PTS functions for error checking at runtime.
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,10 +31,18 @@ void __kmp_free_cons_stack( void * ptr );
|
||||
|
||||
void __kmp_push_parallel( int gtid, ident_t const * ident );
|
||||
void __kmp_push_workshare( int gtid, enum cons_type ct, ident_t const * ident );
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
void __kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p name, kmp_uint32 );
|
||||
#else
|
||||
void __kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p name );
|
||||
#endif
|
||||
|
||||
void __kmp_check_workshare( int gtid, enum cons_type ct, ident_t const * ident );
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
void __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p name, kmp_uint32 );
|
||||
#else
|
||||
void __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p name );
|
||||
#endif
|
||||
|
||||
void __kmp_pop_parallel( int gtid, ident_t const * ident );
|
||||
enum cons_type __kmp_pop_workshare( int gtid, enum cons_type ct, ident_t const * ident );
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_ftn_cdecl.c -- Fortran __cdecl linkage support for OpenMP.
|
||||
* $Revision: 42757 $
|
||||
* $Date: 2013-10-18 08:20:57 -0500 (Fri, 18 Oct 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,7 +16,7 @@
|
||||
#include "kmp.h"
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
# if defined KMP_WIN_CDECL || !defined GUIDEDLL_EXPORTS
|
||||
# if defined KMP_WIN_CDECL || !defined KMP_DYNAMIC_LIB
|
||||
# define KMP_FTN_ENTRIES KMP_FTN_UPPER
|
||||
# endif
|
||||
#elif KMP_OS_UNIX
|
||||
|
||||
+66
-35
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_ftn_entry.h -- Fortran entry linkage support for OpenMP.
|
||||
* $Revision: 42798 $
|
||||
* $Date: 2013-10-30 16:39:54 -0500 (Wed, 30 Oct 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -217,8 +215,6 @@ FTN_GET_LIBRARY (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
|
||||
int FTN_STDCALL
|
||||
FTN_SET_AFFINITY( void **mask )
|
||||
{
|
||||
@@ -261,11 +257,11 @@ FTN_GET_AFFINITY_MAX_PROC( void )
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if KMP_OS_WINDOWS && KMP_ARCH_X86_64
|
||||
if ( __kmp_num_proc_groups <= 1 ) {
|
||||
return KMP_CPU_SETSIZE;
|
||||
#if KMP_GROUP_AFFINITY
|
||||
if ( __kmp_num_proc_groups > 1 ) {
|
||||
return (int)KMP_CPU_SETSIZE;
|
||||
}
|
||||
#endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
|
||||
#endif /* KMP_GROUP_AFFINITY */
|
||||
return __kmp_xproc;
|
||||
#endif
|
||||
}
|
||||
@@ -348,8 +344,6 @@ FTN_GET_AFFINITY_MASK_PROC( int KMP_DEREF proc, void **mask )
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* OMP_30_ENABLED */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
@@ -391,12 +385,8 @@ xexpand(FTN_GET_MAX_THREADS)( void )
|
||||
}
|
||||
gtid = __kmp_entry_gtid();
|
||||
thread = __kmp_threads[ gtid ];
|
||||
#if OMP_30_ENABLED
|
||||
//return thread -> th.th_team -> t.t_current_task[ thread->th.th_info.ds.ds_tid ] -> icvs.nproc;
|
||||
return thread -> th.th_current_task -> td_icvs.nproc;
|
||||
#else
|
||||
return thread -> th.th_team -> t.t_set_nproc[ thread->th.th_info.ds.ds_tid ];
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -412,7 +402,7 @@ xexpand(FTN_GET_THREAD_NUM)( void )
|
||||
gtid = __kmp_entry_gtid();
|
||||
#elif KMP_OS_WINDOWS
|
||||
if (!__kmp_init_parallel ||
|
||||
(gtid = ((kmp_intptr_t)TlsGetValue( __kmp_gtid_threadprivate_key ))) == 0) {
|
||||
(gtid = (int)((kmp_intptr_t)TlsGetValue( __kmp_gtid_threadprivate_key ))) == 0) {
|
||||
// Either library isn't initialized or thread is not registered
|
||||
// 0 is the correct TID in this case
|
||||
return 0;
|
||||
@@ -463,7 +453,6 @@ xexpand(FTN_GET_NUM_PROCS)( void )
|
||||
#ifdef KMP_STUB
|
||||
return 1;
|
||||
#else
|
||||
int gtid;
|
||||
if ( ! TCR_4(__kmp_init_middle) ) {
|
||||
__kmp_middle_initialize();
|
||||
}
|
||||
@@ -534,7 +523,7 @@ xexpand(FTN_IN_PARALLEL)( void )
|
||||
#else
|
||||
kmp_info_t *th = __kmp_entry_thread();
|
||||
#if OMP_40_ENABLED
|
||||
if ( th->th.th_team_microtask ) {
|
||||
if ( th->th.th_teams_microtask ) {
|
||||
// AC: r_in_parallel does not work inside teams construct
|
||||
// where real parallel is inactive, but all threads have same root,
|
||||
// so setting it in one team affects other teams.
|
||||
@@ -547,8 +536,6 @@ xexpand(FTN_IN_PARALLEL)( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
|
||||
void FTN_STDCALL
|
||||
xexpand(FTN_SET_SCHEDULE)( kmp_sched_t KMP_DEREF kind, int KMP_DEREF modifier )
|
||||
{
|
||||
@@ -668,8 +655,6 @@ xexpand(FTN_IN_FINAL)( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // OMP_30_ENABLED
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
|
||||
|
||||
@@ -690,7 +675,7 @@ xexpand(FTN_GET_NUM_TEAMS)( void )
|
||||
return 1;
|
||||
#else
|
||||
kmp_info_t *thr = __kmp_entry_thread();
|
||||
if ( thr->th.th_team_microtask ) {
|
||||
if ( thr->th.th_teams_microtask ) {
|
||||
kmp_team_t *team = thr->th.th_team;
|
||||
int tlevel = thr->th.th_teams_level;
|
||||
int ii = team->t.t_level; // the level of the teams construct
|
||||
@@ -729,7 +714,7 @@ xexpand(FTN_GET_TEAM_NUM)( void )
|
||||
return 0;
|
||||
#else
|
||||
kmp_info_t *thr = __kmp_entry_thread();
|
||||
if ( thr->th.th_team_microtask ) {
|
||||
if ( thr->th.th_teams_microtask ) {
|
||||
kmp_team_t *team = thr->th.th_team;
|
||||
int tlevel = thr->th.th_teams_level; // the level of the teams construct
|
||||
int ii = team->t.t_level;
|
||||
@@ -785,12 +770,60 @@ FTN_GET_NUM_DEVICES( void )
|
||||
|
||||
#endif // KMP_MIC || KMP_OS_DARWIN
|
||||
|
||||
#if ! KMP_OS_LINUX
|
||||
|
||||
int FTN_STDCALL
|
||||
xexpand(FTN_IS_INITIAL_DEVICE)( void )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// This internal function is used when the entry from the offload library
|
||||
// is not found.
|
||||
int _Offload_get_device_number( void ) __attribute__((weak));
|
||||
|
||||
int FTN_STDCALL
|
||||
xexpand(FTN_IS_INITIAL_DEVICE)( void )
|
||||
{
|
||||
if( _Offload_get_device_number ) {
|
||||
return _Offload_get_device_number() == -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ! KMP_OS_LINUX
|
||||
|
||||
#endif // OMP_40_ENABLED
|
||||
|
||||
#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 )
|
||||
{
|
||||
#ifdef KMP_STUB
|
||||
*((kmp_stub_lock_t *)user_lock) = UNLOCKED;
|
||||
#else
|
||||
__kmp_init_lock_hinted( user_lock, KMP_DEREF hint );
|
||||
#endif
|
||||
}
|
||||
|
||||
void FTN_STDCALL
|
||||
FTN_INIT_NEST_LOCK_HINTED( void **user_lock, int KMP_DEREF hint )
|
||||
{
|
||||
#ifdef KMP_STUB
|
||||
*((kmp_stub_lock_t *)user_lock) = UNLOCKED;
|
||||
#else
|
||||
__kmp_init_nest_lock_hinted( user_lock, KMP_DEREF hint );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* initialize the lock */
|
||||
void FTN_STDCALL
|
||||
xexpand(FTN_INIT_LOCK)( void **user_lock )
|
||||
@@ -1013,7 +1046,7 @@ FTN_SET_DEFAULTS( char const * str
|
||||
{
|
||||
#ifndef KMP_STUB
|
||||
#ifdef PASS_ARGS_BY_VALUE
|
||||
int len = strlen( str );
|
||||
int len = (int)KMP_STRLEN( str );
|
||||
#endif
|
||||
__kmp_aux_set_defaults( str, len );
|
||||
#endif
|
||||
@@ -1049,19 +1082,19 @@ FTN_GET_CANCELLATION_STATUS(int cancel_kind) {
|
||||
#endif // OMP_40_ENABLED
|
||||
|
||||
// GCC compatibility (versioned symbols)
|
||||
#if KMP_OS_LINUX
|
||||
#ifdef KMP_USE_VERSION_SYMBOLS
|
||||
|
||||
/*
|
||||
These following sections create function aliases (dummy symbols) for the omp_* routines.
|
||||
These aliases will then be versioned according to how libgomp ``versions'' its
|
||||
symbols (OMP_1.0, OMP_2.0, OMP_3.0, ...) while also retaining the
|
||||
default version which libiomp5 uses: VERSION (defined in exports_so.txt)
|
||||
If you want to see the versioned symbols for libgomp.so.1 then just type:
|
||||
These aliases will then be versioned according to how libgomp ``versions'' its
|
||||
symbols (OMP_1.0, OMP_2.0, OMP_3.0, ...) while also retaining the
|
||||
default version which libomp uses: VERSION (defined in exports_so.txt)
|
||||
If you want to see the versioned symbols for libgomp.so.1 then just type:
|
||||
|
||||
objdump -T /path/to/libgomp.so.1 | grep omp_
|
||||
|
||||
Example:
|
||||
Step 1) Create __kmp_api_omp_set_num_threads_10_alias
|
||||
Step 1) Create __kmp_api_omp_set_num_threads_10_alias
|
||||
which is alias of __kmp_api_omp_set_num_threads
|
||||
Step 2) Set __kmp_api_omp_set_num_threads_10_alias to version: omp_set_num_threads@OMP_1.0
|
||||
Step 2B) Set __kmp_api_omp_set_num_threads to default version : omp_set_num_threads@@VERSION
|
||||
@@ -1093,7 +1126,6 @@ xaliasify(FTN_TEST_NEST_LOCK, 10);
|
||||
xaliasify(FTN_GET_WTICK, 20);
|
||||
xaliasify(FTN_GET_WTIME, 20);
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
// OMP_3.0 aliases
|
||||
xaliasify(FTN_SET_SCHEDULE, 30);
|
||||
xaliasify(FTN_GET_SCHEDULE, 30);
|
||||
@@ -1117,7 +1149,6 @@ xaliasify(FTN_TEST_NEST_LOCK, 30);
|
||||
|
||||
// OMP_3.1 aliases
|
||||
xaliasify(FTN_IN_FINAL, 31);
|
||||
#endif /* OMP_30_ENABLED */
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
// OMP_4.0 aliases
|
||||
@@ -1125,6 +1156,7 @@ xaliasify(FTN_GET_PROC_BIND, 40);
|
||||
xaliasify(FTN_GET_NUM_TEAMS, 40);
|
||||
xaliasify(FTN_GET_TEAM_NUM, 40);
|
||||
xaliasify(FTN_GET_CANCELLATION, 40);
|
||||
xaliasify(FTN_IS_INITIAL_DEVICE, 40);
|
||||
#endif /* OMP_40_ENABLED */
|
||||
|
||||
#if OMP_41_ENABLED
|
||||
@@ -1161,7 +1193,6 @@ xversionify(FTN_TEST_NEST_LOCK, 10, "OMP_1.0");
|
||||
xversionify(FTN_GET_WTICK, 20, "OMP_2.0");
|
||||
xversionify(FTN_GET_WTIME, 20, "OMP_2.0");
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
// OMP_3.0 versioned symbols
|
||||
xversionify(FTN_SET_SCHEDULE, 30, "OMP_3.0");
|
||||
xversionify(FTN_GET_SCHEDULE, 30, "OMP_3.0");
|
||||
@@ -1187,7 +1218,6 @@ xversionify(FTN_TEST_NEST_LOCK, 30, "OMP_3.0");
|
||||
|
||||
// OMP_3.1 versioned symbol
|
||||
xversionify(FTN_IN_FINAL, 31, "OMP_3.1");
|
||||
#endif /* OMP_30_ENABLED */
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
// OMP_4.0 versioned symbols
|
||||
@@ -1195,6 +1225,7 @@ xversionify(FTN_GET_PROC_BIND, 40, "OMP_4.0");
|
||||
xversionify(FTN_GET_NUM_TEAMS, 40, "OMP_4.0");
|
||||
xversionify(FTN_GET_TEAM_NUM, 40, "OMP_4.0");
|
||||
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
|
||||
@@ -1205,7 +1236,7 @@ xversionify(FTN_GET_CANCELLATION, 40, "OMP_4.0");
|
||||
// OMP_5.0 versioned symbols
|
||||
#endif
|
||||
|
||||
#endif /* KMP_OS_LINUX */
|
||||
#endif // KMP_USE_VERSION_SYMBOLS
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //extern "C"
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_ftn_extra.c -- Fortran 'extra' linkage support for OpenMP.
|
||||
* $Revision: 42757 $
|
||||
* $Date: 2013-10-18 08:20:57 -0500 (Fri, 18 Oct 2013) $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
+29
-11
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_ftn_os.h -- KPTS Fortran defines header file.
|
||||
* $Revision: 42745 $
|
||||
* $Date: 2013-10-14 17:02:04 -0500 (Mon, 14 Oct 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -81,6 +79,10 @@
|
||||
#define FTN_GET_TEAM_NUM omp_get_team_num
|
||||
#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
|
||||
#endif
|
||||
#define FTN_DESTROY_LOCK omp_destroy_lock
|
||||
#define FTN_SET_LOCK omp_set_lock
|
||||
#define FTN_UNSET_LOCK omp_unset_lock
|
||||
@@ -103,6 +105,7 @@
|
||||
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device
|
||||
#define FTN_GET_NUM_DEVICES omp_get_num_devices
|
||||
#endif
|
||||
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device
|
||||
#endif
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
@@ -172,6 +175,10 @@
|
||||
#define FTN_GET_TEAM_NUM omp_get_team_num_
|
||||
#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_
|
||||
#endif
|
||||
#define FTN_DESTROY_LOCK omp_destroy_lock_
|
||||
#define FTN_SET_LOCK omp_set_lock_
|
||||
#define FTN_UNSET_LOCK omp_unset_lock_
|
||||
@@ -194,6 +201,7 @@
|
||||
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device_
|
||||
#define FTN_GET_NUM_DEVICES omp_get_num_devices_
|
||||
#endif
|
||||
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device_
|
||||
#endif
|
||||
|
||||
|
||||
@@ -264,6 +272,10 @@
|
||||
#define FTN_GET_TEAM_NUM OMP_GET_TEAM_NUM
|
||||
#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
|
||||
#endif
|
||||
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK
|
||||
#define FTN_SET_LOCK OMP_SET_LOCK
|
||||
#define FTN_UNSET_LOCK OMP_UNSET_LOCK
|
||||
@@ -286,6 +298,7 @@
|
||||
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE
|
||||
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES
|
||||
#endif
|
||||
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE
|
||||
#endif
|
||||
|
||||
|
||||
@@ -356,6 +369,10 @@
|
||||
#define FTN_GET_TEAM_NUM OMP_GET_TEAM_NUM_
|
||||
#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_
|
||||
#endif
|
||||
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK_
|
||||
#define FTN_SET_LOCK OMP_SET_LOCK_
|
||||
#define FTN_UNSET_LOCK OMP_UNSET_LOCK_
|
||||
@@ -378,6 +395,7 @@
|
||||
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE_
|
||||
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES_
|
||||
#endif
|
||||
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE_
|
||||
#endif
|
||||
|
||||
|
||||
@@ -457,7 +475,7 @@
|
||||
#define KMP_API_NAME_GOMP_TASKYIELD GOMP_taskyield
|
||||
|
||||
// All GOMP_4.0 symbols
|
||||
// TODO: As of 2013-10-14, none of the GOMP_4.0 functions are implemented in libiomp5
|
||||
// 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
|
||||
#define KMP_API_NAME_GOMP_CANCELLATION_POINT GOMP_cancellation_point
|
||||
@@ -472,14 +490,14 @@
|
||||
#define KMP_API_NAME_GOMP_TASKGROUP_START GOMP_taskgroup_start
|
||||
#define KMP_API_NAME_GOMP_TASKGROUP_END GOMP_taskgroup_end
|
||||
/* Target functions should be taken care of by liboffload */
|
||||
//#define KMP_API_NAME_GOMP_TARGET GOMP_target
|
||||
//#define KMP_API_NAME_GOMP_TARGET_DATA GOMP_target_data
|
||||
//#define KMP_API_NAME_GOMP_TARGET_END_DATA GOMP_target_end_data
|
||||
//#define KMP_API_NAME_GOMP_TARGET_UPDATE GOMP_target_update
|
||||
#define KMP_API_NAME_GOMP_TARGET GOMP_target
|
||||
#define KMP_API_NAME_GOMP_TARGET_DATA GOMP_target_data
|
||||
#define KMP_API_NAME_GOMP_TARGET_END_DATA GOMP_target_end_data
|
||||
#define KMP_API_NAME_GOMP_TARGET_UPDATE GOMP_target_update
|
||||
#define KMP_API_NAME_GOMP_TEAMS GOMP_teams
|
||||
|
||||
#if KMP_OS_LINUX
|
||||
#define xstr(x) str(x)
|
||||
#ifdef KMP_USE_VERSION_SYMBOLS
|
||||
#define xstr(x) str(x)
|
||||
#define str(x) #x
|
||||
|
||||
// If Linux, xexpand prepends __kmp_api_ to the real API name
|
||||
@@ -494,7 +512,7 @@
|
||||
__asm__(".symver " xstr(__kmp_api_##api_name##_##version_num##_alias) "," xstr(api_name) "@" version_str "\n\t"); \
|
||||
__asm__(".symver " xstr(__kmp_api_##api_name) "," xstr(api_name) "@@" default_ver "\n\t")
|
||||
|
||||
#else /* KMP_OS_LINUX */
|
||||
#else // KMP_USE_VERSION_SYMBOLS
|
||||
#define xstr(x) /* Nothing */
|
||||
#define str(x) /* Nothing */
|
||||
|
||||
@@ -508,7 +526,7 @@
|
||||
#define xversionify(api_name, version_num, version_str) /* Nothing */
|
||||
#define versionify(api_name, version_num, version_str, default_ver) /* Nothing */
|
||||
|
||||
#endif /* KMP_OS_LINUX */
|
||||
#endif // KMP_USE_VERSION_SYMBOLS
|
||||
|
||||
#endif /* KMP_FTN_OS_H */
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_ftn_stdcall.c -- Fortran __stdcall linkage support for OpenMP.
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
+61
-21
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_global.c -- KPTS global variables for runtime support library
|
||||
* $Revision: 42816 $
|
||||
* $Date: 2013-11-11 15:33:37 -0600 (Mon, 11 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -25,6 +23,20 @@ kmp_key_t __kmp_gtid_threadprivate_key;
|
||||
|
||||
kmp_cpuinfo_t __kmp_cpuinfo = { 0 }; // Not initialized
|
||||
|
||||
#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);
|
||||
|
||||
// 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;
|
||||
|
||||
// thread local pointer to stats node within list
|
||||
__thread kmp_stats_list* __kmp_stats_thread_ptr = &__kmp_stats_list;
|
||||
|
||||
// gives reference tick for all events (considered the 0 tick)
|
||||
tsc_tick_count __kmp_stats_start_time;
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
/* INITIALIZATION VARIABLES */
|
||||
@@ -53,6 +65,7 @@ unsigned int __kmp_next_wait = KMP_DEFAULT_NEXT_WAIT; /* susequent number of s
|
||||
size_t __kmp_stksize = KMP_DEFAULT_STKSIZE;
|
||||
size_t __kmp_monitor_stksize = 0; // auto adjust
|
||||
size_t __kmp_stkoffset = KMP_DEFAULT_STKOFFSET;
|
||||
int __kmp_stkpadding = KMP_MIN_STKPADDING;
|
||||
|
||||
size_t __kmp_malloc_pool_incr = KMP_DEFAULT_MALLOC_POOL_INCR;
|
||||
|
||||
@@ -94,7 +107,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" };
|
||||
char const *__kmp_barrier_pattern_name [ bp_last_bar ] = { "linear", "tree", "hyper", "hierarchical" };
|
||||
|
||||
|
||||
int __kmp_allThreadsSpecified = 0;
|
||||
@@ -114,26 +127,26 @@ int __kmp_dflt_team_nth_ub = 0;
|
||||
int __kmp_tp_capacity = 0;
|
||||
int __kmp_tp_cached = 0;
|
||||
int __kmp_dflt_nested = FALSE;
|
||||
#if OMP_30_ENABLED
|
||||
int __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT; /* max_active_levels limit */
|
||||
#endif // OMP_30_ENABLED
|
||||
#if KMP_NESTED_HOT_TEAMS
|
||||
int __kmp_hot_teams_mode = 0; /* 0 - free extra threads when reduced */
|
||||
/* 1 - keep extra threads when reduced */
|
||||
int __kmp_hot_teams_max_level = 1; /* nesting level of hot teams */
|
||||
#endif
|
||||
enum library_type __kmp_library = library_none;
|
||||
enum sched_type __kmp_sched = kmp_sch_default; /* scheduling method for runtime scheduling */
|
||||
enum sched_type __kmp_static = kmp_sch_static_greedy; /* default static scheduling method */
|
||||
enum sched_type __kmp_guided = kmp_sch_guided_iterative_chunked; /* default guided scheduling method */
|
||||
#if OMP_30_ENABLED
|
||||
enum sched_type __kmp_auto = kmp_sch_guided_analytical_chunked; /* default auto scheduling method */
|
||||
#endif // OMP_30_ENABLED
|
||||
int __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
|
||||
int __kmp_monitor_wakeups = KMP_MIN_MONITOR_WAKEUPS;
|
||||
int __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME( KMP_DEFAULT_BLOCKTIME, KMP_MIN_MONITOR_WAKEUPS );
|
||||
#ifdef KMP_ADJUST_BLOCKTIME
|
||||
int __kmp_zero_bt = FALSE;
|
||||
#endif /* KMP_ADJUST_BLOCKTIME */
|
||||
int __kmp_ht_capable = FALSE;
|
||||
int __kmp_ht_enabled = FALSE;
|
||||
int __kmp_ht_log_per_phy = 1;
|
||||
#ifdef KMP_DFLT_NTH_CORES
|
||||
int __kmp_ncores = 0;
|
||||
#endif
|
||||
int __kmp_chunk = 0;
|
||||
int __kmp_abort_delay = 0;
|
||||
#if KMP_OS_LINUX && defined(KMP_TDATA_GTID)
|
||||
@@ -199,9 +212,13 @@ enum clock_function_type __kmp_clock_function;
|
||||
int __kmp_clock_function_param;
|
||||
#endif /* KMP_OS_LINUX */
|
||||
|
||||
#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
|
||||
enum mic_type __kmp_mic_type = non_mic;
|
||||
#endif
|
||||
|
||||
#if KMP_AFFINITY_SUPPORTED
|
||||
|
||||
# if KMP_OS_WINDOWS && KMP_ARCH_X86_64
|
||||
# if KMP_GROUP_AFFINITY
|
||||
|
||||
int __kmp_num_proc_groups = 1;
|
||||
|
||||
@@ -210,7 +227,7 @@ kmp_GetActiveProcessorGroupCount_t __kmp_GetActiveProcessorGroupCount = NULL;
|
||||
kmp_GetThreadGroupAffinity_t __kmp_GetThreadGroupAffinity = NULL;
|
||||
kmp_SetThreadGroupAffinity_t __kmp_SetThreadGroupAffinity = NULL;
|
||||
|
||||
# endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
|
||||
# endif /* KMP_GROUP_AFFINITY */
|
||||
|
||||
size_t __kmp_affin_mask_size = 0;
|
||||
enum affinity_type __kmp_affinity_type = affinity_default;
|
||||
@@ -236,13 +253,10 @@ kmp_nested_proc_bind_t __kmp_nested_proc_bind = { NULL, 0, 0 };
|
||||
int __kmp_affinity_num_places = 0;
|
||||
#endif
|
||||
|
||||
#if KMP_MIC
|
||||
unsigned int __kmp_place_num_cores = 0;
|
||||
unsigned int __kmp_place_num_threads_per_core = 0;
|
||||
unsigned int __kmp_place_core_offset = 0;
|
||||
#endif
|
||||
int __kmp_place_num_cores = 0;
|
||||
int __kmp_place_num_threads_per_core = 0;
|
||||
int __kmp_place_core_offset = 0;
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
kmp_tasking_mode_t __kmp_tasking_mode = tskm_task_teams;
|
||||
|
||||
/* This check ensures that the compiler is passing the correct data type
|
||||
@@ -255,8 +269,6 @@ KMP_BUILD_ASSERT( sizeof(kmp_tasking_flags_t) == 4 );
|
||||
|
||||
kmp_int32 __kmp_task_stealing_constraint = 1; /* Constrain task stealing by default */
|
||||
|
||||
#endif /* OMP_30_ENABLED */
|
||||
|
||||
#ifdef DEBUG_SUSPEND
|
||||
int __kmp_suspend_count = 0;
|
||||
#endif
|
||||
@@ -265,7 +277,7 @@ int __kmp_settings = FALSE;
|
||||
int __kmp_duplicate_library_ok = 0;
|
||||
#if USE_ITT_BUILD
|
||||
int __kmp_forkjoin_frames = 1;
|
||||
int __kmp_forkjoin_frames_mode = 0;
|
||||
int __kmp_forkjoin_frames_mode = 3;
|
||||
#endif
|
||||
PACKED_REDUCTION_METHOD_T __kmp_force_reduction_method = reduction_method_not_defined;
|
||||
int __kmp_determ_red = FALSE;
|
||||
@@ -321,7 +333,11 @@ int __kmp_env_consistency_check = FALSE; /* KMP_CONSISTENCY_CHECK speci
|
||||
kmp_uint32 __kmp_yield_init = KMP_INIT_WAIT;
|
||||
kmp_uint32 __kmp_yield_next = KMP_NEXT_WAIT;
|
||||
kmp_uint32 __kmp_yielding_on = 1;
|
||||
#if KMP_OS_CNK
|
||||
kmp_uint32 __kmp_yield_cycle = 0;
|
||||
#else
|
||||
kmp_uint32 __kmp_yield_cycle = 1; /* Yield-cycle is on by default */
|
||||
#endif
|
||||
kmp_int32 __kmp_yield_on_count = 10; /* By default, yielding is on for 10 monitor periods. */
|
||||
kmp_int32 __kmp_yield_off_count = 1; /* By default, yielding is off for 1 monitor periods. */
|
||||
/* ----------------------------------------------------- */
|
||||
@@ -360,6 +376,29 @@ kmp_global_t __kmp_global = {{ 0 }};
|
||||
/* ----------------------------------------------- */
|
||||
/* GLOBAL SYNCHRONIZATION LOCKS */
|
||||
/* TODO verify the need for these locks and if they need to be global */
|
||||
|
||||
#if KMP_USE_INTERNODE_ALIGNMENT
|
||||
/* Multinode systems have larger cache line granularity which can cause
|
||||
* false sharing if the alignment is not large enough for these locks */
|
||||
KMP_ALIGN_CACHE_INTERNODE
|
||||
|
||||
kmp_bootstrap_lock_t __kmp_initz_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_initz_lock ); /* Control initializations */
|
||||
KMP_ALIGN_CACHE_INTERNODE
|
||||
kmp_bootstrap_lock_t __kmp_forkjoin_lock; /* control fork/join access */
|
||||
KMP_ALIGN_CACHE_INTERNODE
|
||||
kmp_bootstrap_lock_t __kmp_exit_lock; /* exit() is not always thread-safe */
|
||||
KMP_ALIGN_CACHE_INTERNODE
|
||||
kmp_bootstrap_lock_t __kmp_monitor_lock; /* control monitor thread creation */
|
||||
KMP_ALIGN_CACHE_INTERNODE
|
||||
kmp_bootstrap_lock_t __kmp_tp_cached_lock; /* used for the hack to allow threadprivate cache and __kmp_threads expansion to co-exist */
|
||||
|
||||
KMP_ALIGN_CACHE_INTERNODE
|
||||
kmp_lock_t __kmp_global_lock; /* Control OS/global access */
|
||||
KMP_ALIGN_CACHE_INTERNODE
|
||||
kmp_queuing_lock_t __kmp_dispatch_lock; /* Control dispatch access */
|
||||
KMP_ALIGN_CACHE_INTERNODE
|
||||
kmp_lock_t __kmp_debug_lock; /* Control I/O access for KMP_DEBUG */
|
||||
#else
|
||||
KMP_ALIGN_CACHE
|
||||
|
||||
kmp_bootstrap_lock_t __kmp_initz_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_initz_lock ); /* Control initializations */
|
||||
@@ -374,6 +413,7 @@ KMP_ALIGN(128)
|
||||
kmp_queuing_lock_t __kmp_dispatch_lock; /* Control dispatch access */
|
||||
KMP_ALIGN(128)
|
||||
kmp_lock_t __kmp_debug_lock; /* Control I/O access for KMP_DEBUG */
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------- */
|
||||
|
||||
|
||||
+555
-50
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_gsupport.c
|
||||
* $Revision: 42810 $
|
||||
* $Date: 2013-11-07 12:06:33 -0600 (Thu, 07 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -15,12 +13,16 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#if defined(__x86_64)
|
||||
#if defined(__x86_64) || defined (__powerpc64__) || defined(__aarch64__)
|
||||
# define KMP_I8
|
||||
#endif
|
||||
#include "kmp.h"
|
||||
#include "kmp_atomic.h"
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
#include "ompt-specific.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
@@ -40,7 +42,6 @@ xexpand(KMP_API_NAME_GOMP_BARRIER)(void)
|
||||
}
|
||||
|
||||
|
||||
/**/
|
||||
//
|
||||
// Mutual exclusion
|
||||
//
|
||||
@@ -109,6 +110,11 @@ xexpand(KMP_API_NAME_GOMP_ATOMIC_START)(void)
|
||||
{
|
||||
int gtid = __kmp_entry_gtid();
|
||||
KA_TRACE(20, ("GOMP_atomic_start: T#%d\n", gtid));
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
__ompt_thread_assign_wait_id(0);
|
||||
#endif
|
||||
|
||||
__kmp_acquire_atomic_lock(&__kmp_atomic_lock, gtid);
|
||||
}
|
||||
|
||||
@@ -180,7 +186,6 @@ void
|
||||
xexpand(KMP_API_NAME_GOMP_SINGLE_COPY_END)(void *data)
|
||||
{
|
||||
int gtid = __kmp_get_gtid();
|
||||
MKLOC(loc, "GOMP_single_copy_end");
|
||||
KA_TRACE(20, ("GOMP_single_copy_end: T#%d\n", gtid));
|
||||
|
||||
//
|
||||
@@ -216,7 +221,6 @@ xexpand(KMP_API_NAME_GOMP_ORDERED_END)(void)
|
||||
}
|
||||
|
||||
|
||||
/**/
|
||||
//
|
||||
// Dispatch macro defs
|
||||
//
|
||||
@@ -239,23 +243,51 @@ xexpand(KMP_API_NAME_GOMP_ORDERED_END)(void)
|
||||
# define KMP_DISPATCH_NEXT_ULL __kmpc_dispatch_next_8u
|
||||
|
||||
|
||||
/**/
|
||||
//
|
||||
// The parallel contruct
|
||||
//
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
#ifndef KMP_DEBUG
|
||||
static
|
||||
#endif /* KMP_DEBUG */
|
||||
void
|
||||
__kmp_GOMP_microtask_wrapper(int *gtid, int *npr, void (*task)(void *),
|
||||
void *data)
|
||||
{
|
||||
#if OMPT_SUPPORT
|
||||
kmp_info_t *thr;
|
||||
ompt_frame_t *ompt_frame;
|
||||
ompt_state_t enclosing_state;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
// get pointer to thread data structure
|
||||
thr = __kmp_threads[*gtid];
|
||||
|
||||
// save enclosing task state; set current state for task
|
||||
enclosing_state = thr->th.ompt_thread_info.state;
|
||||
thr->th.ompt_thread_info.state = ompt_state_work_parallel;
|
||||
|
||||
// set task frame
|
||||
ompt_frame = __ompt_get_task_frame_internal(0);
|
||||
ompt_frame->exit_runtime_frame = __builtin_frame_address(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
task(data);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
// clear task frame
|
||||
ompt_frame->exit_runtime_frame = NULL;
|
||||
|
||||
// restore enclosing state
|
||||
thr->th.ompt_thread_info.state = enclosing_state;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
#ifndef KMP_DEBUG
|
||||
static
|
||||
#endif /* KMP_DEBUG */
|
||||
void
|
||||
@@ -269,26 +301,60 @@ __kmp_GOMP_parallel_microtask_wrapper(int *gtid, int *npr,
|
||||
KMP_DISPATCH_INIT(loc, *gtid, schedule, start, end, incr, chunk_size,
|
||||
schedule != kmp_sch_static);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
kmp_info_t *thr;
|
||||
ompt_frame_t *ompt_frame;
|
||||
ompt_state_t enclosing_state;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
thr = __kmp_threads[*gtid];
|
||||
// save enclosing task state; set current state for task
|
||||
enclosing_state = thr->th.ompt_thread_info.state;
|
||||
thr->th.ompt_thread_info.state = ompt_state_work_parallel;
|
||||
|
||||
// set task frame
|
||||
ompt_frame = __ompt_get_task_frame_internal(0);
|
||||
ompt_frame->exit_runtime_frame = __builtin_frame_address(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Now invoke the microtask.
|
||||
//
|
||||
task(data);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
// clear task frame
|
||||
ompt_frame->exit_runtime_frame = NULL;
|
||||
|
||||
// reset enclosing state
|
||||
thr->th.ompt_thread_info.state = enclosing_state;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef KMP_DEBUG
|
||||
#ifndef KMP_DEBUG
|
||||
static
|
||||
#endif /* KMP_DEBUG */
|
||||
void
|
||||
__kmp_GOMP_fork_call(ident_t *loc, int gtid, microtask_t wrapper, int argc,...)
|
||||
__kmp_GOMP_fork_call(ident_t *loc, int gtid, void (*unwrapped_task)(void *), microtask_t wrapper, int argc,...)
|
||||
{
|
||||
int rc;
|
||||
kmp_info_t *thr = __kmp_threads[gtid];
|
||||
kmp_team_t *team = thr->th.th_team;
|
||||
int tid = __kmp_tid_from_gtid(gtid);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, argc);
|
||||
|
||||
rc = __kmp_fork_call(loc, gtid, FALSE, argc, wrapper, __kmp_invoke_task_func,
|
||||
#if (KMP_ARCH_X86_64 || KMP_ARCH_ARM) && KMP_OS_LINUX
|
||||
rc = __kmp_fork_call(loc, gtid, fork_context_gnu, argc,
|
||||
#if OMPT_SUPPORT
|
||||
VOLATILE_CAST(void *) unwrapped_task,
|
||||
#endif
|
||||
wrapper, __kmp_invoke_task_func,
|
||||
#if (KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64) && KMP_OS_LINUX
|
||||
&ap
|
||||
#else
|
||||
ap
|
||||
@@ -298,10 +364,71 @@ __kmp_GOMP_fork_call(ident_t *loc, int gtid, microtask_t wrapper, int argc,...)
|
||||
va_end(ap);
|
||||
|
||||
if (rc) {
|
||||
kmp_info_t *thr = __kmp_threads[gtid];
|
||||
__kmp_run_before_invoked_task(gtid, __kmp_tid_from_gtid(gtid), thr,
|
||||
thr->th.th_team);
|
||||
__kmp_run_before_invoked_task(gtid, tid, thr, team);
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
#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)) {
|
||||
ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
|
||||
team_info->parallel_id, task_info->task_id);
|
||||
}
|
||||
#endif
|
||||
thr->th.ompt_thread_info.state = ompt_state_work_parallel;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
__kmp_GOMP_serialized_parallel(ident_t *loc, kmp_int32 gtid, void (*task)(void *))
|
||||
{
|
||||
__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);
|
||||
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));
|
||||
__ompt_lw_taskteam_init(lwt, thr, gtid, (void *) task, ompt_parallel_id);
|
||||
lwt->ompt_task_info.task_id = my_ompt_task_id;
|
||||
lwt->ompt_task_info.frame.exit_runtime_frame = 0;
|
||||
__ompt_lw_taskteam_link(lwt, thr);
|
||||
|
||||
#if OMPT_TRACE
|
||||
// implicit task callback
|
||||
if ((ompt_status == ompt_status_track_callback) &&
|
||||
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);
|
||||
}
|
||||
thr->th.ompt_thread_info.state = ompt_state_work_parallel;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -309,6 +436,16 @@ void
|
||||
xexpand(KMP_API_NAME_GOMP_PARALLEL_START)(void (*task)(void *), void *data, unsigned num_threads)
|
||||
{
|
||||
int gtid = __kmp_entry_gtid();
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
ompt_frame_t *parent_frame;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
parent_frame = __ompt_get_task_frame_internal(0);
|
||||
parent_frame->reenter_runtime_frame = __builtin_frame_address(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
MKLOC(loc, "GOMP_parallel_start");
|
||||
KA_TRACE(20, ("GOMP_parallel_start: T#%d\n", gtid));
|
||||
|
||||
@@ -316,12 +453,18 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_START)(void (*task)(void *), void *data, unsi
|
||||
if (num_threads != 0) {
|
||||
__kmp_push_num_threads(&loc, gtid, num_threads);
|
||||
}
|
||||
__kmp_GOMP_fork_call(&loc, gtid,
|
||||
__kmp_GOMP_fork_call(&loc, gtid, task,
|
||||
(microtask_t)__kmp_GOMP_microtask_wrapper, 2, task, data);
|
||||
}
|
||||
else {
|
||||
__kmpc_serialized_parallel(&loc, gtid);
|
||||
__kmp_GOMP_serialized_parallel(&loc, gtid, task);
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
parent_frame->reenter_runtime_frame = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -329,9 +472,41 @@ void
|
||||
xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(void)
|
||||
{
|
||||
int gtid = __kmp_get_gtid();
|
||||
kmp_info_t *thr;
|
||||
|
||||
thr = __kmp_threads[gtid];
|
||||
|
||||
MKLOC(loc, "GOMP_parallel_end");
|
||||
KA_TRACE(20, ("GOMP_parallel_end: T#%d\n", gtid));
|
||||
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
ompt_parallel_id_t parallel_id;
|
||||
ompt_frame_t *ompt_frame = NULL;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
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);
|
||||
|
||||
#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
|
||||
|
||||
// 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);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! __kmp_threads[gtid]->th.th_team->t.t_serialized) {
|
||||
kmp_info_t *thr = __kmp_threads[gtid];
|
||||
__kmp_run_after_invoked_task(gtid, __kmp_tid_from_gtid(gtid), thr,
|
||||
@@ -340,11 +515,26 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(void)
|
||||
}
|
||||
else {
|
||||
__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)) {
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
ompt_callbacks.ompt_callback(ompt_event_parallel_end)(
|
||||
parallel_id, task_info->task_id);
|
||||
}
|
||||
|
||||
thr->th.ompt_thread_info.state =
|
||||
(((thr->th.th_team)->t.t_serialized) ?
|
||||
ompt_state_work_serial : ompt_state_work_parallel);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**/
|
||||
//
|
||||
// Loop worksharing constructs
|
||||
//
|
||||
@@ -500,7 +690,6 @@ xexpand(KMP_API_NAME_GOMP_LOOP_END_NOWAIT)(void)
|
||||
}
|
||||
|
||||
|
||||
/**/
|
||||
//
|
||||
// Unsigned long long loop worksharing constructs
|
||||
//
|
||||
@@ -563,7 +752,7 @@ xexpand(KMP_API_NAME_GOMP_LOOP_END_NOWAIT)(void)
|
||||
status = KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, \
|
||||
(kmp_uint64 *)p_lb, (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
|
||||
if (status) { \
|
||||
KMP_DEBUG_ASSERT(stride == str2); \
|
||||
KMP_DEBUG_ASSERT((long long)stride == str2); \
|
||||
*p_ub += (str > 0) ? 1 : -1; \
|
||||
} \
|
||||
} \
|
||||
@@ -622,7 +811,6 @@ LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
|
||||
{ KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
|
||||
|
||||
|
||||
/**/
|
||||
//
|
||||
// Combined parallel / loop worksharing constructs
|
||||
//
|
||||
@@ -634,7 +822,6 @@ LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
|
||||
long lb, long ub, long str, long chunk_sz) \
|
||||
{ \
|
||||
int gtid = __kmp_entry_gtid(); \
|
||||
int last = FALSE; \
|
||||
MKLOC(loc, #func); \
|
||||
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 )); \
|
||||
@@ -643,13 +830,13 @@ LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
|
||||
if (num_threads != 0) { \
|
||||
__kmp_push_num_threads(&loc, gtid, num_threads); \
|
||||
} \
|
||||
__kmp_GOMP_fork_call(&loc, gtid, \
|
||||
__kmp_GOMP_fork_call(&loc, gtid, task, \
|
||||
(microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, \
|
||||
task, data, num_threads, &loc, (schedule), lb, \
|
||||
(str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
|
||||
} \
|
||||
else { \
|
||||
__kmpc_serialized_parallel(&loc, gtid); \
|
||||
__kmp_GOMP_serialized_parallel(&loc, gtid, task); \
|
||||
} \
|
||||
\
|
||||
KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
|
||||
@@ -666,10 +853,6 @@ PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START), kmp_s
|
||||
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START), kmp_sch_runtime)
|
||||
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
|
||||
|
||||
/**/
|
||||
//
|
||||
// Tasking constructs
|
||||
//
|
||||
@@ -711,7 +894,7 @@ xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_fu
|
||||
(*copy_func)(task->shareds, data);
|
||||
}
|
||||
else {
|
||||
memcpy(task->shareds, data, arg_size);
|
||||
KMP_MEMCPY(task->shareds, data, arg_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,9 +902,32 @@ xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_fu
|
||||
__kmpc_omp_task(&loc, gtid, task);
|
||||
}
|
||||
else {
|
||||
#if OMPT_SUPPORT
|
||||
ompt_thread_info_t oldInfo;
|
||||
kmp_info_t *thread;
|
||||
kmp_taskdata_t *taskdata;
|
||||
if (ompt_status & ompt_status_track) {
|
||||
// Store the threads states and restore them after the task
|
||||
thread = __kmp_threads[ gtid ];
|
||||
taskdata = KMP_TASK_TO_TASKDATA(task);
|
||||
oldInfo = thread->th.ompt_thread_info;
|
||||
thread->th.ompt_thread_info.wait_id = 0;
|
||||
thread->th.ompt_thread_info.state = ompt_state_work_parallel;
|
||||
taskdata->ompt_task_info.frame.exit_runtime_frame =
|
||||
__builtin_frame_address(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
__kmpc_omp_task_begin_if0(&loc, gtid, task);
|
||||
func(data);
|
||||
__kmpc_omp_task_complete_if0(&loc, gtid, task);
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
thread->th.ompt_thread_info = oldInfo;
|
||||
taskdata->ompt_task_info.frame.exit_runtime_frame = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
KA_TRACE(20, ("GOMP_task exit: T#%d\n", gtid));
|
||||
@@ -742,10 +948,6 @@ xexpand(KMP_API_NAME_GOMP_TASKWAIT)(void)
|
||||
}
|
||||
|
||||
|
||||
#endif /* OMP_30_ENABLED */
|
||||
|
||||
|
||||
/**/
|
||||
//
|
||||
// Sections worksharing constructs
|
||||
//
|
||||
@@ -816,7 +1018,16 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(void (*task) (void *), void *
|
||||
unsigned num_threads, unsigned count)
|
||||
{
|
||||
int gtid = __kmp_entry_gtid();
|
||||
int last = FALSE;
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
ompt_frame_t *parent_frame;
|
||||
|
||||
if (ompt_status & ompt_status_track) {
|
||||
parent_frame = __ompt_get_task_frame_internal(0);
|
||||
parent_frame->reenter_runtime_frame = __builtin_frame_address(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
MKLOC(loc, "GOMP_parallel_sections_start");
|
||||
KA_TRACE(20, ("GOMP_parallel_sections_start: T#%d\n", gtid));
|
||||
|
||||
@@ -824,15 +1035,21 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(void (*task) (void *), void *
|
||||
if (num_threads != 0) {
|
||||
__kmp_push_num_threads(&loc, gtid, num_threads);
|
||||
}
|
||||
__kmp_GOMP_fork_call(&loc, gtid,
|
||||
__kmp_GOMP_fork_call(&loc, gtid, task,
|
||||
(microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, task, data,
|
||||
num_threads, &loc, kmp_nm_dynamic_chunked, (kmp_int)1,
|
||||
(kmp_int)count, (kmp_int)1, (kmp_int)1);
|
||||
}
|
||||
else {
|
||||
__kmpc_serialized_parallel(&loc, gtid);
|
||||
__kmp_GOMP_serialized_parallel(&loc, gtid, task);
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_status & ompt_status_track) {
|
||||
parent_frame->reenter_runtime_frame = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
|
||||
|
||||
KA_TRACE(20, ("GOMP_parallel_sections_start exit: T#%d\n", gtid));
|
||||
@@ -861,9 +1078,266 @@ xexpand(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT)(void)
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TASKYIELD)(void)
|
||||
{
|
||||
|
||||
KA_TRACE(20, ("GOMP_taskyield: T#%d\n", __kmp_get_gtid()))
|
||||
return;
|
||||
}
|
||||
|
||||
#if OMP_40_ENABLED // these are new GOMP_4.0 entry points
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_PARALLEL)(void (*task)(void *), void *data, unsigned num_threads, unsigned int flags)
|
||||
{
|
||||
int gtid = __kmp_entry_gtid();
|
||||
MKLOC(loc, "GOMP_parallel");
|
||||
KA_TRACE(20, ("GOMP_parallel: T#%d\n", gtid));
|
||||
|
||||
if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
|
||||
if (num_threads != 0) {
|
||||
__kmp_push_num_threads(&loc, gtid, num_threads);
|
||||
}
|
||||
if(flags != 0) {
|
||||
__kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags);
|
||||
}
|
||||
__kmp_GOMP_fork_call(&loc, gtid, task,
|
||||
(microtask_t)__kmp_GOMP_microtask_wrapper, 2, task, data);
|
||||
}
|
||||
else {
|
||||
__kmp_GOMP_serialized_parallel(&loc, gtid, task);
|
||||
}
|
||||
task(data);
|
||||
xexpand(KMP_API_NAME_GOMP_PARALLEL_END)();
|
||||
}
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task) (void *), void *data,
|
||||
unsigned num_threads, unsigned count, unsigned flags)
|
||||
{
|
||||
int gtid = __kmp_entry_gtid();
|
||||
MKLOC(loc, "GOMP_parallel_sections");
|
||||
KA_TRACE(20, ("GOMP_parallel_sections: T#%d\n", gtid));
|
||||
|
||||
if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
|
||||
if (num_threads != 0) {
|
||||
__kmp_push_num_threads(&loc, gtid, num_threads);
|
||||
}
|
||||
if(flags != 0) {
|
||||
__kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags);
|
||||
}
|
||||
__kmp_GOMP_fork_call(&loc, gtid, task,
|
||||
(microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, task, data,
|
||||
num_threads, &loc, kmp_nm_dynamic_chunked, (kmp_int)1,
|
||||
(kmp_int)count, (kmp_int)1, (kmp_int)1);
|
||||
}
|
||||
else {
|
||||
__kmp_GOMP_serialized_parallel(&loc, gtid, task);
|
||||
}
|
||||
|
||||
KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
|
||||
|
||||
task(data);
|
||||
xexpand(KMP_API_NAME_GOMP_PARALLEL_END)();
|
||||
KA_TRACE(20, ("GOMP_parallel_sections exit: T#%d\n", gtid));
|
||||
}
|
||||
|
||||
#define PARALLEL_LOOP(func, schedule) \
|
||||
void func (void (*task) (void *), void *data, unsigned num_threads, \
|
||||
long lb, long ub, long str, long chunk_sz, unsigned flags) \
|
||||
{ \
|
||||
int gtid = __kmp_entry_gtid(); \
|
||||
MKLOC(loc, #func); \
|
||||
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 )); \
|
||||
\
|
||||
if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) { \
|
||||
if (num_threads != 0) { \
|
||||
__kmp_push_num_threads(&loc, gtid, num_threads); \
|
||||
} \
|
||||
if (flags != 0) { \
|
||||
__kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags); \
|
||||
} \
|
||||
__kmp_GOMP_fork_call(&loc, gtid, task, \
|
||||
(microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, \
|
||||
task, data, num_threads, &loc, (schedule), lb, \
|
||||
(str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
|
||||
} \
|
||||
else { \
|
||||
__kmp_GOMP_serialized_parallel(&loc, gtid, task); \
|
||||
} \
|
||||
\
|
||||
KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
|
||||
(str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
|
||||
(schedule) != kmp_sch_static); \
|
||||
task(data); \
|
||||
xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(); \
|
||||
\
|
||||
KA_TRACE(20, ( #func " exit: T#%d\n", gtid)); \
|
||||
}
|
||||
|
||||
PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC), kmp_sch_static)
|
||||
PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC), kmp_sch_dynamic_chunked)
|
||||
PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED), kmp_sch_guided_chunked)
|
||||
PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME), kmp_sch_runtime)
|
||||
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TASKGROUP_START)(void)
|
||||
{
|
||||
int gtid = __kmp_get_gtid();
|
||||
MKLOC(loc, "GOMP_taskgroup_start");
|
||||
KA_TRACE(20, ("GOMP_taskgroup_start: T#%d\n", gtid));
|
||||
|
||||
__kmpc_taskgroup(&loc, gtid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TASKGROUP_END)(void)
|
||||
{
|
||||
int gtid = __kmp_get_gtid();
|
||||
MKLOC(loc, "GOMP_taskgroup_end");
|
||||
KA_TRACE(20, ("GOMP_taskgroup_end: T#%d\n", gtid));
|
||||
|
||||
__kmpc_end_taskgroup(&loc, gtid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef KMP_DEBUG
|
||||
static
|
||||
#endif /* KMP_DEBUG */
|
||||
kmp_int32 __kmp_gomp_to_omp_cancellation_kind(int gomp_kind) {
|
||||
kmp_int32 cncl_kind = 0;
|
||||
switch(gomp_kind) {
|
||||
case 1:
|
||||
cncl_kind = cancel_parallel;
|
||||
break;
|
||||
case 2:
|
||||
cncl_kind = cancel_loop;
|
||||
break;
|
||||
case 4:
|
||||
cncl_kind = cancel_sections;
|
||||
break;
|
||||
case 8:
|
||||
cncl_kind = cancel_taskgroup;
|
||||
break;
|
||||
}
|
||||
return cncl_kind;
|
||||
}
|
||||
|
||||
bool
|
||||
xexpand(KMP_API_NAME_GOMP_CANCELLATION_POINT)(int which)
|
||||
{
|
||||
if(__kmp_omp_cancellation) {
|
||||
KMP_FATAL(NoGompCancellation);
|
||||
}
|
||||
int gtid = __kmp_get_gtid();
|
||||
MKLOC(loc, "GOMP_cancellation_point");
|
||||
KA_TRACE(20, ("GOMP_cancellation_point: T#%d\n", gtid));
|
||||
|
||||
kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
|
||||
|
||||
return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
|
||||
}
|
||||
|
||||
bool
|
||||
xexpand(KMP_API_NAME_GOMP_BARRIER_CANCEL)(void)
|
||||
{
|
||||
if(__kmp_omp_cancellation) {
|
||||
KMP_FATAL(NoGompCancellation);
|
||||
}
|
||||
KMP_FATAL(NoGompCancellation);
|
||||
int gtid = __kmp_get_gtid();
|
||||
MKLOC(loc, "GOMP_barrier_cancel");
|
||||
KA_TRACE(20, ("GOMP_barrier_cancel: T#%d\n", gtid));
|
||||
|
||||
return __kmpc_cancel_barrier(&loc, gtid);
|
||||
}
|
||||
|
||||
bool
|
||||
xexpand(KMP_API_NAME_GOMP_CANCEL)(int which, bool do_cancel)
|
||||
{
|
||||
if(__kmp_omp_cancellation) {
|
||||
KMP_FATAL(NoGompCancellation);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int gtid = __kmp_get_gtid();
|
||||
MKLOC(loc, "GOMP_cancel");
|
||||
KA_TRACE(20, ("GOMP_cancel: T#%d\n", gtid));
|
||||
|
||||
kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
|
||||
|
||||
if(do_cancel == FALSE) {
|
||||
return xexpand(KMP_API_NAME_GOMP_CANCELLATION_POINT)(which);
|
||||
} else {
|
||||
return __kmpc_cancel(&loc, gtid, cncl_kind);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
xexpand(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL)(void)
|
||||
{
|
||||
if(__kmp_omp_cancellation) {
|
||||
KMP_FATAL(NoGompCancellation);
|
||||
}
|
||||
int gtid = __kmp_get_gtid();
|
||||
MKLOC(loc, "GOMP_sections_end_cancel");
|
||||
KA_TRACE(20, ("GOMP_sections_end_cancel: T#%d\n", gtid));
|
||||
|
||||
return __kmpc_cancel_barrier(&loc, gtid);
|
||||
}
|
||||
|
||||
bool
|
||||
xexpand(KMP_API_NAME_GOMP_LOOP_END_CANCEL)(void)
|
||||
{
|
||||
if(__kmp_omp_cancellation) {
|
||||
KMP_FATAL(NoGompCancellation);
|
||||
}
|
||||
int gtid = __kmp_get_gtid();
|
||||
MKLOC(loc, "GOMP_loop_end_cancel");
|
||||
KA_TRACE(20, ("GOMP_loop_end_cancel: T#%d\n", gtid));
|
||||
|
||||
return __kmpc_cancel_barrier(&loc, gtid);
|
||||
}
|
||||
|
||||
// All target functions are empty as of 2014-05-29
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TARGET)(int device, void (*fn) (void *), const void *openmp_target,
|
||||
size_t mapnum, void **hostaddrs, size_t *sizes, unsigned char *kinds)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TARGET_DATA)(int device, const void *openmp_target, size_t mapnum,
|
||||
void **hostaddrs, size_t *sizes, unsigned char *kinds)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TARGET_END_DATA)(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TARGET_UPDATE)(int device, const void *openmp_target, size_t mapnum,
|
||||
void **hostaddrs, size_t *sizes, unsigned char *kinds)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
xexpand(KMP_API_NAME_GOMP_TEAMS)(unsigned int num_teams, unsigned int thread_limit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // OMP_40_ENABLED
|
||||
|
||||
|
||||
/*
|
||||
The following sections of code create aliases for the GOMP_* functions,
|
||||
then create versioned symbols using the assembler directive .symver.
|
||||
@@ -871,7 +1345,7 @@ xexpand(KMP_API_NAME_GOMP_TASKYIELD)(void)
|
||||
xaliasify and xversionify are defined in kmp_ftn_os.h
|
||||
*/
|
||||
|
||||
#if KMP_OS_LINUX
|
||||
#ifdef KMP_USE_VERSION_SYMBOLS
|
||||
|
||||
// GOMP_1.0 aliases
|
||||
xaliasify(KMP_API_NAME_GOMP_ATOMIC_END, 10);
|
||||
@@ -917,10 +1391,8 @@ xaliasify(KMP_API_NAME_GOMP_SINGLE_COPY_START, 10);
|
||||
xaliasify(KMP_API_NAME_GOMP_SINGLE_START, 10);
|
||||
|
||||
// GOMP_2.0 aliases
|
||||
#if OMP_30_ENABLED
|
||||
xaliasify(KMP_API_NAME_GOMP_TASK, 20);
|
||||
xaliasify(KMP_API_NAME_GOMP_TASKWAIT, 20);
|
||||
#endif
|
||||
xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT, 20);
|
||||
xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START, 20);
|
||||
xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT, 20);
|
||||
@@ -942,9 +1414,27 @@ xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20);
|
||||
xaliasify(KMP_API_NAME_GOMP_TASKYIELD, 30);
|
||||
|
||||
// GOMP_4.0 aliases
|
||||
/* TODO: add GOMP_4.0 aliases when corresponding
|
||||
GOMP_* functions are implemented
|
||||
*/
|
||||
// The GOMP_parallel* entry points below aren't OpenMP 4.0 related.
|
||||
#if OMP_40_ENABLED
|
||||
xaliasify(KMP_API_NAME_GOMP_PARALLEL, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_TASKGROUP_START, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_TASKGROUP_END, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_BARRIER_CANCEL, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_CANCEL, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_CANCELLATION_POINT, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_LOOP_END_CANCEL, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_TARGET, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_TARGET_DATA, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_TARGET_END_DATA, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_TARGET_UPDATE, 40);
|
||||
xaliasify(KMP_API_NAME_GOMP_TEAMS, 40);
|
||||
#endif
|
||||
|
||||
// GOMP_1.0 versioned symbols
|
||||
xversionify(KMP_API_NAME_GOMP_ATOMIC_END, 10, "GOMP_1.0");
|
||||
@@ -990,10 +1480,8 @@ xversionify(KMP_API_NAME_GOMP_SINGLE_COPY_START, 10, "GOMP_1.0");
|
||||
xversionify(KMP_API_NAME_GOMP_SINGLE_START, 10, "GOMP_1.0");
|
||||
|
||||
// GOMP_2.0 versioned symbols
|
||||
#if OMP_30_ENABLED
|
||||
xversionify(KMP_API_NAME_GOMP_TASK, 20, "GOMP_2.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TASKWAIT, 20, "GOMP_2.0");
|
||||
#endif
|
||||
xversionify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT, 20, "GOMP_2.0");
|
||||
xversionify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START, 20, "GOMP_2.0");
|
||||
xversionify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT, 20, "GOMP_2.0");
|
||||
@@ -1015,11 +1503,28 @@ xversionify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20, "GOMP_2.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TASKYIELD, 30, "GOMP_3.0");
|
||||
|
||||
// GOMP_4.0 versioned symbols
|
||||
/* TODO: add GOMP_4.0 versioned symbols when corresponding
|
||||
GOMP_* functions are implemented
|
||||
*/
|
||||
#if OMP_40_ENABLED
|
||||
xversionify(KMP_API_NAME_GOMP_PARALLEL, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TASKGROUP_START, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TASKGROUP_END, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_BARRIER_CANCEL, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_CANCEL, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_CANCELLATION_POINT, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_LOOP_END_CANCEL, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TARGET, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TARGET_DATA, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TARGET_END_DATA, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TARGET_UPDATE, 40, "GOMP_4.0");
|
||||
xversionify(KMP_API_NAME_GOMP_TEAMS, 40, "GOMP_4.0");
|
||||
#endif
|
||||
|
||||
#endif /* KMP_OS_LINUX */
|
||||
#endif // KMP_USE_VERSION_SYMBOLS
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //extern "C"
|
||||
|
||||
+9
-11
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_i18n.c
|
||||
* $Revision: 42810 $
|
||||
* $Date: 2013-11-07 12:06:33 -0600 (Thu, 07 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -91,7 +89,7 @@ __kmp_i18n_catopen(
|
||||
|
||||
#define KMP_I18N_NULLCAT ((nl_catd)( -1 ))
|
||||
static nl_catd cat = KMP_I18N_NULLCAT; // !!! Shall it be volatile?
|
||||
static char const * name = ( KMP_VERSION_MAJOR == 4 ? "libguide.cat" : "libiomp5.cat" );
|
||||
static char const * name = ( KMP_VERSION_MAJOR == 4 ? "libguide.cat" : "libomp.cat" );
|
||||
|
||||
/*
|
||||
Useful links:
|
||||
@@ -144,7 +142,7 @@ __kmp_i18n_do_catopen(
|
||||
|
||||
if ( status == KMP_I18N_ABSENT ) {
|
||||
if (__kmp_generate_warnings > kmp_warnings_low) { // AC: only issue warning in case explicitly asked to
|
||||
int error = errno; // Save errno immediatelly.
|
||||
int error = errno; // Save errno immediately.
|
||||
char * nlspath = __kmp_env_get( "NLSPATH" );
|
||||
char * lang = __kmp_env_get( "LANG" );
|
||||
|
||||
@@ -260,7 +258,7 @@ __kmp_i18n_catgets(
|
||||
|
||||
#define KMP_I18N_NULLCAT NULL
|
||||
static HMODULE cat = KMP_I18N_NULLCAT; // !!! Shall it be volatile?
|
||||
static char const * name = ( KMP_VERSION_MAJOR == 4 ? "libguide40ui.dll" : "libiomp5ui.dll" );
|
||||
static char const * name = ( KMP_VERSION_MAJOR == 4 ? "libguide40ui.dll" : "libompui.dll" );
|
||||
|
||||
static kmp_i18n_table_t table = { 0, NULL };
|
||||
// Messages formatted by FormatMessage() should be freed, but catgets() interface assumes
|
||||
@@ -402,12 +400,12 @@ __kmp_i18n_do_catopen(
|
||||
// __kmp_i18n_catgets() will not try to open catalog but will return default message.
|
||||
/*
|
||||
If message catalog for another architecture found (e.g. OpenMP RTL
|
||||
for IA-32 architecture opens libiomp5ui.dll for Intel(R) 64)
|
||||
for IA-32 architecture opens libompui.dll for Intel(R) 64)
|
||||
Windows* OS returns error 193 (ERROR_BAD_EXE_FORMAT). However,
|
||||
FormatMessage fails to return a message for this error, so user
|
||||
will see:
|
||||
|
||||
OMP: Warning #2: Cannot open message catalog "1041\libiomp5ui.dll":
|
||||
OMP: Warning #2: Cannot open message catalog "1041\libompui.dll":
|
||||
OMP: System error #193: (No system error message available)
|
||||
OMP: Info #3: Default messages will be used.
|
||||
|
||||
@@ -479,7 +477,7 @@ __kmp_i18n_catclose(
|
||||
Additional mess comes from message catalog: Our catalog source en_US.mc file (generated by
|
||||
message-converter.pl) contains only "\n" characters, but en_US_msg_1033.bin file (produced by
|
||||
mc.exe) may contain "\r\n" or just "\n". This mess goes from en_US_msg_1033.bin file to
|
||||
message catalog, libiomp5ui.dll. For example, message
|
||||
message catalog, libompui.dll. For example, message
|
||||
|
||||
Error
|
||||
|
||||
@@ -815,7 +813,7 @@ sys_error(
|
||||
// not issue warning if strerror_r() returns `int' instead of expected `char *'.
|
||||
message = __kmp_str_format( "%s", err_msg );
|
||||
|
||||
#else // OS X*, FreeBSD etc.
|
||||
#else // OS X*, FreeBSD* etc.
|
||||
|
||||
// XSI version of strerror_r.
|
||||
|
||||
@@ -866,7 +864,7 @@ __kmp_msg_error_code(
|
||||
msg.type = kmp_mt_syserr;
|
||||
msg.num = code;
|
||||
msg.str = sys_error( code );
|
||||
msg.len = strlen( msg.str );
|
||||
msg.len = KMP_STRLEN( msg.str );
|
||||
return msg;
|
||||
|
||||
} // __kmp_msg_error_code
|
||||
@@ -882,7 +880,7 @@ __kmp_msg_error_mesg(
|
||||
msg.type = kmp_mt_syserr;
|
||||
msg.num = 0;
|
||||
msg.str = __kmp_str_format( "%s", mesg );
|
||||
msg.len = strlen( msg.str );
|
||||
msg.len = KMP_STRLEN( msg.str );
|
||||
return msg;
|
||||
|
||||
} // __kmp_msg_error_mesg
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_i18n.h
|
||||
* $Revision: 42810 $
|
||||
* $Date: 2013-11-07 12:06:33 -0600 (Thu, 07 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -80,7 +78,7 @@ char const * __kmp_i18n_catgets( kmp_i18n_id_t id );
|
||||
where
|
||||
|
||||
(1) is a message of warning severity,
|
||||
(2) is a system error caused the previos warning,
|
||||
(2) is a system error caused the previous warning,
|
||||
(3) is a hint for the user how to fix the problem,
|
||||
(4) is a message of informational severity.
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_import.c
|
||||
* $Revision: 42286 $
|
||||
* $Date: 2013-04-18 10:53:26 -0500 (Thu, 18 Apr 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -17,9 +15,9 @@
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------------------------
|
||||
Object generated from this source file is linked to Windows* OS DLL import library (libiomp5md.lib)
|
||||
Object generated from this source file is linked to Windows* OS DLL import library (libompmd.lib)
|
||||
only! It is not a part of regular static or dynamic OpenMP RTL. Any code that just needs to go
|
||||
in the libiomp5md.lib (but not in libiomp5mt.lib and libiomp5md.dll) should be placed in this
|
||||
in the libompmd.lib (but not in libompmt.lib and libompmd.dll) should be placed in this
|
||||
file.
|
||||
------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_io.c -- RTL IO
|
||||
* $Revision: 42150 $
|
||||
* $Date: 2013-03-15 15:40:38 -0500 (Fri, 15 Mar 2013) $
|
||||
* KMP_IO.c -- RTL IO
|
||||
*/
|
||||
|
||||
|
||||
@@ -171,9 +169,9 @@ __kmp_vprintf( enum kmp_io __kmp_io, char const * format, va_list ap )
|
||||
int chars = 0;
|
||||
|
||||
#ifdef KMP_DEBUG_PIDS
|
||||
chars = sprintf( db, "pid=%d: ", getpid() );
|
||||
chars = KMP_SNPRINTF( db, __kmp_debug_buf_chars, "pid=%d: ", (kmp_int32)getpid() );
|
||||
#endif
|
||||
chars += vsprintf( db, format, ap );
|
||||
chars += KMP_VSNPRINTF( db, __kmp_debug_buf_chars, format, ap );
|
||||
|
||||
if ( chars + 1 > __kmp_debug_buf_chars ) {
|
||||
if ( chars + 1 > __kmp_debug_buf_warn_chars ) {
|
||||
@@ -200,7 +198,8 @@ __kmp_vprintf( enum kmp_io __kmp_io, char const * format, va_list ap )
|
||||
#if KMP_OS_WINDOWS
|
||||
DWORD count;
|
||||
#ifdef KMP_DEBUG_PIDS
|
||||
__kmp_str_buf_print( &__kmp_console_buf, "pid=%d: ", getpid() );
|
||||
__kmp_str_buf_print( &__kmp_console_buf, "pid=%d: ",
|
||||
(kmp_int32)getpid() );
|
||||
#endif
|
||||
__kmp_str_buf_vprint( &__kmp_console_buf, format, ap );
|
||||
WriteFile(
|
||||
@@ -213,7 +212,7 @@ __kmp_vprintf( enum kmp_io __kmp_io, char const * format, va_list ap )
|
||||
__kmp_str_buf_clear( &__kmp_console_buf );
|
||||
#else
|
||||
#ifdef KMP_DEBUG_PIDS
|
||||
fprintf( __kmp_stderr, "pid=%d: ", getpid() );
|
||||
fprintf( __kmp_stderr, "pid=%d: ", (kmp_int32)getpid() );
|
||||
#endif
|
||||
vfprintf( __kmp_stderr, format, ap );
|
||||
fflush( __kmp_stderr );
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_io.h -- RTL IO header file.
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#if USE_ITT_BUILD
|
||||
/*
|
||||
* kmp_itt.c -- ITT Notify interface.
|
||||
* $Revision: 42489 $
|
||||
* $Date: 2013-07-08 11:00:09 -0500 (Mon, 08 Jul 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -25,8 +23,13 @@
|
||||
|
||||
#if USE_ITT_NOTIFY
|
||||
|
||||
kmp_int32 __kmp_frame_domain_count = 0;
|
||||
__itt_domain* __kmp_itt_domains[KMP_MAX_FRAME_DOMAINS];
|
||||
kmp_int32 __kmp_barrier_domain_count;
|
||||
kmp_int32 __kmp_region_domain_count;
|
||||
__itt_domain* __kmp_itt_barrier_domains[KMP_MAX_FRAME_DOMAINS];
|
||||
__itt_domain* __kmp_itt_region_domains[KMP_MAX_FRAME_DOMAINS];
|
||||
__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;
|
||||
|
||||
#include "kmp_version.h"
|
||||
#include "kmp_i18n.h"
|
||||
|
||||
+44
-8
@@ -1,8 +1,6 @@
|
||||
#if USE_ITT_BUILD
|
||||
/*
|
||||
* kmp_itt.h -- ITT Notify interface.
|
||||
* $Revision: 42829 $
|
||||
* $Date: 2013-11-21 05:44:01 -0600 (Thu, 21 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -55,12 +53,20 @@ 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 serialized = 0 ); // Master only, before forking threads.
|
||||
__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.
|
||||
// (*) Note: A thread may execute tasks after this point, though.
|
||||
|
||||
// --- Frame reporting ---
|
||||
__kmp_inline void __kmp_itt_frame_submit( int gtid, __itt_timestamp begin, __itt_timestamp end, int imbalance, ident_t *loc );
|
||||
// region = 0 - no regions, region = 1 - parallel, region = 2 - serialized parallel
|
||||
__kmp_inline void __kmp_itt_frame_submit( int gtid, __itt_timestamp begin, __itt_timestamp end, int imbalance, ident_t *loc, int team_size, int region = 0 );
|
||||
|
||||
// --- Metadata reporting ---
|
||||
// begin/end - begin/end timestamps of a barrier frame, imbalance - aggregated wait time value, reduction -if this is a reduction barrier
|
||||
__kmp_inline void __kmp_itt_metadata_imbalance( int gtid, kmp_uint64 begin, kmp_uint64 end, kmp_uint64 imbalance, kmp_uint64 reduction );
|
||||
// sched_type: 0 - static, 1 - dynamic, 2 - guided, 3 - custom (all others); iterations - loop trip count, chunk - chunk size
|
||||
__kmp_inline void __kmp_itt_metadata_loop( ident_t * loc, kmp_uint64 sched_type, kmp_uint64 iterations, kmp_uint64 chunk );
|
||||
__kmp_inline void __kmp_itt_metadata_single( ident_t * loc );
|
||||
|
||||
// --- Barrier reporting ---
|
||||
__kmp_inline void * __kmp_itt_barrier_object( int gtid, int bt, int set_name = 0, int delta = 0 );
|
||||
@@ -78,7 +84,11 @@ __kmp_inline void __kmp_itt_task_starting( void * object );
|
||||
__kmp_inline void __kmp_itt_task_finished( void * object );
|
||||
|
||||
// --- Lock reporting ---
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
__kmp_inline void __kmp_itt_lock_creating( kmp_user_lock_p lock, const ident_t * );
|
||||
#else
|
||||
__kmp_inline void __kmp_itt_lock_creating( kmp_user_lock_p lock );
|
||||
#endif
|
||||
__kmp_inline void __kmp_itt_lock_acquiring( kmp_user_lock_p lock );
|
||||
__kmp_inline void __kmp_itt_lock_acquired( kmp_user_lock_p lock );
|
||||
__kmp_inline void __kmp_itt_lock_releasing( kmp_user_lock_p lock );
|
||||
@@ -86,7 +96,11 @@ __kmp_inline void __kmp_itt_lock_cancelled( kmp_user_lock_p lock );
|
||||
__kmp_inline void __kmp_itt_lock_destroyed( kmp_user_lock_p lock );
|
||||
|
||||
// --- Critical reporting ---
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
__kmp_inline void __kmp_itt_critical_creating( kmp_user_lock_p lock, const ident_t * );
|
||||
#else
|
||||
__kmp_inline void __kmp_itt_critical_creating( kmp_user_lock_p lock );
|
||||
#endif
|
||||
__kmp_inline void __kmp_itt_critical_acquiring( kmp_user_lock_p lock );
|
||||
__kmp_inline void __kmp_itt_critical_acquired( kmp_user_lock_p lock );
|
||||
__kmp_inline void __kmp_itt_critical_releasing( kmp_user_lock_p lock );
|
||||
@@ -135,8 +149,12 @@ __kmp_inline void __kmp_itt_stack_callee_leave(__itt_caller);
|
||||
#if (INCLUDE_SSC_MARKS && KMP_OS_LINUX && KMP_ARCH_X86_64)
|
||||
// Portable (at least for gcc and icc) code to insert the necessary instructions
|
||||
// to set %ebx and execute the unlikely no-op.
|
||||
# define INSERT_SSC_MARK(tag) \
|
||||
__asm__ __volatile__ ("movl %0, %%ebx; .byte 0x64, 0x67, 0x90 " ::"i"(tag):"%ebx")
|
||||
#if defined( __INTEL_COMPILER )
|
||||
# define INSERT_SSC_MARK(tag) __SSC_MARK(tag)
|
||||
#else
|
||||
# define INSERT_SSC_MARK(tag) \
|
||||
__asm__ __volatile__ ("movl %0, %%ebx; .byte 0x64, 0x67, 0x90 " ::"i"(tag):"%ebx")
|
||||
#endif
|
||||
#else
|
||||
# define INSERT_SSC_MARK(tag) ((void)0)
|
||||
#endif
|
||||
@@ -150,6 +168,18 @@ __kmp_inline void __kmp_itt_stack_callee_leave(__itt_caller);
|
||||
#define SSC_MARK_SPIN_START() INSERT_SSC_MARK(0x4376)
|
||||
#define SSC_MARK_SPIN_END() INSERT_SSC_MARK(0x4377)
|
||||
|
||||
// Markers for architecture simulation.
|
||||
// FORKING : Before the master thread forks.
|
||||
// JOINING : At the start of the join.
|
||||
// INVOKING : Before the threads invoke microtasks.
|
||||
// DISPATCH_INIT: At the start of dynamically scheduled loop.
|
||||
// DISPATCH_NEXT: After claming next iteration of dynamically scheduled loop.
|
||||
#define SSC_MARK_FORKING() INSERT_SSC_MARK(0xd693)
|
||||
#define SSC_MARK_JOINING() INSERT_SSC_MARK(0xd694)
|
||||
#define SSC_MARK_INVOKING() INSERT_SSC_MARK(0xd695)
|
||||
#define SSC_MARK_DISPATCH_INIT() INSERT_SSC_MARK(0xd696)
|
||||
#define SSC_MARK_DISPATCH_NEXT() INSERT_SSC_MARK(0xd697)
|
||||
|
||||
// The object is an address that associates a specific set of the prepare, acquire, release,
|
||||
// and cancel operations.
|
||||
|
||||
@@ -227,8 +257,14 @@ __kmp_inline void __kmp_itt_stack_callee_leave(__itt_caller);
|
||||
|
||||
const int KMP_MAX_FRAME_DOMAINS = 512; // Maximum number of frame domains to use (maps to
|
||||
// different OpenMP regions in the user source code).
|
||||
extern kmp_int32 __kmp_frame_domain_count;
|
||||
extern __itt_domain* __kmp_itt_domains[KMP_MAX_FRAME_DOMAINS];
|
||||
extern kmp_int32 __kmp_barrier_domain_count;
|
||||
extern kmp_int32 __kmp_region_domain_count;
|
||||
extern __itt_domain* __kmp_itt_barrier_domains[KMP_MAX_FRAME_DOMAINS];
|
||||
extern __itt_domain* __kmp_itt_region_domains[KMP_MAX_FRAME_DOMAINS];
|
||||
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;
|
||||
|
||||
#else
|
||||
|
||||
// Null definitions of the synchronization tracing functions.
|
||||
|
||||
+329
-50
@@ -1,8 +1,6 @@
|
||||
#if USE_ITT_BUILD
|
||||
/*
|
||||
* kmp_itt.inl -- Inline functions of ITT Notify.
|
||||
* $Revision: 42866 $
|
||||
* $Date: 2013-12-10 15:15:58 -0600 (Tue, 10 Dec 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -63,6 +61,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static kmp_bootstrap_lock_t metadata_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( metadata_lock );
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------------------------
|
||||
Parallel region reporting.
|
||||
@@ -89,12 +89,10 @@
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
LINKAGE void
|
||||
__kmp_itt_region_forking( int gtid, int serialized ) {
|
||||
__kmp_itt_region_forking( int gtid, int team_size, int barriers, int serialized ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
kmp_team_t * team = __kmp_team_from_gtid( gtid );
|
||||
#if OMP_30_ENABLED
|
||||
if (team->t.t_active_level + serialized > 1)
|
||||
#endif
|
||||
{
|
||||
// The frame notifications are only supported for the outermost teams.
|
||||
return;
|
||||
@@ -105,40 +103,81 @@ __kmp_itt_region_forking( int gtid, int serialized ) {
|
||||
// Assume that reserved_2 contains zero initially. Since zero is special
|
||||
// value here, store the index into domain array increased by 1.
|
||||
if (loc->reserved_2 == 0) {
|
||||
if (__kmp_frame_domain_count < KMP_MAX_FRAME_DOMAINS) {
|
||||
int frm = KMP_TEST_THEN_INC32( & __kmp_frame_domain_count ); // get "old" value
|
||||
if (__kmp_region_domain_count < KMP_MAX_FRAME_DOMAINS) {
|
||||
int frm = KMP_TEST_THEN_INC32( & __kmp_region_domain_count ); // get "old" value
|
||||
if (frm >= KMP_MAX_FRAME_DOMAINS) {
|
||||
KMP_TEST_THEN_DEC32( & __kmp_frame_domain_count ); // revert the count
|
||||
KMP_TEST_THEN_DEC32( & __kmp_region_domain_count ); // revert the count
|
||||
return; // loc->reserved_2 is still 0
|
||||
}
|
||||
//if (!KMP_COMPARE_AND_STORE_ACQ32( &loc->reserved_2, 0, frm + 1 )) {
|
||||
// frm = loc->reserved_2 - 1; // get value saved by other thread for same loc
|
||||
//} // AC: this block is to replace next unsynchronized line
|
||||
loc->reserved_2 = frm + 1; // save "new" value
|
||||
|
||||
// We need to save indexes for both region and barrier frames. We'll use loc->reserved_2
|
||||
// field but put region index to the low two bytes and barrier indexes to the high
|
||||
// two bytes. It is OK because KMP_MAX_FRAME_DOMAINS = 512.
|
||||
loc->reserved_2 |= (frm + 1); // save "new" value
|
||||
|
||||
// Transform compiler-generated region location into the format
|
||||
// that the tools more or less standardized on:
|
||||
// "<func>$omp$parallel@[file:]<line>[:<col>]"
|
||||
const char * buff = NULL;
|
||||
kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
|
||||
buff = __kmp_str_format("%s$omp$parallel@%s:%d:%d",
|
||||
str_loc.func, str_loc.file,
|
||||
buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d",
|
||||
str_loc.func, team_size, str_loc.file,
|
||||
str_loc.line, str_loc.col);
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
__kmp_itt_domains[ frm ] = __itt_domain_create( buff );
|
||||
__kmp_itt_region_domains[ frm ] = __itt_domain_create( buff );
|
||||
__itt_suppress_pop();
|
||||
|
||||
__kmp_str_free( &buff );
|
||||
__itt_frame_begin_v3(__kmp_itt_domains[ frm ], NULL);
|
||||
if( barriers ) {
|
||||
if (__kmp_barrier_domain_count < KMP_MAX_FRAME_DOMAINS) {
|
||||
int frm = KMP_TEST_THEN_INC32( & __kmp_barrier_domain_count ); // get "old" value
|
||||
if (frm >= KMP_MAX_FRAME_DOMAINS) {
|
||||
KMP_TEST_THEN_DEC32( & __kmp_barrier_domain_count ); // revert the count
|
||||
return; // loc->reserved_2 is still 0
|
||||
}
|
||||
const char * buff = NULL;
|
||||
buff = __kmp_str_format("%s$omp$barrier@%s:%d",
|
||||
str_loc.func, str_loc.file, str_loc.col);
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
__kmp_itt_barrier_domains[ frm ] = __itt_domain_create( buff );
|
||||
__itt_suppress_pop();
|
||||
__kmp_str_free( &buff );
|
||||
// Save the barrier frame index to the high two bytes.
|
||||
loc->reserved_2 |= (frm + 1) << 16;
|
||||
}
|
||||
}
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
__itt_frame_begin_v3(__kmp_itt_region_domains[ frm ], NULL);
|
||||
}
|
||||
} else { // Region domain exists for this location
|
||||
// Check if team size was changed. Then create new region domain for this location
|
||||
int frm = (loc->reserved_2 & 0x0000FFFF) - 1;
|
||||
if( __kmp_itt_region_team_size[frm] != team_size ) {
|
||||
const char * buff = NULL;
|
||||
kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
|
||||
buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d",
|
||||
str_loc.func, team_size, str_loc.file,
|
||||
str_loc.line, str_loc.col);
|
||||
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
__kmp_itt_region_domains[ frm ] = __itt_domain_create( buff );
|
||||
__itt_suppress_pop();
|
||||
|
||||
__kmp_str_free( &buff );
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
__kmp_itt_region_team_size[frm] = team_size;
|
||||
__itt_frame_begin_v3(__kmp_itt_region_domains[frm], NULL);
|
||||
} else { // Team size was not changed. Use existing domain.
|
||||
__itt_frame_begin_v3(__kmp_itt_region_domains[frm], NULL);
|
||||
}
|
||||
} else { // if it is not 0 then it should be <= KMP_MAX_FRAME_DOMAINS
|
||||
__itt_frame_begin_v3(__kmp_itt_domains[loc->reserved_2 - 1], NULL);
|
||||
}
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
KMP_ITT_DEBUG_PRINT( "[frm beg] gtid=%d, idx=%d, serialized:%d, loc:%p\n",
|
||||
gtid, loc->reserved_2 - 1, serialized, loc );
|
||||
KMP_ITT_DEBUG_PRINT( "[frm beg] gtid=%d, idx=%x, serialized:%d, loc:%p\n",
|
||||
gtid, loc->reserved_2, serialized, loc );
|
||||
}
|
||||
#endif
|
||||
} // __kmp_itt_region_forking
|
||||
@@ -146,50 +185,213 @@ __kmp_itt_region_forking( int gtid, int serialized ) {
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
LINKAGE void
|
||||
__kmp_itt_frame_submit( int gtid, __itt_timestamp begin, __itt_timestamp end, int imbalance, ident_t * loc ) {
|
||||
__kmp_itt_frame_submit( int gtid, __itt_timestamp begin, __itt_timestamp end, int imbalance, ident_t * loc, int team_size, int region ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
if( region ) {
|
||||
kmp_team_t * team = __kmp_team_from_gtid( gtid );
|
||||
int serialized = ( region == 2 ? 1 : 0 );
|
||||
if (team->t.t_active_level + serialized > 1)
|
||||
{
|
||||
// The frame notifications are only supported for the outermost teams.
|
||||
return;
|
||||
}
|
||||
//Check region domain has not been created before. It's index is saved in the low two bytes.
|
||||
if ((loc->reserved_2 & 0x0000FFFF) == 0) {
|
||||
if (__kmp_region_domain_count < KMP_MAX_FRAME_DOMAINS) {
|
||||
int frm = KMP_TEST_THEN_INC32( & __kmp_region_domain_count ); // get "old" value
|
||||
if (frm >= KMP_MAX_FRAME_DOMAINS) {
|
||||
KMP_TEST_THEN_DEC32( & __kmp_region_domain_count ); // revert the count
|
||||
return; // loc->reserved_2 is still 0
|
||||
}
|
||||
|
||||
// We need to save indexes for both region and barrier frames. We'll use loc->reserved_2
|
||||
// field but put region index to the low two bytes and barrier indexes to the high
|
||||
// two bytes. It is OK because KMP_MAX_FRAME_DOMAINS = 512.
|
||||
loc->reserved_2 |= (frm + 1); // save "new" value
|
||||
|
||||
// Transform compiler-generated region location into the format
|
||||
// that the tools more or less standardized on:
|
||||
// "<func>$omp$parallel:team_size@[file:]<line>[:<col>]"
|
||||
const char * buff = NULL;
|
||||
kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
|
||||
buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d",
|
||||
str_loc.func, team_size, str_loc.file,
|
||||
str_loc.line, str_loc.col);
|
||||
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
__kmp_itt_region_domains[ frm ] = __itt_domain_create( buff );
|
||||
__itt_suppress_pop();
|
||||
|
||||
__kmp_str_free( &buff );
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
__kmp_itt_region_team_size[frm] = team_size;
|
||||
__itt_frame_submit_v3(__kmp_itt_region_domains[ frm ], NULL, begin, end );
|
||||
}
|
||||
} else { // Region domain exists for this location
|
||||
// Check if team size was changed. Then create new region domain for this location
|
||||
int frm = (loc->reserved_2 & 0x0000FFFF) - 1;
|
||||
if( __kmp_itt_region_team_size[frm] != team_size ) {
|
||||
const char * buff = NULL;
|
||||
kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
|
||||
buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d",
|
||||
str_loc.func, team_size, str_loc.file,
|
||||
str_loc.line, str_loc.col);
|
||||
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
__kmp_itt_region_domains[ frm ] = __itt_domain_create( buff );
|
||||
__itt_suppress_pop();
|
||||
|
||||
__kmp_str_free( &buff );
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
__kmp_itt_region_team_size[frm] = team_size;
|
||||
__itt_frame_submit_v3(__kmp_itt_region_domains[ frm ], NULL, begin, end );
|
||||
} else { // Team size was not changed. Use existing domain.
|
||||
__itt_frame_submit_v3(__kmp_itt_region_domains[ frm ], NULL, begin, end );
|
||||
}
|
||||
}
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
KMP_ITT_DEBUG_PRINT( "[reg sub] gtid=%d, idx=%x, region:%d, loc:%p, beg:%llu, end:%llu\n",
|
||||
gtid, loc->reserved_2, region, loc, begin, end );
|
||||
return;
|
||||
} else { // called for barrier reporting
|
||||
if (loc) {
|
||||
if (loc->reserved_2 == 0) {
|
||||
if (__kmp_frame_domain_count < KMP_MAX_FRAME_DOMAINS) {
|
||||
int frm = KMP_TEST_THEN_INC32( & __kmp_frame_domain_count ); // get "old" value
|
||||
if ((loc->reserved_2 & 0xFFFF0000) == 0) {
|
||||
if (__kmp_barrier_domain_count < KMP_MAX_FRAME_DOMAINS) {
|
||||
int frm = KMP_TEST_THEN_INC32( & __kmp_barrier_domain_count ); // get "old" value
|
||||
if (frm >= KMP_MAX_FRAME_DOMAINS) {
|
||||
KMP_TEST_THEN_DEC32( & __kmp_frame_domain_count ); // revert the count
|
||||
KMP_TEST_THEN_DEC32( & __kmp_barrier_domain_count ); // revert the count
|
||||
return; // loc->reserved_2 is still 0
|
||||
}
|
||||
// Should it be synchronized? See the comment in __kmp_itt_region_forking
|
||||
loc->reserved_2 = frm + 1; // save "new" value
|
||||
// Save the barrier frame index to the high two bytes.
|
||||
loc->reserved_2 |= (frm + 1) << 16; // save "new" value
|
||||
|
||||
// Transform compiler-generated region location into the format
|
||||
// that the tools more or less standardized on:
|
||||
// "<func>$omp$frame@[file:]<line>[:<col>]"
|
||||
const char * buff = NULL;
|
||||
kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
|
||||
if( imbalance ) {
|
||||
buff = __kmp_str_format("%s$omp$barrier-imbalance@%s:%d",
|
||||
str_loc.func, str_loc.file, str_loc.col);
|
||||
const char * buff_imb = NULL;
|
||||
buff_imb = __kmp_str_format("%s$omp$barrier-imbalance:%d@%s:%d",
|
||||
str_loc.func, team_size, str_loc.file, str_loc.col);
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
__kmp_itt_imbalance_domains[ frm ] = __itt_domain_create( buff_imb );
|
||||
__itt_suppress_pop();
|
||||
__itt_frame_submit_v3(__kmp_itt_imbalance_domains[ frm ], NULL, begin, end );
|
||||
__kmp_str_free( &buff_imb );
|
||||
} else {
|
||||
const char * buff = NULL;
|
||||
buff = __kmp_str_format("%s$omp$barrier@%s:%d",
|
||||
str_loc.func, str_loc.file, str_loc.col);
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
__kmp_itt_barrier_domains[ frm ] = __itt_domain_create( buff );
|
||||
__itt_suppress_pop();
|
||||
__itt_frame_submit_v3(__kmp_itt_barrier_domains[ frm ], NULL, begin, end );
|
||||
__kmp_str_free( &buff );
|
||||
}
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
__kmp_itt_domains[ frm ] = __itt_domain_create( buff );
|
||||
__itt_suppress_pop();
|
||||
|
||||
__kmp_str_free( &buff );
|
||||
__itt_frame_submit_v3(__kmp_itt_domains[ frm ], NULL, begin, end );
|
||||
}
|
||||
} else { // if it is not 0 then it should be <= KMP_MAX_FRAME_DOMAINS
|
||||
__itt_frame_submit_v3(__kmp_itt_domains[loc->reserved_2 - 1], NULL, begin, end );
|
||||
if( imbalance ) {
|
||||
__itt_frame_submit_v3(__kmp_itt_imbalance_domains[ (loc->reserved_2 >> 16) - 1 ], NULL, begin, end );
|
||||
} else {
|
||||
__itt_frame_submit_v3(__kmp_itt_barrier_domains[(loc->reserved_2 >> 16) - 1], NULL, begin, end );
|
||||
}
|
||||
}
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
KMP_ITT_DEBUG_PRINT( "[frm sub] gtid=%d, idx=%x, loc:%p, beg:%llu, end:%llu\n",
|
||||
gtid, loc->reserved_2, loc, begin, end );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // __kmp_itt_frame_submit
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
LINKAGE void
|
||||
__kmp_itt_metadata_imbalance( int gtid, kmp_uint64 begin, kmp_uint64 end, kmp_uint64 imbalance, kmp_uint64 reduction ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
if( metadata_domain == NULL) {
|
||||
__kmp_acquire_bootstrap_lock( & metadata_lock );
|
||||
if( metadata_domain == NULL) {
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
metadata_domain = __itt_domain_create( "OMP Metadata" );
|
||||
__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);
|
||||
#endif
|
||||
} // __kmp_itt_metadata_imbalance
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
LINKAGE void
|
||||
__kmp_itt_metadata_loop( ident_t * loc, kmp_uint64 sched_type, kmp_uint64 iterations, kmp_uint64 chunk ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
if( metadata_domain == NULL) {
|
||||
__kmp_acquire_bootstrap_lock( & metadata_lock );
|
||||
if( metadata_domain == NULL) {
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
metadata_domain = __itt_domain_create( "OMP Metadata" );
|
||||
__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 );
|
||||
|
||||
kmp_uint64 loop_data[ 5 ];
|
||||
loop_data[ 0 ] = str_loc.line;
|
||||
loop_data[ 1 ] = str_loc.col;
|
||||
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);
|
||||
#endif
|
||||
} // __kmp_itt_metadata_loop
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
LINKAGE void
|
||||
__kmp_itt_metadata_single( ident_t * loc ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
if( metadata_domain == NULL) {
|
||||
__kmp_acquire_bootstrap_lock( & metadata_lock );
|
||||
if( metadata_domain == NULL) {
|
||||
__itt_suppress_push(__itt_suppress_memory_errors);
|
||||
metadata_domain = __itt_domain_create( "OMP Metadata" );
|
||||
__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;
|
||||
single_data[ 1 ] = str_loc.col;
|
||||
|
||||
__kmp_str_loc_free( &str_loc );
|
||||
|
||||
__itt_metadata_add(metadata_domain, __itt_null, string_handle, __itt_metadata_u64, 2, single_data);
|
||||
#endif
|
||||
} // __kmp_itt_metadata_single
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
LINKAGE void
|
||||
__kmp_itt_region_starting( int gtid ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
@@ -210,19 +412,21 @@ LINKAGE void
|
||||
__kmp_itt_region_joined( int gtid, int serialized ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
kmp_team_t * team = __kmp_team_from_gtid( gtid );
|
||||
#if OMP_30_ENABLED
|
||||
if (team->t.t_active_level + serialized > 1)
|
||||
#endif
|
||||
{
|
||||
// The frame notifications are only supported for the outermost teams.
|
||||
return;
|
||||
}
|
||||
ident_t * loc = __kmp_thread_from_gtid( gtid )->th.th_ident;
|
||||
if (loc && loc->reserved_2 && loc->reserved_2 <= KMP_MAX_FRAME_DOMAINS) {
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
__itt_frame_end_v3(__kmp_itt_domains[loc->reserved_2 - 1], NULL);
|
||||
KMP_ITT_DEBUG_PRINT( "[frm end] gtid=%d, idx=%d, serialized:%d, loc:%p\n",
|
||||
gtid, loc->reserved_2 - 1, serialized, loc );
|
||||
if (loc && loc->reserved_2)
|
||||
{
|
||||
int frm = (loc->reserved_2 & 0x0000FFFF) - 1;
|
||||
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 );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // __kmp_itt_region_joined
|
||||
@@ -409,8 +613,6 @@ __kmp_itt_barrier_finished( int gtid, void * object ) {
|
||||
#endif
|
||||
} // __kmp_itt_barrier_finished
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------------------------
|
||||
Taskwait reporting.
|
||||
@@ -507,8 +709,6 @@ __kmp_itt_task_finished(
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
#endif /* OMP_30_ENABLED */
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------------------------
|
||||
Lock reporting.
|
||||
@@ -534,6 +734,21 @@ __kmp_itt_task_finished(
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
// Takes location information directly
|
||||
__kmp_inline
|
||||
void
|
||||
___kmp_itt_lock_init( kmp_user_lock_p lock, char const *type, const ident_t *loc ) {
|
||||
#if USE_ITT_NOTIFY
|
||||
if ( __itt_sync_create_ptr ) {
|
||||
char const * src = ( loc == NULL ? NULL : loc->psource );
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
__itt_sync_create( lock, type, src, 0 );
|
||||
KMP_ITT_DEBUG_PRINT( "[lck ini] scre( %p, \"%s\", \"%s\", 0 )\n", lock, type, src );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else // KMP_USE_DYNAMIC_LOCK
|
||||
// Internal guts -- common code for locks and critical sections, do not call directly.
|
||||
__kmp_inline
|
||||
void
|
||||
@@ -550,6 +765,7 @@ ___kmp_itt_lock_init( kmp_user_lock_p lock, char const * type ) {
|
||||
}; // if
|
||||
#endif
|
||||
} // ___kmp_itt_lock_init
|
||||
#endif // KMP_USE_DYNAMIC_LOCK
|
||||
|
||||
// Internal guts -- common code for locks and critical sections, do not call directly.
|
||||
__kmp_inline
|
||||
@@ -565,29 +781,82 @@ ___kmp_itt_lock_fini( kmp_user_lock_p lock, char const * type ) {
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
void
|
||||
__kmp_itt_lock_creating( kmp_user_lock_p lock, const ident_t *loc ) {
|
||||
___kmp_itt_lock_init( lock, "OMP Lock", loc );
|
||||
}
|
||||
#else
|
||||
void
|
||||
__kmp_itt_lock_creating( kmp_user_lock_p lock ) {
|
||||
___kmp_itt_lock_init( lock, "OMP Lock" );
|
||||
} // __kmp_itt_lock_creating
|
||||
#endif
|
||||
|
||||
void
|
||||
__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);
|
||||
__itt_sync_prepare( ilk->lock );
|
||||
} else {
|
||||
__itt_sync_prepare( lock );
|
||||
}
|
||||
}
|
||||
#else
|
||||
__itt_sync_prepare( lock );
|
||||
#endif
|
||||
} // __kmp_itt_lock_acquiring
|
||||
|
||||
void
|
||||
__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);
|
||||
__itt_sync_acquired( ilk->lock );
|
||||
} else {
|
||||
__itt_sync_acquired( lock );
|
||||
}
|
||||
}
|
||||
#else
|
||||
__itt_sync_acquired( lock );
|
||||
#endif
|
||||
} // __kmp_itt_lock_acquired
|
||||
|
||||
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);
|
||||
__itt_sync_releasing( ilk->lock );
|
||||
} else {
|
||||
__itt_sync_releasing( lock );
|
||||
}
|
||||
}
|
||||
#else
|
||||
__itt_sync_releasing( lock );
|
||||
#endif
|
||||
} // __kmp_itt_lock_releasing
|
||||
|
||||
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);
|
||||
__itt_sync_cancel( ilk->lock );
|
||||
} else {
|
||||
__itt_sync_cancel( lock );
|
||||
}
|
||||
}
|
||||
#else
|
||||
__itt_sync_cancel( lock );
|
||||
#endif
|
||||
} // __kmp_itt_lock_cancelled
|
||||
|
||||
void
|
||||
@@ -602,11 +871,17 @@ __kmp_itt_lock_destroyed( kmp_user_lock_p lock ) {
|
||||
Critical sections are treated exactly as locks (but have different object type).
|
||||
------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if KMP_USE_DYNAMIC_LOCK
|
||||
void
|
||||
__kmp_itt_critical_creating( kmp_user_lock_p lock, const ident_t *loc ) {
|
||||
___kmp_itt_lock_init( lock, "OMP Critical", loc);
|
||||
}
|
||||
#else
|
||||
void
|
||||
__kmp_itt_critical_creating( kmp_user_lock_p lock ) {
|
||||
___kmp_itt_lock_init( lock, "OMP Critical" );
|
||||
} // __kmp_itt_critical_creating
|
||||
#endif
|
||||
|
||||
void
|
||||
__kmp_itt_critical_acquiring( kmp_user_lock_p lock ) {
|
||||
@@ -757,7 +1032,11 @@ __kmp_itt_thread_name( int gtid ) {
|
||||
if ( __itt_thr_name_set_ptr ) {
|
||||
kmp_str_buf_t name;
|
||||
__kmp_str_buf_init( & name );
|
||||
__kmp_str_buf_print( & name, "OMP Worker Thread #%d", gtid );
|
||||
if( KMP_MASTER_GTID(gtid) ) {
|
||||
__kmp_str_buf_print( & name, "OMP Master Thread #%d", gtid );
|
||||
} else {
|
||||
__kmp_str_buf_print( & name, "OMP Worker Thread #%d", gtid );
|
||||
}
|
||||
KMP_ITT_DEBUG_LOCK();
|
||||
__itt_thr_name_set( name.str, name.used );
|
||||
KMP_ITT_DEBUG_PRINT( "[thr nam] name( \"%s\")\n", name.str );
|
||||
|
||||
+1132
-805
File diff suppressed because it is too large
Load Diff
+285
-32
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_lock.h -- lock header file
|
||||
* $Revision: 42810 $
|
||||
* $Date: 2013-11-07 12:06:33 -0600 (Thu, 07 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -163,18 +161,21 @@ typedef union kmp_tas_lock kmp_tas_lock_t;
|
||||
|
||||
extern void __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 void __kmp_release_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_test_nested_tas_lock( kmp_tas_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_release_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 );
|
||||
extern void __kmp_destroy_nested_tas_lock( kmp_tas_lock_t *lck );
|
||||
|
||||
#define KMP_LOCK_RELEASED 1
|
||||
#define KMP_LOCK_STILL_HELD 0
|
||||
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)
|
||||
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// futex locks. futex locks are only available on Linux* OS.
|
||||
@@ -214,17 +215,17 @@ typedef union kmp_futex_lock kmp_futex_lock_t;
|
||||
|
||||
extern void __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 void __kmp_release_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_test_nested_futex_lock( kmp_futex_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_release_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)
|
||||
#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -263,13 +264,13 @@ typedef union kmp_ticket_lock kmp_ticket_lock_t;
|
||||
extern void __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 void __kmp_release_ticket_lock( 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_test_nested_ticket_lock( kmp_ticket_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_release_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 );
|
||||
extern void __kmp_destroy_nested_ticket_lock( kmp_ticket_lock_t *lck );
|
||||
|
||||
@@ -280,16 +281,16 @@ extern void __kmp_destroy_nested_ticket_lock( kmp_ticket_lock_t *lck );
|
||||
|
||||
#if KMP_USE_ADAPTIVE_LOCKS
|
||||
|
||||
struct kmp_adaptive_lock;
|
||||
struct kmp_adaptive_lock_info;
|
||||
|
||||
typedef struct kmp_adaptive_lock kmp_adaptive_lock_t;
|
||||
typedef struct kmp_adaptive_lock_info kmp_adaptive_lock_info_t;
|
||||
|
||||
#if KMP_DEBUG_ADAPTIVE_LOCKS
|
||||
|
||||
struct kmp_adaptive_lock_statistics {
|
||||
/* So we can get stats from locks that haven't been destroyed. */
|
||||
kmp_adaptive_lock_t * next;
|
||||
kmp_adaptive_lock_t * prev;
|
||||
kmp_adaptive_lock_info_t * next;
|
||||
kmp_adaptive_lock_info_t * prev;
|
||||
|
||||
/* Other statistics */
|
||||
kmp_uint32 successfulSpeculations;
|
||||
@@ -307,7 +308,7 @@ extern void __kmp_init_speculative_stats();
|
||||
|
||||
#endif // KMP_DEBUG_ADAPTIVE_LOCKS
|
||||
|
||||
struct kmp_adaptive_lock
|
||||
struct kmp_adaptive_lock_info
|
||||
{
|
||||
/* Values used for adaptivity.
|
||||
* Although these are accessed from multiple threads we don't access them atomically,
|
||||
@@ -348,10 +349,6 @@ struct kmp_base_queuing_lock {
|
||||
kmp_int32 depth_locked; // depth locked, for nested locks only
|
||||
|
||||
kmp_lock_flags_t flags; // lock specifics, e.g. critical section lock
|
||||
#if KMP_USE_ADAPTIVE_LOCKS
|
||||
KMP_ALIGN(CACHE_LINE)
|
||||
kmp_adaptive_lock_t adaptive; // Information for the speculative adaptive lock
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct kmp_base_queuing_lock kmp_base_queuing_lock_t;
|
||||
@@ -369,16 +366,40 @@ 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_test_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_release_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_test_nested_queuing_lock( kmp_queuing_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_release_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 );
|
||||
extern void __kmp_destroy_nested_queuing_lock( kmp_queuing_lock_t *lck );
|
||||
|
||||
#if KMP_USE_ADAPTIVE_LOCKS
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Adaptive locks.
|
||||
// ----------------------------------------------------------------------------
|
||||
struct kmp_base_adaptive_lock {
|
||||
kmp_base_queuing_lock qlk;
|
||||
KMP_ALIGN(CACHE_LINE)
|
||||
kmp_adaptive_lock_info_t adaptive; // Information for the speculative adaptive lock
|
||||
};
|
||||
|
||||
typedef struct kmp_base_adaptive_lock kmp_base_adaptive_lock_t;
|
||||
|
||||
union KMP_ALIGN_CACHE kmp_adaptive_lock {
|
||||
kmp_base_adaptive_lock_t lk;
|
||||
kmp_lock_pool_t pool;
|
||||
double lk_align;
|
||||
char lk_pad[ KMP_PAD(kmp_base_adaptive_lock_t, CACHE_LINE) ];
|
||||
};
|
||||
typedef union kmp_adaptive_lock kmp_adaptive_lock_t;
|
||||
|
||||
# define GET_QLK_PTR(l) ((kmp_queuing_lock_t *) & (l)->lk.qlk)
|
||||
|
||||
#endif // KMP_USE_ADAPTIVE_LOCKS
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// DRDPA ticket locks.
|
||||
@@ -449,13 +470,13 @@ 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_test_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_release_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_test_nested_drdpa_lock( kmp_drdpa_lock_t *lck, kmp_int32 gtid );
|
||||
extern void __kmp_release_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 );
|
||||
extern void __kmp_destroy_nested_drdpa_lock( kmp_drdpa_lock_t *lck );
|
||||
|
||||
@@ -518,7 +539,7 @@ __kmp_destroy_bootstrap_lock( kmp_bootstrap_lock_t *lck )
|
||||
// Internal RTL locks are also implemented as ticket locks, for now.
|
||||
//
|
||||
// FIXME - We should go through and figure out which lock kind works best for
|
||||
// each internal lock, and use the type deeclaration and function calls for
|
||||
// each internal lock, and use the type declaration and function calls for
|
||||
// that explicit lock kind (and get rid of this section).
|
||||
//
|
||||
|
||||
@@ -570,7 +591,7 @@ __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)
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
lk_futex,
|
||||
#endif
|
||||
lk_ticket,
|
||||
@@ -587,7 +608,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)
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
kmp_futex_lock_t futex;
|
||||
#endif
|
||||
kmp_ticket_lock_t ticket;
|
||||
@@ -601,6 +622,8 @@ union kmp_user_lock {
|
||||
|
||||
typedef union kmp_user_lock *kmp_user_lock_p;
|
||||
|
||||
#if ! KMP_USE_DYNAMIC_LOCK
|
||||
|
||||
extern size_t __kmp_base_user_lock_size;
|
||||
extern size_t __kmp_user_lock_size;
|
||||
|
||||
@@ -615,7 +638,7 @@ __kmp_get_user_lock_owner( kmp_user_lock_p lck )
|
||||
|
||||
extern void ( *__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)
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
|
||||
#define __kmp_acquire_user_lock_with_checks(lck,gtid) \
|
||||
if (__kmp_user_lock_kind == lk_tas) { \
|
||||
@@ -665,7 +688,7 @@ __kmp_acquire_user_lock_with_checks( kmp_user_lock_p lck, kmp_int32 gtid )
|
||||
|
||||
extern int ( *__kmp_test_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)
|
||||
#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
|
||||
|
||||
#include "kmp_i18n.h" /* AC: KMP_FATAL definition */
|
||||
extern int __kmp_env_consistency_check; /* AC: copy from kmp.h here */
|
||||
@@ -696,7 +719,7 @@ __kmp_test_user_lock_with_checks( kmp_user_lock_p lck, kmp_int32 gtid )
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void ( *__kmp_release_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_int32 gtid );
|
||||
extern int ( *__kmp_release_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_int32 gtid );
|
||||
|
||||
static inline void
|
||||
__kmp_release_user_lock_with_checks( kmp_user_lock_p lck, kmp_int32 gtid )
|
||||
@@ -828,13 +851,13 @@ __kmp_test_nested_user_lock_with_checks( kmp_user_lock_p lck, kmp_int32 gtid )
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void ( *__kmp_release_nested_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_int32 gtid );
|
||||
extern int ( *__kmp_release_nested_user_lock_with_checks_ )( kmp_user_lock_p lck, kmp_int32 gtid );
|
||||
|
||||
static inline void
|
||||
static inline int
|
||||
__kmp_release_nested_user_lock_with_checks( kmp_user_lock_p lck, kmp_int32 gtid )
|
||||
{
|
||||
KMP_DEBUG_ASSERT( __kmp_release_nested_user_lock_with_checks_ != NULL );
|
||||
( *__kmp_release_nested_user_lock_with_checks_ )( lck, gtid );
|
||||
return ( *__kmp_release_nested_user_lock_with_checks_ )( lck, gtid );
|
||||
}
|
||||
|
||||
extern void ( *__kmp_init_nested_user_lock_with_checks_ )( kmp_user_lock_p lck );
|
||||
@@ -913,7 +936,26 @@ __kmp_set_user_lock_flags( kmp_user_lock_p lck, kmp_lock_flags_t flags )
|
||||
//
|
||||
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##kind##_##suffix; \
|
||||
__kmp_release##nest##user_lock_with_checks_ = ( int (*)( kmp_user_lock_p, kmp_int32 ) ) \
|
||||
__kmp_release##nest##kind##_##suffix; \
|
||||
__kmp_test##nest##user_lock_with_checks_ = ( int (*)( kmp_user_lock_p, kmp_int32 ) ) \
|
||||
__kmp_test##nest##kind##_##suffix; \
|
||||
__kmp_init##nest##user_lock_with_checks_ = ( void (*)( kmp_user_lock_p ) ) \
|
||||
__kmp_init##nest##kind##_##suffix; \
|
||||
__kmp_destroy##nest##user_lock_with_checks_ = ( void (*)( kmp_user_lock_p ) ) \
|
||||
__kmp_destroy##nest##kind##_##suffix; \
|
||||
}
|
||||
|
||||
#define KMP_BIND_USER_LOCK(kind) KMP_BIND_USER_LOCK_TEMPLATE(_, kind, lock)
|
||||
#define KMP_BIND_USER_LOCK_WITH_CHECKS(kind) KMP_BIND_USER_LOCK_TEMPLATE(_, kind, lock_with_checks)
|
||||
#define KMP_BIND_NESTED_USER_LOCK(kind) KMP_BIND_USER_LOCK_TEMPLATE(_nested_, kind, lock)
|
||||
#define KMP_BIND_NESTED_USER_LOCK_WITH_CHECKS(kind) KMP_BIND_USER_LOCK_TEMPLATE(_nested_, kind, lock_with_checks)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// User lock table & lock allocation
|
||||
@@ -978,9 +1020,220 @@ extern void __kmp_cleanup_user_locks();
|
||||
} \
|
||||
}
|
||||
|
||||
#endif // KMP_USE_DYNAMIC_LOCK
|
||||
|
||||
#undef KMP_PAD
|
||||
#undef KMP_GTID_DNE
|
||||
|
||||
#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
|
||||
|
||||
// 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
|
||||
# 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
|
||||
#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
|
||||
# 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
|
||||
|
||||
// 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)
|
||||
|
||||
// Base type for dynamic locks.
|
||||
typedef kmp_uint32 kmp_dyna_lock_t;
|
||||
|
||||
// Lock sequence that enumerates all lock kinds.
|
||||
// Always make this enumeration consistent with kmp_lockseq_t in the include directory.
|
||||
typedef enum {
|
||||
lockseq_indirect = 0,
|
||||
#define expand_seq(l,a) lockseq_##l,
|
||||
FOREACH_D_LOCK(expand_seq, 0)
|
||||
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)
|
||||
#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)
|
||||
|
||||
// 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)
|
||||
#undef expand_tag
|
||||
} kmp_direct_locktag_t;
|
||||
|
||||
// Indirect lock type
|
||||
typedef struct {
|
||||
kmp_user_lock_p lock;
|
||||
kmp_indirect_locktag_t type;
|
||||
} 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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))
|
||||
|
||||
// Extracts indirect lock index from a user lock pointer
|
||||
#define DYNA_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)]
|
||||
|
||||
// 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]
|
||||
|
||||
// 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)
|
||||
|
||||
// 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)
|
||||
|
||||
// Returns "free" lock value for the given lock type.
|
||||
#define DYNA_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)
|
||||
|
||||
// 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);
|
||||
|
||||
// Initializes global states and data structures for managing dynamic user locks.
|
||||
extern void __kmp_init_dynamic_user_locks();
|
||||
|
||||
// Allocates and returns an indirect lock with the given indirect lock tag.
|
||||
extern kmp_indirect_lock_t * __kmp_allocate_indirect_lock(void **, kmp_int32, kmp_indirect_locktag_t);
|
||||
|
||||
// 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.
|
||||
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) { \
|
||||
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) { \
|
||||
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 \
|
||||
? __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 \
|
||||
? __kmp_indirect_get_flags[(lck)->type]((lck)->lock) \
|
||||
: NULL )
|
||||
|
||||
//
|
||||
// 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;
|
||||
// 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) )
|
||||
|
||||
// Used once in kmp_error.c
|
||||
extern kmp_int32
|
||||
__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)
|
||||
|
||||
#endif // KMP_USE_DYNAMIC_LOCK
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
+55
-30
@@ -1,8 +1,7 @@
|
||||
#if USE_DEBUGGER
|
||||
/*
|
||||
* kmp_omp.h -- OpenMP definition for kmp_omp_struct_info_t.
|
||||
* This is for information about runtime library structures.
|
||||
* $Revision: 42105 $
|
||||
* $Date: 2013-03-11 14:51:34 -0500 (Mon, 11 Mar 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -30,7 +29,7 @@
|
||||
* stable, then any new updates to the structures or data structure traversal algorithms need to
|
||||
* change this value.
|
||||
*/
|
||||
#define KMP_OMP_VERSION 8
|
||||
#define KMP_OMP_VERSION 9
|
||||
|
||||
typedef struct {
|
||||
kmp_int32 offset;
|
||||
@@ -73,6 +72,7 @@ typedef struct {
|
||||
addr_and_size_t major;
|
||||
addr_and_size_t minor;
|
||||
addr_and_size_t build;
|
||||
addr_and_size_t openmp_version;
|
||||
addr_and_size_t banner;
|
||||
|
||||
/* Various globals. */
|
||||
@@ -80,16 +80,19 @@ typedef struct {
|
||||
addr_and_size_t roots; // Pointer to __kmp_root.
|
||||
addr_and_size_t capacity; // Pointer to __kmp_threads_capacity.
|
||||
addr_and_size_t monitor; // Pointer to __kmp_monitor.
|
||||
#if ! KMP_USE_DYNAMIC_LOCK
|
||||
addr_and_size_t lock_table; // Pointer to __kmp_lock_table.
|
||||
#endif
|
||||
addr_and_size_t func_microtask;
|
||||
addr_and_size_t func_fork;
|
||||
addr_and_size_t func_fork_teams;
|
||||
addr_and_size_t team_counter;
|
||||
addr_and_size_t task_counter;
|
||||
addr_and_size_t nthr_info;
|
||||
kmp_int32 address_width;
|
||||
kmp_int32 indexed_locks;
|
||||
kmp_int32 last_barrier;
|
||||
kmp_int32 deque_size;
|
||||
kmp_int32 last_barrier; // The end in enum barrier_type
|
||||
kmp_int32 deque_size; // TASK_DEQUE_SIZE
|
||||
|
||||
/* thread structure information. */
|
||||
kmp_int32 th_sizeof_struct;
|
||||
@@ -100,11 +103,17 @@ typedef struct {
|
||||
offset_and_size_t th_ident; // location for this thread (if available)
|
||||
offset_and_size_t th_spin_here; // is thread waiting for lock (if available)
|
||||
offset_and_size_t th_next_waiting; // next thread waiting for lock (if available)
|
||||
offset_and_size_t th_task_team;
|
||||
offset_and_size_t th_current_task;
|
||||
offset_and_size_t th_task_state;
|
||||
offset_and_size_t th_task_team; // task team struct
|
||||
offset_and_size_t th_current_task; // innermost task being executed
|
||||
offset_and_size_t th_task_state; // alternating 0/1 for task team identification
|
||||
offset_and_size_t th_bar;
|
||||
offset_and_size_t th_b_worker_arrived;
|
||||
offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it arrives to the barrier
|
||||
|
||||
/* 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
|
||||
|
||||
/* kmp_desc structure (for info field above) */
|
||||
kmp_int32 ds_sizeof_struct;
|
||||
@@ -122,11 +131,12 @@ typedef struct {
|
||||
offset_and_size_t t_serialized; // # levels of serialized teams
|
||||
offset_and_size_t t_id; // unique team id
|
||||
offset_and_size_t t_pkfn;
|
||||
offset_and_size_t t_task_team;
|
||||
offset_and_size_t t_implicit_task;
|
||||
offset_and_size_t t_task_team; // task team structure
|
||||
offset_and_size_t t_implicit_task; // taskdata for the thread's implicit task
|
||||
offset_and_size_t t_cancel_request;
|
||||
offset_and_size_t t_bar;
|
||||
offset_and_size_t t_b_master_arrived;
|
||||
offset_and_size_t t_b_team_arrived;
|
||||
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
|
||||
|
||||
/* root structure information */
|
||||
kmp_int32 r_sizeof_struct;
|
||||
@@ -150,12 +160,15 @@ typedef struct {
|
||||
offset_and_size_t lk_now_serving;
|
||||
offset_and_size_t lk_owner_id;
|
||||
offset_and_size_t lk_depth_locked;
|
||||
offset_and_size_t lk_lock_flags;
|
||||
|
||||
#if ! KMP_USE_DYNAMIC_LOCK
|
||||
/* lock_table_t */
|
||||
kmp_int32 lt_size_of_struct; /* Size and layout of kmp_lock_table_t. */
|
||||
offset_and_size_t lt_used;
|
||||
offset_and_size_t lt_allocated;
|
||||
offset_and_size_t lt_table;
|
||||
#endif
|
||||
|
||||
/* task_team_t */
|
||||
kmp_int32 tt_sizeof_struct;
|
||||
@@ -164,17 +177,37 @@ typedef struct {
|
||||
offset_and_size_t tt_nproc;
|
||||
offset_and_size_t tt_unfinished_threads;
|
||||
offset_and_size_t tt_active;
|
||||
offset_and_size_t tt_state;
|
||||
|
||||
/* kmp_taskdata_t */
|
||||
kmp_int32 td_sizeof_struct;
|
||||
offset_and_size_t td_task_id;
|
||||
offset_and_size_t td_flags;
|
||||
offset_and_size_t td_team;
|
||||
offset_and_size_t td_parent;
|
||||
offset_and_size_t td_ident;
|
||||
offset_and_size_t td_allocated_child_tasks;
|
||||
offset_and_size_t td_incomplete_child_tasks;
|
||||
offset_and_size_t td_task_id; // task id
|
||||
offset_and_size_t td_flags; // task flags
|
||||
offset_and_size_t td_team; // team for this task
|
||||
offset_and_size_t td_parent; // parent task
|
||||
offset_and_size_t td_level; // task testing level
|
||||
offset_and_size_t td_ident; // task identifier
|
||||
offset_and_size_t td_allocated_child_tasks; // child tasks (+ current task) not yet deallocated
|
||||
offset_and_size_t td_incomplete_child_tasks; // child tasks not yet complete
|
||||
|
||||
/* Taskwait */
|
||||
offset_and_size_t td_taskwait_ident;
|
||||
offset_and_size_t td_taskwait_counter;
|
||||
offset_and_size_t td_taskwait_thread; // gtid + 1 of thread encountered taskwait
|
||||
|
||||
/* 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
|
||||
offset_and_size_t td_cancel; // request for cancellation of this taskgroup
|
||||
|
||||
/* Task dependency */
|
||||
offset_and_size_t td_depnode; // pointer to graph node if the task has dependencies
|
||||
offset_and_size_t dn_node;
|
||||
offset_and_size_t dn_next;
|
||||
offset_and_size_t dn_successors;
|
||||
offset_and_size_t dn_task;
|
||||
offset_and_size_t dn_npredecessors;
|
||||
offset_and_size_t dn_nrefs;
|
||||
offset_and_size_t dn_routine;
|
||||
|
||||
/* kmp_thread_data_t */
|
||||
kmp_int32 hd_sizeof_struct;
|
||||
@@ -186,17 +219,9 @@ typedef struct {
|
||||
|
||||
// The last field of stable version.
|
||||
kmp_uint64 last_field;
|
||||
// Extensions.
|
||||
// When KMP_OMP_VERSION is bumped, move these fields up to appropriate location,
|
||||
// to let last_field be actually last.
|
||||
addr_and_size_t openmp_version;
|
||||
offset_and_size_t td_taskwait_ident;
|
||||
offset_and_size_t td_taskwait_counter;
|
||||
offset_and_size_t td_taskwait_thread;
|
||||
|
||||
offset_and_size_t lk_lock_flags;
|
||||
|
||||
} kmp_omp_struct_info_t;
|
||||
|
||||
#endif /* USE_DEBUGGER */
|
||||
|
||||
/* end of file */
|
||||
|
||||
+53
-123
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_os.h -- KPTS runtime header file.
|
||||
* $Revision: 42820 $
|
||||
* $Date: 2013-11-13 16:53:44 -0600 (Wed, 13 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -46,6 +44,7 @@
|
||||
#define KMP_COMPILER_ICC 0
|
||||
#define KMP_COMPILER_GCC 0
|
||||
#define KMP_COMPILER_CLANG 0
|
||||
#define KMP_COMPILER_MSVC 0
|
||||
|
||||
#if defined( __INTEL_COMPILER )
|
||||
# undef KMP_COMPILER_ICC
|
||||
@@ -56,108 +55,25 @@
|
||||
#elif defined( __GNUC__ )
|
||||
# undef KMP_COMPILER_GCC
|
||||
# define KMP_COMPILER_GCC 1
|
||||
#elif defined( _MSC_VER )
|
||||
# undef KMP_COMPILER_MSVC
|
||||
# define KMP_COMPILER_MSVC 1
|
||||
#else
|
||||
# error Unknown compiler
|
||||
#endif
|
||||
|
||||
/* ---------------------- Operating system recognition ------------------- */
|
||||
#include "kmp_platform.h"
|
||||
|
||||
#define KMP_OS_LINUX 0
|
||||
#define KMP_OS_FREEBSD 0
|
||||
#define KMP_OS_DARWIN 0
|
||||
#define KMP_OS_WINDOWS 0
|
||||
#define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
|
||||
|
||||
#define KMP_ARCH_X86 0
|
||||
#define KMP_ARCH_X86_64 0
|
||||
|
||||
#ifdef _WIN32
|
||||
# undef KMP_OS_WINDOWS
|
||||
# define KMP_OS_WINDOWS 1
|
||||
#endif
|
||||
|
||||
#if ( defined __APPLE__ && defined __MACH__ )
|
||||
# undef KMP_OS_DARWIN
|
||||
# define KMP_OS_DARWIN 1
|
||||
#endif
|
||||
|
||||
#if ( defined __linux )
|
||||
# undef KMP_OS_LINUX
|
||||
# define KMP_OS_LINUX 1
|
||||
#endif
|
||||
|
||||
#if ( defined __FreeBSD__ )
|
||||
# undef KMP_OS_FREEBSD
|
||||
# define KMP_OS_FREEBSD 1
|
||||
#endif
|
||||
|
||||
#if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)
|
||||
# error Unknown OS
|
||||
#endif
|
||||
|
||||
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_DARWIN
|
||||
# undef KMP_OS_UNIX
|
||||
# define KMP_OS_UNIX 1
|
||||
#endif
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
# if defined _M_AMD64
|
||||
# undef KMP_ARCH_X86_64
|
||||
# define KMP_ARCH_X86_64 1
|
||||
#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
|
||||
# define KMP_GROUP_AFFINITY 1
|
||||
# else
|
||||
# undef KMP_ARCH_X86
|
||||
# define KMP_ARCH_X86 1
|
||||
# define KMP_GROUP_AFFINITY 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if KMP_OS_UNIX
|
||||
# if defined __x86_64
|
||||
# undef KMP_ARCH_X86_64
|
||||
# define KMP_ARCH_X86_64 1
|
||||
# elif defined __i386
|
||||
# undef KMP_ARCH_X86
|
||||
# define KMP_ARCH_X86 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || \
|
||||
defined(__ARM_ARCH_7A__)
|
||||
# define KMP_ARCH_ARMV7 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV7) || defined(__ARM_ARCH_6__) || \
|
||||
defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \
|
||||
defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || \
|
||||
defined(__ARM_ARCH_6ZK__)
|
||||
# define KMP_ARCH_ARMV6 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV6) || defined(__ARM_ARCH_5T__) || \
|
||||
defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
|
||||
defined(__ARM_ARCH_5TEJ__)
|
||||
# define KMP_ARCH_ARMV5 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV5) || defined(__ARM_ARCH_4__) || \
|
||||
defined(__ARM_ARCH_4T__)
|
||||
# define KMP_ARCH_ARMV4 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV4) || defined(__ARM_ARCH_3__) || \
|
||||
defined(__ARM_ARCH_3M__)
|
||||
# define KMP_ARCH_ARMV3 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV3) || defined(__ARM_ARCH_2__)
|
||||
# define KMP_ARCH_ARMV2 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV2)
|
||||
# define KMP_ARCH_ARM 1
|
||||
#endif
|
||||
|
||||
#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM)
|
||||
# error Unknown or unsupported architecture
|
||||
#else
|
||||
# define KMP_AFFINITY_SUPPORTED 0
|
||||
# define KMP_GROUP_AFFINITY 0
|
||||
#endif
|
||||
|
||||
/* Check for quad-precision extension. */
|
||||
@@ -175,6 +91,8 @@
|
||||
typedef __float128 _Quad;
|
||||
# undef KMP_HAVE_QUAD
|
||||
# define KMP_HAVE_QUAD 1
|
||||
# elif KMP_COMPILER_MSVC
|
||||
typedef long double _Quad;
|
||||
# endif
|
||||
#else
|
||||
# if __LDBL_MAX_EXP__ >= 16384 && KMP_COMPILER_GCC
|
||||
@@ -232,7 +150,7 @@
|
||||
|
||||
#if KMP_ARCH_X86 || KMP_ARCH_ARM
|
||||
# define KMP_SIZE_T_SPEC KMP_UINT32_SPEC
|
||||
#elif KMP_ARCH_X86_64
|
||||
#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64
|
||||
# define KMP_SIZE_T_SPEC KMP_UINT64_SPEC
|
||||
#else
|
||||
# error "Can't determine size_t printf format specifier."
|
||||
@@ -320,7 +238,7 @@ typedef double kmp_real64;
|
||||
|
||||
#define KMP_EXPORT extern /* export declaration in guide libraries */
|
||||
|
||||
#if __GNUC__ == 4
|
||||
#if __GNUC__ >= 4
|
||||
#define __forceinline __inline
|
||||
#endif
|
||||
|
||||
@@ -335,6 +253,8 @@ typedef double kmp_real64;
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#define INTERNODE_CACHE_LINE 4096 /* for multi-node systems */
|
||||
|
||||
/* Define the default size of the cache line */
|
||||
#ifndef CACHE_LINE
|
||||
#define CACHE_LINE 128 /* cache line size in bytes */
|
||||
@@ -345,16 +265,6 @@ extern "C" {
|
||||
#endif
|
||||
#endif /* CACHE_LINE */
|
||||
|
||||
/* SGI's cache padding improvements using align decl specs (Ver 19) */
|
||||
#if !defined KMP_PERF_V19
|
||||
# define KMP_PERF_V19 KMP_ON
|
||||
#endif
|
||||
|
||||
/* SGI's improvements for inline argv (Ver 106) */
|
||||
#if !defined KMP_PERF_V106
|
||||
# define KMP_PERF_V106 KMP_ON
|
||||
#endif
|
||||
|
||||
#define KMP_CACHE_PREFETCH(ADDR) /* nothing */
|
||||
|
||||
/* Temporary note: if performance testing of this passes, we can remove
|
||||
@@ -362,10 +272,12 @@ extern "C" {
|
||||
#if KMP_OS_UNIX && defined(__GNUC__)
|
||||
# define KMP_DO_ALIGN(bytes) __attribute__((aligned(bytes)))
|
||||
# define KMP_ALIGN_CACHE __attribute__((aligned(CACHE_LINE)))
|
||||
# define KMP_ALIGN_CACHE_INTERNODE __attribute__((aligned(INTERNODE_CACHE_LINE)))
|
||||
# define KMP_ALIGN(bytes) __attribute__((aligned(bytes)))
|
||||
#else
|
||||
# define KMP_DO_ALIGN(bytes) __declspec( align(bytes) )
|
||||
# define KMP_ALIGN_CACHE __declspec( align(CACHE_LINE) )
|
||||
# define KMP_ALIGN_CACHE_INTERNODE __declspec( align(INTERNODE_CACHE_LINE) )
|
||||
# define KMP_ALIGN(bytes) __declspec( align(bytes) )
|
||||
#endif
|
||||
|
||||
@@ -419,6 +331,9 @@ enum kmp_mem_fence_type {
|
||||
# define KMP_TEST_THEN_DEC_ACQ32(p) InterlockedExchangeAdd( (volatile long *)(p), -1 )
|
||||
# define KMP_TEST_THEN_ADD32(p, v) InterlockedExchangeAdd( (volatile long *)(p), (v) )
|
||||
|
||||
extern kmp_int8 __kmp_test_then_add8( volatile kmp_int8 *p, kmp_int8 v );
|
||||
extern kmp_int8 __kmp_test_then_or8( volatile kmp_int8 *p, kmp_int8 v );
|
||||
extern kmp_int8 __kmp_test_then_and8( volatile kmp_int8 *p, kmp_int8 v );
|
||||
# define KMP_COMPARE_AND_STORE_RET32(p, cv, sv) InterlockedCompareExchange( (volatile long *)(p),(long)(sv),(long)(cv) )
|
||||
|
||||
# define KMP_XCHG_FIXED32(p, v) InterlockedExchange( (volatile long *)(p), (long)(v) )
|
||||
@@ -455,8 +370,11 @@ extern kmp_int32 __kmp_xchg_fixed32( volatile kmp_int32 *p, kmp_int32 v );
|
||||
extern kmp_int64 __kmp_xchg_fixed64( volatile kmp_int64 *p, kmp_int64 v );
|
||||
extern kmp_real32 __kmp_xchg_real32( volatile kmp_real32 *p, kmp_real32 v );
|
||||
extern kmp_real64 __kmp_xchg_real64( volatile kmp_real64 *p, kmp_real64 v );
|
||||
# define KMP_TEST_THEN_ADD8(p, v) __kmp_test_then_add8( (p), (v) )
|
||||
|
||||
//# define KMP_TEST_THEN_INC32(p) __kmp_test_then_add32( (p), 1 )
|
||||
# define KMP_TEST_THEN_OR8(p, v) __kmp_test_then_or8( (p), (v) )
|
||||
# define KMP_TEST_THEN_AND8(p, v) __kmp_test_then_and8( (p), (v) )
|
||||
//# define KMP_TEST_THEN_INC_ACQ32(p) __kmp_test_then_add32( (p), 1 )
|
||||
# define KMP_TEST_THEN_INC64(p) __kmp_test_then_add64( (p), 1LL )
|
||||
# define KMP_TEST_THEN_INC_ACQ64(p) __kmp_test_then_add64( (p), 1LL )
|
||||
@@ -504,10 +422,13 @@ extern kmp_real64 __kmp_xchg_real64( volatile kmp_real64 *p, kmp_real64 v );
|
||||
# define KMP_XCHG_REAL64(p, v) __kmp_xchg_real64( (p), (v) );
|
||||
|
||||
|
||||
#elif (KMP_ASM_INTRINS && (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_DARWIN)) || !(KMP_ARCH_X86 || KMP_ARCH_X86_64)
|
||||
#elif (KMP_ASM_INTRINS && KMP_OS_UNIX) || !(KMP_ARCH_X86 || KMP_ARCH_X86_64)
|
||||
# define KMP_TEST_THEN_ADD8(p, v) __sync_fetch_and_add( (kmp_int8 *)(p), (v) )
|
||||
|
||||
/* cast p to correct type so that proper intrinsic will be used */
|
||||
# define KMP_TEST_THEN_INC32(p) __sync_fetch_and_add( (kmp_int32 *)(p), 1 )
|
||||
# define KMP_TEST_THEN_OR8(p, v) __sync_fetch_and_or( (kmp_int8 *)(p), (v) )
|
||||
# define KMP_TEST_THEN_AND8(p, v) __sync_fetch_and_and( (kmp_int8 *)(p), (v) )
|
||||
# define KMP_TEST_THEN_INC_ACQ32(p) __sync_fetch_and_add( (kmp_int32 *)(p), 1 )
|
||||
# define KMP_TEST_THEN_INC64(p) __sync_fetch_and_add( (kmp_int64 *)(p), 1LL )
|
||||
# define KMP_TEST_THEN_INC_ACQ64(p) __sync_fetch_and_add( (kmp_int64 *)(p), 1LL )
|
||||
@@ -547,6 +468,9 @@ extern kmp_real64 __kmp_xchg_real64( volatile kmp_real64 *p, kmp_real64 v );
|
||||
#define KMP_XCHG_FIXED32(p, v) __sync_lock_test_and_set( (volatile kmp_uint32 *)(p), (kmp_uint32)(v) )
|
||||
#define KMP_XCHG_FIXED64(p, v) __sync_lock_test_and_set( (volatile kmp_uint64 *)(p), (kmp_uint64)(v) )
|
||||
|
||||
extern kmp_int8 __kmp_test_then_add8( volatile kmp_int8 *p, kmp_int8 v );
|
||||
extern kmp_int8 __kmp_test_then_or8( volatile kmp_int8 *p, kmp_int8 v );
|
||||
extern kmp_int8 __kmp_test_then_and8( volatile kmp_int8 *p, kmp_int8 v );
|
||||
inline kmp_real32 KMP_XCHG_REAL32( volatile kmp_real32 *p, kmp_real32 v)
|
||||
{
|
||||
kmp_int32 tmp = __sync_lock_test_and_set( (kmp_int32*)p, *(kmp_int32*)&v);
|
||||
@@ -582,9 +506,12 @@ extern kmp_int16 __kmp_xchg_fixed16( volatile kmp_int16 *p, kmp_int16 v );
|
||||
extern kmp_int32 __kmp_xchg_fixed32( volatile kmp_int32 *p, kmp_int32 v );
|
||||
extern kmp_int64 __kmp_xchg_fixed64( volatile kmp_int64 *p, kmp_int64 v );
|
||||
extern kmp_real32 __kmp_xchg_real32( volatile kmp_real32 *p, kmp_real32 v );
|
||||
# define KMP_TEST_THEN_ADD8(p, v) __kmp_test_then_add8( (p), (v) )
|
||||
extern kmp_real64 __kmp_xchg_real64( volatile kmp_real64 *p, kmp_real64 v );
|
||||
|
||||
# define KMP_TEST_THEN_INC32(p) __kmp_test_then_add32( (p), 1 )
|
||||
# define KMP_TEST_THEN_OR8(p, v) __kmp_test_then_or8( (p), (v) )
|
||||
# define KMP_TEST_THEN_AND8(p, v) __kmp_test_then_and8( (p), (v) )
|
||||
# define KMP_TEST_THEN_INC_ACQ32(p) __kmp_test_then_add32( (p), 1 )
|
||||
# define KMP_TEST_THEN_INC64(p) __kmp_test_then_add64( (p), 1LL )
|
||||
# define KMP_TEST_THEN_INC_ACQ64(p) __kmp_test_then_add64( (p), 1LL )
|
||||
@@ -633,17 +560,6 @@ extern kmp_real64 __kmp_xchg_real64( volatile kmp_real64 *p, kmp_real64 v );
|
||||
|
||||
#endif /* KMP_ASM_INTRINS */
|
||||
|
||||
# if !KMP_MIC
|
||||
//
|
||||
// no routines for floating addition on MIC
|
||||
// no intrinsic support for floating addition on UNIX
|
||||
//
|
||||
extern kmp_real32 __kmp_test_then_add_real32 ( volatile kmp_real32 *p, kmp_real32 v );
|
||||
extern kmp_real64 __kmp_test_then_add_real64 ( volatile kmp_real64 *p, kmp_real64 v );
|
||||
# define KMP_TEST_THEN_ADD_REAL32(p, v) __kmp_test_then_add_real32( (p), (v) )
|
||||
# define KMP_TEST_THEN_ADD_REAL64(p, v) __kmp_test_then_add_real64( (p), (v) )
|
||||
# endif
|
||||
|
||||
|
||||
/* ------------- relaxed consistency memory model stuff ------------------ */
|
||||
|
||||
@@ -657,6 +573,10 @@ extern kmp_real64 __kmp_test_then_add_real64 ( volatile kmp_real64 *p, kmp_real6
|
||||
# endif
|
||||
#endif /* KMP_OS_WINDOWS */
|
||||
|
||||
#if KMP_ARCH_PPC64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64
|
||||
# define KMP_MB() __sync_synchronize()
|
||||
#endif
|
||||
|
||||
#ifndef KMP_MB
|
||||
# define KMP_MB() /* nothing to do */
|
||||
#endif
|
||||
@@ -681,6 +601,8 @@ extern kmp_real64 __kmp_test_then_add_real64 ( volatile kmp_real64 *p, kmp_real6
|
||||
# define KMP_LD_ACQ64(A) ( *(A) )
|
||||
#endif
|
||||
|
||||
#define TCR_1(a) (a)
|
||||
#define TCW_1(a,b) (a) = (b)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
//
|
||||
// FIXME - maybe this should this be
|
||||
@@ -707,7 +629,7 @@ extern kmp_real64 __kmp_test_then_add_real64 ( volatile kmp_real64 *p, kmp_real6
|
||||
#define TCX_SYNC_8(a,b,c) KMP_COMPARE_AND_STORE_REL64((volatile kmp_int64 *)(volatile void *)&(a), (kmp_int64)(b), (kmp_int64)(c))
|
||||
|
||||
#if KMP_ARCH_X86
|
||||
|
||||
// What about ARM?
|
||||
#define TCR_PTR(a) ((void *)TCR_4(a))
|
||||
#define TCW_PTR(a,b) TCW_4((a),(b))
|
||||
#define TCR_SYNC_PTR(a) ((void *)TCR_SYNC_4(a))
|
||||
@@ -763,7 +685,7 @@ typedef void (*microtask_t)( int *gtid, int *npr, ... );
|
||||
#endif /* KMP_I8 */
|
||||
|
||||
/* 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_OS_LINUX
|
||||
#if (KMP_ARCH_X86_64 || KMP_ARCH_PPC64) && KMP_OS_LINUX
|
||||
# define STATIC_EFI2_WORKAROUND
|
||||
#else
|
||||
# define STATIC_EFI2_WORKAROUND static
|
||||
@@ -783,6 +705,11 @@ typedef void (*microtask_t)( int *gtid, int *npr, ... );
|
||||
# define USE_CMPXCHG_FIX 1
|
||||
#endif
|
||||
|
||||
// Enable dynamic user lock
|
||||
#ifndef KMP_USE_DYNAMIC_LOCK
|
||||
# define KMP_USE_DYNAMIC_LOCK 0
|
||||
#endif
|
||||
|
||||
// Warning levels
|
||||
enum kmp_warnings_level {
|
||||
kmp_warnings_off = 0, /* No warnings */
|
||||
@@ -796,3 +723,6 @@ enum kmp_warnings_level {
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif /* KMP_OS_H */
|
||||
// Safe C API
|
||||
#include "kmp_safe_c_api.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* kmp_platform.h -- header for determining operating system and architecture
|
||||
*/
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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_PLATFORM_H
|
||||
#define KMP_PLATFORM_H
|
||||
|
||||
/* ---------------------- Operating system recognition ------------------- */
|
||||
|
||||
#define KMP_OS_LINUX 0
|
||||
#define KMP_OS_FREEBSD 0
|
||||
#define KMP_OS_DARWIN 0
|
||||
#define KMP_OS_WINDOWS 0
|
||||
#define KMP_OS_CNK 0
|
||||
#define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
# undef KMP_OS_WINDOWS
|
||||
# define KMP_OS_WINDOWS 1
|
||||
#endif
|
||||
|
||||
#if ( defined __APPLE__ && defined __MACH__ )
|
||||
# undef KMP_OS_DARWIN
|
||||
# define KMP_OS_DARWIN 1
|
||||
#endif
|
||||
|
||||
// in some ppc64 linux installations, only the second condition is met
|
||||
#if ( defined __linux )
|
||||
# undef KMP_OS_LINUX
|
||||
# define KMP_OS_LINUX 1
|
||||
#elif ( defined __linux__)
|
||||
# undef KMP_OS_LINUX
|
||||
# define KMP_OS_LINUX 1
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if ( defined __FreeBSD__ )
|
||||
# undef KMP_OS_FREEBSD
|
||||
# define KMP_OS_FREEBSD 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)
|
||||
# error Unknown OS
|
||||
#endif
|
||||
|
||||
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_DARWIN
|
||||
# undef KMP_OS_UNIX
|
||||
# define KMP_OS_UNIX 1
|
||||
#endif
|
||||
|
||||
/* ---------------------- Architecture recognition ------------------- */
|
||||
|
||||
#define KMP_ARCH_X86 0
|
||||
#define KMP_ARCH_X86_64 0
|
||||
#define KMP_ARCH_AARCH64 0
|
||||
#define KMP_ARCH_PPC64_BE 0
|
||||
#define KMP_ARCH_PPC64_LE 0
|
||||
#define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE)
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
# if defined _M_AMD64
|
||||
# undef KMP_ARCH_X86_64
|
||||
# define KMP_ARCH_X86_64 1
|
||||
# else
|
||||
# undef KMP_ARCH_X86
|
||||
# define KMP_ARCH_X86 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if KMP_OS_UNIX
|
||||
# if defined __x86_64
|
||||
# undef KMP_ARCH_X86_64
|
||||
# define KMP_ARCH_X86_64 1
|
||||
# elif defined __i386
|
||||
# undef KMP_ARCH_X86
|
||||
# define KMP_ARCH_X86 1
|
||||
# elif defined __powerpc64__
|
||||
# if defined __LITTLE_ENDIAN__
|
||||
# undef KMP_ARCH_PPC64_LE
|
||||
# define KMP_ARCH_PPC64_LE 1
|
||||
# else
|
||||
# undef KMP_ARCH_PPC64_BE
|
||||
# define KMP_ARCH_PPC64_BE 1
|
||||
# endif
|
||||
# elif defined __aarch64__
|
||||
# undef KMP_ARCH_AARCH64
|
||||
# define KMP_ARCH_AARCH64 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || \
|
||||
defined(__ARM_ARCH_7A__)
|
||||
# define KMP_ARCH_ARMV7 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV7) || defined(__ARM_ARCH_6__) || \
|
||||
defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \
|
||||
defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || \
|
||||
defined(__ARM_ARCH_6ZK__)
|
||||
# define KMP_ARCH_ARMV6 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV6) || defined(__ARM_ARCH_5T__) || \
|
||||
defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
|
||||
defined(__ARM_ARCH_5TEJ__)
|
||||
# define KMP_ARCH_ARMV5 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV5) || defined(__ARM_ARCH_4__) || \
|
||||
defined(__ARM_ARCH_4T__)
|
||||
# define KMP_ARCH_ARMV4 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV4) || defined(__ARM_ARCH_3__) || \
|
||||
defined(__ARM_ARCH_3M__)
|
||||
# define KMP_ARCH_ARMV3 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV3) || defined(__ARM_ARCH_2__)
|
||||
# define KMP_ARCH_ARMV2 1
|
||||
#endif
|
||||
|
||||
#if defined(KMP_ARCH_ARMV2)
|
||||
# define KMP_ARCH_ARM 1
|
||||
#endif
|
||||
|
||||
// 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
|
||||
#endif
|
||||
|
||||
#endif // KMP_PLATFORM_H
|
||||
+1944
-2828
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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_SAFE_C_API_H
|
||||
#define KMP_SAFE_C_API_H
|
||||
|
||||
//
|
||||
// Replacement for banned C API
|
||||
//
|
||||
|
||||
// Not every unsafe call listed here is handled now, but keeping everything
|
||||
// in one place should be handy for future maintenance.
|
||||
#if KMP_OS_WINDOWS
|
||||
|
||||
# define RSIZE_MAX_STR ( 4UL << 10 ) // 4KB
|
||||
|
||||
// _malloca was suggested, but it is not a drop-in replacement for _alloca
|
||||
# define KMP_ALLOCA _alloca
|
||||
|
||||
# define KMP_MEMCPY_S memcpy_s
|
||||
# define KMP_SNPRINTF sprintf_s
|
||||
# define KMP_SSCANF sscanf_s
|
||||
# define KMP_STRCPY_S strcpy_s
|
||||
# define KMP_STRNCPY_S strncpy_s
|
||||
|
||||
// Use this only when buffer size is unknown
|
||||
# define KMP_MEMCPY(dst, src, cnt) memcpy_s(dst, cnt, src, cnt)
|
||||
|
||||
# define KMP_STRLEN(str) strnlen_s(str, RSIZE_MAX_STR)
|
||||
|
||||
// Use this only when buffer size is unknown
|
||||
# define KMP_STRNCPY(dst, src, cnt) strncpy_s(dst, cnt, src, cnt)
|
||||
|
||||
// _TRUNCATE insures buffer size > max string to print.
|
||||
# define KMP_VSNPRINTF(dst, cnt, fmt, arg) vsnprintf_s(dst, cnt, _TRUNCATE, fmt, arg)
|
||||
|
||||
#else // KMP_OS_WINDOWS
|
||||
|
||||
// For now, these macros use the existing API.
|
||||
|
||||
# define KMP_ALLOCA alloca
|
||||
# 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_STRNCPY_S(dst, bsz, src, cnt) strncpy(dst, src, cnt)
|
||||
# define KMP_VSNPRINTF vsnprintf
|
||||
# define KMP_STRNCPY strncpy
|
||||
# define KMP_STRLEN strlen
|
||||
# define KMP_MEMCPY memcpy
|
||||
|
||||
#endif // KMP_OS_WINDOWS
|
||||
|
||||
#endif // KMP_SAFE_C_API_H
|
||||
+589
-26
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_sched.c -- static scheduling -- iteration initialization
|
||||
* $Revision: 42358 $
|
||||
* $Date: 2013-05-07 13:43:26 -0500 (Tue, 07 May 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -28,6 +26,12 @@
|
||||
#include "kmp_i18n.h"
|
||||
#include "kmp_str.h"
|
||||
#include "kmp_error.h"
|
||||
#include "kmp_stats.h"
|
||||
#include "kmp_itt.h"
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
#include "ompt-specific.h"
|
||||
#endif
|
||||
|
||||
// template for type limits
|
||||
template< typename T >
|
||||
@@ -79,6 +83,7 @@ __kmp_for_static_init(
|
||||
typename traits_t< T >::signed_t incr,
|
||||
typename traits_t< T >::signed_t chunk
|
||||
) {
|
||||
KMP_COUNT_BLOCK(OMP_FOR_static);
|
||||
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.. */
|
||||
@@ -87,7 +92,14 @@ __kmp_for_static_init(
|
||||
register kmp_uint32 nth;
|
||||
register UT trip_count;
|
||||
register kmp_team_t *team;
|
||||
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);
|
||||
#endif
|
||||
|
||||
KMP_DEBUG_ASSERT( plastiter && plower && pupper && pstride );
|
||||
KE_TRACE( 10, ("__kmpc_for_static_init called (%d)\n", global_tid));
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
@@ -108,12 +120,12 @@ __kmp_for_static_init(
|
||||
__kmp_push_workshare( global_tid, ct_pdo, loc );
|
||||
if ( incr == 0 ) {
|
||||
__kmp_error_construct( kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo, loc );
|
||||
|
||||
}
|
||||
}
|
||||
/* special handling for zero-trip loops */
|
||||
if ( incr > 0 ? (*pupper < *plower) : (*plower < *pupper) ) {
|
||||
*plastiter = FALSE;
|
||||
if( plastiter != NULL )
|
||||
*plastiter = FALSE;
|
||||
/* leave pupper and plower set to entire iteration space */
|
||||
*pstride = incr; /* value should never be used */
|
||||
// *plower = *pupper - incr; // let compiler bypass the illegal loop (like for(i=1;i<10;i--)) THIS LINE CAUSED shape2F/h_tests_1.f TO HAVE A FAILURE ON A ZERO-TRIP LOOP (lower=1,\
|
||||
@@ -130,6 +142,15 @@ __kmp_for_static_init(
|
||||
}
|
||||
#endif
|
||||
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) &&
|
||||
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
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,19 +158,20 @@ __kmp_for_static_init(
|
||||
if ( schedtype > kmp_ord_upper ) {
|
||||
// we are in DISTRIBUTE construct
|
||||
schedtype += kmp_sch_static - kmp_distribute_static; // AC: convert to usual schedule type
|
||||
tid = __kmp_threads[ gtid ]->th.th_team->t.t_master_tid;
|
||||
team = __kmp_threads[ gtid ]->th.th_team->t.t_parent;
|
||||
tid = th->th.th_team->t.t_master_tid;
|
||||
team = th->th.th_team->t.t_parent;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
tid = __kmp_tid_from_gtid( global_tid );
|
||||
team = __kmp_threads[ gtid ]->th.th_team;
|
||||
team = th->th.th_team;
|
||||
}
|
||||
|
||||
/* determine if "for" loop is an active worksharing construct */
|
||||
if ( team -> t.t_serialized ) {
|
||||
/* serialized parallel, each thread executes whole iteration space */
|
||||
*plastiter = TRUE;
|
||||
if( plastiter != NULL )
|
||||
*plastiter = TRUE;
|
||||
/* leave pupper and plower set to entire iteration space */
|
||||
*pstride = (incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1));
|
||||
|
||||
@@ -165,12 +187,22 @@ __kmp_for_static_init(
|
||||
}
|
||||
#endif
|
||||
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) &&
|
||||
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
|
||||
return;
|
||||
}
|
||||
nth = team->t.t_nproc;
|
||||
if ( nth == 1 ) {
|
||||
*plastiter = TRUE;
|
||||
|
||||
if( plastiter != NULL )
|
||||
*plastiter = TRUE;
|
||||
*pstride = (incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1));
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
@@ -183,6 +215,15 @@ __kmp_for_static_init(
|
||||
}
|
||||
#endif
|
||||
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) &&
|
||||
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
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,12 +233,13 @@ __kmp_for_static_init(
|
||||
} else if (incr == -1) {
|
||||
trip_count = *plower - *pupper + 1;
|
||||
} else {
|
||||
if ( incr > 1 ) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if ( __kmp_env_consistency_check ) {
|
||||
/* tripcount overflow? */
|
||||
if ( trip_count == 0 && *pupper != *plower ) {
|
||||
@@ -219,14 +261,16 @@ __kmp_for_static_init(
|
||||
} else {
|
||||
*plower = *pupper + incr;
|
||||
}
|
||||
*plastiter = ( tid == trip_count - 1 );
|
||||
if( plastiter != NULL )
|
||||
*plastiter = ( tid == trip_count - 1 );
|
||||
} else {
|
||||
if ( __kmp_static == kmp_sch_static_balanced ) {
|
||||
register UT small_chunk = trip_count / nth;
|
||||
register UT extras = trip_count % nth;
|
||||
*plower += incr * ( tid * small_chunk + ( tid < extras ? tid : extras ) );
|
||||
*pupper = *plower + small_chunk * incr - ( tid < extras ? 0 : incr );
|
||||
*plastiter = ( tid == nth - 1 );
|
||||
if( plastiter != NULL )
|
||||
*plastiter = ( tid == nth - 1 );
|
||||
} else {
|
||||
register T big_chunk_inc_count = ( trip_count/nth +
|
||||
( ( trip_count % nth ) ? 1 : 0) ) * incr;
|
||||
@@ -238,16 +282,16 @@ __kmp_for_static_init(
|
||||
*plower += tid * big_chunk_inc_count;
|
||||
*pupper = *plower + big_chunk_inc_count - incr;
|
||||
if ( incr > 0 ) {
|
||||
if ( *pupper < *plower ) {
|
||||
if( *pupper < *plower )
|
||||
*pupper = i_maxmin< T >::mx;
|
||||
}
|
||||
*plastiter = *plower <= old_upper && *pupper > old_upper - incr;
|
||||
if( plastiter != NULL )
|
||||
*plastiter = *plower <= old_upper && *pupper > old_upper - incr;
|
||||
if ( *pupper > old_upper ) *pupper = old_upper; // tracker C73258
|
||||
} else {
|
||||
if ( *pupper > *plower ) {
|
||||
if( *pupper > *plower )
|
||||
*pupper = i_maxmin< T >::mn;
|
||||
}
|
||||
*plastiter = *plower >= old_upper && *pupper < old_upper - incr;
|
||||
if( plastiter != NULL )
|
||||
*plastiter = *plower >= old_upper && *pupper < old_upper - incr;
|
||||
if ( *pupper < old_upper ) *pupper = old_upper; // tracker C73258
|
||||
}
|
||||
}
|
||||
@@ -256,7 +300,7 @@ __kmp_for_static_init(
|
||||
}
|
||||
case kmp_sch_static_chunked:
|
||||
{
|
||||
register T span;
|
||||
register ST span;
|
||||
if ( chunk < 1 ) {
|
||||
chunk = 1;
|
||||
}
|
||||
@@ -264,11 +308,8 @@ __kmp_for_static_init(
|
||||
*pstride = span * nth;
|
||||
*plower = *plower + (span * tid);
|
||||
*pupper = *plower + span - incr;
|
||||
/* TODO: is the following line a bug? Shouldn't it be plastiter instead of *plastiter ? */
|
||||
if (*plastiter) { /* only calculate this if it was requested */
|
||||
kmp_int32 lasttid = ((trip_count - 1) / ( UT )chunk) % nth;
|
||||
*plastiter = (tid == lasttid);
|
||||
}
|
||||
if( plastiter != NULL )
|
||||
*plastiter = (tid == ((trip_count - 1)/( UT )chunk) % nth);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -276,6 +317,23 @@ __kmp_for_static_init(
|
||||
break;
|
||||
}
|
||||
|
||||
#if USE_ITT_BUILD
|
||||
// Report loop metadata
|
||||
if ( KMP_MASTER_TID(tid) && __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
|
||||
#if OMP_40_ENABLED
|
||||
th->th.th_teams_microtask == NULL &&
|
||||
#endif
|
||||
team->t.t_active_level == 1 )
|
||||
{
|
||||
kmp_uint64 cur_chunk = chunk;
|
||||
// Calculate chunk in case it was not specified; it is specified for kmp_sch_static_chunked
|
||||
if ( schedtype == kmp_sch_static ) {
|
||||
cur_chunk = trip_count / nth + ( ( trip_count % nth ) ? 1 : 0);
|
||||
}
|
||||
// 0 - "static" schedule
|
||||
__kmp_itt_metadata_loop(loc, 0, trip_count, cur_chunk);
|
||||
}
|
||||
#endif
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
@@ -288,9 +346,367 @@ __kmp_for_static_init(
|
||||
}
|
||||
#endif
|
||||
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) &&
|
||||
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
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static void
|
||||
__kmp_dist_for_static_init(
|
||||
ident_t *loc,
|
||||
kmp_int32 gtid,
|
||||
kmp_int32 schedule,
|
||||
kmp_int32 *plastiter,
|
||||
T *plower,
|
||||
T *pupper,
|
||||
T *pupperDist,
|
||||
typename traits_t< T >::signed_t *pstride,
|
||||
typename traits_t< T >::signed_t incr,
|
||||
typename traits_t< T >::signed_t chunk
|
||||
) {
|
||||
KMP_COUNT_BLOCK(OMP_DISTR_FOR_static);
|
||||
typedef typename traits_t< T >::unsigned_t UT;
|
||||
typedef typename traits_t< T >::signed_t ST;
|
||||
register kmp_uint32 tid;
|
||||
register kmp_uint32 nth;
|
||||
register kmp_uint32 team_id;
|
||||
register kmp_uint32 nteams;
|
||||
register UT trip_count;
|
||||
register kmp_team_t *team;
|
||||
kmp_info_t * th;
|
||||
|
||||
KMP_DEBUG_ASSERT( plastiter && plower && pupper && pupperDist && pstride );
|
||||
KE_TRACE( 10, ("__kmpc_dist_for_static_init called (%d)\n", gtid));
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
// create format specifiers before the debug output
|
||||
buff = __kmp_str_format(
|
||||
"__kmpc_dist_for_static_init: T#%%d schedLoop=%%d liter=%%d "\
|
||||
"iter=(%%%s, %%%s, %%%s) chunk=%%%s signed?<%s>\n",
|
||||
traits_t< T >::spec, traits_t< T >::spec, traits_t< ST >::spec,
|
||||
traits_t< ST >::spec, traits_t< T >::spec );
|
||||
KD_TRACE(100, ( buff, gtid, schedule, *plastiter,
|
||||
*plower, *pupper, incr, chunk ) );
|
||||
__kmp_str_free( &buff );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( __kmp_env_consistency_check ) {
|
||||
__kmp_push_workshare( gtid, ct_pdo, loc );
|
||||
if( incr == 0 ) {
|
||||
__kmp_error_construct( kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo, loc );
|
||||
}
|
||||
if( incr > 0 ? (*pupper < *plower) : (*plower < *pupper) ) {
|
||||
// The loop is illegal.
|
||||
// Some zero-trip loops maintained by compiler, e.g.:
|
||||
// for(i=10;i<0;++i) // lower >= upper - run-time check
|
||||
// for(i=0;i>10;--i) // lower <= upper - run-time check
|
||||
// for(i=0;i>10;++i) // incr > 0 - compile-time check
|
||||
// for(i=10;i<0;--i) // incr < 0 - compile-time check
|
||||
// Compiler does not check the following illegal loops:
|
||||
// for(i=0;i<10;i+=incr) // where incr<0
|
||||
// for(i=10;i>0;i-=incr) // where incr<0
|
||||
__kmp_error_construct( kmp_i18n_msg_CnsLoopIncrIllegal, ct_pdo, loc );
|
||||
}
|
||||
}
|
||||
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
|
||||
nteams = th->th.th_teams_size.nteams;
|
||||
#endif
|
||||
team_id = team->t.t_master_tid;
|
||||
KMP_DEBUG_ASSERT(nteams == team->t.t_parent->t.t_nproc);
|
||||
|
||||
// compute global trip count
|
||||
if( incr == 1 ) {
|
||||
trip_count = *pupper - *plower + 1;
|
||||
} else if(incr == -1) {
|
||||
trip_count = *plower - *pupper + 1;
|
||||
} else {
|
||||
trip_count = (ST)(*pupper - *plower) / incr + 1; // cast to signed to cover incr<0 case
|
||||
}
|
||||
*pstride = *pupper - *plower; // just in case (can be unused)
|
||||
if( trip_count <= nteams ) {
|
||||
KMP_DEBUG_ASSERT(
|
||||
__kmp_static == kmp_sch_static_greedy || \
|
||||
__kmp_static == kmp_sch_static_balanced
|
||||
); // Unknown static scheduling type.
|
||||
// only masters of some teams get single iteration, other threads get nothing
|
||||
if( team_id < trip_count && tid == 0 ) {
|
||||
*pupper = *pupperDist = *plower = *plower + team_id * incr;
|
||||
} else {
|
||||
*pupperDist = *pupper;
|
||||
*plower = *pupper + incr; // compiler should skip loop body
|
||||
}
|
||||
if( plastiter != NULL )
|
||||
*plastiter = ( tid == 0 && team_id == trip_count - 1 );
|
||||
} else {
|
||||
// Get the team's chunk first (each team gets at most one chunk)
|
||||
if( __kmp_static == kmp_sch_static_balanced ) {
|
||||
register UT chunkD = trip_count / nteams;
|
||||
register UT extras = trip_count % nteams;
|
||||
*plower += incr * ( team_id * chunkD + ( team_id < extras ? team_id : extras ) );
|
||||
*pupperDist = *plower + chunkD * incr - ( team_id < extras ? 0 : incr );
|
||||
if( plastiter != NULL )
|
||||
*plastiter = ( team_id == nteams - 1 );
|
||||
} else {
|
||||
register T chunk_inc_count =
|
||||
( trip_count / nteams + ( ( trip_count % nteams ) ? 1 : 0) ) * incr;
|
||||
register T upper = *pupper;
|
||||
KMP_DEBUG_ASSERT( __kmp_static == kmp_sch_static_greedy );
|
||||
// Unknown static scheduling type.
|
||||
*plower += team_id * chunk_inc_count;
|
||||
*pupperDist = *plower + chunk_inc_count - incr;
|
||||
// Check/correct bounds if needed
|
||||
if( incr > 0 ) {
|
||||
if( *pupperDist < *plower )
|
||||
*pupperDist = i_maxmin< T >::mx;
|
||||
if( plastiter != NULL )
|
||||
*plastiter = *plower <= upper && *pupperDist > upper - incr;
|
||||
if( *pupperDist > upper )
|
||||
*pupperDist = upper; // tracker C73258
|
||||
if( *plower > *pupperDist ) {
|
||||
*pupper = *pupperDist; // no iterations available for the team
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
if( *pupperDist > *plower )
|
||||
*pupperDist = i_maxmin< T >::mn;
|
||||
if( plastiter != NULL )
|
||||
*plastiter = *plower >= upper && *pupperDist < upper - incr;
|
||||
if( *pupperDist < upper )
|
||||
*pupperDist = upper; // tracker C73258
|
||||
if( *plower < *pupperDist ) {
|
||||
*pupper = *pupperDist; // no iterations available for the team
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get the parallel loop chunk now (for thread)
|
||||
// compute trip count for team's chunk
|
||||
if( incr == 1 ) {
|
||||
trip_count = *pupperDist - *plower + 1;
|
||||
} else if(incr == -1) {
|
||||
trip_count = *plower - *pupperDist + 1;
|
||||
} else {
|
||||
trip_count = (ST)(*pupperDist - *plower) / incr + 1;
|
||||
}
|
||||
KMP_DEBUG_ASSERT( trip_count );
|
||||
switch( schedule ) {
|
||||
case kmp_sch_static:
|
||||
{
|
||||
if( trip_count <= nth ) {
|
||||
KMP_DEBUG_ASSERT(
|
||||
__kmp_static == kmp_sch_static_greedy || \
|
||||
__kmp_static == kmp_sch_static_balanced
|
||||
); // Unknown static scheduling type.
|
||||
if( tid < trip_count )
|
||||
*pupper = *plower = *plower + tid * incr;
|
||||
else
|
||||
*plower = *pupper + incr; // no iterations available
|
||||
if( plastiter != NULL )
|
||||
if( *plastiter != 0 && !( tid == trip_count - 1 ) )
|
||||
*plastiter = 0;
|
||||
} else {
|
||||
if( __kmp_static == kmp_sch_static_balanced ) {
|
||||
register UT chunkL = trip_count / nth;
|
||||
register UT extras = trip_count % nth;
|
||||
*plower += incr * (tid * chunkL + (tid < extras ? tid : extras));
|
||||
*pupper = *plower + chunkL * incr - (tid < extras ? 0 : incr);
|
||||
if( plastiter != NULL )
|
||||
if( *plastiter != 0 && !( tid == nth - 1 ) )
|
||||
*plastiter = 0;
|
||||
} else {
|
||||
register T chunk_inc_count =
|
||||
( trip_count / nth + ( ( trip_count % nth ) ? 1 : 0) ) * incr;
|
||||
register T upper = *pupperDist;
|
||||
KMP_DEBUG_ASSERT( __kmp_static == kmp_sch_static_greedy );
|
||||
// Unknown static scheduling type.
|
||||
*plower += tid * chunk_inc_count;
|
||||
*pupper = *plower + chunk_inc_count - incr;
|
||||
if( incr > 0 ) {
|
||||
if( *pupper < *plower )
|
||||
*pupper = i_maxmin< T >::mx;
|
||||
if( plastiter != NULL )
|
||||
if( *plastiter != 0 && !(*plower <= upper && *pupper > upper - incr) )
|
||||
*plastiter = 0;
|
||||
if( *pupper > upper )
|
||||
*pupper = upper;//tracker C73258
|
||||
} else {
|
||||
if( *pupper > *plower )
|
||||
*pupper = i_maxmin< T >::mn;
|
||||
if( plastiter != NULL )
|
||||
if( *plastiter != 0 && !(*plower >= upper && *pupper < upper - incr) )
|
||||
*plastiter = 0;
|
||||
if( *pupper < upper )
|
||||
*pupper = upper;//tracker C73258
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kmp_sch_static_chunked:
|
||||
{
|
||||
register ST span;
|
||||
if( chunk < 1 )
|
||||
chunk = 1;
|
||||
span = chunk * incr;
|
||||
*pstride = span * nth;
|
||||
*plower = *plower + (span * tid);
|
||||
*pupper = *plower + span - incr;
|
||||
if( plastiter != NULL )
|
||||
if( *plastiter != 0 && !(tid == ((trip_count - 1) / ( UT )chunk) % nth) )
|
||||
*plastiter = 0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
KMP_ASSERT2( 0, "__kmpc_dist_for_static_init: unknown loop scheduling type" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
end:;
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
// create format specifiers before the debug output
|
||||
buff = __kmp_str_format(
|
||||
"__kmpc_dist_for_static_init: last=%%d lo=%%%s up=%%%s upDist=%%%s "\
|
||||
"stride=%%%s signed?<%s>\n",
|
||||
traits_t< T >::spec, traits_t< T >::spec, traits_t< T >::spec,
|
||||
traits_t< ST >::spec, traits_t< T >::spec );
|
||||
KD_TRACE(100, ( buff, *plastiter, *plower, *pupper, *pupperDist, *pstride ) );
|
||||
__kmp_str_free( &buff );
|
||||
}
|
||||
#endif
|
||||
KE_TRACE( 10, ("__kmpc_dist_for_static_init: T#%d return\n", gtid ) );
|
||||
return;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static void
|
||||
__kmp_team_static_init(
|
||||
ident_t *loc,
|
||||
kmp_int32 gtid,
|
||||
kmp_int32 *p_last,
|
||||
T *p_lb,
|
||||
T *p_ub,
|
||||
typename traits_t< T >::signed_t *p_st,
|
||||
typename traits_t< T >::signed_t incr,
|
||||
typename traits_t< T >::signed_t chunk
|
||||
) {
|
||||
// The routine returns the first chunk distributed to the team and
|
||||
// stride for next chunks calculation.
|
||||
// Last iteration flag set for the team that will execute
|
||||
// the last iteration of the loop.
|
||||
// The routine is called for dist_schedue(static,chunk) only.
|
||||
typedef typename traits_t< T >::unsigned_t UT;
|
||||
typedef typename traits_t< T >::signed_t ST;
|
||||
kmp_uint32 team_id;
|
||||
kmp_uint32 nteams;
|
||||
UT trip_count;
|
||||
T lower;
|
||||
T upper;
|
||||
ST span;
|
||||
kmp_team_t *team;
|
||||
kmp_info_t *th;
|
||||
|
||||
KMP_DEBUG_ASSERT( p_last && p_lb && p_ub && p_st );
|
||||
KE_TRACE( 10, ("__kmp_team_static_init called (%d)\n", gtid));
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
// create format specifiers before the debug output
|
||||
buff = __kmp_str_format( "__kmp_team_static_init enter: T#%%d liter=%%d "\
|
||||
"iter=(%%%s, %%%s, %%%s) chunk %%%s; signed?<%s>\n",
|
||||
traits_t< T >::spec, traits_t< T >::spec, traits_t< ST >::spec,
|
||||
traits_t< ST >::spec, traits_t< T >::spec );
|
||||
KD_TRACE(100, ( buff, gtid, *p_last, *p_lb, *p_ub, *p_st, chunk ) );
|
||||
__kmp_str_free( &buff );
|
||||
}
|
||||
#endif
|
||||
|
||||
lower = *p_lb;
|
||||
upper = *p_ub;
|
||||
if( __kmp_env_consistency_check ) {
|
||||
if( incr == 0 ) {
|
||||
__kmp_error_construct( kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo, loc );
|
||||
}
|
||||
if( incr > 0 ? (upper < lower) : (lower < upper) ) {
|
||||
// The loop is illegal.
|
||||
// Some zero-trip loops maintained by compiler, e.g.:
|
||||
// for(i=10;i<0;++i) // lower >= upper - run-time check
|
||||
// for(i=0;i>10;--i) // lower <= upper - run-time check
|
||||
// for(i=0;i>10;++i) // incr > 0 - compile-time check
|
||||
// for(i=10;i<0;--i) // incr < 0 - compile-time check
|
||||
// Compiler does not check the following illegal loops:
|
||||
// for(i=0;i<10;i+=incr) // where incr<0
|
||||
// for(i=10;i>0;i-=incr) // where incr<0
|
||||
__kmp_error_construct( kmp_i18n_msg_CnsLoopIncrIllegal, ct_pdo, loc );
|
||||
}
|
||||
}
|
||||
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
|
||||
nteams = th->th.th_teams_size.nteams;
|
||||
#endif
|
||||
team_id = team->t.t_master_tid;
|
||||
KMP_DEBUG_ASSERT(nteams == team->t.t_parent->t.t_nproc);
|
||||
|
||||
// compute trip count
|
||||
if( incr == 1 ) {
|
||||
trip_count = upper - lower + 1;
|
||||
} else if(incr == -1) {
|
||||
trip_count = lower - upper + 1;
|
||||
} else {
|
||||
trip_count = (ST)(upper - lower) / incr + 1; // cast to signed to cover incr<0 case
|
||||
}
|
||||
if( chunk < 1 )
|
||||
chunk = 1;
|
||||
span = chunk * incr;
|
||||
*p_st = span * nteams;
|
||||
*p_lb = lower + (span * team_id);
|
||||
*p_ub = *p_lb + span - incr;
|
||||
if ( p_last != NULL )
|
||||
*p_last = (team_id == ((trip_count - 1)/(UT)chunk) % nteams);
|
||||
// Correct upper bound if needed
|
||||
if( incr > 0 ) {
|
||||
if( *p_ub < *p_lb ) // overflow?
|
||||
*p_ub = i_maxmin< T >::mx;
|
||||
if( *p_ub > upper )
|
||||
*p_ub = upper; // tracker C73258
|
||||
} else { // incr < 0
|
||||
if( *p_ub > *p_lb )
|
||||
*p_ub = i_maxmin< T >::mn;
|
||||
if( *p_ub < upper )
|
||||
*p_ub = upper; // tracker C73258
|
||||
}
|
||||
#ifdef KMP_DEBUG
|
||||
{
|
||||
const char * buff;
|
||||
// create format specifiers before the debug output
|
||||
buff = __kmp_str_format( "__kmp_team_static_init exit: T#%%d team%%u liter=%%d "\
|
||||
"iter=(%%%s, %%%s, %%%s) chunk %%%s\n",
|
||||
traits_t< T >::spec, traits_t< T >::spec, traits_t< ST >::spec,
|
||||
traits_t< ST >::spec );
|
||||
KD_TRACE(100, ( buff, gtid, team_id, *p_last, *p_lb, *p_ub, *p_st, chunk ) );
|
||||
__kmp_str_free( &buff );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
extern "C" {
|
||||
|
||||
@@ -310,7 +726,7 @@ Each of the four functions here are identical apart from the argument types.
|
||||
|
||||
The functions compute the upper and lower bounds and stride to be used for the set of iterations
|
||||
to be executed by the current thread from the statically scheduled loop that is described by the
|
||||
initial values of the bround, stride, increment and chunk size.
|
||||
initial values of the bounds, stride, increment and chunk size.
|
||||
|
||||
@{
|
||||
*/
|
||||
@@ -362,5 +778,152 @@ __kmpc_for_static_init_8u( ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, km
|
||||
@}
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ingroup WORK_SHARING
|
||||
@param loc Source code location
|
||||
@param gtid Global thread id of this thread
|
||||
@param schedule Scheduling type for the parallel loop
|
||||
@param plastiter Pointer to the "last iteration" flag
|
||||
@param plower Pointer to the lower bound
|
||||
@param pupper Pointer to the upper bound of loop chunk
|
||||
@param pupperD Pointer to the upper bound of dist_chunk
|
||||
@param pstride Pointer to the stride for parallel loop
|
||||
@param incr Loop increment
|
||||
@param chunk The chunk size for the parallel loop
|
||||
|
||||
Each of the four functions here are identical apart from the argument types.
|
||||
|
||||
The functions compute the upper and lower bounds and strides to be used for the set of iterations
|
||||
to be executed by the current thread from the statically scheduled loop that is described by the
|
||||
initial values of the bounds, strides, increment and chunks for parallel loop and distribute
|
||||
constructs.
|
||||
|
||||
@{
|
||||
*/
|
||||
void
|
||||
__kmpc_dist_for_static_init_4(
|
||||
ident_t *loc, kmp_int32 gtid, kmp_int32 schedule, kmp_int32 *plastiter,
|
||||
kmp_int32 *plower, kmp_int32 *pupper, kmp_int32 *pupperD,
|
||||
kmp_int32 *pstride, kmp_int32 incr, kmp_int32 chunk )
|
||||
{
|
||||
__kmp_dist_for_static_init< kmp_int32 >(
|
||||
loc, gtid, schedule, plastiter, plower, pupper, pupperD, pstride, incr, chunk );
|
||||
}
|
||||
|
||||
/*!
|
||||
See @ref __kmpc_dist_for_static_init_4
|
||||
*/
|
||||
void
|
||||
__kmpc_dist_for_static_init_4u(
|
||||
ident_t *loc, kmp_int32 gtid, kmp_int32 schedule, kmp_int32 *plastiter,
|
||||
kmp_uint32 *plower, kmp_uint32 *pupper, kmp_uint32 *pupperD,
|
||||
kmp_int32 *pstride, kmp_int32 incr, kmp_int32 chunk )
|
||||
{
|
||||
__kmp_dist_for_static_init< kmp_uint32 >(
|
||||
loc, gtid, schedule, plastiter, plower, pupper, pupperD, pstride, incr, chunk );
|
||||
}
|
||||
|
||||
/*!
|
||||
See @ref __kmpc_dist_for_static_init_4
|
||||
*/
|
||||
void
|
||||
__kmpc_dist_for_static_init_8(
|
||||
ident_t *loc, kmp_int32 gtid, kmp_int32 schedule, kmp_int32 *plastiter,
|
||||
kmp_int64 *plower, kmp_int64 *pupper, kmp_int64 *pupperD,
|
||||
kmp_int64 *pstride, kmp_int64 incr, kmp_int64 chunk )
|
||||
{
|
||||
__kmp_dist_for_static_init< kmp_int64 >(
|
||||
loc, gtid, schedule, plastiter, plower, pupper, pupperD, pstride, incr, chunk );
|
||||
}
|
||||
|
||||
/*!
|
||||
See @ref __kmpc_dist_for_static_init_4
|
||||
*/
|
||||
void
|
||||
__kmpc_dist_for_static_init_8u(
|
||||
ident_t *loc, kmp_int32 gtid, kmp_int32 schedule, kmp_int32 *plastiter,
|
||||
kmp_uint64 *plower, kmp_uint64 *pupper, kmp_uint64 *pupperD,
|
||||
kmp_int64 *pstride, kmp_int64 incr, kmp_int64 chunk )
|
||||
{
|
||||
__kmp_dist_for_static_init< kmp_uint64 >(
|
||||
loc, gtid, schedule, plastiter, plower, pupper, pupperD, pstride, incr, chunk );
|
||||
}
|
||||
/*!
|
||||
@}
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// Auxiliary routines for Distribute Parallel Loop construct implementation
|
||||
// Transfer call to template< type T >
|
||||
// __kmp_team_static_init( ident_t *loc, int gtid,
|
||||
// int *p_last, T *lb, T *ub, ST *st, ST incr, ST chunk )
|
||||
|
||||
/*!
|
||||
@ingroup WORK_SHARING
|
||||
@{
|
||||
@param loc Source location
|
||||
@param gtid Global thread id
|
||||
@param p_last pointer to last iteration flag
|
||||
@param p_lb pointer to Lower bound
|
||||
@param p_ub pointer to Upper bound
|
||||
@param p_st Step (or increment if you prefer)
|
||||
@param incr Loop increment
|
||||
@param chunk The chunk size to block with
|
||||
|
||||
The functions compute the upper and lower bounds and stride to be used for the set of iterations
|
||||
to be executed by the current team from the statically scheduled loop that is described by the
|
||||
initial values of the bounds, stride, increment and chunk for the distribute construct as part of
|
||||
composite distribute parallel loop construct.
|
||||
These functions are all identical apart from the types of the arguments.
|
||||
*/
|
||||
|
||||
void
|
||||
__kmpc_team_static_init_4(
|
||||
ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
|
||||
kmp_int32 *p_lb, kmp_int32 *p_ub, kmp_int32 *p_st, kmp_int32 incr, kmp_int32 chunk )
|
||||
{
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_team_static_init< kmp_int32 >( loc, gtid, p_last, p_lb, p_ub, p_st, incr, chunk );
|
||||
}
|
||||
|
||||
/*!
|
||||
See @ref __kmpc_team_static_init_4
|
||||
*/
|
||||
void
|
||||
__kmpc_team_static_init_4u(
|
||||
ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
|
||||
kmp_uint32 *p_lb, kmp_uint32 *p_ub, kmp_int32 *p_st, kmp_int32 incr, kmp_int32 chunk )
|
||||
{
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_team_static_init< kmp_uint32 >( loc, gtid, p_last, p_lb, p_ub, p_st, incr, chunk );
|
||||
}
|
||||
|
||||
/*!
|
||||
See @ref __kmpc_team_static_init_4
|
||||
*/
|
||||
void
|
||||
__kmpc_team_static_init_8(
|
||||
ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
|
||||
kmp_int64 *p_lb, kmp_int64 *p_ub, kmp_int64 *p_st, kmp_int64 incr, kmp_int64 chunk )
|
||||
{
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_team_static_init< kmp_int64 >( loc, gtid, p_last, p_lb, p_ub, p_st, incr, chunk );
|
||||
}
|
||||
|
||||
/*!
|
||||
See @ref __kmpc_team_static_init_4
|
||||
*/
|
||||
void
|
||||
__kmpc_team_static_init_8u(
|
||||
ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
|
||||
kmp_uint64 *p_lb, kmp_uint64 *p_ub, kmp_int64 *p_st, kmp_int64 incr, kmp_int64 chunk )
|
||||
{
|
||||
KMP_DEBUG_ASSERT( __kmp_init_serial );
|
||||
__kmp_team_static_init< kmp_uint64 >( loc, gtid, p_last, p_lb, p_ub, p_st, incr, chunk );
|
||||
}
|
||||
/*!
|
||||
@}
|
||||
*/
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
+369
-338
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_settings.h -- Initialize environment variables
|
||||
* $Revision: 42598 $
|
||||
* $Date: 2013-08-19 15:40:56 -0500 (Mon, 19 Aug 2013) $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,615 @@
|
||||
/** @file kmp_stats.cpp
|
||||
* Statistics gathering and processing.
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#if KMP_STATS_ENABLED
|
||||
|
||||
#include "kmp.h"
|
||||
#include "kmp_str.h"
|
||||
#include "kmp_lock.h"
|
||||
#include "kmp_stats.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <stdlib.h> // for atexit
|
||||
|
||||
#define STRINGIZE2(x) #x
|
||||
#define STRINGIZE(x) STRINGIZE2(x)
|
||||
|
||||
#define expandName(name,flags,ignore) {STRINGIZE(name),flags},
|
||||
statInfo timeStat::timerInfo[] = {
|
||||
KMP_FOREACH_TIMER(expandName,0)
|
||||
{0,0}
|
||||
};
|
||||
const statInfo counter::counterInfo[] = {
|
||||
KMP_FOREACH_COUNTER(expandName,0)
|
||||
{0,0}
|
||||
};
|
||||
#undef expandName
|
||||
|
||||
#define expandName(ignore1,ignore2,ignore3) {0.0,0.0,0.0},
|
||||
kmp_stats_output_module::rgb_color kmp_stats_output_module::timerColorInfo[] = {
|
||||
KMP_FOREACH_TIMER(expandName,0)
|
||||
{0.0,0.0,0.0}
|
||||
};
|
||||
#undef expandName
|
||||
|
||||
const kmp_stats_output_module::rgb_color kmp_stats_output_module::globalColorArray[] = {
|
||||
{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, 0.0, 1.0}, // blue
|
||||
{0.6, 0.2, 0.8}, // purple
|
||||
{1.0, 0.0, 1.0}, // magenta
|
||||
{0.0, 0.4, 0.2}, // dark green
|
||||
{1.0, 1.0, 0.6}, // light yellow
|
||||
{0.6, 0.4, 0.6}, // dirty purple
|
||||
{0.0, 1.0, 1.0}, // cyan
|
||||
{1.0, 0.4, 0.8}, // pink
|
||||
{0.5, 0.5, 0.5}, // grey
|
||||
{0.8, 0.7, 0.5}, // brown
|
||||
{0.6, 0.6, 1.0}, // light blue
|
||||
{1.0, 0.7, 0.5}, // peach
|
||||
{0.8, 0.5, 1.0}, // lavender
|
||||
{0.6, 0.0, 0.0}, // dark red
|
||||
{0.7, 0.6, 0.0}, // gold
|
||||
{0.0, 0.0, 0.0} // black
|
||||
};
|
||||
|
||||
// Ensure that the atexit handler only runs once.
|
||||
static uint32_t statsPrinted = 0;
|
||||
|
||||
// output interface
|
||||
static kmp_stats_output_module __kmp_stats_global_output;
|
||||
|
||||
/* ****************************************************** */
|
||||
/* ************* statistic member functions ************* */
|
||||
|
||||
void statistic::addSample(double sample)
|
||||
{
|
||||
double delta = sample - meanVal;
|
||||
|
||||
sampleCount = sampleCount + 1;
|
||||
meanVal = meanVal + delta/sampleCount;
|
||||
m2 = m2 + delta*(sample - meanVal);
|
||||
|
||||
minVal = std::min(minVal, sample);
|
||||
maxVal = std::max(maxVal, sample);
|
||||
}
|
||||
|
||||
statistic & statistic::operator+= (const statistic & other)
|
||||
{
|
||||
if (sampleCount == 0)
|
||||
{
|
||||
*this = other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint64_t newSampleCount = sampleCount + other.sampleCount;
|
||||
double dnsc = double(newSampleCount);
|
||||
double dsc = double(sampleCount);
|
||||
double dscBydnsc = dsc/dnsc;
|
||||
double dosc = double(other.sampleCount);
|
||||
double delta = other.meanVal - meanVal;
|
||||
|
||||
// Try to order these calculations to avoid overflows.
|
||||
// If this were Fortran, then the compiler would not be able to re-order over brackets.
|
||||
// In C++ it may be legal to do that (we certainly hope it doesn't, and CC+ Programming Language 2nd edition
|
||||
// suggests it shouldn't, since it says that exploitation of associativity can only be made if the operation
|
||||
// really is associative (which floating addition isn't...)).
|
||||
meanVal = meanVal*dscBydnsc + other.meanVal*(1-dscBydnsc);
|
||||
m2 = m2 + other.m2 + dscBydnsc*dosc*delta*delta;
|
||||
minVal = std::min (minVal, other.minVal);
|
||||
maxVal = std::max (maxVal, other.maxVal);
|
||||
sampleCount = newSampleCount;
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void statistic::scale(double factor)
|
||||
{
|
||||
minVal = minVal*factor;
|
||||
maxVal = maxVal*factor;
|
||||
meanVal= meanVal*factor;
|
||||
m2 = m2*factor*factor;
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
/* ************* explicitTimer member functions ************* */
|
||||
|
||||
void explicitTimer::start(timer_e timerEnumValue) {
|
||||
startTime = tsc_tick_count::now();
|
||||
if(timeStat::logEvent(timerEnumValue)) {
|
||||
__kmp_stats_thread_ptr->incrementNestValue();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void explicitTimer::stop(timer_e timerEnumValue) {
|
||||
if (startTime.getValue() == 0)
|
||||
return;
|
||||
|
||||
tsc_tick_count finishTime = tsc_tick_count::now();
|
||||
|
||||
//stat->addSample ((tsc_tick_count::now() - startTime).ticks());
|
||||
stat->addSample ((finishTime - startTime).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->decrementNestValue();
|
||||
}
|
||||
|
||||
/* We accept the risk that we drop a sample because it really did start at t==0. */
|
||||
startTime = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ******************************************************************* */
|
||||
/* ************* kmp_stats_event_vector member functions ************* */
|
||||
|
||||
void kmp_stats_event_vector::deallocate() {
|
||||
__kmp_free(events);
|
||||
internal_size = 0;
|
||||
allocated_size = 0;
|
||||
events = NULL;
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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;
|
||||
kmp_stats_event* ev2 = (kmp_stats_event*)event2;
|
||||
|
||||
if(ev1->getStart() < ev2->getStart()) return -1;
|
||||
else if(ev1->getStart() > ev2->getStart()) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
void kmp_stats_event_vector::sort() {
|
||||
qsort(events, internal_size, sizeof(kmp_stats_event), compare_two_events);
|
||||
}
|
||||
|
||||
/* *********************************************************** */
|
||||
/* ************* 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* 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();
|
||||
newnode->setGtid(gtid);
|
||||
newnode->prev = this->prev;
|
||||
newnode->next = this;
|
||||
newnode->prev->next = newnode;
|
||||
newnode->next->prev = newnode;
|
||||
return newnode;
|
||||
}
|
||||
void kmp_stats_list::deallocate() {
|
||||
kmp_stats_list* ptr = this->next;
|
||||
kmp_stats_list* delptr = this->next;
|
||||
while(ptr != this) {
|
||||
delptr = ptr;
|
||||
ptr=ptr->next;
|
||||
// placement new means we have to explicitly call destructor.
|
||||
delptr->_event_vector.deallocate();
|
||||
delptr->~kmp_stats_list();
|
||||
__kmp_free(delptr);
|
||||
}
|
||||
}
|
||||
kmp_stats_list::iterator kmp_stats_list::begin() {
|
||||
kmp_stats_list::iterator it;
|
||||
it.ptr = this->next;
|
||||
return it;
|
||||
}
|
||||
kmp_stats_list::iterator kmp_stats_list::end() {
|
||||
kmp_stats_list::iterator it;
|
||||
it.ptr = this;
|
||||
return it;
|
||||
}
|
||||
int kmp_stats_list::size() {
|
||||
int retval;
|
||||
kmp_stats_list::iterator it;
|
||||
for(retval=0, it=begin(); it!=end(); it++, retval++) {}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* ********************************************************************* */
|
||||
/* ************* kmp_stats_list::iterator member functions ************* */
|
||||
|
||||
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;
|
||||
return *this;
|
||||
}
|
||||
kmp_stats_list::iterator kmp_stats_list::iterator::operator++(int dummy) {
|
||||
this->ptr = this->ptr->next;
|
||||
return *this;
|
||||
}
|
||||
kmp_stats_list::iterator kmp_stats_list::iterator::operator--() {
|
||||
this->ptr = this->ptr->prev;
|
||||
return *this;
|
||||
}
|
||||
kmp_stats_list::iterator kmp_stats_list::iterator::operator--(int dummy) {
|
||||
this->ptr = this->ptr->prev;
|
||||
return *this;
|
||||
}
|
||||
bool kmp_stats_list::iterator::operator!=(const kmp_stats_list::iterator & rhs) {
|
||||
return this->ptr!=rhs.ptr;
|
||||
}
|
||||
bool kmp_stats_list::iterator::operator==(const kmp_stats_list::iterator & rhs) {
|
||||
return this->ptr==rhs.ptr;
|
||||
}
|
||||
kmp_stats_list* kmp_stats_list::iterator::operator*() const {
|
||||
return this->ptr;
|
||||
}
|
||||
|
||||
/* *************************************************************** */
|
||||
/* ************* 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()
|
||||
{
|
||||
char * statsFileName = getenv("KMP_STATS_FILE");
|
||||
eventsFileName = getenv("KMP_STATS_EVENTS_FILE");
|
||||
plotFileName = getenv("KMP_STATS_PLOT_FILE");
|
||||
char * threadStats = getenv("KMP_STATS_THREADS");
|
||||
char * threadEvents = getenv("KMP_STATS_EVENTS");
|
||||
|
||||
// set the stats output filenames based on environment variables and defaults
|
||||
outputFileName = statsFileName;
|
||||
eventsFileName = eventsFileName ? eventsFileName : "events.dat";
|
||||
plotFileName = plotFileName ? plotFileName : "events.plt";
|
||||
|
||||
// set the flags based on environment variables matching: true, on, 1, .true. , .t. , yes
|
||||
printPerThreadFlag = __kmp_str_match_true(threadStats);
|
||||
printPerThreadEventsFlag = __kmp_str_match_true(threadEvents);
|
||||
|
||||
if(printPerThreadEventsFlag) {
|
||||
// assigns a color to each timer for printing
|
||||
setupEventColors();
|
||||
} else {
|
||||
// will clear flag so that no event will be logged
|
||||
timeStat::clearEventFlags();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::setupEventColors() {
|
||||
int i;
|
||||
int globalColorIndex = 0;
|
||||
int numGlobalColors = sizeof(globalColorArray) / sizeof(rgb_color);
|
||||
for(i=0;i<TIMER_LAST;i++) {
|
||||
if(timeStat::logEvent((timer_e)i)) {
|
||||
timerColorInfo[i] = globalColorArray[globalColorIndex];
|
||||
globalColorIndex = (globalColorIndex+1)%numGlobalColors;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::printStats(FILE *statsOut, statistic const * theStats, bool areTimers)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::printCounters(FILE * statsOut, counter const * theCounters)
|
||||
{
|
||||
// We print all the counters even if they are zero.
|
||||
// That makes it easier to slice them into a spreadsheet if you need to.
|
||||
fprintf (statsOut, "\nCounter, Count\n");
|
||||
for (int c = 0; c<COUNTER_LAST; c++) {
|
||||
counter const * stat = &theCounters[c];
|
||||
fprintf (statsOut, "%-25s, %s\n", counter::name(counter_e(c)), formatSI(stat->getValue(), 9, ' ').c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::printEvents(FILE* eventsOut, kmp_stats_event_vector* theEvents, int gtid) {
|
||||
// sort by start time before printing
|
||||
theEvents->sort();
|
||||
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(),
|
||||
1.2 - (ev.getNestLevel() * 0.2),
|
||||
color.r, color.g, color.b,
|
||||
timeStat::name(ev.getTimerName())
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
// 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++) {
|
||||
for (int timer=0; timer<EXPLICIT_TIMER_LAST; timer++) {
|
||||
(*it)->getExplicitTimer(explicit_timer_e(timer))->stop((timer_e)timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::printPloticusFile() {
|
||||
int i;
|
||||
int size = __kmp_stats_list.size();
|
||||
FILE* plotOut = fopen(plotFileName, "w+");
|
||||
|
||||
fprintf(plotOut, "#proc page\n"
|
||||
" pagesize: 15 10\n"
|
||||
" scale: 1.0\n\n");
|
||||
|
||||
fprintf(plotOut, "#proc getdata\n"
|
||||
" file: %s\n\n",
|
||||
eventsFileName);
|
||||
|
||||
fprintf(plotOut, "#proc areadef\n"
|
||||
" title: OpenMP Sampling Timeline\n"
|
||||
" titledetails: align=center size=16\n"
|
||||
" rectangle: 1 1 13 9\n"
|
||||
" xautorange: datafield=2,3\n"
|
||||
" yautorange: -1 %d\n\n",
|
||||
size);
|
||||
|
||||
fprintf(plotOut, "#proc xaxis\n"
|
||||
" stubs: inc\n"
|
||||
" stubdetails: size=12\n"
|
||||
" label: Time (ticks)\n"
|
||||
" labeldetails: size=14\n\n");
|
||||
|
||||
fprintf(plotOut, "#proc yaxis\n"
|
||||
" stubs: inc 1\n"
|
||||
" stubrange: 0 %d\n"
|
||||
" stubdetails: size=12\n"
|
||||
" label: Thread #\n"
|
||||
" labeldetails: size=14\n\n",
|
||||
size-1);
|
||||
|
||||
fprintf(plotOut, "#proc bars\n"
|
||||
" exactcolorfield: 5\n"
|
||||
" axis: x\n"
|
||||
" locfield: 1\n"
|
||||
" segmentfields: 2 3\n"
|
||||
" barwidthfield: 4\n\n");
|
||||
|
||||
// create legend entries corresponding to the timer color
|
||||
for(i=0;i<TIMER_LAST;i++) {
|
||||
if(timeStat::logEvent((timer_e)i)) {
|
||||
rgb_color c = getEventColor((timer_e)i);
|
||||
fprintf(plotOut, "#proc legendentry\n"
|
||||
" sampletype: color\n"
|
||||
" label: %s\n"
|
||||
" details: rgb(%1.1f,%1.1f,%1.1f)\n\n",
|
||||
timeStat::name((timer_e)i),
|
||||
c.r, c.g, c.b);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(plotOut, "#proc legend\n"
|
||||
" format: down\n"
|
||||
" location: max max\n\n");
|
||||
fclose(plotOut);
|
||||
return;
|
||||
}
|
||||
|
||||
void kmp_stats_output_module::outputStats(const char* heading)
|
||||
{
|
||||
statistic allStats[TIMER_LAST];
|
||||
statistic allCounters[COUNTER_LAST];
|
||||
|
||||
// stop all the explicit timers for all threads
|
||||
windupExplicitTimers();
|
||||
|
||||
FILE * eventsOut;
|
||||
FILE * statsOut = outputFileName ? fopen (outputFileName, "a+") : stderr;
|
||||
|
||||
if (eventPrintingEnabled()) {
|
||||
eventsOut = fopen(eventsFileName, "w+");
|
||||
}
|
||||
|
||||
if (!statsOut)
|
||||
statsOut = stderr;
|
||||
|
||||
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()) {
|
||||
fprintf (statsOut, "Thread %d\n", t);
|
||||
printStats(statsOut, (*it)->getTimers(), true);
|
||||
printCounters(statsOut, (*it)->getCounters());
|
||||
fprintf(statsOut,"\n");
|
||||
}
|
||||
// Output per thread events if requested.
|
||||
if (eventPrintingEnabled()) {
|
||||
kmp_stats_event_vector events = (*it)->getEventVector();
|
||||
printEvents(eventsOut, &events, t);
|
||||
}
|
||||
|
||||
for (int s = 0; s<TIMER_LAST; s++) {
|
||||
// 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.
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
statistic * threadStat = (*it)->getTimer(timer_e(s));
|
||||
allStats[s] += *threadStat;
|
||||
}
|
||||
|
||||
// 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)
|
||||
continue;
|
||||
allCounters[c].addSample ((*it)->getCounter(counter_e(c))->getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (eventPrintingEnabled()) {
|
||||
printPloticusFile();
|
||||
fclose(eventsOut);
|
||||
}
|
||||
|
||||
fprintf (statsOut, "Aggregate for all threads\n");
|
||||
printStats (statsOut, &allStats[0], true);
|
||||
fprintf (statsOut, "\n");
|
||||
printStats (statsOut, &allCounters[0], false);
|
||||
|
||||
if (statsOut != stderr)
|
||||
fclose(statsOut);
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************** */
|
||||
/* ************* exported C functions ************** */
|
||||
|
||||
// no name mangling for these functions, we want the c files to be able to get at these functions
|
||||
extern "C" {
|
||||
|
||||
void __kmp_reset_stats()
|
||||
{
|
||||
kmp_stats_list::iterator it;
|
||||
for(it = __kmp_stats_list.begin(); it != __kmp_stats_list.end(); it++) {
|
||||
timeStat * timers = (*it)->getTimers();
|
||||
counter * counters = (*it)->getCounters();
|
||||
explicitTimer * eTimers = (*it)->getExplicitTimers();
|
||||
|
||||
for (int t = 0; t<TIMER_LAST; t++)
|
||||
timers[t].reset();
|
||||
|
||||
for (int c = 0; c<COUNTER_LAST; c++)
|
||||
counters[c].reset();
|
||||
|
||||
for (int t=0; t<EXPLICIT_TIMER_LAST; t++)
|
||||
eTimers[t].reset();
|
||||
|
||||
// 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.
|
||||
void __kmp_output_stats(const char * heading)
|
||||
{
|
||||
__kmp_stats_global_output.outputStats(heading);
|
||||
__kmp_reset_stats();
|
||||
}
|
||||
|
||||
void __kmp_accumulate_stats_at_exit(void)
|
||||
{
|
||||
// Only do this once.
|
||||
if (KMP_XCHG_FIXED32(&statsPrinted, 1) != 0)
|
||||
return;
|
||||
|
||||
__kmp_output_stats("Statistics on exit");
|
||||
return;
|
||||
}
|
||||
|
||||
void __kmp_stats_init(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // KMP_STATS_ENABLED
|
||||
@@ -0,0 +1,706 @@
|
||||
#ifndef KMP_STATS_H
|
||||
#define KMP_STATS_H
|
||||
|
||||
/** @file kmp_stats.h
|
||||
* Functions for collecting statistics.
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#if KMP_STATS_ENABLED
|
||||
/*
|
||||
* Statistics accumulator.
|
||||
* Accumulates number of samples and computes min, max, mean, standard deviation on the fly.
|
||||
*
|
||||
* Online variance calculation algorithm from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm
|
||||
*/
|
||||
|
||||
#include <limits>
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include <new> // placement new
|
||||
#include "kmp_stats_timing.h"
|
||||
|
||||
|
||||
/*!
|
||||
* @ingroup STATS_GATHERING
|
||||
* \brief flags to describe the statistic ( timers 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)
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Add new counters under KMP_FOREACH_COUNTER() macro in kmp_stats.h
|
||||
*
|
||||
* @param macro a user defined macro that takes three arguments - macro(COUNTER_NAME, flags, arg)
|
||||
* @param arg a user defined argument to send to the user defined macro
|
||||
*
|
||||
* \details A counter counts the occurrence of some event.
|
||||
* 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.
|
||||
* 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_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_BARRIER, 0, arg) \
|
||||
macro (OMP_CRITICAL,0, arg) \
|
||||
macro (OMP_SINGLE, 0, arg) \
|
||||
macro (OMP_MASTER, 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 (LAST,0,arg)
|
||||
|
||||
/*!
|
||||
* \brief Add new timers under KMP_FOREACH_TIMER() macro in kmp_stats.h
|
||||
*
|
||||
* @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.
|
||||
* 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).
|
||||
* 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
|
||||
*/
|
||||
#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) \
|
||||
macro (LAST,0, arg)
|
||||
|
||||
|
||||
|
||||
// OMP_PARALLEL_args -- the number of arguments passed to a fork
|
||||
// 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
|
||||
// KMP_fork_barrier -- time in __kmp_fork_barrier
|
||||
// KMP_join_barrier -- time in __kmp_join_barrier
|
||||
// KMP_barrier -- time in __kmp_barrier
|
||||
// KMP_end_split_barrier -- time in __kmp_end_split_barrier
|
||||
// KMP_setup_icv_copy -- time in __kmp_setup_icv_copy
|
||||
// KMP_icv_copy -- start/stop timer for any ICV copying
|
||||
// KMP_linear_gather -- time in __kmp_linear_barrier_gather
|
||||
// KMP_linear_release -- time in __kmp_linear_barrier_release
|
||||
// KMP_tree_gather -- time in __kmp_tree_barrier_gather
|
||||
// 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
|
||||
|
||||
/*!
|
||||
* \brief Add new explicit timers under KMP_FOREACH_EXPLICIT_TIMER() macro.
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* \warning YOU MUST HAVE THE SAME NAMED TIMER UNDER KMP_FOREACH_TIMER() OR ELSE BAD THINGS WILL HAPPEN!
|
||||
*
|
||||
* \details Explicit timers are ones where we need to allocate a timer itself (as well as the accumulated timing statistics).
|
||||
* We allocate these on a per-thread basis, and explicitly start and stop them.
|
||||
* Block timers just allocate the timer itself on the stack, and use the destructor to notice block exit; they don't
|
||||
* need to be defined here.
|
||||
* The name here should be the same as that of a timer above.
|
||||
*
|
||||
* @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) \
|
||||
macro(LAST, 0, arg)
|
||||
|
||||
#define ENUMERATE(name,ignore,prefix) prefix##name,
|
||||
enum timer_e {
|
||||
KMP_FOREACH_TIMER(ENUMERATE, TIMER_)
|
||||
};
|
||||
|
||||
enum explicit_timer_e {
|
||||
KMP_FOREACH_EXPLICIT_TIMER(ENUMERATE, EXPLICIT_TIMER_)
|
||||
};
|
||||
|
||||
enum counter_e {
|
||||
KMP_FOREACH_COUNTER(ENUMERATE, COUNTER_)
|
||||
};
|
||||
#undef ENUMERATE
|
||||
|
||||
class statistic
|
||||
{
|
||||
double minVal;
|
||||
double maxVal;
|
||||
double meanVal;
|
||||
double m2;
|
||||
uint64_t sampleCount;
|
||||
|
||||
public:
|
||||
statistic() { reset(); }
|
||||
statistic (statistic const &o): minVal(o.minVal), maxVal(o.maxVal), meanVal(o.meanVal), m2(o.m2), sampleCount(o.sampleCount) {}
|
||||
|
||||
double getMin() const { return minVal; }
|
||||
double getMean() const { return meanVal; }
|
||||
double getMax() const { return maxVal; }
|
||||
uint64_t getCount() const { return sampleCount; }
|
||||
double getSD() const { return sqrt(m2/sampleCount); }
|
||||
double getTotal() const { return sampleCount*meanVal; }
|
||||
|
||||
void reset()
|
||||
{
|
||||
minVal = std::numeric_limits<double>::max();
|
||||
maxVal = -std::numeric_limits<double>::max();
|
||||
meanVal= 0.0;
|
||||
m2 = 0.0;
|
||||
sampleCount = 0;
|
||||
}
|
||||
void addSample(double sample);
|
||||
void scale (double factor);
|
||||
void scaleDown(double f) { scale (1./f); }
|
||||
statistic & operator+= (statistic const & other);
|
||||
|
||||
std::string format(char unit, bool total=false) const;
|
||||
};
|
||||
|
||||
struct statInfo
|
||||
{
|
||||
const char * name;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
class timeStat : public statistic
|
||||
{
|
||||
static statInfo timerInfo[];
|
||||
|
||||
public:
|
||||
timeStat() : statistic() {}
|
||||
static const char * name(timer_e e) { return timerInfo[e].name; }
|
||||
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++) {
|
||||
timerInfo[i].flags &= (~(stats_flags_e::logEvent));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Where we need explicitly to start and end the timer, this version can be used
|
||||
// Since these timers normally aren't nicely scoped, so don't have a good place to live
|
||||
// on the stack of the thread, they're more work to use.
|
||||
class explicitTimer
|
||||
{
|
||||
timeStat * stat;
|
||||
tsc_tick_count startTime;
|
||||
|
||||
public:
|
||||
explicitTimer () : stat(0), startTime(0) { }
|
||||
explicitTimer (timeStat * s) : stat(s), startTime() { }
|
||||
|
||||
void setStat (timeStat *s) { stat = s; }
|
||||
void start(timer_e timerEnumValue);
|
||||
void stop(timer_e timerEnumValue);
|
||||
void reset() { startTime = 0; }
|
||||
};
|
||||
|
||||
// Where all you need is to time a block, this is enough.
|
||||
// (It avoids the need to have an explicit end, leaving the scope suffices.)
|
||||
class blockTimer : public explicitTimer
|
||||
{
|
||||
timer_e timerEnumValue;
|
||||
public:
|
||||
blockTimer (timeStat * s, timer_e newTimerEnumValue) : timerEnumValue(newTimerEnumValue), explicitTimer(s) { start(timerEnumValue); }
|
||||
~blockTimer() { stop(timerEnumValue); }
|
||||
};
|
||||
|
||||
// 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
|
||||
{
|
||||
uint64_t value;
|
||||
static const statInfo counterInfo[];
|
||||
|
||||
public:
|
||||
counter() : value(0) {}
|
||||
void increment() { value++; }
|
||||
uint64_t getValue() const { return value; }
|
||||
void reset() { value = 0; }
|
||||
static const char * name(counter_e e) { return counterInfo[e].name; }
|
||||
static bool masterOnly (counter_e e) { return counterInfo[e].flags & stats_flags_e::onlyInMaster; }
|
||||
};
|
||||
|
||||
/* ****************************************************************
|
||||
Class to implement an event
|
||||
|
||||
There are four components to an event: start time, stop time
|
||||
nest_level, and timer_name.
|
||||
The start and stop time should be obvious (recorded in clock ticks).
|
||||
The nest_level relates to the bar width in the timeline graph.
|
||||
The timer_name is used to determine which timer event triggered this event.
|
||||
|
||||
the interface to this class is through four read-only operations:
|
||||
1) getStart() -- returns the start time as 64 bit integer
|
||||
2) getStop() -- returns the stop time as 64 bit integer
|
||||
3) getNestLevel() -- returns the nest level of the event
|
||||
4) getTimerName() -- returns the timer name that triggered event
|
||||
|
||||
*MORE ON NEST_LEVEL*
|
||||
The nest level is used in the bar graph that represents the timeline.
|
||||
Its main purpose is for showing how events are nested inside eachother.
|
||||
For example, say events, A, B, and C are recorded. If the timeline
|
||||
looks like this:
|
||||
|
||||
Begin -------------------------------------------------------------> Time
|
||||
| | | | | |
|
||||
A B C C B A
|
||||
start start start end end end
|
||||
|
||||
Then A, B, C will have a nest level of 1, 2, 3 respectively.
|
||||
These values are then used to calculate the barwidth so you can
|
||||
see that inside A, B has occurred, and inside B, C has occurred.
|
||||
Currently, this is shown with A's bar width being larger than B's
|
||||
bar width, and B's bar width being larger than C's bar width.
|
||||
|
||||
**************************************************************** */
|
||||
class kmp_stats_event {
|
||||
uint64_t start;
|
||||
uint64_t stop;
|
||||
int nest_level;
|
||||
timer_e timer_name;
|
||||
public:
|
||||
kmp_stats_event() : start(0), stop(0), nest_level(0), timer_name(TIMER_LAST) {}
|
||||
kmp_stats_event(uint64_t strt, uint64_t stp, int nst, timer_e nme) : start(strt), stop(stp), nest_level(nst), timer_name(nme) {}
|
||||
inline uint64_t getStart() const { return start; }
|
||||
inline uint64_t getStop() const { return stop; }
|
||||
inline int getNestLevel() const { return nest_level; }
|
||||
inline timer_e getTimerName() const { return timer_name; }
|
||||
};
|
||||
|
||||
/* ****************************************************************
|
||||
Class to implement a dynamically expandable array of events
|
||||
|
||||
---------------------------------------------------------
|
||||
| event 1 | event 2 | event 3 | event 4 | ... | event N |
|
||||
---------------------------------------------------------
|
||||
|
||||
An event is pushed onto the back of this array at every
|
||||
explicitTimer->stop() call. The event records the thread #,
|
||||
start time, stop time, and nest level related to the bar width.
|
||||
|
||||
The event vector starts at size INIT_SIZE and grows (doubles in size)
|
||||
if needed. An implication of this behavior is that log(N)
|
||||
reallocations are needed (where N is number of events). If you want
|
||||
to avoid reallocations, then set INIT_SIZE to a large value.
|
||||
|
||||
the interface to this class is through six operations:
|
||||
1) reset() -- sets the internal_size back to 0 but does not deallocate any memory
|
||||
2) size() -- returns the number of valid elements in the vector
|
||||
3) push_back(start, stop, nest, timer_name) -- pushes an event onto
|
||||
the back of the array
|
||||
4) deallocate() -- frees all memory associated with the vector
|
||||
5) sort() -- sorts the vector by start time
|
||||
6) operator[index] or at(index) -- returns event reference at that index
|
||||
|
||||
**************************************************************** */
|
||||
class kmp_stats_event_vector {
|
||||
kmp_stats_event* events;
|
||||
int internal_size;
|
||||
int allocated_size;
|
||||
static const int INIT_SIZE = 1024;
|
||||
public:
|
||||
kmp_stats_event_vector() {
|
||||
events = (kmp_stats_event*)__kmp_allocate(sizeof(kmp_stats_event)*INIT_SIZE);
|
||||
internal_size = 0;
|
||||
allocated_size = INIT_SIZE;
|
||||
}
|
||||
~kmp_stats_event_vector() {}
|
||||
inline void reset() { internal_size = 0; }
|
||||
inline int size() const { return internal_size; }
|
||||
void push_back(uint64_t start_time, uint64_t stop_time, int nest_level, timer_e name) {
|
||||
int i;
|
||||
if(internal_size == allocated_size) {
|
||||
kmp_stats_event* tmp = (kmp_stats_event*)__kmp_allocate(sizeof(kmp_stats_event)*allocated_size*2);
|
||||
for(i=0;i<internal_size;i++) tmp[i] = events[i];
|
||||
__kmp_free(events);
|
||||
events = tmp;
|
||||
allocated_size*=2;
|
||||
}
|
||||
events[internal_size] = kmp_stats_event(start_time, stop_time, nest_level, name);
|
||||
internal_size++;
|
||||
return;
|
||||
}
|
||||
void deallocate();
|
||||
void sort();
|
||||
const kmp_stats_event & operator[](int index) const { return events[index]; }
|
||||
kmp_stats_event & operator[](int index) { return events[index]; }
|
||||
const kmp_stats_event & at(int index) const { return events[index]; }
|
||||
kmp_stats_event & at(int index) { return events[index]; }
|
||||
};
|
||||
|
||||
/* ****************************************************************
|
||||
Class to implement a doubly-linked, circular, statistics list
|
||||
|
||||
|---| ---> |---| ---> |---| ---> |---| ---> ... next
|
||||
| | | | | | | |
|
||||
|---| <--- |---| <--- |---| <--- |---| <--- ... prev
|
||||
Sentinel first second third
|
||||
Node node node node
|
||||
|
||||
The Sentinel Node is the user handle on the list.
|
||||
The first node corresponds to thread 0's statistics.
|
||||
The second node corresponds to thread 1's statistics and so on...
|
||||
|
||||
Each node has a _timers, _counters, and _explicitTimers array to
|
||||
hold that thread's statistics. The _explicitTimers
|
||||
point to the correct _timer and update its statistics at every stop() call.
|
||||
The explicitTimers' pointers are set up in the constructor.
|
||||
Each node also has an event vector to hold that thread's timing events.
|
||||
The event vector expands as necessary and records the start-stop times
|
||||
for each timer.
|
||||
|
||||
The nestLevel variable is for plotting events and is related
|
||||
to the bar width in the timeline graph.
|
||||
|
||||
Every thread will have a __thread local pointer to its node in
|
||||
the list. The sentinel node is used by the master thread to
|
||||
store "dummy" statistics before __kmp_create_worker() is called.
|
||||
|
||||
**************************************************************** */
|
||||
class kmp_stats_list {
|
||||
int gtid;
|
||||
timeStat _timers[TIMER_LAST+1];
|
||||
counter _counters[COUNTER_LAST+1];
|
||||
explicitTimer _explicitTimers[EXPLICIT_TIMER_LAST+1];
|
||||
int _nestLevel; // one per thread
|
||||
kmp_stats_event_vector _event_vector;
|
||||
kmp_stats_list* next;
|
||||
kmp_stats_list* prev;
|
||||
public:
|
||||
kmp_stats_list() : next(this) , prev(this) , _event_vector(), _nestLevel(0) {
|
||||
#define doInit(name,ignore1,ignore2) \
|
||||
getExplicitTimer(EXPLICIT_TIMER_##name)->setStat(getTimer(TIMER_##name));
|
||||
KMP_FOREACH_EXPLICIT_TIMER(doInit,0);
|
||||
#undef doInit
|
||||
}
|
||||
~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 timeStat * getTimers() { return _timers; }
|
||||
inline counter * getCounters() { return _counters; }
|
||||
inline explicitTimer * getExplicitTimers() { return _explicitTimers; }
|
||||
inline kmp_stats_event_vector & getEventVector() { return _event_vector; }
|
||||
inline void resetEventVector() { _event_vector.reset(); }
|
||||
inline void incrementNestValue() { _nestLevel++; }
|
||||
inline int getNestValue() { return _nestLevel; }
|
||||
inline void decrementNestValue() { _nestLevel--; }
|
||||
inline int getGtid() const { return gtid; }
|
||||
inline void setGtid(int newgtid) { gtid = newgtid; }
|
||||
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);
|
||||
}
|
||||
void deallocate();
|
||||
class iterator;
|
||||
kmp_stats_list::iterator begin();
|
||||
kmp_stats_list::iterator end();
|
||||
int size();
|
||||
class iterator {
|
||||
kmp_stats_list* ptr;
|
||||
friend kmp_stats_list::iterator kmp_stats_list::begin();
|
||||
friend kmp_stats_list::iterator kmp_stats_list::end();
|
||||
public:
|
||||
iterator();
|
||||
~iterator();
|
||||
iterator operator++();
|
||||
iterator operator++(int dummy);
|
||||
iterator operator--();
|
||||
iterator operator--(int dummy);
|
||||
bool operator!=(const iterator & rhs);
|
||||
bool operator==(const iterator & rhs);
|
||||
kmp_stats_list* operator*() const; // dereference operator
|
||||
};
|
||||
};
|
||||
|
||||
/* ****************************************************************
|
||||
Class to encapsulate all output functions and the environment variables
|
||||
|
||||
This module holds filenames for various outputs (normal stats, events, plot file),
|
||||
as well as coloring information for the plot file.
|
||||
|
||||
The filenames and flags variables are read from environment variables.
|
||||
These are read once by the constructor of the global variable __kmp_stats_output
|
||||
which calls init().
|
||||
|
||||
During this init() call, event flags for the timeStat::timerInfo[] global array
|
||||
are cleared if KMP_STATS_EVENTS is not true (on, 1, yes).
|
||||
|
||||
The only interface function that is public is outputStats(heading). This function
|
||||
should print out everything it needs to, either to files or stderr,
|
||||
depending on the environment variables described below
|
||||
|
||||
ENVIRONMENT VARIABLES:
|
||||
KMP_STATS_FILE -- if set, all statistics (not events) will be printed to this file,
|
||||
otherwise, print to stderr
|
||||
KMP_STATS_THREADS -- if set to "on", then will print per thread statistics to either
|
||||
KMP_STATS_FILE or stderr
|
||||
KMP_STATS_PLOT_FILE -- if set, print the ploticus plot file to this filename,
|
||||
otherwise, the plot file is sent to "events.plt"
|
||||
KMP_STATS_EVENTS -- if set to "on", then log events, otherwise, don't log events
|
||||
KMP_STATS_EVENTS_FILE -- if set, all events are outputted to this file,
|
||||
otherwise, output is sent to "events.dat"
|
||||
|
||||
**************************************************************** */
|
||||
class kmp_stats_output_module {
|
||||
|
||||
public:
|
||||
struct rgb_color {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
};
|
||||
|
||||
private:
|
||||
static const char* outputFileName;
|
||||
static const char* eventsFileName;
|
||||
static const char* plotFileName;
|
||||
static int printPerThreadFlag;
|
||||
static int printPerThreadEventsFlag;
|
||||
static const rgb_color globalColorArray[];
|
||||
static rgb_color timerColorInfo[];
|
||||
|
||||
void init();
|
||||
static void setupEventColors();
|
||||
static void printPloticusFile();
|
||||
static void printStats(FILE *statsOut, statistic const * theStats, bool areTimers);
|
||||
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;
|
||||
}
|
||||
|
||||
public:
|
||||
kmp_stats_output_module() { init(); }
|
||||
void outputStats(const char* heading);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void __kmp_stats_init();
|
||||
void __kmp_reset_stats();
|
||||
void __kmp_output_stats(const char *);
|
||||
void __kmp_accumulate_stats_at_exit(void);
|
||||
// thread local pointer to stats node within list
|
||||
extern __thread kmp_stats_list* __kmp_stats_thread_ptr;
|
||||
// head to stats list.
|
||||
extern kmp_stats_list __kmp_stats_list;
|
||||
// lock for __kmp_stats_list
|
||||
extern kmp_tas_lock_t __kmp_stats_lock;
|
||||
// reference start time
|
||||
extern tsc_tick_count __kmp_stats_start_time;
|
||||
// interface to output
|
||||
extern kmp_stats_output_module __kmp_stats_output;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Simple, standard interfaces that drop out completely if stats aren't enabled
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Uses specified timer (name) to time code block.
|
||||
*
|
||||
* @param name timer name as specified under the KMP_FOREACH_TIMER() macro
|
||||
*
|
||||
* \details Use KMP_TIME_BLOCK(name) macro to time a code block. This will record the time taken in the block
|
||||
* and use the destructor to stop the timer. Convenient!
|
||||
* With this definition you can't have more than one KMP_TIME_BLOCK in the same code block.
|
||||
* I don't think that's a problem.
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_TIME_BLOCK(name) \
|
||||
blockTimer __BLOCKTIME__(__kmp_stats_thread_ptr->getTimer(TIMER_##name), TIMER_##name)
|
||||
|
||||
/*!
|
||||
* \brief Adds value to specified timer (name).
|
||||
*
|
||||
* @param name timer name as specified under the KMP_FOREACH_TIMER() macro
|
||||
* @param value double precision sample value to add to statistics for the timer
|
||||
*
|
||||
* \details Use KMP_COUNT_VALUE(name, value) macro to add a particular value to a timer statistics.
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_COUNT_VALUE(name, value) \
|
||||
__kmp_stats_thread_ptr->getTimer(TIMER_##name)->addSample(value)
|
||||
|
||||
/*!
|
||||
* \brief Increments specified counter (name).
|
||||
*
|
||||
* @param name counter name as specified under the KMP_FOREACH_COUNTER() macro
|
||||
*
|
||||
* \details Use KMP_COUNT_BLOCK(name, value) macro to increment a statistics counter for the executing thread.
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_COUNT_BLOCK(name) \
|
||||
__kmp_stats_thread_ptr->getCounter(COUNTER_##name)->increment()
|
||||
|
||||
/*!
|
||||
* \brief "Starts" an explicit timer which will need a corresponding KMP_STOP_EXPLICIT_TIMER() macro.
|
||||
*
|
||||
* @param name explicit timer name as specified under the KMP_FOREACH_EXPLICIT_TIMER() macro
|
||||
*
|
||||
* \details Use to start a timer. This will need a corresponding KMP_STOP_EXPLICIT_TIMER()
|
||||
* macro to stop the timer unlike the KMP_TIME_BLOCK(name) macro which has an implicit stopping macro at the end
|
||||
* of the code block. All explicit timers are stopped at library exit time before the final statistics are outputted.
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_START_EXPLICIT_TIMER(name) \
|
||||
__kmp_stats_thread_ptr->getExplicitTimer(EXPLICIT_TIMER_##name)->start(TIMER_##name)
|
||||
|
||||
/*!
|
||||
* \brief "Stops" an explicit timer.
|
||||
*
|
||||
* @param name explicit timer name as specified under the KMP_FOREACH_EXPLICIT_TIMER() macro
|
||||
*
|
||||
* \details Use KMP_STOP_EXPLICIT_TIMER(name) to stop a timer. When this is done, the time between the last KMP_START_EXPLICIT_TIMER(name)
|
||||
* and this KMP_STOP_EXPLICIT_TIMER(name) will be added to the timer's stat value. The timer will then be reset.
|
||||
* After the KMP_STOP_EXPLICIT_TIMER(name) macro is called, another call to KMP_START_EXPLICIT_TIMER(name) will start the timer once again.
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_STOP_EXPLICIT_TIMER(name) \
|
||||
__kmp_stats_thread_ptr->getExplicitTimer(EXPLICIT_TIMER_##name)->stop(TIMER_##name)
|
||||
|
||||
/*!
|
||||
* \brief Outputs the current thread statistics and reset them.
|
||||
*
|
||||
* @param heading_string heading put above the final stats output
|
||||
*
|
||||
* \details Explicitly stops all timers and outputs all stats.
|
||||
* Environment variable, `OMPTB_STATSFILE=filename`, can be used to output the stats to a filename instead of stderr
|
||||
* Environment variable, `OMPTB_STATSTHREADS=true|undefined`, can be used to output thread specific stats
|
||||
* For now the `OMPTB_STATSTHREADS` environment variable can either be defined with any value, which will print out thread
|
||||
* specific stats, or it can be undefined (not specified in the environment) and thread specific stats won't be printed
|
||||
* It should be noted that all statistics are reset when this macro is called.
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_OUTPUT_STATS(heading_string) \
|
||||
__kmp_output_stats(heading_string)
|
||||
|
||||
/*!
|
||||
* \brief resets all stats (counters to 0, timers to 0 elapsed ticks)
|
||||
*
|
||||
* \details Reset all stats for all threads.
|
||||
*
|
||||
* @ingroup STATS_GATHERING
|
||||
*/
|
||||
#define KMP_RESET_STATS() __kmp_reset_stats()
|
||||
|
||||
#else // KMP_STATS_ENABLED
|
||||
|
||||
// Null definitions
|
||||
#define KMP_TIME_BLOCK(n) ((void)0)
|
||||
#define KMP_COUNT_VALUE(n,v) ((void)0)
|
||||
#define KMP_COUNT_BLOCK(n) ((void)0)
|
||||
#define KMP_START_EXPLICIT_TIMER(n) ((void)0)
|
||||
#define KMP_STOP_EXPLICIT_TIMER(n) ((void)0)
|
||||
|
||||
#define KMP_OUTPUT_STATS(heading_string) ((void)0)
|
||||
#define KMP_RESET_STATS() ((void)0)
|
||||
|
||||
#endif // KMP_STATS_ENABLED
|
||||
|
||||
#endif // KMP_STATS_H
|
||||
@@ -0,0 +1,167 @@
|
||||
/** @file kmp_stats_timing.cpp
|
||||
* Timing functions
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#include "kmp_stats_timing.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#if KMP_OS_LINUX
|
||||
# if KMP_MIC
|
||||
double tsc_tick_count::tick_time()
|
||||
{
|
||||
// pretty bad assumption of 1GHz clock for MIC
|
||||
return 1/((double)1000*1.e6);
|
||||
}
|
||||
# else
|
||||
# include <string.h>
|
||||
// Extract the value from the CPUID information
|
||||
double tsc_tick_count::tick_time()
|
||||
{
|
||||
static double result = 0.0;
|
||||
|
||||
if (result == 0.0)
|
||||
{
|
||||
int cpuinfo[4];
|
||||
char brand[256];
|
||||
|
||||
__cpuid(cpuinfo, 0x80000000);
|
||||
memset(brand, 0, sizeof(brand));
|
||||
int ids = cpuinfo[0];
|
||||
|
||||
for (unsigned int i=2; i<(ids^0x80000000)+2; i++)
|
||||
__cpuid(brand+(i-2)*sizeof(cpuinfo), i | 0x80000000);
|
||||
|
||||
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
|
||||
{
|
||||
cout << "Error determining multiplier '" << *end << "'\n";
|
||||
exit (-1);
|
||||
}
|
||||
*end = 0;
|
||||
while (*end != ' ') end--;
|
||||
end++;
|
||||
|
||||
double freq = strtod(end, &start);
|
||||
if (freq == 0.0)
|
||||
{
|
||||
cout << "Error calculating frequency " << end << "\n";
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
result = ((double)1.0)/(freq * multiplier);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static bool useSI = true;
|
||||
|
||||
// Return a formatted string after normalising the value into
|
||||
// engineering style and using a suitable unit prefix (e.g. ms, us, ns).
|
||||
std::string formatSI(double interval, int width, char unit)
|
||||
{
|
||||
std::stringstream os;
|
||||
|
||||
if (useSI)
|
||||
{
|
||||
// Preserve accuracy for small numbers, since we only multiply and the positive powers
|
||||
// of ten are precisely representable.
|
||||
static struct { double scale; char prefix; } ranges[] = {
|
||||
{1.e12,'f'},
|
||||
{1.e9, 'p'},
|
||||
{1.e6, 'n'},
|
||||
{1.e3, 'u'},
|
||||
{1.0, 'm'},
|
||||
{1.e-3,' '},
|
||||
{1.e-6,'k'},
|
||||
{1.e-9,'M'},
|
||||
{1.e-12,'G'},
|
||||
{1.e-15,'T'},
|
||||
{1.e-18,'P'},
|
||||
{1.e-21,'E'},
|
||||
{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;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
bool negative = false;
|
||||
if (interval < 0.0)
|
||||
{
|
||||
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 <<
|
||||
(negative ? -interval : interval) << std::setw(2) << ranges[i].prefix << std::setw(1) << unit;
|
||||
|
||||
return os.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
os << std::setprecision(2) << std::fixed << std::right << std::setw(width-3) << interval << std::setw(3) << 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();
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
#ifndef KMP_STATS_TIMING_H
|
||||
#define KMP_STATS_TIMING_H
|
||||
|
||||
/** @file kmp_stats_timing.h
|
||||
* Access to real time clock and timers.
|
||||
*/
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 <stdint.h>
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include "kmp_os.h"
|
||||
|
||||
class tsc_tick_count {
|
||||
private:
|
||||
int64_t my_count;
|
||||
|
||||
public:
|
||||
class tsc_interval_t {
|
||||
int64_t value;
|
||||
explicit tsc_interval_t(int64_t _value) : value(_value) {}
|
||||
public:
|
||||
tsc_interval_t() : value(0) {}; // Construct 0 time duration
|
||||
double seconds() const; // Return the length of a time interval in seconds
|
||||
double ticks() const { return double(value); }
|
||||
int64_t getValue() const { return value; }
|
||||
|
||||
friend class tsc_tick_count;
|
||||
|
||||
friend tsc_interval_t operator-(
|
||||
const tsc_tick_count t1, const tsc_tick_count t0);
|
||||
};
|
||||
|
||||
tsc_tick_count() : my_count(static_cast<int64_t>(__rdtsc())) {};
|
||||
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 earlier(tsc_tick_count const other) const {
|
||||
return my_count < other.my_count ? (*this) : other;
|
||||
}
|
||||
static double tick_time(); // returns seconds per cycle (period) of clock
|
||||
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);
|
||||
};
|
||||
|
||||
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
|
||||
{
|
||||
return value*tick_time();
|
||||
}
|
||||
|
||||
extern std::string formatSI(double interval, int width, char unit);
|
||||
|
||||
inline std::string formatSeconds(double interval, int width)
|
||||
{
|
||||
return formatSI(interval, width, 'S');
|
||||
}
|
||||
|
||||
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
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_str.c -- String manipulation routines.
|
||||
* $Revision: 42810 $
|
||||
* $Date: 2013-11-07 12:06:33 -0600 (Thu, 07 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -114,7 +112,7 @@ __kmp_str_buf_reserve(
|
||||
if ( buffer->str == NULL ) {
|
||||
KMP_FATAL( MemoryAllocFailed );
|
||||
}; // if
|
||||
memcpy( buffer->str, buffer->bulk, buffer->used + 1 );
|
||||
KMP_MEMCPY_S( buffer->str, buffer->size, buffer->bulk, buffer->used + 1 );
|
||||
} else {
|
||||
buffer->str = (char *) KMP_INTERNAL_REALLOC( buffer->str, buffer->size );
|
||||
if ( buffer->str == NULL ) {
|
||||
@@ -144,7 +142,7 @@ __kmp_str_buf_detach(
|
||||
if ( buffer->str == NULL ) {
|
||||
KMP_FATAL( MemoryAllocFailed );
|
||||
}; // if
|
||||
memcpy( buffer->str, buffer->bulk, buffer->used + 1 );
|
||||
KMP_MEMCPY_S( buffer->str, buffer->size, buffer->bulk, buffer->used + 1 );
|
||||
}; // if
|
||||
|
||||
} // __kmp_str_buf_detach
|
||||
@@ -175,7 +173,7 @@ __kmp_str_buf_cat(
|
||||
KMP_DEBUG_ASSERT( str != NULL );
|
||||
KMP_DEBUG_ASSERT( len >= 0 );
|
||||
__kmp_str_buf_reserve( buffer, buffer->used + len + 1 );
|
||||
memcpy( buffer->str + buffer->used, str, len );
|
||||
KMP_MEMCPY( buffer->str + buffer->used, str, len );
|
||||
buffer->str[ buffer->used + len ] = 0;
|
||||
buffer->used += len;
|
||||
KMP_STR_BUF_INVARIANT( buffer );
|
||||
@@ -213,7 +211,7 @@ __kmp_str_buf_vprint(
|
||||
__va_copy( _args, args ); // Make copy of args.
|
||||
#define args _args // Substitute args with its copy, _args.
|
||||
#endif // KMP_OS_WINDOWS
|
||||
rc = vsnprintf( buffer->str + buffer->used, free, format, args );
|
||||
rc = KMP_VSNPRINTF( buffer->str + buffer->used, free, format, args );
|
||||
#if ! KMP_OS_WINDOWS
|
||||
#undef args // Remove substitution.
|
||||
va_end( _args );
|
||||
@@ -277,7 +275,6 @@ __kmp_str_buf_print_size(
|
||||
char const * names[] = { "", "k", "M", "G", "T", "P", "E", "Z", "Y" };
|
||||
int const units = sizeof( names ) / sizeof( char const * );
|
||||
int u = 0;
|
||||
int rc;
|
||||
if ( size > 0 ) {
|
||||
while ( ( size % 1024 == 0 ) && ( u + 1 < units ) ) {
|
||||
size = size / 1024;
|
||||
@@ -504,7 +501,7 @@ __kmp_str_format( // Allocated string.
|
||||
|
||||
// Try to format string.
|
||||
va_start( args, format );
|
||||
rc = vsnprintf( buffer, size, format, args );
|
||||
rc = KMP_VSNPRINTF( buffer, size, format, args );
|
||||
va_end( args );
|
||||
|
||||
// No errors, string has been formatted.
|
||||
@@ -735,7 +732,6 @@ __kmp_str_to_size( // R: Error code.
|
||||
size_t value = 0;
|
||||
size_t factor = 0;
|
||||
int overflow = 0;
|
||||
int bad_unit = 0;
|
||||
int i = 0;
|
||||
int digit;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_str.h -- String manipulation routines.
|
||||
* $Revision: 42613 $
|
||||
* $Date: 2013-08-23 13:29:50 -0500 (Fri, 23 Aug 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -28,9 +26,7 @@
|
||||
#endif // __cplusplus
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
#define strdup _strdup
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
# define strdup _strdup
|
||||
#endif
|
||||
|
||||
/* some macros to replace ctype.h functions */
|
||||
|
||||
+11
-27
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_stub.c -- stub versions of user-callable OpenMP RT functions.
|
||||
* $Revision: 42826 $
|
||||
* $Date: 2013-11-20 03:39:45 -0600 (Wed, 20 Nov 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -15,13 +13,13 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#include "kmp_stub.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "kmp_os.h" // KMP_OS_*
|
||||
#include "omp.h" // Function renamings.
|
||||
#include "kmp.h" // KMP_DEFAULT_STKSIZE
|
||||
#include "kmp_stub.h"
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
@@ -29,20 +27,12 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "omp.h" // Function renamings.
|
||||
#include "kmp.h" // KMP_DEFAULT_STKSIZE
|
||||
#include "kmp_version.h"
|
||||
|
||||
// Moved from omp.h
|
||||
#if OMP_30_ENABLED
|
||||
|
||||
#define omp_set_max_active_levels ompc_set_max_active_levels
|
||||
#define omp_set_schedule ompc_set_schedule
|
||||
#define omp_get_ancestor_thread_num ompc_get_ancestor_thread_num
|
||||
#define omp_get_team_size ompc_get_team_size
|
||||
|
||||
#endif // OMP_30_ENABLED
|
||||
|
||||
#define omp_set_num_threads ompc_set_num_threads
|
||||
#define omp_set_dynamic ompc_set_dynamic
|
||||
#define omp_set_nested ompc_set_nested
|
||||
@@ -95,15 +85,13 @@ static size_t __kmps_init() {
|
||||
void omp_set_num_threads( omp_int_t num_threads ) { i; }
|
||||
void omp_set_dynamic( omp_int_t dynamic ) { i; __kmps_set_dynamic( dynamic ); }
|
||||
void omp_set_nested( omp_int_t nested ) { i; __kmps_set_nested( nested ); }
|
||||
#if OMP_30_ENABLED
|
||||
void omp_set_max_active_levels( omp_int_t max_active_levels ) { i; }
|
||||
void omp_set_schedule( omp_sched_t kind, omp_int_t modifier ) { i; __kmps_set_schedule( (kmp_sched_t)kind, modifier ); }
|
||||
int omp_get_ancestor_thread_num( omp_int_t level ) { i; return ( level ) ? ( -1 ) : ( 0 ); }
|
||||
int omp_get_team_size( omp_int_t level ) { i; return ( level ) ? ( -1 ) : ( 1 ); }
|
||||
int kmpc_set_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
||||
int kmpc_unset_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
||||
int kmpc_get_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
||||
#endif // OMP_30_ENABLED
|
||||
void omp_set_max_active_levels( omp_int_t max_active_levels ) { i; }
|
||||
void omp_set_schedule( omp_sched_t kind, omp_int_t modifier ) { i; __kmps_set_schedule( (kmp_sched_t)kind, modifier ); }
|
||||
int omp_get_ancestor_thread_num( omp_int_t level ) { i; return ( level ) ? ( -1 ) : ( 0 ); }
|
||||
int omp_get_team_size( omp_int_t level ) { i; return ( level ) ? ( -1 ) : ( 1 ); }
|
||||
int kmpc_set_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
||||
int kmpc_unset_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
||||
int kmpc_get_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
||||
|
||||
/* kmp API functions */
|
||||
void kmp_set_stacksize( omp_int_t arg ) { i; __kmps_set_stacksize( arg ); }
|
||||
@@ -178,8 +166,6 @@ int __kmps_get_stacksize( void ) {
|
||||
return __kmps_stacksize;
|
||||
} // __kmps_get_stacksize
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
|
||||
static kmp_sched_t __kmps_sched_kind = kmp_sched_default;
|
||||
static int __kmps_sched_modifier = 0;
|
||||
|
||||
@@ -195,8 +181,6 @@ static int __kmps_sched_modifier = 0;
|
||||
*modifier = __kmps_sched_modifier;
|
||||
} // __kmps_get_schedule
|
||||
|
||||
#endif // OMP_30_ENABLED
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
|
||||
static kmp_proc_bind_t __kmps_proc_bind = proc_bind_false;
|
||||
@@ -226,7 +210,7 @@ double __kmps_get_wtime( void ) {
|
||||
}; // if
|
||||
}; // if
|
||||
#else
|
||||
// gettimeofday() returns seconds and microseconds sinse the Epoch.
|
||||
// gettimeofday() returns seconds and microseconds since the Epoch.
|
||||
struct timeval tval;
|
||||
int rc;
|
||||
rc = gettimeofday( & tval, NULL );
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* kmp_stub.h
|
||||
* $Revision: 42061 $
|
||||
* $Date: 2013-02-28 16:36:24 -0600 (Thu, 28 Feb 2013) $
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,7 +31,6 @@ int __kmps_get_nested( void );
|
||||
void __kmps_set_stacksize( int arg );
|
||||
int __kmps_get_stacksize();
|
||||
|
||||
#if OMP_30_ENABLED
|
||||
#ifndef KMP_SCHED_TYPE_DEFINED
|
||||
#define KMP_SCHED_TYPE_DEFINED
|
||||
typedef enum kmp_sched {
|
||||
@@ -46,11 +43,10 @@ typedef enum kmp_sched {
|
||||
#endif
|
||||
void __kmps_set_schedule( kmp_sched_t kind, int modifier );
|
||||
void __kmps_get_schedule( kmp_sched_t *kind, int *modifier );
|
||||
#endif // OMP_30_ENABLED
|
||||
|
||||
#if OMP_40_ENABLED
|
||||
void __kmps_set_proc_bind( enum kmp_proc_bind_t arg );
|
||||
enum kmp_proc_bind_t __kmps_get_proc_bind( void );
|
||||
void __kmps_set_proc_bind( kmp_proc_bind_t arg );
|
||||
kmp_proc_bind_t __kmps_get_proc_bind( void );
|
||||
#endif /* OMP_40_ENABLED */
|
||||
|
||||
double __kmps_get_wtime();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user