Compare commits

...
399 Commits
Author SHA1 Message Date
Jonathan Peyton f38e0ce0f1 Merging r285703:
------------------------------------------------------------------------
r285703 | achurbanov | 2016-11-01 11:19:04 -0500 (Tue, 01 Nov 2016) | 9 lines

Fixed problem introduced by part of https://reviews.llvm.org/D21196.

Check Task Scheduling Constraint (TSC) on stealing of untied task.
This is needed because the untied task can produce tied children
those can break TSC if untied is not a descendant of current task.
This can cause live lock on complex tyasking tests
(e.g. kastors/strassen-task-dep).

Differential Revision: https://reviews.llvm.org/D26182
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/openmp/branches/release_39@287561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 18:49:41 +00:00
Jonathan Peyton b402abdbbf Merging r287551:
------------------------------------------------------------------------
r287551 | jlpeyton | 2016-11-21 10:18:57 -0600 (Mon, 21 Nov 2016) | 8 lines

Fix for D25504 - segfault because of double free()-ing in shutdown code.

Paul Osmialowski pointed out a double free bug in shutdown code.  This patch
Moves the freeing of the implicit task to above the freeing of all fast memory
to prevent the double-free issue.

Differential Revision: https://reviews.llvm.org/D26860

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/openmp/branches/release_39@287560 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 18:47:18 +00:00
Jonathan Peyton ae6d028427 Merging r285283:
------------------------------------------------------------------------
r285283 | achurbanov | 2016-10-27 06:43:07 -0500 (Thu, 27 Oct 2016) | 6 lines

Fixed a memory leak related to task dependencies.

Differential Revision: http://reviews.llvm.org/D25504

Patch by Alex Duran.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/openmp/branches/release_39@287559 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 18:45:39 +00:00
Jonathan Peyton 91b0f59656 Merging r280138:
------------------------------------------------------------------------
r280138 | jlpeyton | 2016-08-30 14:28:58 -0500 (Tue, 30 Aug 2016) | 5 lines

Appease older gcc compilers for the many-microtask-args.c test

Older gcc compilers error out with the C99 syntax of: for (int i =...)
so this change just moves the int i; declaration up above.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/openmp/branches/release_39@287558 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 18:43:38 +00:00
Jonathan Peyton 05cf7728d5 Merging r278332:
------------------------------------------------------------------------
r278332 | achurbanov | 2016-08-11 08:04:00 -0500 (Thu, 11 Aug 2016) | 3 lines

Fixes for hierarchical barrier (possible hang if team size changed).

Differential Revision: http://reviews.llvm.org/D23175
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/openmp/branches/release_39@287557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 18:42:31 +00:00
Hans Wennborg 168b27e91b Merging r278036:
------------------------------------------------------------------------
r278036 | dim | 2016-08-08 11:34:05 -0700 (Mon, 08 Aug 2016) | 18 lines

Fix linking of omp_foreign_thread_team_reuse test on FreeBSD

Summary:
On FreeBSD, linking the misc_bugs/omp_foreign_thread_team_reuse.c test
case fails with:

   /usr/local/bin/ld: /tmp/omp_foreign_thread_team_reuse-c5e71b.o: undefined reference to symbol 'pthread_create@@FBSD_1.0'

This is because the program is linked without `-lpthread`.  Since the
%libomp-compile-and-run macro does not allow that option to be added to
the compile command line, split it up and add the required `-lpthread`
between %libomp-compile and %libomp-run.

Reviewers: jlpeyton, hfinkel, Hahnfeld

Subscribers: Hahnfeld, emaste, openmp-commits

Differential Revision: https://reviews.llvm.org/D23084
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/openmp/branches/release_39@278059 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08 22:11:41 +00:00
Hans Wennborg 82fb5e6198 Creating release_39 branch off revision 275826
git-svn-id: https://llvm.org/svn/llvm-project/openmp/branches/release_39@275839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 17:53:16 +00:00
Andrey Churbanov 17265704ce http://reviews.llvm.org/D22134: Implementation of OpenMP 4.5 nonmonotonic schedule modifier
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@275052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11 10:44:57 +00:00
Jonathan Peyton e942708d81 Improving EPCC performance when linking with hwloc
When linking with libhwloc, the ORDERED EPCC test slows down on big
machines (> 48 cores). Performance analysis showed that a cache thrash
was occurring and this padding helps alleviate the problem.

Also, inside the main spin-wait loop in kmp_wait_release.h, we can eliminate
the references to the global shared variables by instead creating a local
variable, oversubscribed and instead checking that.

Differential Revision: http://reviews.llvm.org/D22093


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274894 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 17:43:21 +00:00
Andrey Churbanov 643c28a2e4 D22138: Added more Intel compiler versions as allowed build compilers
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 15:23:35 +00:00
Andrey Churbanov fa6d122132 D22137: Memory leak fixed by adding missed cleanup of single level array of hot teams info
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274851 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 14:53:24 +00:00
Andrey Churbanov 7ff70929d2 D22136: Memory leaks fixed by adding missed __kmp_free() calls
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274850 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 14:40:20 +00:00
Andrey Churbanov 248f6cc602 D22135: formatting change
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274849 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 14:35:41 +00:00
Jonathan Peyton d72ef36ee0 Fix the nowait tests for omp for and omp single
These tests are now modeled after the sections nowait test where threads wait
to be released in the first construct (either for or single) and the last thread
skips the last for/single construct and releases those threads.  If the test
fails, then it hangs because an unnecessary barrier is executed in between the
constructs.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274641 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06 17:26:12 +00:00
Jonas Hahnfeld da4548933a __kmp_partition_places: Update assertion for new parameter update_master_only
If update_master_only is set the place list is not completely traversed
and therefore this assertion failed. Make it only trigger if
update_master_only is false.

(was introduced by D20539)

Differential Revision: http://reviews.llvm.org/D21925

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274482 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-04 05:58:10 +00:00
Jonathan Peyton e570daa772 Fix checks on schedule struct
This change fixes an error in comparing the existing schedule on the team to
the new schedule, in the chunk field. Also added additional checks and used
KMP_CHECK_UPDATE where appropriate.

Patch by Terry Wilmarth.

Differential Revision: http://reviews.llvm.org/D21897


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274371 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 17:54:32 +00:00
Jonathan Peyton 4720bb4a5c Improve performance of #pragma omp single
EPCC Performance of single is considerably worse than plain barrier.
Adding a read-only check to the code before the atomic compare-and-store
helps considerably.

Patch by Terry Wilmarth.

Differential Revision: http://reviews.llvm.org/D21893


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274369 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 17:37:49 +00:00
Jonathan Peyton 5afb0c9897 Fix omp_sections_nowait.c test to address Bugzilla Bug 28336
This rewrite of the omp_sections_nowait.c test file causes it to hang if the
nowait is not respected. If the nowait isn't respected, the lone thread which
can escape the first sections construct will just sleep at a barrier which
shouldn't exist. All reliance on timers is taken out. For good measure, the test
makes sure that all eight sections are executed as well. The test should take no
longer than a few seconds on any modern machine.

Differential Revision: http://reviews.llvm.org/D21842


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274151 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 19:46:52 +00:00
Jonathan Peyton f01e27f138 Fix bugs in TAS and futex lock
* Incorrect lock value written in __kmp_test_futex_lock
* Incorrect lock value check in tas/futex lock with USE_LOCK_PROFILE on

Patch by Hansang Bae


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-28 19:37:24 +00:00
Jonathan Peyton 1a885988bf Revert r273898's UNICODE quick fix in favor of CMake's remove_definitions()
UNICODE and _UNICODE defintions were added in the LLVM CMake build system.
While on Unices, the UNICODE/_UNICODE macros don't cause problems, on Windows
only ittnotify_static.c should be compiled using -DUNICODE.  We are still
looking at a proper fix, but this change sets the build back to exactly what it
was doing before.  Also, a comment and TODO were added in the src/CMakeLists.txt
file to help explain.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@274052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-28 19:25:13 +00:00
Hans Wennborg ad958989b0 Fix the Windows build after r273599
That patch made all LLVM projects build with -DUNICODE. However, this doesn't
work for the OpenMP runtime.

But just overriding the flag with -UUNICODE breaks compiling ittnotify_static.c,
which for some reason needs to be compiled with -DUNICIODE. Note that compiling
ittnotify.h with -DUNICODE does not work though.

This seems like a mess. This commit fixes it for now, but it would be great
if someone who works on the OpenMP runtime could fix it properly.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273898 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-27 18:03:45 +00:00
Jonathan Peyton 153bf3fb97 Remove redundant %libomp-compile step from test/lock/omp_lock.c
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 16:18:59 +00:00
Jonathan Peyton d770e3b3e6 Fix bug in futex fast path inside kmp_csupport.c
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273439 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 16:36:07 +00:00
Jonathan Peyton e402afb408 Apply the KMP_USE_FUTEX feature macro everywhere
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273438 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 16:35:12 +00:00
Jonathan Peyton d2f54c3c3b Add debug trace messages for taskloop
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273299 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 19:18:13 +00:00
Jonathan Peyton 5fda24f1d2 Bug fix for hang when tasks used in nested parallel
Bug fix for hang when omp task and nested parallelism used together.
Still some problem remains with task state saving/restoring, but
user's case works fine now. All tasking unit tests passed as well.

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21558


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273297 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 19:12:07 +00:00
Jonathan Peyton ab79479bbf Performance improvement: accessing thread struct as opposed to team struct
Replaced readings of nproc from team structure with ones from
thread structure to improve performance.

Patch by Andrey Churbanov.

Differential Revision: http://reviews.llvm.org/D21559


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273293 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 18:30:15 +00:00
Jonathan Peyton 8d07e31950 Addition of debugger comments and whitespace
The removal of legacy code to support long-deprecated debugger support library
resulted in some whitespace changes. Comments from that legacy code were made
public as they may be useful for other debuggers.

Patch by Olga Malysheva.

Differential Revision: http://reviews.llvm.org/D21391


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273282 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 15:59:34 +00:00
Jonathan Peyton de40b77396 Improvements to process affinity mask setting
A couple improvements:
1) Add ability to limit fullMask size when KMP_HW_SUBSET limits resources.
2) Make KMP_HW_SUBSET work for affinity_none, and only limit fullMask in this case.

Patch by Andrey Churbanov.

Differential Revision: http://reviews.llvm.org/D21528


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 15:54:38 +00:00
Jonathan Peyton bef163a8b2 Bug fix for segfault in stubs library
There was a segfault in the stubs library in posix_memalign because
of a bad parameter. The fix is to send address of the pointer as a
parameter. Also added check of result of posix_memalign.

Patch by Andrey Churbanov.

Differential Revision: http://reviews.llvm.org/D21529


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 15:39:08 +00:00
Jonathan Peyton 1860d030e5 [STATS] Adding process id to output filename
This change appends the process id to the KMP_STATS_FILE (if specified) which
enables MPI processes to output their stats to separate files.

Differential Revision: http://reviews.llvm.org/D21386


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 15:20:33 +00:00
Jonathan Peyton 555cbc14bd Fix typos in Fortran headers
Fix typos in Fortran headers to match spec.
Patch by Andrey Churbanov.
Differential Revision: http://reviews.llvm.org/D21531


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@273272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 15:16:51 +00:00
Jonathan Peyton e82ed9c802 Change hwloc discovery algorithm to print topology only for accessible resources
Change hwloc discovery algorithm to print topology for only accessible
resources, and report uniformity correspondingly, similar to what other topology
discovery algorithms do. Fixes minor inconsistency in total topology reported
and resources used for threads binding in case hwloc used.

Patch by Andrey Churbanov.

Differential Revision: http://reviews.llvm.org/D21389


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272952 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 20:31:19 +00:00
Jonathan Peyton c1cd14fc40 Teach OpenMP Library to use Hwloc on Windows
This patch allows a user to enable Hwloc on windows. There are three main
changes in here:
1.kmp.h - Move definitions/declarations out of KMP_OS_WINDOWS guard (our windows
          implementation of affinity) because they need to be defined when
          KMP_USE_HWLOC is on as well.
2.teach __kmp_set_system_affinity, __kmp_get_system_affinity,
        __kmp_get_proc_group, and __kmp_affinity_bind_thread how to use hwloc.
3.teach CMake how to include hwloc when building Windows

Another minor change in here is to make sure that anything under KMP_USE_HWLOC
is also guarded by KMP_AFFINITY_SUPPORTED as well. This is to prevent Mac
builds from requiring anything from Hwloc.

Differential Revision: http://reviews.llvm.org/D21441


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 20:23:11 +00:00
Jonathan Peyton 24cb1f28b4 Fix for crash in task dependencies
With single thread using __kmpc_omp_wait_deps segfaults in OpenMP runtime.
Offloading with depend also encounters this problem when we generate
kmpc_omp_wait_deps instead of kmpc_omp_task_with_deps.

Patch by Alex Duran

Differential Revision: http://reviews.llvm.org/D21384


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272949 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 20:18:31 +00:00
Jonathan Peyton e5a6ff39db Fixed missing memory cleanup in __kmp_affinity_create_hwloc_map()
Cleanup: fixed missing memory cleanup in couple of corner cases. Fixes possible
memory leak in some corner cases

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21355


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272946 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 20:14:54 +00:00
Jonathan Peyton 7ffaa1b0a4 Reduce perf impact of redundant ittnotify calls
Improved performance of ittnotify calls by request from ittnotify
owner: calls to __itt_string_handle_create made unique (it was
called multiple times).

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21353


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 20:11:51 +00:00
Jonathan Peyton 5c280a4383 Deprecate KMP_PLACE_THREADS and rename as KMP_HW_SUBSET
Deprecate KMP_PLACE_THREADS and rename it to KMP_HW_SUBSET due to confusion
about its purpose and function among users.  KMP_HW_SUBSET is an environment
variable which allows users to easily pick a subset of the hardware topology to
use.  e.g., KMP_HW_SUBSET=30c,2t means use 30 cores, 2 threads per core.

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21340


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272937 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 18:53:48 +00:00
Jonathan Peyton 5ff54f36e0 Bug fix: crash if teams executed on host
Added argv array check/allocation for parallel directly nested inside the teams
construct, as new coming Fortran codegen passes parameters directly into
kmpc_fork_call missing same parameters in kmpc_fork_teams (earlier codegen
passed to parallel the subset of parameter passed to teams, and thus
no check/allocation needed).

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21336


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272935 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 18:47:38 +00:00
Jonathan Peyton 4cbdcd9d46 Fix large overhead with itt notifications on region/barrier name composing
Currently, there is a big overhead in reporting of loop metadata through
ittnotify.  The pair of functions: __kmp_str_loc_init/__kmp_str_loc_free are
replaced with strchr/atoi calls.  Thus, a lot of time consuming actions are
skipped - many memory allocations/deallocations, heavy string duplication, etc.
The loop metadata only needs line and column info from the source string, so no
allocations and string splitting actually needed.

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21309


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272698 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 19:27:22 +00:00
Jonathan Peyton 0951fde96b Remove unused wait/release code.
Cleanup - unused code removal.
TODO: consider to remove (replace with flag class methods)
also kmp_wait_64 and kmp_release_64 routines.

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21332


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272697 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 19:15:40 +00:00
Jonathan Peyton cdab46b74d Whitespace cleanup of dllexports
Differential Revision: http://reviews.llvm.org/D21331


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272691 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 18:47:47 +00:00
Jonathan Peyton 171ddd1f23 Renaming change: 41 -> 45 and 4.1 -> 4.5
OpenMP 4.1 is now OpenMP 4.5.  Any mention of 41 or 4.1 is replaced with
45 or 4.5.  Also, if the CMake option LIBOMP_OMP_VERSION is 41, CMake warns that
41 is deprecated and to use 45 instead.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272687 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 17:57:47 +00:00
Jonathan Peyton f7dc7b1746 Bug fix for Bugzilla bug 26602: Remove function bodies with KMP_ASSERT(0)
Fix for bugzilla https://llvm.org/bugs/show_bug.cgi?id=26602.  Removed functions
body consisted of the only KMP_ASSERT(0) statement.  Thus possible runtime crash
converted to compile-time error, which looks preferable (faster possible error
detection).

TODO: consider C++11 static assert as an alternative, that could
make the diagnostics better.

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21304


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 21:33:30 +00:00
Jonathan Peyton 146e0c7b5f Affinity mask processing improvements
Remove static specifier from var fullMask and remove kmp_get_fullMask() routine.
When iterating through procs in a mask, always check if proc is in fullMask
(this check was missing in a few places).

Patch by Brian Bliss.

Differential Revision: http://reviews.llvm.org/D21300


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272589 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 21:28:03 +00:00
Jonathan Peyton 021a4a2897 Exclude untied tasks from task stealing constraint
If either current_task or new_task is untied then skip task scheduling
constraint checks, because untied tasks are not affected by the task
scheduling constraints.

Differential Revision: http://reviews.llvm.org/D21196


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272570 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 17:51:59 +00:00
Jonathan Peyton ed25b3ab12 Fix crash when libomp loaded/unloaded multiple times
The problem scenario is the following:
A dynamic library, libfoo.so, depends on libomp.so (it creates parallel region
and calls some omp functions).  An application has a loop where it dynamically
loads libfoo.so, calls the function from it, unloads libfoo.so.  After several
loop iterations application crashes with the message about lack of resources
OMP: Error #34: System unable to allocate necessary resources for OMP thread:

The problem is that pthread_kill() was not followed by pthread_join() in case
of terminated thread. This patch fixes this problem for both worker and monitor
threads.

Differential Revision: http://reviews.llvm.org/D21200


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272567 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 17:36:40 +00:00
Jonathan Peyton 8672b2ed72 Hwloc refactoring patch
These changes remove the hwloc_topology_ignore_type function which doesn't exist
in the hwloc 2.0 API. In the existing code, the topology extracted from hwloc
has the cache levels stripped out and then assumes the final stripped topology
follows the typical three-level topology: packages -> cores -> HW threads.
But the code is doing unclean manipulations to determine at what level those
resources are located and also assumes too much about what hwloc is detecting
(there could be intermediate levels in between socket and core for instance).
This new way of extracting the topology doesn't strip out any hardware objects
that hwloc detects. It does not assume the three level topology, and instead
searches for the relevant three levels within the topology for each bit of
information using hwloc interface functions. i.e., the three level topology
subset that our affinity code is interested in is extracted from the hwloc
topology tree directly.

For example, the new __kmp_hwloc_get_nobjs_under_obj function gives the user the
number of cores under a socket reliably without worrying if there are unexpected
objects between the socket object and core object in the hwloc topology
structure. Also, now that all topology information is kept, there are also
possibilities of using the caches/numa nodes to determine more sophisticated
affinity settings in the future.

There is also some cleanup code added for the destruction of the
__kmp_hwloc_topology object.

Differential Revision: http://reviews.llvm.org/D21195


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272565 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 17:30:08 +00:00
Jonathan Peyton 49c056c6db Fix bitmask complement operation
The bitmask complement operation doesn't consider the max proc id which means
something like !{0} will be translated to {1,2,3,4,...,600,601,...,1023} on a
Linux system even though there aren't 600 processors on said system. This
change has the complement bitmask and-ed with the fullmask so that it will only
contain valid processors.

Differential Revision: http://reviews.llvm.org/D21245


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 17:01:26 +00:00
Jonathan Peyton f981e33157 [STATS] Add stats gathering for taskloop construct
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272560 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 16:56:41 +00:00
Jonathan Peyton 6018ddafaa Fix spelling in comment
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 18:51:17 +00:00
Jonathan Peyton 56168b3a23 Revert accidental commit to lit.cfg
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272287 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 18:29:36 +00:00
Jonathan Peyton 93153d271f Refactor __kmp_execute_tasks_template function
Refactored __kmp_execute_tasks_template to shorten and remove code redundancy.
The original code for __kmp_execute_tasks_template was very redundant with
large sections of repeated code that needed to be kept consistent, and goto
statements that made the control flow difficult to discern. This refactoring
removes all gotos and redundancy.

Patch by Terry Wilmarth

Differential Revision: http://reviews.llvm.org/D20879


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272286 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 18:27:03 +00:00
Hans Wennborg a763c59623 kmp_lock.h: Fix VS2013 build after r271324
MSVC doesn't allow std::atomic<>s in a union since they don't have trivial
copy constructor. Replacing them with e.g. std::atomic_int works, but that
breaks the GCC build on Linux, because then calls to e.g. std::atomic_load_explicit
fail, as they expect a real std::atomic<> pointer.

Fixing this with an #ifdef to unbreak the build for now.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@272271 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 15:54:43 +00:00
Paul Osmialowski 8951c8e6f3 Fine tuning of TC* macros - small followup
As I replaced no-op TCR_4 with actual code, compiler complained while building debug build.
This patch moves 'cast to int' to the correct place.

Extension to Differential Revision: http://reviews.llvm.org/D19880

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@271377 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 09:59:26 +00:00
Paul Osmialowski e75e989062 Use C++11 atomics for ticket locks implementation
This patch replaces use of compiler builtin atomics with
C++11 atomics for ticket locks implementation. Ticket locks
are used in critical places of the runtime, e.g. in the tasking
mechanism.

The main reason this change was introduced is the problem
with work stealing function on ARM architecture which suffered
from nasty race condition. It turned out that the root cause of
the problem lies in the way ticket locks are implemented. Changing
compiler builtins into C++11 atomics solves the problem.

Two assertions were added into kmp_tasking.c which are useful
for detecting early symptoms of something wrong going on with
work stealing, which were among the possible outcomes of the
race condition.

Differential Revision: http://reviews.llvm.org/D19878

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@271324 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 20:20:32 +00:00
Jonathan Peyton 50df1d2f4c Addition of OpenMP 4.5 feature: schedule(simd:static)
This patch implements the new kmp_sch_static_balanced_chunked schedule kind that
the compiler will generate when it encounters schedule(simd: static). It just
adds the new constant and the new switch case __kmp_for_static_init.

Patch by Alex Duran.

Differential Revision: http://reviews.llvm.org/D20699


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@271320 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 19:12:18 +00:00
Jonathan Peyton a93f24d670 Avoid deadlock with COI
When an asynchronous offload task is completed, COI calls the runtime to queue
a "destructor task".  When the task deques are full, a dead-lock situation
arises where the OpenMP threads are inside but cannot progress because the COI
thread is stuck inside the runtime trying to find a slot in a deque.

This patch implements the solution where the task deques doubled in size when
a task is being queued from a COI thread.

Differential Revision: http://reviews.llvm.org/D20733


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@271319 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 19:07:00 +00:00
Jonathan Peyton ce32bac98c Offer API for setting number of loop dispatch buffers
The problem is the lack of dispatch buffers when thousands of loops with nowait,
about 10 iterations each, are executed by hundreds of threads. We only have
built-in 7 dispatch buffers, but there is a need in dozens or hundreds of
buffers.

The problem can be fixed by setting KMP_MAX_DISP_BUF to bigger value. In order
to give users same possibility I changed build-time control into run-time one,
adding API just in case.

This change adds an environment variable KMP_DISP_NUM_BUFFERS and a new API
function kmp_set_disp_num_buffers(int num_buffers).

The KMP_DISP_NUM_BUFFERS envirable works only before serial initialization,
because during the serial initialization we already allocate buffers for the hot
team, so it is too late to change the number of buffers later (or we need to
reallocate buffers for all teams which sounds too complicated). The
kmp_set_defaults() routine does not work for this envirable, because it calls
serial initialization before reading the parameter string. So a new routine,
kmp_set_disp_num_buffers(), is created so that it can set our internal global
variable before the library initialization. If both the envirable and API used
the envirable wins.

Differential Revision: http://reviews.llvm.org/D20697


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@271318 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 19:01:15 +00:00
Hal Finkel cbb2a49897 Fix storing the frame pointer for OMP-T during ppc64 microtask dispatch
Thanks to John Mellor-Crummey for reporting the omission.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@271035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 19:04:05 +00:00
Jonathan Peyton 541b718def Add missing OpenMP 4.5 device entries to stubs library.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@271006 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 15:51:14 +00:00
Jonathan Peyton 100061452c Fix for OMP_PROC_BIND=spread strategy
The OMP_PROC_BIND=spread strategy fails to assign the master thread the
correct place partition after the first parallel region. Other threads in the
hot team will remember their place_partition, but the master's place partition
is restored to what it was before entering the parallel region. So when the hot
team is used for subsequent parallel regions, the master has lost this info.
This fix calls __kmp_partition_places to update only the master thread's place
partition in the spread case when there are no other changes to the hot team.

Patch by Terry Wilmarth

Differential Revision: http://reviews.llvm.org/D20539


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270890 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 19:09:46 +00:00
Jonathan Peyton 5ecfa9d187 Make LIBOMP_USE_ITT_NOTIFY a setting that can be enabled or disabled
On Blue Gene/Q, having LIBOMP_USE_ITT_NOTIFY support compiled into a
statically-linked binary causes a failure at runtime because dlopen fails.
This patch changes LIBOMP_USE_ITT_NOTIFY to a cacheable configuration setting
that can be disabled.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D20517


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270884 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 18:19:10 +00:00
Hal Finkel fea1a1cd1a Add a test case for microtask dispatch with many arguments
This is a cleaned-up version of the test case posted in the D19879 review.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270867 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 16:34:05 +00:00
Hal Finkel 9c04b6d2d7 Add an assembly __kmp_invoke_microtask for ppc64[le]
Clang no longer restricts itself to generating microtasks with a small number
of arguments, and so an assembly implementation is required to prevent hitting
the parameter limit present in the C implementation. This adds an
implementation for ppc64[le].

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270821 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 04:48:14 +00:00
Andrey Churbanov 177c3c8777 D20525: Use more general function for getting gtid which may be faster than specific one.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270694 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 12:53:17 +00:00
Jonathan Peyton 58cc7e0de3 Fork performance improvements
Most of this is modifications to check for differences before updating data
fields in team struct. There is also some rearrangement of the team struct.

Patch by Diego Caballero

Differential Revision: http://reviews.llvm.org/D20487


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270468 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23 18:01:19 +00:00
Jonathan Peyton 531ce2ade7 Allow unit testing on Windows
These changes allow testing on Windows using clang.exe.
There are two main changes:
1. Only link to -lm when it actually exists on the system
2. Create basic versions of pthread_create() and pthread_join() for windows.
   They are not POSIX compliant by any stretch but will allow any existing
   and future tests to use pthread_create() and pthread_join() for testing
   interactions of libomp with os threads.

Differential Revision: http://reviews.llvm.org/D20391


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23 17:50:32 +00:00
Jonathan Peyton 43eef9805e Changed parameter names in Fortran modules to correspond with OpenMP 4.5 specification
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270447 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23 16:24:39 +00:00
Jonathan Peyton 561ebb5943 Remove trailing whitespace in src/ directory
This patch doesn't affect D19878's context.  So D19878 still cleanly applies.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@270252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20 19:03:38 +00:00
Jonathan Peyton f7f0293db9 Remove unnecessary unistd.h header from tests.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 21:36:34 +00:00
Jonathan Peyton 9cab9c8fc5 Remove trailing whitespace in files in doc/ directory
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269842 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 21:12:48 +00:00
Jonathan Peyton fcef12cd45 Remove trailing whitespace from tests
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 21:08:52 +00:00
Jonathan Peyton 9c8a7db909 Remove trailing whitespace in files in tools/ directory
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269837 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 20:54:10 +00:00
Jonathan Peyton b0081632c4 Remove trailing whitespace in CMake files
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269836 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 20:51:24 +00:00
Jonathan Peyton aa4e4f26ff Remove trailing whitespace in READMEs, CREDITS.txt and index.html
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269835 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 20:48:42 +00:00
Jonathan Peyton da1e2c84c3 Update copyright year in LICENSE.txt
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269826 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 20:11:26 +00:00
Jonathan Peyton 9c0b306f7d [OpenMP Testing] Have lit.py be a valid lit executable
Users can use either llvm-lit (generated during llvm build) or lit.py which
exists in llvm/utils/lit.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269774 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 15:12:11 +00:00
Paul Osmialowski d19f27349b Clean all the mess around KMP_USE_FUTEX and kmp_lock.h
KMP_USE_FUTEX preprocessor definition defined in kmp_lock.h is used
inconsequently throughout LLVM libomp code.

* some .c files that use this define do not include kmp_lock.h file,
  in effect guarded part of code are never compiled
* some places in code use architecture-depending preprocessor
  logic expressions which effectively disable use of Futex for
  AArch64 architecture, all these places should use
  '#if KMP_USE_FUTEX' instead to avoid any further confusions
* some places use KMP_HAS_FUTEX which is nowhere defined,
  KMP_USE_FUTEX should be used instead

Differential Revision: http://reviews.llvm.org/D19629

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269642 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 09:44:11 +00:00
Paul Osmialowski 65f68b9d4b NFC fix indent (relates to my previous commit)
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269443 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 17:45:49 +00:00
Paul Osmialowski 1238ecb8f7 Solve 'Too many args to microtask' problem
This patch solves 'Too many args to microtask' problem which occurs
while executing lulesh2.0.3 benchmark on AArch64.

To solve this I had to wrtite AArch64 assembly version of
__kmp_invoke_microtask() function, similar to x86 and x86_64
implementations.

Differential Revision: http://reviews.llvm.org/D19879

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269399 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 08:26:42 +00:00
Jonathan Peyton 700a1a0f37 Adding new kmp_aligned_malloc() entry point
This change adds a new entry point,
kmp_aligned_malloc(size_t size, size_t alignment), an entry point corresponding
to kmp_malloc() but with the capability to return aligned memory as well.
Other allocator routines have been adjusted so that kmp_free() can be used for
freeing memory blocks allocated by any kmp_*alloc() routine, including the new
kmp_aligned_malloc() routine.

Differential Revision: http://reviews.llvm.org/D19814


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269365 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 22:00:37 +00:00
Jonathan Peyton e0719d4bb6 Fix team reuse with foreign threads
After hot teams were enabled by default, the library started using levels kept
in the team structure. The levels are broken in case foreign thread exits and
puts its team into the pool which is then re-used by another foreign thread.
The broken behavior observed is when printing the levels for each new team, one
gets 1, 2, 1, 2, 1, 2, etc. This makes the library believe that every other
team is nested which is incorrect. What is wanted is for the levels to be
1, 1, 1, etc.

Differential Revision: http://reviews.llvm.org/D19980


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 21:54:30 +00:00
Paul Osmialowski bac3f87342 New hwloc API compatibility
Differential Revision: http://reviews.llvm.org/D19628

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 11:46:40 +00:00
Hal Finkel 8a3c7df762 Restore NULL flag check in __kmp_null_resume_wrapper
This reverts a presumaby-unintentional change in:

  r268640 - [STATS] Use partitioned timer scheme

and fixes segfaults in an x86_64 debug build of the runtime library.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@269259 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 00:54:08 +00:00
Paul Osmialowski 2f585ea95f Fine tuning of TC* macros
This patch introduces following:
* TCI_* and TCD_* macros for incrementation and decrementation
* Fix for invalid use of TCR_8 in one expression

Differential Revision: http://reviews.llvm.org/D19880

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@268826 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07 00:00:00 +00:00
Jonathan Peyton 039c3ab59a [STATS] Use partitioned timer scheme
This change removes the current timers with ones that partition time properly.
The current timers are nested, so that if a new timer, B, starts when the
current timer, A, is already timing, A's time will include B's. To eliminate
this problem, the partitioned timers are designed to stop the current timer (A),
let the new timer run (B), and when the new timer is finished, restart the
previously running timer (A). With this partitioning of time, a threads' timers
all sum up to the OMP_worker_thread_life time and can now easily show the
percentage of time a thread is spending in different parts of the runtime or
user code.

There is also a new state variable associated with each thread which tells where
it is executing a task. This corresponds with the timers: OMP_task_*, e.g., if
time is spent in OMP_task_taskwait, then that thread executed tasks inside a
#pragma omp taskwait construct.

The changes are mostly changing the MACROs to use the new PARITIONED_* macros,
the new partitionedTimers class and its methods, and new state logic.

Differential Revision: http://reviews.llvm.org/D19229


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@268640 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 16:15:57 +00:00
Paul Osmialowski 45c857dc34 NFC remove unneded spaces (test commit)
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@268462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 23:10:20 +00:00
Jonathan Peyton 843428ce2a Remove architecture dependent Hwloc DEBUG section
This debug sections's functionality can be replicated using the environment
variable KMP_TOPOLOGY_METHOD with different values and KMP_AFFINITY=verbose


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@267472 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 21:11:26 +00:00
Jonathan Peyton 3bef31a43c Fix buffer problem with printing long Hwloc affinity mask
This change has the hwloc_bitmap_list_snprintf() function use the entire buffer
to print the mask.  There is no need to shorten the buffer length by 7.  It only
needs to be shortened by one byte.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@267470 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 21:08:31 +00:00
Jonathan Peyton d3e4ccd5d4 ARM Limited license agreement from the copyright/patent holder
I have prepared some patches for LLVM OpenMP runtime, mostly addressing
ARMv8 support. Before I upstream them, I must address legal issues that
arose around my planned contribution. I was advised that before I send any
substantial commit, I need to make sure that LICENSE.txt file in the projects
repository contains a statement submitted by ARM, similar to the one provided
by Intel (see "a license agreement from the copyright/patent holders"). This is
the same situation as with top-level LLVM project: ARM has provided the same
statement in http://llvm.org/svn/llvm-project/llvm/trunk/lib/Target/ARM/LICENSE.TXT file.

Patch by Paul Osmialowski

Differential Revision: http://reviews.llvm.org/D19319


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@267446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 19:12:20 +00:00
Jonathan Peyton 43ffd46990 [ITTNOTIFY] Remove serialized parallel regions from frame notification
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 16:55:17 +00:00
Jonathan Peyton 56dc65916c Fix trip count calculation for parallel loops in runtime
The trip count calculation was incorrect for loops with large bounds. For example,
for(int i=-2,000,000,000; i < 2,000,000,000; i+=50000000), the trip count
calculation had overflow (trying to calculate 2,000,000,000 + 2,000,000,000 with
signed integers) and wasn't giving the right value. This patch fixes this error
in the runtime by using unsigned integers instead. There is still a bug in the
clang compiler component because it warns that there is overflow in the
test case file when there isn't. This error isn't there for the Intel Compiler.
So for now, the test case is designated as XFAIL.

Differential Revision: http://reviews.llvm.org/D19078


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266677 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 21:38:29 +00:00
Jonathan Peyton 376dc01a45 Runtime support for untied tasks
Introduced a counter of parts of an untied task submitted for execution. The
counter controls whether all parts of the task are already finished. The
compiler should generate re-submission of partially executed untied task by
itself before exiting of each task part except for the lexical last part.

Differential Revision: http://reviews.llvm.org/D19026


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266675 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 21:35:14 +00:00
Jonathan Peyton 0a8fbe6d06 Fix for pthread_setspecific (TLS and shutdown) problem
Some codes that use TLS fail intermittently because one thread tries to write
TLS values after the TLS key has been destroyed by another thread. This happens
when one thread executes library shutdown (and destroys TLS keys), while another
thread starts to execute the TLS key destructor routine. Before this change, the
kmp_init_runtime flag was checked before calling pthread_* TLS functions, but
this flag is set to FALSE later than the destruction of the TLS keys, which
leads to failure. The fix is to check kmp_init_gtid instead, as this flag is
unset *before* the destruction of TLS keys.

Differential Revision: http://reviews.llvm.org/D19022


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266674 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 21:33:01 +00:00
Jonathan Peyton c87f146dfd [STATS] Remove timePair class and unused functions
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 17:27:30 +00:00
Jonathan Peyton bda570af9c [STATS] print Total_* stats on their own line
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266633 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 17:24:20 +00:00
Jonathan Peyton 3fb06fd2fe [ITTNOTIFY] Correct barrier imbalance time in case of tasks
ittnotify fix for barrier imbalance time in case tasks exist. In the current
implementation, task execution time is included into aggregated time on a
barrier. This fix calculates task execution time and corrects the arrive time
by subtracting the task execution time.

Since __kmp_invoke_task() can not only be called on a barrier, the field
th.th_bar_arrive_time is used to check if the function was called at the
barrier (th.th_bar_arrive_time != 0). So for this check, th_bar_arrive_time
is set to zero right after the value is used on the barrier.

Differential Revision: http://reviews.llvm.org/D19030


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266332 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-14 16:06:49 +00:00
Jonathan Peyton be019e9440 Exponential back off logic for test-and-set lock
This change adds back off logic in the test and set lock for better contended
lock performance. It uses a simple truncated binary exponential back off
function. The default back off parameters are tuned for x86.

The main back off logic has a two loop structure where each is controlled by a
user-level parameter:
max_backoff - limits the outer loop number of iterations.
    This parameter should be a power of 2.
min_ticks - the inner spin wait loop number of "ticks" which is system
    dependent and should be tuned for your system if you so choose.
    The "ticks" on x86 correspond to the time stamp counter,
    but on other architectures ticks is a timestamp derived
    from gettimeofday().

The user can modify these via the environment variable:
KMP_SPIN_BACKOFF_PARAMS=max_backoff[,min_ticks]
Currently, since the default user lock is a queuing lock,
one would have to also specify KMP_LOCK_KIND=tas to use the test-and-set locks.

Differential Revision: http://reviews.llvm.org/D19020


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266329 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-14 16:00:37 +00:00
Jonathan Peyton 949a018241 Add declarations of OpenMP 4.5 target/offload routines to headers
All these routines are implemented in the offload library.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@266120 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-12 20:37:18 +00:00
Jonathan Peyton 089e14d905 [STATS] Remove trailing whitespace in stats source files
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@265437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 18:48:48 +00:00
Jonathan Peyton 84ea928f38 OMP_WAIT_POLICY changes
This change has OMP_WAIT_POLICY=active to mean that threads will busy-wait in
spin loops and virtually never go to sleep. OMP_WAIT_POLICY=passive now means
that threads will immediately go to sleep inside a spin loop. KMP_BLOCKTIME was
the previous mechanism to specify this behavior via KMP_BLOCKTIME=0 or
KMP_BLOCKTIME=infinite, but the standard OpenMP environment variable should
also be able to specify this behavior.

Differential Revision: http://reviews.llvm.org/D18577


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@265339 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 19:38:32 +00:00
Jonathan Peyton 7b70a4f1f5 Fix bug when KMP_USE_ADAPTIVE_LOCKS is 0
#endif was one line too low.  If KMP_USE_ADAPTIVE_LOCKS is 0,
then queuing locks would incorrectly use drdpa lock mechanism.
This is a fix for https://llvm.org/bugs/show_bug.cgi?id=26649


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264934 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 21:50:59 +00:00
Jonathan Peyton 7b93f85cfe Fix comment in kmp_wait_release.h
Removed reference to "ref ct" in a comment, as ref_ct no longer exists. Also
moved the comment to where the task_team is about to be tested if NULL.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264786 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 21:08:29 +00:00
Jonathan Peyton 30f9d73139 Fix incorrect indention in kmp_alloc.c
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264777 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 20:10:00 +00:00
Jonathan Peyton 65298d8318 Remove dead KMP_USE_POOLED_ALLOC code
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264776 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 20:05:27 +00:00
Jonathan Peyton f2e12f4e42 [STATS] Missing check for MIC in config-ix.cmake
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264616 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 18:53:10 +00:00
Hal Finkel 71b975dd98 Fixing the non-x86 build by removing dependence on kmp_cpuid_t
The problem is that the definition of kmp_cpuinfo_t contains:

  char       name [3*sizeof (kmp_cpuid_t)]; // CPUID(0x80000002,0x80000003,0x80000004)

and kmp_cpuid_t is only defined when compiling for x86.

Differential Revision: http://reviews.llvm.org/D18245

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264535 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-27 13:24:09 +00:00
Jonas Hahnfeld 3bcc68623b [OMPT] Fix parallel_id and task_id in loop_end with schedule static
For serialized parallel regions, wrong ids were reported. Now the same code is
used as in kmp_dispatch.cpp which emits the correct ids.

Differential Revision: http://reviews.llvm.org/D18348

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 12:52:20 +00:00
Jonas Hahnfeld 014497155a [OMPT] Test ids reported by ompt_get_{parallel,task}_id
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 12:52:11 +00:00
Jonas Hahnfeld 0dd34acf87 [OMPT] Fix duplicate implicit_task_end events for master thread with GCC
For non-serialized parallel regions the master thread issued two callbacks:
The first one in kmp_gsupport.c and the second in __kmp_join_call. Therefore
only trigger the callback in kmp_gsupport.c for serialized parallel regions.

Differential Revision: http://reviews.llvm.org/D16716

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264264 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 12:52:04 +00:00
Jonathan Peyton b6ab8f8fd7 Fix Visual Studio builds
Have Visual Studio use MemoryBarrier() instead of _mm_mfence() and remove
__declspec align attribute from function parameters in kmp_atomic.h


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264166 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 16:27:25 +00:00
Jonas Hahnfeld 55582d0683 [OMPT] Make tests require OMPT_BLAME
ompt_event_barrier_{begin,end} are optional blame events.
In total it doesn't make any sense to test partially built OMPT support.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264031 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 08:23:24 +00:00
Jonas Hahnfeld 569d1e46d8 [OMPT] Create infrastructure and add first tests for OMPT
Some basic checks next to the implementation should futher lower the
possibility to introduce regressions. (Note that this would have catched
the ordering issue fixed in rL258866 and pointed to rL263940.)

The tests are implementation dependent in one point because they assume that
thread ids are assigned in ascending order. This is not defined by the standard
but currently ensured in libomp. We have to think about another way of ordering
the threads should this ever be subject to change...

Note that this isn't aiming at replacing the implementation independent
test-suite at https://github.com/OpenMPToolsInterface/ompt-test-suite!

Differential Revision: http://reviews.llvm.org/D16715

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@264027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 07:22:49 +00:00
Jonathan Peyton a83f15dc1f [STATS] Add OMP_critical and OMP_critical_wait timers
OMP_critical - time spent in critical section
OMP_critical_wait - time spent waiting to enter a critical section


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263967 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 18:32:26 +00:00
Jonathan Peyton cc34ba0458 [STATS] separate noTotal bit flag from onlyInMaster and noUnits
This change logically separates the stats_flags_e::noTotal bit flag from the
stats_flags_e::onlyInMaster and stats_flags_e::noUnits bit flags. If no
TOTAL_foo output is wanted for a particular statistic, the flag must be
explicitly included in that statistic's flags.

Differential Revision: http://reviews.llvm.org/D18198


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263954 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 17:26:23 +00:00
Jonas Hahnfeld b5e41b49f7 [OMPT] Fix wrong parent_task_id in serialized parallel_begin with GCC
Without this patch a simple '#pragma omp parallel num_threads(1)' leads to
ompt_event_parallel_begin: parent_task_id=3, [...], parallel_id=2, [...]
ompt_event_parallel_end: parallel_id=2, task_id=4, [...]

Differential Revision: http://reviews.llvm.org/D16714

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263940 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 12:37:52 +00:00
Jonathan Peyton 53e20db26d Update www/index.html to reflect current status of OpenMP project
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263788 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18 14:50:01 +00:00
Jonathan Peyton 8d0a576cf4 [CMake] Fix Windows build problem for CMake versions < 3.3
Building libomp using CMake versions < 3.3 caused a link time error.  These
errors occurred because when assembling z_Windows_NT-586_asm.asm, the
definitions: OMPT_SUPPORT, _M_AMD64|_M_IA32 weren't defined on the command line.
To fix the problem, the COMPILE_FLAGS property for the assembly file is appended
to instead of the COMPILE_DEFINITIONS property being set.  For whatever reason, the
COMPILE_DEFINITIONS property doesn't pick up the definitions for assembly files
for the older CMake versions.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263651 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-16 18:44:18 +00:00
Jonathan Peyton 4ceed43a1f Fix spelling error in comment
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 20:59:10 +00:00
Jonathan Peyton 03208f6d91 [STATS] Print "Unknown" for frequency if it wasn't able to be parsed
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 20:55:32 +00:00
Jonathan Peyton 9a5f28cca8 [STATS] Fix comments in kmp_stats.h
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263582 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 20:49:01 +00:00
Jonathan Peyton 85b4f2c9cf [STATS] Add header information to stats print out
This change adds a header to the printout of the statistics which includes the
time, machine name, and processor info if available. This change also includes
some cosmetic changes like using enum casting for timer and counter iteration.

Differential Revision: http://reviews.llvm.org/D18153


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263580 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 20:28:47 +00:00
Samuel Antao c0a469edc3 Initialize two variables in kmp_tasking.
Summary:
Two initialized local variables are causing clang to produce warnings:

```
./src/projects/openmp/runtime/src/kmp_tasking.c:3019:5: error: variable 'num_tasks' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
    default:
    ^~~~~~~
./src/projects/openmp/runtime/src/kmp_tasking.c:3027:21: note: uninitialized use occurs here
    for( i = 0; i < num_tasks; ++i ) {
                    ^~~~~~~~~
./src/projects/openmp/runtime/src/kmp_tasking.c:2968:28: note: initialize the variable 'num_tasks' to silence this warning
    kmp_uint64 i, num_tasks, extras;
                           ^
                            = 0
./src/projects/openmp/runtime/src/kmp_tasking.c:3019:5: error: variable 'extras' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
    default:
    ^~~~~~~
./src/projects/openmp/runtime/src/kmp_tasking.c:3022:52: note: uninitialized use occurs here
    KMP_DEBUG_ASSERT(tc == num_tasks * grainsize + extras);
                                                   ^~~~~~
./src/projects/openmp/runtime/src/kmp_debug.h:62:60: note: expanded from macro 'KMP_DEBUG_ASSERT'
        #define KMP_DEBUG_ASSERT( cond )       KMP_ASSERT( cond )
                                                           ^
./src/projects/openmp/runtime/src/kmp_debug.h:60:51: note: expanded from macro 'KMP_ASSERT'
        #define KMP_ASSERT( cond )             ( (cond) ? 0 : __kmp_debug_assert( #cond, __FILE__, __LINE__ ) )
                                                  ^
./src/projects/openmp/runtime/src/kmp_tasking.c:2968:36: note: initialize the variable 'extras' to silence this warning
    kmp_uint64 i, num_tasks, extras;
                                   ^
                                    = 0
2 errors generated.
```

This patch initializes these two variables.

Reviewers: tlwilmar, jlpeyton

Subscribers: tlwilmar, openmp-commits

Differential Revision: http://reviews.llvm.org/D17909

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263316 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-12 00:55:17 +00:00
Jonathan Peyton d64c3d7995 [STATS] change TASK_execution name to OMP_task
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 20:23:05 +00:00
Jonathan Peyton 3d4a12f1c0 [STATS] Add a total statistics count
This change removes synthesized stats and instead has all timers print out a
total which is the aggregate statistics across threads. This is displayed as
"Total_foo" at the end of program. The stats_flags_e::synthesized flag is
removed and the printStats() function is split into two separate functions:
printTimerStats() which can display the aggregate total and printCounterStats().

Differential Revision: http://reviews.llvm.org/D17869


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@263290 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 20:20:49 +00:00
Jonathan Peyton 9a94fcde13 [STATS] fix output formatting when sample count is 0
Force 0.0 to be displayed for all statistics which have sample count equal to 0


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@262658 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 21:24:13 +00:00
Jonathan Peyton 33b0f4a88e [STATS] fix master and single timers
Only the thread which executes the single/master section will update its statistics.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@262656 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 21:21:05 +00:00
Jonathan Peyton ad1775a1cf Add new OpenMP 4.5 taskloop construct feature
From the standard: The taskloop construct specifies that the iterations of one
or more associated loops will be executed in parallel using OpenMP tasks. The
iterations are distributed across tasks created by the construct and scheduled
to be executed.

This initial implementation uses a simple linear tasks distribution algorithm.
Later we can add other algorithms to speedup generation of huge number of tasks
(i.e., tree-like tasks generation should be faster).

This needs to be put into the OpenMP runtime library in order for the
compiler team to develop the compiler side of the implementation.

Differential Revision: http://reviews.llvm.org/D17404


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@262535 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 22:47:51 +00:00
Jonathan Peyton 1588c74337 Forgot to add test files for doacross and task priority.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@262533 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 22:43:14 +00:00
Jonathan Peyton 0c1f627ac8 Add new OpenMP 4.5 doacross loop nest feature
From the standard: A doacross loop nest is a loop nest that has cross-iteration
dependence. An iteration is dependent on one or more lexicographically earlier
iterations. The ordered clause parameter on a loop directive identifies the
loop(s) associated with the doacross loop nest.

The init/fini routines allocate/free doacross buffer(s) for each loop for each
thread.  The wait routine waits for a flag designated by the dependence vector.
The post routine sets the flag designated by current iteration vector.  We use
a similar technique of shared buffer indices that covers up to 7 nowait loops
executed simultaneously by different threads (number 7 has no real meaning,
just heuristic value).  Also, the size of structures are kept intact via
reducing dummy arrays.

This needs to be put into the OpenMP runtime library in order for the compiler
team to develop the compiler side of the implementation.

Differential Revision: http://reviews.llvm.org/D17399


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@262532 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 22:42:06 +00:00
Jonathan Peyton a5496bff70 Add new OpenMP 4.5 affinity API
This change introduces the new OpenMP 4.5 affinity api surrounding
OpenMP Places. There are six new entry points:

Typically called in serial region:
 * omp_get_num_places - returns the number of places available to the execution
       environment in the place list.
 * omp_get_place_num_procs - returns the number of processors available to the
       execution environment in the specified place.
 * omp_get_place_proc_ids - returns the numerical identifiers of the processors
       available to the execution environment in the specified place.

Typically called inside parallel region:
 * omp_get_place_num - returns the place number of the place to which the
       encountering thread is bound.
 * omp_get_partition_num_places - returns the number of places in the place
       partition of the innermost implicit task.
 * omp_get_partition_place_nums - returns the list of place numbers
       corresponding to the places in the place-var ICV of the innermost
       implicit task.

Differential Revision: http://reviews.llvm.org/D17417


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@261915 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 18:49:52 +00:00
Jonathan Peyton c62c0fa658 Add initial support for OpenMP 4.5 task priority feature
The maximum task priority value is read from envirable: OMP_MAX_TASK_PRIORITY.
But as of now, nothing is done with it.  We just handle the environment variable
and add the new api: omp_get_max_task_priority() which returns that value or
zero if it is not set.

Differential Revision: http://reviews.llvm.org/D17411


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@261908 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 18:04:09 +00:00
Jonathan Peyton 4255e2f88d dd new OpenMP 4.5 schedule clause modifiers (monotonic/non-monotonic) feature
The monotonic/non-monotonic flags are sent to the runtime via the sched_type by
setting the 30th (non-monotonic) or 29th (monotonic) bit in the sched_type.
Macros are added to probe if monotonic or non-monotonic is specified
(SCHEDULE_HAS_[NON]MONOTONIC & SCHEDULE_HAS_NO_MODIFIERS)
and also to to get the base sched_type (SCHEDULE_WITHOUT_MODIFIERS)

Currently, nothing is done with the modifiers.

Also, this patch adds some comments on the use of the enumerations in at least
 one place where it is subtle.

Differential Revision: http://reviews.llvm.org/D17406


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@261906 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 17:55:50 +00:00
Jonathan Peyton 373c7b45ae Remove unnecessary semicolons after braces
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@261249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 19:38:25 +00:00
Jonas Hahnfeld e0df9a933b [OMPT] Frame information for openmp taskwait
For pragma omp taskwait the runtime is called from the task context.
Therefore, the reentry frame information should be updated.

The information should be available for both taskwait event calls; therefore,
set before the first event and reset after the last event.

Patch by Joachim Protze
Differential Revision: http://reviews.llvm.org/D17145

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@260674 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 12:19:59 +00:00
Jonathan Peyton 662997c02a Fix incorrect task_team in __kmp_give_task
When a target task finishes and it tries to access the th_task_team from the
threads in the team where it was created, th_task_team can be NULL or point to
a different place when that thread started a nested region that is still
running. Finding the exact task_team that the threads were using is difficult
as it would require to unwind the task_state_memo_stack. So a new field was added
in the taskdata structure to point to the active task_team when the task was
created.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@260615 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 23:07:30 +00:00
Jonathan Peyton 1251a47e34 Fix a couple of typos in comments
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@260613 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 22:58:29 +00:00
Jonathan Peyton cb7899d667 Proxy task fix: task_state stack push condition on fork
The problem is that the master's thread state was not saved before entering a
parallel region so it does not remember tasks when it returns.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@260306 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 22:32:41 +00:00
Jonathan Peyton 1256a5d50f Have Mac builds use @rpath when supported in CMake
The -install_name linker flag will use "@rpath/" when supported in CMake
which is the recommended usage for dynamic libraries on Mac OSX.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@260300 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 22:15:30 +00:00
Jonas Hahnfeld 20e20fe91a [GCC] GOMP_task: Change argument type of if_cond from int to bool
(libgomp has bool as well)

This was causing a test failure in omp_test_if.c when building with GCC in
Debug mode. I have verified that GCC versions 4.9.2 and 5.3.0 now work and
compile-tested this change with clang 3.7.1 and Intel Compiler 16.0.

Differential Revision: http://reviews.llvm.org/D16921

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@260204 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 07:07:30 +00:00
Jonas Hahnfeld db9f0656a6 [CMake] Introduce OPENMP_LLVM_TOOLS_DIR
This will be used in a later patch to find additional LLVM tools for tests and
enables reusability for libomptarget that is currently under review.

Differential Revision: http://reviews.llvm.org/D16713

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@259876 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-05 07:00:13 +00:00
Jonathan Peyton ccd4e436a1 Add LIBOMP_ENABLE_SHARED option for CMake
When building executables for Cray supercomputers, statically-linked executables
are preferred. This patch makes it possible to build the OpenMP runtime as an
archive for building statically-linked executables.  The patch adds the flag
LIBOMP_ENABLE_SHARED, which defaults to true. When true, a build of the OpenMP
runtime yields dynamic libraries. When false, a build of the OpenMP runtime
yields static libraries. There is no setting that allows both kinds of libraries
to be built.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D16525


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@259817 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 19:29:35 +00:00
Jonathan Peyton 0ccf0552f5 Fix task dependency performance problem
In: http://lists.llvm.org/pipermail/openmp-dev/2015-August/000858.html, a
performance issue was found with libomp's task dependencies.  The task
dependencies hash table has an issue with collisions. The current table size is
a power of two. This combined with the current hash function causes a large
number of collisions to occurr. Also, the current size (64) is too small for
larger applications so the table size is increased.

This patch creates a two level hash table approach for task dependencies. The
implicit task is considered the "master" or "top-level" task which has a large
static sized hash table (997), and nested tasks will have smaller hash
tables (97). Prime numbers were chosen to help reduce collisions.

Differential Revision: http://reviews.llvm.org/D16640


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@259113 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 23:10:44 +00:00
Jonas Hahnfeld 09d935a93e [OMPT] Add support for ompt_event_task_dependences and ompt_event_task_dependence_pair
The attached patch adds support for ompt_event_task_dependences and
ompt_event_task_dependence_pair events from the OMPT specification [1]. These
events only apply to OpenMP 4.0 and 4.1 (aka 4.5) because task dependencies
were introduced in 4.0.

With respect to the changes:

ompt_event_task_dependences
According to the specification, this event is raised after the task has been
created, thefore this event needs to be raised after ompt_event_task_begin
(in __kmp_task_start). However, the dependencies are known at
__kmpc_omp_task_with_deps which occurs before __kmp_task_start. My modifications
extend the ompt_task_info_t struct in order to store the dependencies of the
task when _kmpc_omp_task_with_deps occurs and then they are emitted in
__kmp_task_start just after raising the ompt_event_task_begin. The deps field
is allocated and valid until the event is raised and it is freed and set
to null afterwards.

ompt_event_task_dependence_pair
The processing of the dependences (i.e. checking whenever a dependence is
already satisfied) is done within __kmp_process_deps. That function checks
every dependence and calls the __kmp_track_dependence routine which gives some
support for graphical output. I used that routine to emit the dependence pair
but I also needed to know the sink_task. Despite the fact that the code within
KMP_SUPPORT_GRAPH_OUTPUT refers to task_sink it may be null because
sink->dn.task (there's a comment regarding this) and in fact it does not point
to a proper pointer value because the value is set in node->dn.task = task;
after the __kmp_process_deps calls in __kmp_check_deps. I have extended the
__kmp_process_deps and __kmp_track_dependence parameter list to receive the
sink_task.

[1] https://github.com/OpenMPToolsInterface/OMPT-Technical-Report/blob/target/ompt-tr.pdf

Patch by Harald Servat
Differential Revision: http://reviews.llvm.org/D14746

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@259038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 10:39:52 +00:00
Jonas Hahnfeld 7ed52f6efa [OMPT] Avoid SEGV when a worker thread needs its parallel id behind the barrier
When the code behind the barrier is executed, the master thread may have
already resumed execution. That's why we cannot safely assume that *pteam
is not yet freed.

This has been introduced by r258866.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@259037 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 10:39:45 +00:00
Jonas Hahnfeld 38c9e1422e [OMPT] Workaround clang failing with 'declare target'
Current clang trunk reports _OPENMP to be 201307 = OpenMP 4.0. It doesn't
recognize '#pragma omp declare target' though (patch still pending) and
therefore fails compilation.

Differential Revision: http://reviews.llvm.org/D16631

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@259026 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 07:14:44 +00:00
Jonathan Peyton 0355c11c1d Restore th_current_task first as suggested by John Mellor-Crummey
If an asynchronous inquiry peers into the runtime system
it doesn't see the freed task as the current task.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258990 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 21:20:26 +00:00
Jonathan Peyton 5b35c4a417 Formatting fixes
Removing extraneous { } bracket sections.  Unindenting blocks of
code as a result.  Also removing empty #ifdef KMP_STUB


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258986 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 21:02:04 +00:00
Jonathan Peyton fa6b30f80a Fixing comments.
Removing references to non-existent functions, fixing typos.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 20:57:32 +00:00
Jonathan Peyton 78e62243f9 Removing extra empty lines
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258984 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 20:44:49 +00:00
Jonas Hahnfeld 2db9469c66 Change whitespace to test commit access
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 07:24:03 +00:00
Jonathan Peyton b035b29274 [OMPT]: Fix the order of implicit_task_end_events
For implcit barriers in simple parallel for loops, the order of the OMPT events
was wrong.  The barrier_{begin,end} events came after the implcit_task_end
event for the implcit barrier at the end of the parallel region. This is wrong
because the implicit task executes the barrier before ending. This patch fixes
the order of the event: It will be triggerd now just before
__kmp_pop_current_task_from_thread() is called.

Patch by Tim Cramer

Differential Revision: http://reviews.llvm.org/D16347


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258866 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:45:21 +00:00
Jonathan Peyton dc8116e660 Bypass Perl modules in build system
This change fixes the bug: https://llvm.org/bugs/show_bug.cgi?id=25975
by bypassing the perl module files which try to deduce system information.
These perl modules files don't offer useful information and are from the 
original build system. They can be removed after this change.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258843 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 19:44:31 +00:00
Ismail Donmez bfffb780fe Fix compilations with msvc's /Zc:strictStrings
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258797 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 08:24:57 +00:00
Andrey Churbanov 86a6c9071f omp_barrier.c test fixed in order to reliably and faster run on any number of processors
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258695 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-25 16:52:10 +00:00
Jonathan Peyton 306381bbda Add missing cleanup code for cached indirect lock pool.
This change fixes one issue reported at https://llvm.org/bugs/show_bug.cgi?id=26184
There was missing cleanup code for the cached indirect lock pool. The change
will fix the reported case where it tries to initialize a lock after runtime
cleanup/reinitialization, but it is still possible that the user program runs
into another problem because most test programs have a call to __kmpc_set_lock
after cleanup/reinitialization without calling __kmpc_init_lock causing a crash/hang.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258528 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 19:16:14 +00:00
Hans Wennborg 940dd50273 lit.cfg: Pass -isysroot to the SDK on Darwin
Newly-built Clangs don't automatically find the SDK, and newer versions
of Mac OS X don't provide it under /usr/include etc.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@258169 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 19:26:43 +00:00
Hans Wennborg 444b0e1c07 Don't use __DATE__ or __TIME__; it breaks release builds (PR26145)
The release builds are configured to be reproducible, so that the
binaries compare equal between bootstrap iterations. The OpenMP
run-time build was failing like this:

runtime/src/kmp_version.c:108:79: error: expansion of date or time macro is not reproducible [-Werror,-Wdate-time]
char const __kmp_version_build_time[]     = KMP_VERSION_PREFIX "build time: " __DATE__ " " __TIME__;

Figuring as the build currently doesn't set LIBOMP_DATE, it's probably
OK to skip setting the build time here too.

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@257833 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 23:18:20 +00:00
Jonathan Peyton 4f88c88870 New API for restoring current thread's affinity to init affinity of application
This new API, int kmp_set_thread_affinity_mask_initial(), is available for use
by other parallel runtime libraries inside a possibly OpenMP-registered thread.
This entry point restores the current thread's affinity mask to the affinity
mask of the application when it first began. If -1 is returned it can be assumed
that either the thread hasn't called affinity initialization or that the thread
isn't registered with the OpenMP library. If 0 is returned then, then the call
was successful. Any return value greater than zero indicates an error occurred
when setting affinity.

Differential Revision: http://reviews.llvm.org/D15867


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@257489 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-12 17:21:55 +00:00
Jonathan Peyton 3d9851ae3c Remove double negative in if() logic.
Change (__kmp_mic_type != non_mic) to (__kmp_mic_type == mic2)


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@257380 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 20:37:39 +00:00
Jonathan Peyton a632fb38bb Put function names on their own line.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@257378 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 20:28:55 +00:00
Jonathan Peyton c73da114f8 Removed unused __kmp_*_i8 functions.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@256790 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-04 23:20:26 +00:00
Jonathan Peyton da540cd0d0 Fix for barrier problem: applications with many parallel regions (2^30) hang
The barrier states type doesn't need to be explicitly set.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@256778 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-04 20:51:48 +00:00
Andrey Churbanov c77957295e test omp_threadprivate_for.c fixed
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@256473 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-27 18:14:40 +00:00
Jonathan Peyton 7209df241a Fix build error: OMPT_SUPPORT=true was not tested after hinted lock changes
Recent changes to support dynamic locks didn't consider the code compiled when
OMPT_SUPPORT=true. As a result, the OMPT support was broken by recent changes
to nested locks to support dynamic locks. For OMPT to work with dynamic locks,
they need to provide a return code indicating whether a nested lock acquisition
was the first or not.

This patch moves the OMPT support for nested locks into the #else case when
DYNAMIC locks were not used. New support is needed for dynamic locks. This patch
fixes the build and leaves a placeholder where the missing OMPT callbacks can be
added either the author of the OMPT support for locks, or the dynamic
locking support.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D15656


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@256314 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-23 02:34:03 +00:00
Jonathan Peyton 0d9b4ce671 Prevent monitor thread creation when KMP_BLOCKTIME="infinite"
When users sets envirable KMP_BLOCKTIME to "infinite" (the time one busy-waits
at barrieres, etc.), the monitor thread is not useful and can be ignored. This
change prevents the creation of the monitor thread when the users sets
KMP_BLOCKTIME to "infinite".

Differential Revision: http://reviews.llvm.org/D15628


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@256061 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 23:20:36 +00:00
Jonathan Peyton 98c0f1f794 Remove some extra spaces
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@256060 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 23:15:35 +00:00
Jonathan Peyton ac919e8776 [STATS] Have CMake do real check for stats functionality
This change allows clang to build the stats library for every architecture
which supports __builtin_readcyclecounter().  CMake also checks for all
necessary features for stats and will error out if the platform does not
support it.

Patch by Hal Finkel and Johnny Peyton


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@256002 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 16:19:35 +00:00
Jonathan Peyton ef79bf6744 [STATS] Properly guard the tick_time() function and its uses
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@255910 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-17 17:27:51 +00:00
Jonathan Peyton 3c0db8d0f0 [STATS] replace __cpuid() intrinsic with already existing __kmp_x86_cpuid() function
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@255907 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-17 16:58:26 +00:00
Jonathan Peyton c4efcf656b [STATS] Fix stats lock problem to be compatible with new hinted lock code
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@255901 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-17 16:19:05 +00:00
Jonathan Peyton acb7b535be [STATS] Add libm.so to lib dependencies for stats library
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@255900 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-17 16:15:39 +00:00
Jonathan Peyton 93b3e400ad Fix broken visual studio builds by disabling KMP_USE_TSX.
Visual studio can't handle the asm extension in the KMP_USE_TSX code sections.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@255514 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 17:39:30 +00:00
Jonathan Peyton ce2fd30954 Hinted lock (OpenMP 4.5 feature) Updates/Fixes Part 3
This change set includes all changes to make the code conform to the OMP 4.5 specification:

* Removed hint / hinted_init definitions from include/40 files
* Hint values are powers of 2 to enable composition (4.5 spec)
* Hinted lock initialization functions were renamed (4.5 spec)
  kmp_init_lock_hinted -> omp_init_lock_with_hint
  kmp_init_nest_lock_hinted -> omp_init_nest_lock_with_hint
* __kmpc_critical_section_with_hint was added to support a critical section with
  a hint (4.5 spec)
* __kmp_map_hint_to_lock was added to convert a hint (possibly a composite) to
  an internal lock type
* kmpc_init_lock_with_hint and kmpc_init_nest_lock_with_hint were added as
  internal entries for the hinted lock initializers. The preivous internal
  functions (__kmp_init*) were moved to kmp_csupport.c and reused in multiple
  places
* Added the two init functions to dllexports
* KMP_USE_DYNAMIC_LOCK is turned on if OMP_41_ENABLED is turned on

Differential Revision: http://reviews.llvm.org/D15205


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@255376 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-11 22:04:05 +00:00
Jonathan Peyton 63a38dc75a Hinted lock (OpenMP 4.5 feature) Updates/Fixes Part 2
* Added a new user TSX lock implementation, RTM, This implementation is a
  light-weight version of the adaptive lock implementation, omitting the
  back-off logic for deciding when to specualte (or not). The fall-back lock is
  still the queuing lock.
* Changed indirect lock table management. The data for indirect lock management
  was encapsulated in the "kmp_indirect_lock_table_t" type. Also, the lock table
  dimension was changed to 2D (was linear), and each entry is a
  kmp_indirect_lock_t object now (was a pointer to an object).
* Some clean up in the critical section code
* Removed the limits of the tuning parameters read from KMP_ADAPTIVE_LOCK_PROPS
* KMP_USE_DYNAMIC_LOCK=1 also turns on these two switches:
  KMP_USE_TSX, KMP_USE_ADAPTIVE_LOCKS

Differential Revision: http://reviews.llvm.org/D15204


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@255375 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-11 21:57:06 +00:00
Jonathan Peyton ea87904bc4 Hinted lock (OpenMP 4.5 feature) Updates/Fixes
There are going to be two more patches which bring this feature up to date and in line with OpenMP 4.5.

* Renamed jump tables for the lock functions (and some clean up).
* Renamed some macros to be in KMP_ namespace.
* Return type of unset functions changed from void to int.
* Enabled use of _xebgin() et al. intrinsics for accessing TSX instructions.

Differential Revision: http://reviews.llvm.org/D15199


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@255373 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-11 21:49:08 +00:00
Jonathan Peyton 8d380df97b Replace DYNA_* names with KMP_* names
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@254637 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 19:37:20 +00:00
Jonathan Peyton d62fdbdc17 Fix honoring of OMP_THREAD_LIMIT in the teams construct
Fix for crash in the teams construct in case user sets OMP_THREAD_LIMIT to a
number less than the number of processors. Now the number of threads will be
silently reduced if the user didn't specify teams parameters or with a
warning if the user specified teams parameters conflicting with
OMP_THREAD_LIMIT.

Differential Revision: http://reviews.llvm.org/D14732


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@254322 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-30 20:14:05 +00:00
Jonathan Peyton c33a75a1ae Fix crash when __kmp_task_team_setup called for single threaded team
The task_team pointer is dereferenced unconditionally which causes a SEGFAULT
when it is NULL (e.g. for serialized parallel, that can happen for "teams"
construct or for "target nowait").  The solution is to skip second task team
setup for single thread team.

Differential Revision: http://reviews.llvm.org/D14729


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@254321 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-30 20:05:13 +00:00
Jonathan Peyton 8d8e4657d1 Adding Hwloc library option for affinity mechanism
These changes allow libhwloc to be used as the topology discovery/affinity
mechanism for libomp.  It is supported on Unices. The code additions:
* Canonicalize KMP_CPU_* interface macros so bitmask operations are
  implementation independent and work with both hwloc bitmaps and libomp
  bitmaps.  So there are new KMP_CPU_ALLOC_* and KMP_CPU_ITERATE() macros and
  the like. These are all in kmp.h and appropriately placed.
* Hwloc topology discovery code in kmp_affinity.cpp. This uses the hwloc
  interface to create a libomp address2os object which the rest of libomp knows
  how to handle already.
* To build, use -DLIBOMP_USE_HWLOC=on and
  -DLIBOMP_HWLOC_INSTALL_DIR=/path/to/install/dir [default /usr/local]. If CMake
  can't find the library or hwloc.h, then it will tell you and exit.

Differential Revision: http://reviews.llvm.org/D13991


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@254320 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-30 20:02:59 +00:00
Jonathan Peyton 271a72612d Add newlines to debug TRACE messages in kmp_taskdeps.cpp
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@253265 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-16 22:53:38 +00:00
Jonathan Peyton 59fd2d5636 Add missing KMP_NESTED_HOT_TEAMS guards
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@253264 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-16 22:48:41 +00:00
Alexey Bataev 5fedb90a30 [OPENMP] Fixed tests for gcc build.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@253200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-16 11:35:57 +00:00
Jonathan Peyton 22361cf975 Add debug trace message for hierarchical barrier
Trace when thread is waiting at join phase for oncore children.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252954 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 21:40:39 +00:00
Jonathan Peyton de99836584 Remove outdated comment
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252953 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 21:34:29 +00:00
Jonathan Peyton e2b86ca4e4 Fix for ittnotify loop reporting
Fix ittnotify loop metadata reporting for schedule(runtime) and
chunked schedule set via OMP_SCHEDULE. The bug was that chunk=1 
reported always.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 21:26:22 +00:00
Jonathan Peyton 0d94178f2d [OMPT] Add ompt_event_task_switch event into OMPT/OpenMP
The patch adds support for ompt_event_task_switch into LLVM/OpenMP. Note that
the patch has also updated the signature of ompt_event_task_switch to
ompt_task_pair_callback_t (rather than the previous ompt_task_switch_callback_t).

Patch by Harald Servat

Differential Revision: http://reviews.llvm.org/D14566


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 17:49:50 +00:00
Jonathan Peyton 18e13ca264 [OMPT] Remove unnecessary header in ompt-general.c
Patch by Harald Servat

Differential Revision: http://reviews.llvm.org/D14565


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252756 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 17:30:26 +00:00
Jonathan Peyton 21b23ce699 Fixes to wait-loop code
1) Add get_ptr_type() method to all wait flag types.
2) Flag in sleep_loc may change type by the time the resume is called from
   __kmp_null_resume_wrapper. We use get_ptr_type to obtain the real type
   and compare it to the casted object received. If they don't match, we know
   the flag has changed (already resumed and replaced by another flag). If they
   match, it doesn't hurt to go ahead and resume it.

Differential Revision: http://reviews.llvm.org/D14458


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252487 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 16:31:51 +00:00
Jonathan Peyton 6e98151883 Fixes and improvements to tasking in barriers
1) When the number of threads in a team increases, new threads need to have all
   their barrier struct fields initialized. We were missing the parent_bar and
   team fields.
2) For non-forkjoin barriers, we now do the __kmp_task_team_setup before the
   gather. The setup now sets up the task_team that all the threads will switch
   to after the barrier, but it needs to be done before other threads do the
   switch.
3) Remove an unneeded assignment of tt_found_tasks in task team free function.

Differential Revision: http://reviews.llvm.org/D14456


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252486 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 16:28:32 +00:00
Jonathan Peyton 9543a7dad8 Improvements to machine_hierarchy code for re-sizing
These changes include:
 1) Machine hierarchy now uses the base_num_threads field to indicate the 
    maximum number of threads the current hierarchy can handle without a resize.
 2) In __kmp_get_hierarchy, we need to get depth after any potential resize
    is done.
 3) Cleanup of hierarchy resize code to support 1 above.

Differential Revision: http://reviews.llvm.org/D14455


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252475 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 16:24:53 +00:00
Jonathan Peyton 5677b5095c [OMPT] Add OMPT events for the OpenMP taskwait construct.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 15:57:04 +00:00
Jonathan Peyton f15a791e85 Fix for zero chunk size
Setting dynamic schedule with chunk size 0 via omp_set_schedule(dynamic,0)
and then using "schedule (runtime)" causes infinite loop because for the 
chunked dynamic schedule we didn't correct zero chunk to the default (1).


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252338 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-06 20:32:44 +00:00
Jonathan Peyton 103648dd39 Improve OMPT initialization code
Use of #ifdef OMPT_DEBUG was causing messages to be generated under normal
operation when the OpenMP library was compiled with KMP_DEBUG enabled.
Elsewhere, KMP_DEBUG evaluates assertions, but never produces messages during
normal operation. To avoid this inconsistency, set OMPT_DEBUG using a cmake
variable LIBOMP_OMPT_DEBUG.

While I was editing the associated ompt-specific.h and ompt-general.c files,
make the spacing and comments consistent.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D14355


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252173 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 16:54:55 +00:00
Jonathan Peyton dfa0ba085a Remove incorrect debug assert.
in __kmp_free_team(), the team's number of processors can be == 1.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 22:31:57 +00:00
Jonathan Peyton 2332aabedb Remove some empty lines.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252084 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 22:06:07 +00:00
Jonathan Peyton b9e8048db1 Refactor of task_team code.
This is a refactoring of the task_team code that more elegantly handles the two
task_team case. Two task_teams per team are kept in use for the lifetime of the
team. Thus no reference counting is needed.

Differential Revision: http://reviews.llvm.org/D13993


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252082 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 21:37:48 +00:00
Alexey Bataev e73ff632d5 [OPENMP] Add dependency to clang/clang-headers etc. for in-tree build of libomp.
Add additional dependency to clang/clang-headers/FileCheck to avoid possible troubles with in-tree build/test of libomp + allow parallel testing of libomp. Also includes bugfixes for tests + improvements to avoid possible race conditions.
Differential Revision: http://reviews.llvm.org/D14055


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@251797 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-02 13:43:32 +00:00
Jonathan Peyton 7e9ea404f1 [OMPT] Adding missing free() calls to ompt_tool_windows() function.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@251719 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 20:24:25 +00:00
Jonathan Peyton a4032ada02 [OMPT] Windows Support for OMPT
The problem is that the ompt_tool() function (which must be implemented by a
performance tool) should be defined in the RTL as well to cover the case when
the tool is not present in the address space of the process. This functionality
is accomplished with weak symbols in Unices. Unfortunately, Windows does not
support weak symbols.

The solution in these changes is to grab the list of all modules loaded by the
process and then search for symbol "ompt_tool()" within them. The function
ompt_tool_windows() performs the search of the ompt_tool symbol. If ompt_tool is
found, then its return value is used to initialize the tool. If ompt_tool is not
found, then ompt_tool_windows() returns NULL and OMPT is thus, disabled.

While doing these changes, the OMPT_SUPPORT detection in CMake was changed to
test for the required featuers for OMPT_SUPPORT, namely: builtin_frame_address()
existence, weak attribute existence and psapi.dll existence. For
LIBOMP_HAVE_OMPT_SUPPORT to be true, it must be that the builtin_frame_address()
intrinsic exists AND one of: either weak attributes exist or psapi.dll exists.

Also, since Process Status API is used I had to add new dependency -- psapi.dll
to the library dependency micro test.

Differential Revision: http://reviews.llvm.org/D14027


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@251654 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 20:56:24 +00:00
Jonathan Peyton dfa603c6ec Removed zeroing th.th_task_state for master thread at start of nested parallel.
The th.th_task_state for the master thread at the start of a nested parallel
should not be zeroed in __kmp_allocate_team() because it is later put in the
stack of states in __kmp_fork_call() for further re-use after exiting the
nested region. It is zeroed after being put in the stack.

Differential Revision: http://reviews.llvm.org/D13702


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@250847 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20 19:21:04 +00:00
Jonathan Peyton 73bdc170b5 Removed '@' from delimiters, added it as offset designator.
Moved '@' from delimiters to offset designators for the KMP_PLACE_THREADS
environment variable. Only one of: postfix "o" or prefix @, should be used
in the value of KMP_PLACE_THREADS. For example, '2s@2,4c@2,1t'. This is also
the format of KMP_SETTINGS=1 output now (removed "o" from there).
e.g., 2s,2o,4c,2o,1t.

Differential Revision: http://reviews.llvm.org/D13701


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@250846 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20 19:15:48 +00:00
Jonathan Peyton 120e5c4db4 Fix OMP_PLACES negation operator parsing (!place)
Just moved the *scan++ line up before the recursive call.  Otherwise,
infinite recursion occurs and leads to a segmentation fault.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@250729 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 19:43:01 +00:00
Jonathan Peyton 62e3cf352c Clean-up cancellation state flag between parallel regions
Without this fix, cancellation requests in one parallel region cause
cancellation of the second region even though the second one was
not intended to be cancelled.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@250727 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 19:33:38 +00:00
Dimitry Andric 5e4f900fd0 On FreeBSD, PTHREADS_THREADS_MAX does not fit into an int, leading to
warnings similar to the following:

    runtime/src/kmp_global.c:117:35: warning: implicit conversion from
    'unsigned long' to 'int' changes value from 18446744073709551615 to -1
    [-Wconstant-conversion]
    int           __kmp_sys_max_nth = KMP_MAX_NTH;
                  ~~~~~~~~~~~~~~~~~   ^~~~~~~~~~~
    runtime/src/kmp.h:849:34: note: expanded from macro 'KMP_MAX_NTH'
    #    define KMP_MAX_NTH          PTHREAD_THREADS_MAX
                                     ^~~~~~~~~~~~~~~~~~~

Clamp KMP_MAX_NTH to INT_MAX to avoid these warnings.  Also use INT_MAX
whenever PTHREAD_THREADS_MAX is not defined at all.

Differential Revision: http://reviews.llvm.org/D13827


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@250708 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 17:32:04 +00:00
Jonathan Peyton d1e8ef1834 [OMPT] Add OMPT events for API locking
This fix implements the following OMPT events for the API locking routines:
* ompt_event_acquired_lock
* ompt_event_acquired_nest_lock_first
* ompt_event_acquired_nest_lock_next
* ompt_event_init_lock
* ompt_event_init_nest_lock
* ompt_event_destroy_lock
* ompt_event_destroy_nest_lock

For the acquired events the depths of the locks ist required, so a return value
was added similiar to the return values we already have for the release lock
routines.

Patch by Tim Cramer

Differential Revision: http://reviews.llvm.org/D13689


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@250526 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 16:52:58 +00:00
Jonathan Peyton eee928503e Detect final task in GOMP interface.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@250198 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 18:36:22 +00:00
Jonathan Peyton 8ec4ec3838 [OPENMP][TESTSUITE] Undefined variable in test omp_task_final.c
Patch by Alexey Bataev

Differential Revision: http://reviews.llvm.org/D13661


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@250066 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 17:01:05 +00:00
Jonathan Peyton 2a541f0d91 [OMPT] Reduce overhead of OMPT
* Avoid computing state needed only by OMPT unless the ompt_enabled flag is set.
* Properly handle a corner case in OMPT where team == NULL.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D13502


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@249857 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 17:42:52 +00:00
Jonathan Peyton c64cfb2ef1 [OMPT] Initialize task fields only if needed
Because __kmp_task_init_ompt is called for every initial task in each thread
and always generated task ids, this was a big performance issue on bigger
systems even without any tool attached.  After changing the initialization 
interface to ompt_tool, we can now rely on already knowing whether a tool is
attached and OMPT is enabled at this point.

Patch by Jonas Hahnfeld

Differential Revision: http://reviews.llvm.org/D13494


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@249855 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 17:38:05 +00:00
Jonathan Peyton d76e1838f1 Formatting/Whitespace/Comment changes associated with wait/release improvements.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@249725 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 19:44:16 +00:00
Jonathan Peyton 90185a5f18 Debug trace and assert statement changes for wait/release improvements.
These changes improve/update the trace messages and debug asserts related to
the previous wait/release checkin.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@249717 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 18:49:40 +00:00
Jonathan Peyton fd69bc2810 OpenMP Wait/release improvements.
These changes improve the wait/release mechanism for threads spinning in 
barriers that are handling tasks while spinnin by providing feedback to the 
barriers about any task stealing that occurs.

Differential Revision: http://reviews.llvm.org/D13353


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@249711 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 18:23:38 +00:00
Jonathan Peyton 89eb36ffe7 Added sockets to the syntax of KMP_PLACE_THREADS environment variable.
Added (optional) sockets to the syntax of the KMP_PLACE_THREADS environment variable.
Some limitations:
* The number of sockets and then optional offset should be specified first (before other parameters).
* The letter designation is mandatory for sockets and then for other parameters.
* If number of cores is specified first, then the number of sockets is defaulted to all sockets on the machine; also, the old syntax is partially supported if sockets are skipped.
* If number of threads per core is specified first, then the number of sockets and cores per socket are defaulted to all sockets and all cores per socket respectively.
* The number of cores per socket cannot be specified before sockets or after threads per core.
* The number of threads per core can be specified before or after core-offset (old syntax required it to be before core-offset);
* Parameters delimiter can be: empty, comma, lower-case x;
* Spaces are allowed around numbers, around letters, around delimiter.
Approximate shorthand specification:
KMP_PLACE_THREADS="[num_sockets(S|s)[[delim]offset(O|o)][delim]][num_cores_per_socket(C|c)[[delim]offset(O|o)][delim]][num_threads_per_core(T|t)]"

Differential Revision: http://reviews.llvm.org/D13175


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@249708 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 17:55:54 +00:00
Jonathan Peyton 25344f9ecc Fix memory corruption in Windows debug library
This patch adjusts the buffer size when reducing the buffer used for printing.
This solves the memory corruption in Windows debug library, and potential
memory corruption in other builds.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248588 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-25 17:23:17 +00:00
Jonathan Peyton a2b144ab95 [OpenMP Testsuite] Change omp_get_wtime.c timer resolution to 3 percent
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248501 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 15:10:57 +00:00
Jonathan Peyton b62edcf6b8 [OpenMP Testsuite] Mac rpath specified when compiling tests
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248500 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 15:09:51 +00:00
Jonathan Peyton d18f8d4d8c Fix stats build problem.
This change removes the KMP_STATS_ENABLED macro inside kmp_stats.cpp since it
is only compiled anyways when LIBOMP_STATS=on.  Also, include kmp_config.h in
kmp_stats.h to ensure KMP_STATS_ENABLED is defined.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248494 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 14:47:51 +00:00
Jonathan Peyton 7811d1db7f Update Reference.pdf files.
This updates the Reference.pdf files to say LLVM OpenMP Runtime Library and
also updates the build documentation to show how to build with CMake.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248407 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 18:09:47 +00:00
Jonathan Peyton 9e321cbfc5 OpenMP Initial testsuite change to purely llvm-lit based testing
This change introduces a check-libomp target which is based upon llvm's lit
test infrastructure. Each test (generated from the University of Houston's
OpenMP testsuite) is compiled and then run. For each test, an exit status of 0
indicates success and non-zero indicates failure. This way, FileCheck is not
needed. I've added a bit of logic to generate symlinks (libiomp5 and libgomp)
in the build tree so that gcc can be tested as well.  When building out-of-
tree builds, the user will have to provide llvm-lit either by specifying
-DLIBOMP_LLVM_LIT_EXECUTABLE or having llvm-lit in their PATH.

Differential Revision: http://reviews.llvm.org/D11821


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248211 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 20:41:31 +00:00
Joerg Sonnenberger 2aec68db20 Use sysconf for the number of cores on FreeBSD too.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248209 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 20:29:12 +00:00
Joerg Sonnenberger 61bb8dd178 Complex division requires libm on NetBSD, add it.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248207 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 20:21:02 +00:00
Joerg Sonnenberger 70eac4ffbd Add basic NetBSD support.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 20:02:45 +00:00
Joerg Sonnenberger 60a90c830f Teach the Perl modules about NetBSD.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248203 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 19:42:05 +00:00
Joerg Sonnenberger 8cd13fe13e libomp on NetBSD needs libc, libpthread and libm.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 19:40:59 +00:00
Joerg Sonnenberger 98bea25703 Assume that all Unix-like systems will want to handle signals and
simplify conditional.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248199 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 19:38:56 +00:00
Joerg Sonnenberger cecce61d1e Darwin is the exception when it comes to accessing environ, all other
Unix-like systems can follow the same code path.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248198 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 19:37:05 +00:00
Jonathan Peyton f56794a06c [OMPT] Simplify control variable logic for OMPT
Prior to this change, OMPT had a status flag ompt_status, which could take
several values. This was due to an earlier OMPT design that had several levels
of enablement (ready, disabled, tracking state, tracking callbacks). The
current OMPT design has OMPT support either on or off.
This revision replaces ompt_status with a boolean flag ompt_enabled, which 
simplifies the runtime logic for OMPT.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D12999


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248189 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 18:11:22 +00:00
Jonathan Peyton 05e6b65636 [OMPT] Overhaul OMPT initialization interface
The OMPT specification has changed. This revision brings the LLVM OpenMP
implementation up to date.

Technical overview of changes:
Previously, a public weak symbol ompt_initialize was called after the OpenMP
runtime is initialized. The new interface calls a global weak symbol ompt_tool
prior to initialization. If a tool is present, ompt_tool returns a pointer to
a function that matches the signature for ompt_initialize. After OpenMP is 
initialized the function pointer is called to initialize a tool.
Knowing that OMPT will be enabled before initialization allows OMPT support to
be initialized as part of initialization instead of back patching
initialization of OMPT support after the fact.
Post OpenMP initialization support has been generalized moves from
ompt-specific.c into ompt-general.c, since the OMPT initialization logic is no
longer implementation specific.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D12998


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248187 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 18:01:02 +00:00
Jonathan Peyton 9a904471e9 Fix the OpenMP 3.0 build
This change adds guards to the code in places where they are missing to enable
the OpenMP 3.0 build.

Patch by Diego Caballero and Johnny Peyton

Mailing List: http://lists.llvm.org/pipermail/openmp-dev/2015-September/000935.html


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248178 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 17:24:46 +00:00
Jonathan Peyton 5c72f9ce80 [OMPT] Correct an incorrect OMPT ifdef
An ifdef for OMPT_TRACE needs to be OMPT_BLAME so that both instances of a
callback are controlled by the same ifdef.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D12911


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@248001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-18 16:24:46 +00:00
Sylvestre Ledru 0401c9a540 Force the readelf call to be in English
Summary:
For example, when readelf is called on a french localization, it will find "Librairie partagées" instead of "shared library"


Reviewers: AndreyChurbanov, jcownie

Differential Revision: http://reviews.llvm.org/D12902

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@247787 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 12:01:14 +00:00
Jonathan Peyton 8aa5b7d146 Removing the Makefile/Perl build system.
This change deletes the Makefile+Perl build system and all files used by it
which aren't used by the CMake build system. This included many Perl files,
*.mk files, iomp* files.  This change also updates the README's and
index.html to instruct the user to use the CMake build system. All mentioning
of the Perl+Makefile based system are removed.

Differential Revision: http://reviews.llvm.org/D12331


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@247583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 17:20:30 +00:00
Jonathan Peyton 34260e3af7 [OMPT] Fix assertion that arises when waiting for proxy tasks on runtime shutdown
This only triggered when built in debug mode with OMPT enabled:
__kmp_wait_template expected the state of the current thread to be either
ompt_state_idle or ompt_state_wait_barrier{,_implicit,_explicit}.

Patch by Jonas Hahnfeld

Differential Revision: http://reviews.llvm.org/D12754


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@247339 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:33:50 +00:00
Jonathan Peyton 48df373982 Fix depth field bug and resize() function in hierarchical barrier
This is a follow up to the hierarchy cleanup patch.
Added some clarifying comments to hierarchy_info.
Fixed a bug with the depth field not being updated cleanly during a resize.
Fixed resize to first check capacity as determined by maxLevels before actually doing the full resize.

Differential Revision: http://reviews.llvm.org/D12562


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@247333 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 20:34:32 +00:00
Jonathan Peyton 0b3c56d5b5 Cleanup of affinity hierarchy code.
Some of this is improvement to code suggested by Hal Finkel. Four changes here:
1.Cleanup of hierarchy code to handle all hierarchy cases whether affinity is available or not
2.Separated this and other classes and common functions out to a header file
3.Added a destructor-like fini function for the hierarchy (and call in __kmp_cleanup)
4.Remove some redundant code that is hopefully no longer needed

Differential Revision: http://reviews.llvm.org/D12449


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@247326 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 19:22:07 +00:00
Jonathan Peyton ccc39aacca Fix hanging barriers if number of parallel regions exceeds UINT_MAX
The fix is to make b_arrived flag 64 bit in both structures - kmp_balign_team_t
and kmp_balign_t. Otherwise when flag in kmp_balign_team_t wrapped over
UINT_MAX the library hangs.

Differential Revision: http://reviews.llvm.org/D12563


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@247320 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:44:30 +00:00
Jonathan Peyton e78ed18a55 Remove duplicate of num_threads assignment.
The th.th_team_nproc is assigned in __kmp_allocate_thread() just 3 lines above,
so there is no need to assign the same value again.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 20:28:50 +00:00
Jonathan Peyton fb9db4c128 Remove fork_context argument from __kmp_join_call() when OMPT is off
Conditionally include the fork_context parameter to __kmp_join_call()
only if OMPT_SUPPORT=1

Differential Revision: http://reviews.llvm.org/D12495


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246460 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 18:15:00 +00:00
Jonathan Peyton 349425018c Follow up to r246426 (Break Fortran Module Files build)
The CMAKE_CURRENT_BINARY_DIR is only necessary on the DEPENDS part of
the add_custom_command to build the Fortran Modules.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246448 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 15:52:32 +00:00
Andrey Churbanov f8089721ae D12403: Fix GCC warning 'always_inline function might not be inlinable'
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246434 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 12:32:55 +00:00
Andrey Churbanov a774451283 Fix for Fortran modules build (from C.Bergstrom)
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246426 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 09:21:21 +00:00
Jonathan Peyton b6c63f3ee3 Add kmp_config.h.cmake
In r246314 (Removing expand-vars.pl) patch, I forgot to add kmp_config.h.cmake
This patch just adds it.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246317 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 19:24:39 +00:00
Jonathan Peyton 45318d1e6f [OpenMP] [CMake] Removing expand-vars.pl in favor of CMake's configure_file()
Currently, the libomp CMake build system uses a Perl script to configure files
(tools/expand-vars.pl). This patch replaces the use of the Perl script by using
CMake's configure_file() function. The major changes include:
1. *.var has every $KMP_* variable changed to @LIBOMP_*@
2. kmp_config.h.cmake is a new file which contains all the feature macros and
   #cmakedefine lines
3. Most of the -D lines have been moved from LibompDefinitions.cmake but some
   OS specific MACROs (e.g., _GNU_SOURCE) remain.
4. All expand-vars.pl related logic is removed from the CMake files.

One important note about this change is that it breaks the old Perl+Makefile
build system because it can't create kmp_config.h properly.

Differential Review: http://reviews.llvm.org/D12211


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246314 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 18:42:10 +00:00
Jonathan Peyton ac4964ceea Update README.txt to include table of supported Power processors
Small patch to the README.txt file which adds a table that shows what compiler
version works on what Power processor. 

Patch by Carlo Bertolli

http://lists.llvm.org/pipermail/openmp-commits/2015-August/000595.html


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 17:19:17 +00:00
Jonathan Peyton 1960f887c7 Put taskdata variables under KMP_DEBUG guards.
These variables are only used in the TRACE macros and
so don't need to be defined unless compiling in debug mode.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246067 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 20:02:21 +00:00
Jonathan Peyton d78ef70561 Replace variables with definitions inside KMP_DEBUG_ASSERT statements
This change just removes the variables created solely for KMP_DEBUG_ASSERT statements
and puts the definition of the removed variables inside the KMP_DEBUG_ASSERT
statements.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 19:58:48 +00:00
Jonathan Peyton 9c8205e43f Remove redundant definition of thr in kmp_gsupport.c
There is a thr variable with the same definition at the top of this function 
as the thr variable inside the if block.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246064 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 19:55:13 +00:00
Jonathan Peyton 0e47cdd237 Remove unused caller_gtid variable in both z_Linux_util.c and z_Windows_NT_util.c
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@246059 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 19:43:15 +00:00
Jonathan Peyton 1887f0f2ed Fix machine topology pruning.
This patch fixes a bug when eliminating layers in the machine topology (namely
cores, and threads). Before this patch, if a user specifies using only one 
thread per socket, then affinity is not set properly due to bad topology
pruning.

Differential Revision: http://reviews.llvm.org/D11158


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@245966 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 18:44:41 +00:00
Jonathan Peyton c3e1a461e2 Update z_Linux_asm.s to use platform macros
z_Linux_asm.s can use the KMP_OS_* / KMP_MIC macros instead of the predefined
compiler macro checks.  The macro logic to determine KMP_MIC is moved from
kmp_os.h to kmp_platform.h.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@245602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 19:46:14 +00:00
Andrey Churbanov fc660a2d58 D11990: Lock-free start of serialized parallel regions
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@245286 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 10:08:27 +00:00
Andrey Churbanov fc8ef92585 D11988: Force serial reduction when team size is 1
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@245209 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-17 10:12:12 +00:00
Andrey Churbanov a5220977d0 D11157: Fixed missed threads re-binding in case team size reduced via omp_set_num_threads
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@245206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-17 10:04:38 +00:00
Jonathan Peyton aab4548382 Remove unused KMP_SETVERSION macro
This macro and the small amount of code along with it are unused and
can be removed.  The macro is never defined in any build script or source file.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 15:26:38 +00:00
Jonathan Peyton 6a56f9430c Fix two typos in documentation
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244811 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 21:05:22 +00:00
Jonathan Peyton 7bd6023443 One line fix for hierarchical barrier
There was a missing implicit task init for the ICV PUSH case in hierarchical barrier.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244807 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 20:59:48 +00:00
Jonathan Peyton 9eca9d092c Add recognition of the Intel 16.0 compiler in kmp_version.c
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244799 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 19:48:31 +00:00
Jonathan Peyton 9d7a4861d7 Tidy statistics collection
This removes some statistics counters and timers which were not used,
adds new counters and timers for some language features that were not
monitored previously and separates the counters and timers into those
which are of interest for investigating user code and those which are
only of interest to the developer of the runtime itself.
The runtime developer statistics are now ony collected if the
additional #define KMP_DEVELOPER_STATS is set.

Additional user statistics which are now collected include:
* Count of nested parallelism (omp parallel inside a parallel region)
* Count of omp distribute occurrences
* Count of omp teams occurrences
* Counts of task related statistics (taskyield, task execution, task
  cancellation, task steal)
* Values passed to omp_set_numtheads
* Time spent in omp single and omp master

None of this affects code compiled without stats gathering enabled,
which is the normal library build mode.

This also fixes the CMake build by linking to the standard c++ library
when building the stats library as it is a requirement.  The normal library
does not have this requirement and its link phase is left alone.

Differential Revision: http://reviews.llvm.org/D11759


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244677 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 21:36:41 +00:00
Jonathan Peyton d90b41fbda Fix link error on Windows when LIBOMP_USE_DEBUGGER is off
Two symbols for the external debugger support were incorrectly exported when LIBOMP_USE_DEBUGGER=off.

Differential Revision: http://reviews.llvm.org/D11763


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244217 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 15:16:54 +00:00
Andrey Churbanov 2991608ede D11156: Fix comments by eliminating possible trademark conflicts
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244034 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 12:00:07 +00:00
Andrey Churbanov 4738131753 D11301: Remove the __kmp_invoke_microtask() that relies on libffi
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244031 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 11:23:10 +00:00
Andrey Churbanov 9a343549b4 D11159: Fixing the stack offset functionality
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244030 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 11:12:45 +00:00
Tanya Lattner 7edc770912 Update to lists.llvm.org
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@244008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 04:04:09 +00:00
Jonathan Peyton 416a19a376 Update Build_With_CMake.txt to reflect changes in CMake refactor
This just updates the documentation regarding how to build libomp with CMake.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@243276 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 16:23:42 +00:00
Hans Wennborg a02bbb9b3a LibompMicroTests.cmake: Invoke 'test' instead of using '[ x -eq y ]'
I was getting this cmake error on Mac OS X:

  CMake Error: Error in cmake code at
  /tmp/openmp/runtime/cmake/LibompMicroTests.cmake:140:
  Parse error.  Function missing ending ")".  Instead found bad character with text "[".

Perhaps invoking 'test' is less confusing for cmake.

Differential Revision: http://reviews.llvm.org/D11493

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@243165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24 21:24:48 +00:00
Jonathan Peyton 50be853810 Patch out a fatal assertion in OpenMP runtime until preconditions are met
Compiling simple testcase with g++ and linking it to the LLVM OpenMP runtime
compiled in debug mode trips an assertion that produces a fatal error. When
the assertion is skipped, the program runs successfully to completion and 
produces the same answer as the sequential code. Intel will restore the
assertion with a patch that fixes the issues that cause it to trip.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D11269


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@243032 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 18:58:37 +00:00
Jonathan Peyton d907054da3 [CMake] Fix libomp_check_linker_flag function
libomp_check_linker_flag rewrites src_to_link.c and CMakeLists.txt in build
directory for test project, but cmake does not rebuild the project. The root
cause is that on some filesystems (ext3, reiserfs) timestamp resoultion is 1
second. So cmake does not rebuild test project if check takes less than 1 second.
This patch puts each test in its own directory to avoid the timestamp problem.

Patch by Chris Bergstrom

http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-July/000817.html


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@243017 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 14:41:35 +00:00
Jonathan Peyton 9b32683178 Fix OMPT support for task frames, parallel regions, and parallel regions + loops
This patch makes it possible for a performance tool that uses call stack
unwinding to map implementation-level call stacks from master and worker
threads into a unified global view. There are several components to this patch.

include/*/ompt.h.var
  Add a new enumeration type that indicates whether the code for a master task
    for a parallel region is invoked by the user program or the runtime system
  Change the signature for OMPT parallel begin/end callbacks to indicate whether
    the master task will be invoked by the program or the runtime system. This
    enables a performance tool using call stack unwinding to handle these two
    cases differently. For this case, a profiler that uses call stack unwinding
    needs to know that the call path prefix for the master task may differ from
    those available within the begin/end callbacks if the program invokes the
    master.

kmp.h
  Change the signature for __kmp_join_call to take an additional parameter
  indicating the fork_context type. This is needed to supply the OMPT parallel
  end callback with information about whether the compiler or the runtime
  invoked the master task for a parallel region.

kmp_csupport.c
  Ensure that the OMPT task frame field reenter_runtime_frame is properly set
    and cleared before and after calls to fork and join threads for a parallel
    region.
  Adjust the code for the new signature for __kmp_join_call.
  Adjust the OMPT parallel begin callback invocations to carry the extra
    parameter indicating whether the program or the runtime invokes the master
    task for a parallel region.

kmp_gsupport.c
  Apply all of the analogous changes described for kmp_csupport.c for the GOMP
    interface
  Add OMPT support for the GOMP combined parallel region + loop API to
    maintain the OMPT task frame field reenter_runtime_frame.

kmp_runtime.c:
  Use the new information passed by __kmp_join_call to adjust the OMPT
    parallel end callback invocations to carry the extra parameter indicating
    whether the program or the runtime invokes the master task for a parallel
    region.

ompt_internal.h:
  Use the flavor of the parallel region API (GNU or Intel) to determine who
    invokes the master task.

Differential Revision: http://reviews.llvm.org/D11259


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@242817 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 18:03:30 +00:00
Chandler Carruth b2e5aba353 [cmake] Support enabling -Werror in the OpenMP runtime CMake build and
clean up the build.

This disables all of the Clang warnings that fire for me when building
libomp.so on Linux with a recent Clang binary. Lots of these should
probably be fixed, but I want to at least get the build warning-clean
and make it easy to keep that way.

I also switched a bunch of the warnings that are used both for C and C++
compiles to check the flag with C compilation test.

Differential Revision: http://reviews.llvm.org/D11253

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@242604 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-18 03:14:02 +00:00
Jonathan Peyton 9d41ae24e1 Re-indent the CMake refactor to two-space indention
I apologize for this nasty commit, but I somehow overlooked Chandler's
comment to re-indent these files to two space indention.  I know this
is a horrible commit, but I figured if it was done quickly after the 
first one, not too many conflicts would arise.

Again, I'm sorry and won't do this again.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@242301 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-15 16:57:19 +00:00
Jonathan Peyton 81551056dc Large Refactor of CMake build system
This commit improves numerous functionalities of the OpenMP CMake build 
system to be more conducive with LLVM's build system and build philosophies.
The CMake build system, as it was before this commit, was not up to LLVM's 
standards and did not implement the configuration stage like most CMake based
build systems offer (check for compiler flags, libraries, etc.) In order to
improve it dramatically in a short period of time, a large refactoring had 
to be done.
The main changes done with this commit are as follows:

* Compiler flag checks - The flags are no longer grabbed from compiler specific
  directories.  They are checked for availability in config-ix.cmake and added
  accordingly inside LibompHandleFlags.cmake.
* Feature checks were added in config-ix.cmake.  For example, the standard CMake
  module FindThreads is probed for the threading model to use inside the OpenMP
  library.
* OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic
  is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning 
  a Unix flavor of some sort.
* Got rid of vestigial functions/macros/variables
* Added new libomp_append() function which is used everywhere to conditionally
  or undconditionally append to a list
* All targets have the libomp prefix so as not to interfere with any other
  project
* LibompCheckLinkerFlag.cmake module was added which checks for linker flags
  specifically for building shared libraries.
* LibompCheckFortranFlag.cmake module was added which checks for fortran flag
  availability.
* Removed most of the cruft from the translation between the perl+Makefile based
  build system and this one.  The remaining components that they share are
  perl scripts which I'm in the process of removing.

There is still more left to do.  The perl scripts still need to be removed, and
a config.h.in file (or similarly named) needs to be added with #cmakedefine lines
in it.  But this is a much better first step than the previous system.

Differential Revision: http://reviews.llvm.org/D10656


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@242298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-15 16:05:30 +00:00
Jonathan Peyton 0ce89f8efe Rename OMPT placeholder type names to be in the OMPT name space
r242052 changed the name of OMPT placeholder functions to move them from
the omp_ name space to the ompt_ name space. This patch moves the names of the
types of these functions into the OMPT name space as well.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D11171


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@242155 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-14 15:42:03 +00:00
Jonathan Peyton b6f9ab4d7c Fix some bugs in OMPT support
1.) in kmp_csupport.c, move computation of parameters only needed for OMPT tracing
inside a conditional to reduce overhead if not receiving ompt_event_master_begin
callbacks.
2.) in kmp_gsupport.c, remove spurious reset of OMPT reenter_runtime_frame (which 
is set in its caller, GOMP_parallel_start correct placement of #if OMP_TRACE so 
that state is maintained even if tracing support not included.  
3.) in z_Linux_util.c, add architecture independent support for OMPT by setting 
and resetting OMPT's exit_frame_ptr before and after invoking a microtask.  
4.) On the Intel MIC, the loader refuses to retain static symbols in the 
libomp.so shared library, even though tools need them. The loader could not be
bullied into doing so. To accommodate this, I changed the visibility of OMPT 
placeholder functions to public. This required additions in exports.so.txt, 
adding extern "C" scoping in ompt-general.c so that the public placeholder
symbols won't be mangled.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D11062


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@242052 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-13 18:55:45 +00:00
Andrey Churbanov 39454f4614 fixed typo in debug assertion reported by John Mellor-Crummey
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@242043 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-13 17:52:41 +00:00
Jonathan Peyton dc3324f7ee Turn debugger interface off by default.
Just changed LIBOMP_USE_DEBUGGER to false.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@241852 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 20:17:16 +00:00
Jonathan Peyton 7f88ff4ca8 Follow up to safe API patch
A while back, we made an initial change where dangerous C API functions were
replaced with macros that translated the dangerous API function calls to safer
function calls e.g., sprintf() replaced with KMP_SPRINTF() which translates to 
sprintf_s() on Windows. Currently, the only operating system where this is 
applicable is Windows. Unix-like systems are still using the dangerous API 
e.g., KMP_SPRINTF() translates to sprintf().  Our own testing showed no
performance differences.

Differential Revision: http://reviews.llvm.org/D9918


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@241833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 18:20:51 +00:00
Jonathan Peyton c0d8cfddb6 Enable debugger support
These changes enable external debuggers to conveniently interface with 
the LLVM OpenMP Library.  Structures are added which describe the important
internal structures of the OpenMP Library e.g., teams, threads, etc.
This feature is turned on by default (CMake variable LIBOMP_USE_DEBUGGER)
and can be turned off with -DLIBOMP_USE_DEBUGGER=off.

Differential Revision: http://reviews.llvm.org/D10038


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@241832 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 18:16:58 +00:00
Jonathan Peyton 219c0242d9 Fix OMPT event_barrer_end
The OMPT status is never equal to ompt_status_track. ompt_status_track = 0x2 
and ompt_status_track_callback = 0x6 just share a bit, so that we can check 
for traceing and callbacks with the same status.

Patch by Tim Cramer

Differential Revision: http://reviews.llvm.org/D10863


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@241167 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-01 15:16:04 +00:00
Jonathan Peyton bb405b54c6 Remove _KMP_BUILD_TIME macro from kmp_version.c
At the suggestion of Chandler Carruth, I've removed the timestamp macro,
_KMP_BUILD_TIME, that cmake currently sets to "No_Timestamp" and replaced it with standard
__DATE__ and __TIME__ macros inside kmp_version.c.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@240985 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-29 19:22:12 +00:00
Jonathan Peyton ffef79f8a4 Remove use of assignment to multiple struct fields using .fieldname (OMPT)
Remove use of assignment to multiple struct fields using .fieldname syntax. 
This doesn't work with gcc 4.8 and earlier.  Replace with elementwise field assignments.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D10798


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@240972 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-29 17:33:03 +00:00
Jonathan Peyton 0746d6010e Fix OMPT state maintenance for barriers and missing init of implicit task id.
Fix OMPT support for barriers so that state changes occur even if OMPT_TRACE turned off. 
These state changes are needed by performance tools that use callbacks for either 
ompt_event_wait_barrier_begin or ompt_event_wait_barrier_end.  Change ifdef flag to OMPT_BLAME 
for callbacks ompt_event_wait_barrier_begin or ompt_event_wait_barrier_end rather than 
OMPT_TRACE -- they were misclassified.  Without this patch, when the runtime is compiled with 
LIBOMP_OMPT_SUPPORT=true, LIBOMP_OMPT_BLAME=true, and LIBOMP_OMPT_TRACE=false, and a callback 
is registered for either ompt_event_wait_barrier_begin or ompt_event_wait_barrier_end, then an 
assertion will trip.  Fix the scoping of one OMPT_TRACE ifdef, which should not have surrounded 
an update of an OMPT state.  Add a missing initialization of an OMPT task id for an implicit task.

Patch by John Mellor-Crummey

Differential Revision: http://reviews.llvm.org/D10759


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@240970 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-29 17:28:57 +00:00
Jonathan Peyton 316fcc308a Allow machine hierarchy expansion
This fix allows the machine hierarchy to be expanded in case it needs to handle 
more threads. It adds a resize function to accomplish this.

Differential Revision: http://reviews.llvm.org/D9900


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@240292 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 15:59:18 +00:00
Jonathan Peyton a48c8b78c0 Re-enable Visual Studio Builds.
I tried to compile with Visual Studio using CMake and found these two sections of code 
causing problems for Visual Studio.  The first one removes the use of variable length 
arrays by instead using KMP_ALLOCA().  The second part eliminates a redundant cpuid 
assembly call by using the already existing __kmp_x86_cpuid() call instead.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@240290 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 15:53:50 +00:00
Jonathan Peyton 295dc6c4f3 Have CMake error out on Windows when user wants OMPT support
Currently, OMPT support requires the weak attribute which isn't supported
on Windows.  This patch has CMake error out when LIBOMP_OMPT_SUPPORT=true
and the users is building on Windows.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000692.html

Patch by Jonas Hahnfeld


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239912 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-17 15:43:34 +00:00
Jonathan Peyton d4c3a31f48 Remove unused variables '__kmp_build_check_*' for non assert builds.
Add new LIBOMP_ENABLE_ASSERTIONS macro which can be set in a standalone build
or takes the value of LLVM_ENABLE_ASSERTIONS when inside llvm/projects.  This
change also defines the KMP_BUILD_ASSERT() macro to do nothing when ENABLE_ASSERTIONS
is off.  This means the __kmp_build_check_* types won't be defined and thus, no warnings.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000719.html

Patch by Jack Howarth and Jonathan Peyton


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239546 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 17:36:16 +00:00
Jonathan Peyton f2cc667b65 Implement recursive CMake.
Most CMake build systems put CMakeLists.txt files inside source directories where 
items need to get built. This change follows that convention by adding a new 
runtime/src/CMakeLists.txt file. An additional benefit is this helps logically 
seperate configuring with building as well. This change is mostly just copying and 
pasting the bottom half of runtime/CMakeLists.txt into runtime/src/CMakeLists.txt, 
but a few changes had to be made to get it to work. Most of those changes were to 
directory prefixes.

Differential Revision: http://reviews.llvm.org/D10344


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239542 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 17:23:57 +00:00
Jonathan Peyton c4046a0728 Remove unused variables '__kmp_build_check_*'
As an ongoing effort to sanitize the openmp code, this one word change
eliminates creating 1 byte arrays named __kmp_build_check_* and instead
creates one byte array types.  The KMP_BUILD_ASSERT macro still offers the same
functionality; array types with negative number of elements is illegal 
and will cause a compiler failure.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239337 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 20:18:10 +00:00
Jonathan Peyton a409d02503 Remove unused variable warnings by deletion.
As an ongoing effort to sanitize the openmp code, these changes delete 
variables that aren't used at all.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000701.html

Patch by Jack Howarth


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239334 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 20:01:14 +00:00
Jonathan Peyton 5174723912 Remove unused variable warnings by moving variables.
As an ongoing effort to sanitize the openmp code, these changes move
variables under already existing macro guards.

Patch by Jack Howarth


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 19:39:07 +00:00
Jonathan Peyton 9015a0bc3e Remove unused variable warnings by adding proper macro guards.
As an ongoing effort to sanitize the openmp code, these changes remove unused variables
by adding proper macros around both variables and functions.

Patch by Jack Howarth


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 19:25:25 +00:00
Jonathan Peyton 4c6ccfea87 Remove unused variable warnings by fooling compiler.
Some variables are convenient to keep around even if they aren't
really used in a release build.  This is often seen in DEBUG guarded code where the variable
is only used in a DEBUG build.

Patch by Jack Howarth


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239326 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 18:56:33 +00:00
Jonathan Peyton ce39a6d2ca Removed unused functions.
As an ongoing effort to sanitize the openmp code, these changes remove unused functions.
The unused functions are:
__kmp_fini_allocator_thread(), __kmp_env_isDefined(), __kmp_strip_quotes(),
__kmp_convert_to_seconds(), and __kmp_convert_to_nanoseconds(). 

Patch by Jack Howarth


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239323 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 18:38:23 +00:00
Jonathan Peyton d6fcd063d4 Fix extern warnings produced by ittnotify_static.c
when compiling with gcc or clang numerous warnings concerning the usage 
of extern "C" linkage.  All the __kmp_itt_sync* variables are declared
like: extern "C" type __kmp_itt_sync... = definition; through various macros.
This note from cppreference.com explains why this is a problem.
// From http://en.cppreference.com/w/cpp/language/language_linkage
extern "C" int x; // a declaration and not a definition
// The above line is equivalent to extern "C" { extern int x; }
extern "C" { int x; } // a declaration and definition
Since the __kmp_itt_* variables are being declared and defined, these variables 
should use the bracketed version instead.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 20:24:13 +00:00
Jonathan Peyton a1bf3122c5 Fix some sign compare warnings.
This change changes kmp_bstate.old_tid to sign integer instead of unsigned integer.
It also defines two new macros KMP_NSEC_PER_SEC and KMP_USEC_PER_SEC which lets us take
control of the sign (we want them to be longs).  Also, in kmp_wait_release.h, the byteref()
function's return type is changed from char to unsigned char.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@239057 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 17:29:13 +00:00
Jonathan Peyton c6a79237e2 Suppress uninitialized-variable-is-used warning in kmp_csupport.c
The following change is needed to suppress the "variable 'retval' is used 
uninitialized whenever 'if' condition is false" warnings in runtime/src/kmp_csupport.c.
This change just initializes 'retval' to 0.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000667.html

Patch by Jack Howarth


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238954 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 19:31:39 +00:00
Jonathan Peyton 1b7b309815 Remove conditional parameters from KA_TRACE macro.
It's undefined behavior to have arguments to macros be conditionally preprocessed.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000669.html

Patch by Jack Howarth and Jonathan Peyton


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238950 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 18:24:02 +00:00
Jonathan Peyton 5588286861 Reorder C++ initialization lists to appease compiler.
in kmp_wait_release.h, there were some constructors where the initialization
lists were out of order with the member declarations inside the class.  This
patch just reorders the initialization list so the compiler doesn't complain.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000670.html

Patch by Jack Howarth and Jonathan Peyton


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238946 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 17:26:47 +00:00
Jonathan Peyton 897380cff5 Remove unused variable anonym from kmp_atomic.c
There is an anonym variable inside a macro that is declared and defined
but never used.  This patch removes it.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000666.html

Patch by Jack Howarth and Jonathan Peyton


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238934 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:23:36 +00:00
Jonathan Peyton ef3f591ff4 Get rid of some dead code.
Some old references to RML and IOMP which aren't used anywhere are deleted.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000664.html

Patch by Jack Howarth and Jonathan Peyton


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238878 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 22:21:37 +00:00
Jonathan Peyton 9c97519f26 Remove unused KMP_IOMP_NAME macro from kmp.h
Getting rid of more iomp references.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000659.html



git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238847 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 16:19:44 +00:00
Jonathan Peyton 643e32e86a Change Intel(R) OpenMP* to LLVM* OpenMP* in libomp.rc.var
Missed some places that referenced the Intel(R) OpenMP* Runtime Library.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238840 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 15:06:08 +00:00
Jonathan Peyton df46ccc9e9 Apply name change to testsuite file.
This change has the llvm-lit part of the testsuite have clang
link to libomp instead of libiomp5.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238721 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 04:24:23 +00:00
Jonathan Peyton 3c63973a53 Apply name change to Makefile build system.
This change produces a dynamic library named libomp instead of
libiomp5.  Similar to the CMake change, it produces symlinks of libiomp5
in the exports/ directory for Unix systems and copies for Windows.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238720 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 04:21:22 +00:00
Jonathan Peyton 8d85f8eca1 Apply name change to CMake build system.
This change has the CMake build system create a dynamic library named
libomp instead of libiomp5.  Also any reference to libiomp is replaced
with libomp.  One can still use the LIBOMP_LIB_NAME variable to enforce
a different name, and everything will still work as expected.  An important
note is that libiomp5 and libgomp symlinks are created at install time when
on Unix systems.  On Windows, copies are created with the legacy names.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238715 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 03:05:13 +00:00
Jonathan Peyton 705074b169 Apply name change to tools/* files.
These changes are all in comments.  Change libiomp references to
libomp.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238713 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 02:41:44 +00:00
Jonathan Peyton d03bb79e0c Apply name change to src/* files.
These changes are mostly in comments, but there are a few
that aren't.  Change libiomp5 => libomp everywhere.  One internal
function name is changed in kmp_gsupport.c, and in kmp_i18n.c, the
static char[] variable 'name' is changed to "libomp".


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238712 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 02:37:28 +00:00
Jonathan Peyton 6d330264cc Apply name change to doxygen files.
This change only affects the doxygen file that contains a
reference to libiomp5.  change libiomp5 to libomp.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238711 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 02:32:03 +00:00
Jonathan Peyton 5f4fa366ad Adding libomp.rc.var for name change
Adding a new file libomp.rc.var in anticipation of more
name change commits.  This file is a copy of libiomp.rc.var.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238710 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 02:26:08 +00:00
Jonathan Peyton 532a5c62ee Allow CMAKE_OSX_ARCHITECTURES to build fat library.
The CMAKE_OSX_ARCHITECTURES CMake variable allows users to build
universal fat libraries that contain both i386 and x86_64 code.  These
changes allow this build by having the z_Linux_asm.s file detect the architecture
itself instead of receiving it through the build system.

Also, there was a LIBOMP_OSX_ARCHITECTURES CMake variable added to allow
people to only build libomp as a fat library and not the entire LLVM/Clang system.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-May/000626.html



git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238566 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 16:13:56 +00:00
Jonathan Peyton c9239bc64a Fix comment about balanced affinity
A while back, Hal mentioned fixing a comment concerning balanced affinity.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2014-December/000358.html
I forgot about fixing it until now, but now is better than never.



git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238378 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 23:27:33 +00:00
Jonathan Peyton bbb8bf893d Allow gcc 5.x to compile library.
Change check of __GNUC__ macro from:
__GNUC__ == 4 to __GNUC__ >= 4


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238347 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 18:57:33 +00:00
Jonathan Peyton 29ed987b04 Change macro GUIDEDLL_EXPORTS to KMP_DYNAMIC_LIB
A while back, Hal suggested updating the GUIDEDLL_EXPORTS macro guard to 
a more descriptive name.  It represents a dynamic library build so 
KMP_DYNAMIC_LIB is a more suitable name.

Differential Revision: http://reviews.llvm.org/D9899


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238221 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 17:32:53 +00:00
Jonathan Peyton 0b4c1d5ffa Change CMake file formatting
Removing unnecessary spaces. For CACHE variables, putting the description string
on its own line which mimics libcxx. There are no logic changes.

Differential Revision: http://reviews.llvm.org/D9945


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238219 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 17:27:01 +00:00
Jonathan Peyton ae9c8b86e4 One line fix for possible out-of-bounds issue in kmp_runtime.c
The variable j is now checked so there is no possible
out-of-bounds issue when accessing __kmp_nested_nth.nth[] array.



git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238216 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 16:38:26 +00:00
Jonathan Peyton 066dde2994 One line fix for possible out-of-bounds issue in kmp_error.c
This off-by-one error could lead to an out-of-bounds access on the
cons_text_c[] array.



git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238215 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 16:30:41 +00:00
Andrey Churbanov 030d077d4b fixed missed arch renaming (from C.Bergstrom)
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238153 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 20:01:16 +00:00
Jonathan Peyton 336e25ce53 Fix doxygen comments
These fixes make doxygen happy.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238061 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 22:37:22 +00:00
Jonathan Peyton 6590b366d3 Fix spelling errors
These spelling errors are in comments and some debug messages.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@238060 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 22:35:51 +00:00
Jonathan Peyton b9f584cb60 One line fix - bug with final clause of task construct
Should be looking at parent_task->td_flags.final instead of the recently allocated task.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237959 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:16:38 +00:00
Jonathan Peyton 78445f97d8 Fix task team synchronization
The fix simply syncs up the new threads to have the same task_state and
task_team as the old threads.  The master thread is skipped,
because it shouldn't at this point have the team's task_team value yet
-- it should still have parent_team's task_team.  It gets pointed at
the new team's task_team later, after __kmp_allocate_team returns, and
the master has stored a memo of it's old task_state.



git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237916 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 17:20:01 +00:00
Jonathan Peyton 3913441f89 Change CMake variable prefix to LIBOMP
Cached CMake variables need to have a prefix so they don't collide with other
projects. This change (a lot of simple changes) simply prefixes cached variables
with LIBOMP_ and sets all of these variables to UPPERCASE which is convention.
e.g., os => LIBOMP_OS, ompt_support => LIBOMP_OMPT_SUPPORT.

Differential Revision: http://reviews.llvm.org/D9829


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 22:33:24 +00:00
Jonathan Peyton 97212dc34e Makefile fix for testsuite -- Follow up to r237618
This changes INCLUDE_PATH to C_INCLUDE_PATH and misspelled CLASH to SLASH

Patch by Sunita Chandrasekaran


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237727 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:28:33 +00:00
Jonathan Peyton 02f4d88433 Fix for testsuite including omp.h
When calling the testsuite, clang could not locate omp.h.  The
proper environment variable was modified to include:
exports/common/omp.h.  Documentation was also updated to be more
clear.

Patch by Sunita Chandrasekaran


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237618 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 21:38:50 +00:00
Jonathan Peyton 3a7707192b Delete old CMake build system
Remove runtime/CMakeLists.txt.old and runtime/src/CMakeLists.txt as
they no longer worked and were not being kept up to date.

Differential Revision: http://reviews.llvm.org/D9756


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237615 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 21:21:25 +00:00
Jonathan Peyton 8e7493dbf1 Small fix to allow FreeBSD build to work.
Add xexpand macro to the FTN_IS_INITIAL_DEVICE api function

Patch by Davide Italiano

Differential Revision: http://reviews.llvm.org/D9798


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 19:57:36 +00:00
Jonathan Peyton be30a9edec Testing commit privilege
Added comment to CMakeLists.txt about library install directory suffix option.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237384 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 19:54:56 +00:00
Andrey Churbanov 95876670b8 Cross compiler build fix [Important] - from J.Peyton, initial version from C.Bergstrom.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237360 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 12:54:08 +00:00
Andrey Churbanov 784d89cf28 Removed mentioning of OpenMP as unsupported feature (patch2 from A.Bokhanko)
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237253 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 13:42:59 +00:00
Andrey Churbanov 41ab51f237 patch to allow lib name at configure time (from C.Bergstrom)
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237130 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 13:31:57 +00:00
Andrey Churbanov a6bafed791 Missing file runtime/src/include/41/ompt.h.var added; fixed build to optionally use added file.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237125 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 13:10:54 +00:00
Andrey Churbanov d4f09d3c11 D9576: Updates documentation to include all possible architecture builds, synchronizes runtime/README.txt and www/README.txt, updates the building-with-CMake documentation. This change also changes references of Intel(R) OpenMP Library to LLVM OpenMP Library.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@237124 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 12:52:43 +00:00
Andrey Churbanov 1fd47b8943 Change some text areas from saying Intel(R) OpenMP runtime library to LLVM OpenMP runtime library.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236884 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 17:41:32 +00:00
Andrey Churbanov 4af0f3a6a7 D9306 omp 4.1 async offload support (partial): code changes
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236753 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-07 17:41:51 +00:00
Andrey Churbanov 941ff3cfec D9306 omp 4.1 async offload support (partial): build changes for version 4.1
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236746 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-07 17:07:06 +00:00
Andrey Churbanov d3bad19554 D9306 omp 4.1 async offload support (partial): added version 4.1 headers.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236744 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-07 16:58:05 +00:00
Andrey Churbanov 1cbd964ba5 D7631: added regression tests for hinted locks - to be integrated into testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236632 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 19:40:54 +00:00
Andrey Churbanov efb6bb2106 D9302.partial2: cleanup of ittnotify checks, that eliminats redundant notifications in case of nested regions.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236631 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 19:22:36 +00:00
Andrey Churbanov 730074da8d D9302.partial: bug fix for ittnotify: added missed timing on hierarchical barrier.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236623 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 18:34:15 +00:00
Andrey Churbanov 08a240ddea Added missed symbol omp_in_final into include/module files.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236619 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 18:13:52 +00:00
Andrey Churbanov 00a59d4327 ittnotify: change default notification mode to 3, which includes parallel regions, barriers + imbalance, loops, single regions reporting.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236616 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 17:41:58 +00:00
Andrey Churbanov 80ba310a1f Liboffload: Patch for MPSS > 3.4.x (provided by Tim Cramer)
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236588 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 10:58:40 +00:00
Andrey Churbanov afd2c6c3fd Integrate libiomp CMake into LLVM CMake build system.
This patch integrates the libiomp CMake build system into the LLVM CMake build 
system so that users can checkout libiomp into the projects directory of llvm 
and build llvm,clang, and libiomp all together.  These changes specifically 
introduce a new install target which will put libraries and headers into the 
correct locations when either a standalone build or part of llvm.
The copy_recipe() method has been removed in favor of the POST_BUILD method 
to move headers into the exports subdirectory.  And lastly, the MicroTests.cmake 
file was refactored which led to simpler target dependencies and a new target, 
make libiomp-micro-tests, which performs the 5 small tests (test-relo, 
test-touch, etc.) when called.


git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236534 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-05 20:02:52 +00:00
Andrey Churbanov 98270aa879 These are the actual changes in the runtime to issue OMPT-related functions. All of them are surrounded by #if OMPT_SUPPORT and can be disabled (which is the default).
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236122 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:42:24 +00:00
Andrey Churbanov 7866075b26 This patch contains the new files for OMPT and the needed changes to the build infrastructure
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236117 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:22:07 +00:00
Andrey Churbanov 107fb0e39e This is a preparation patch to get information about the actual release status from nested locks for OMPT.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236114 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 15:52:19 +00:00
Andrey Churbanov 1d0ad7f8a7 UH OpenMP testsuite update
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@236105 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 14:36:38 +00:00
Andrey Churbanov 0c6d80bd14 updated copyright date to 2015
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@235086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 11:10:17 +00:00
Andrey Churbanov 97f7eb4877 The generation of the hierarchy used by hierarchical barrier improved in how the generation reacts to affinity set to none, or disabled, or no affinity available, or oversubscription. Some cleanup actions based on review comments to follow: need to use meaningful names instead of digital constants, e.g. use enumerators.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@234775 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-13 18:51:59 +00:00
Andrey Churbanov 8c2806cda5 Replace some unsafe API calls with safe alternatives on Windows, prepare code for similar actions on other platforms - wrap unsafe API calls into macros.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@233915 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 13:27:08 +00:00
Andrey Churbanov 1e585c2e08 Eliminated the write to depth field of the machine_hierarchy data structure in __kmp_get_hierarchy(), thus fixing race condition. Now local variable used by each thread.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@233914 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 13:18:50 +00:00
Andrey Churbanov 03e9d1a623 fix for broken commit 231774
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231781 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 10:14:57 +00:00
Andrey Churbanov de7026a553 issuing of incorrect warning fixed
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231779 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 09:34:38 +00:00
Andrey Churbanov 37d0af3296 cleanup: removed unused function __kmp_change_thread_affinity_mask
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231778 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 09:31:21 +00:00
Andrey Churbanov 890e8fd276 proc_bind_disabled enum value removed, its usage replased with proc_bind_false
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231776 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 09:19:47 +00:00
Andrey Churbanov f2d8bd6591 cleanup: usages of mask size wrapped into macros
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231775 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 09:15:26 +00:00
Andrey Churbanov 24a57ca394 Adding some 8-bit atomic operations for future use
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231774 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 09:03:42 +00:00
Andrey Churbanov 20b8da7236 changed unsigned types to signed - caused by comments of Hal Finkel on one of earlier patches
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231773 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 09:00:36 +00:00
Andrey Churbanov 8b78c4a5dc moved Windows-specific flags under the WINDOWS guard in CMake
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231384 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-05 17:50:48 +00:00
Andrey Churbanov 3fa7333224 added KMP_NESTED_HOT_TEAMS macro definition
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231383 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-05 17:48:53 +00:00
Andrey Churbanov 137f02169d minor change: comment improved
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231381 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-05 17:46:50 +00:00
Andrey Churbanov 1f60457c77 Cleanup provided by Carlo Bertolli
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@231078 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 16:19:57 +00:00
Andrey Churbanov f22e087f7c Removed all header files for OpenMP 2.5
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230521 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 18:38:08 +00:00
Andrey Churbanov 893d25d72c Export the common header files to exports/ with CMake
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230520 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 18:32:30 +00:00
Andrey Churbanov 45ed5c3e63 Set the Intel compiler as default when building for the MIC without CMake
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230519 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 18:30:50 +00:00
Andrey Churbanov 6c8cce6f8b Two warning messages fixed.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230035 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:19:41 +00:00
Andrey Churbanov b4d5def747 Misprint in comment fixed
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230034 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:17:03 +00:00
Andrey Churbanov 53e806cdc1 Detect Intel MIC architecture and set some defaults at run time instead of build time.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230033 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:14:43 +00:00
Andrey Churbanov 032f90ffc6 Removed unused varargs from __kmpc_flush function.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230032 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:09:27 +00:00
Andrey Churbanov 5356a729f1 Added new user-guided lock api, currently disabled. Use KMP_USE_DYNAMIC_LOCK=1 to enable it.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230030 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:05:17 +00:00
Andrey Churbanov 195acc9c80 Changed default stack offset for threads on non-Mac architectures to a CACHE_LINE.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230029 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 17:57:58 +00:00
Andrey Churbanov 19b619330a Added some compiler flags for security on Linux and Mac link stages.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@230027 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 17:55:48 +00:00
Andrey Churbanov 0fb8c1581f Fixed memory corruption problem.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@228736 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 20:10:21 +00:00
Andrey Churbanov 65e9157ebc Updated the kmp_omp_struct_info_t structure used by debuggers.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@228734 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 19:53:13 +00:00
Andrey Churbanov 50cba614b0 OpenMP 4.0 standard function omp_is_initial_device() implemented.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@228730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 19:47:09 +00:00
Andrey Churbanov f23bef7fdc Added comment on format of local labels in asm code
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@228727 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 19:31:17 +00:00
Andrey Churbanov 143c590366 Added CFI directives to asm code in order to have correct backtraces in gdb.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@228721 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 18:51:52 +00:00
Andrey Churbanov 2ce31a0c3a The usage of tt_state flag is replaced by an array of two task_team pointers.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@228718 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 18:37:43 +00:00
Andrey Churbanov 8afa9cc53a Pin the libiomp5.dll for the lifetime of application, Windows-specific
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227469 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 17:18:20 +00:00
Andrey Churbanov d6f9c6363f enable environment variable KMP_PLACE_THREADS also for non-MIC architectures
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 17:14:58 +00:00
Andrey Churbanov cf569cf54a fix that sets proc-bind-var to proc_bind_false if affinity is not supported
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227454 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 15:52:20 +00:00
Andrey Churbanov fe92d4cfd7 fixing typo in error message
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227451 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 15:49:22 +00:00
Andrey Churbanov ba07f9b3fe fixing mistake in kmp_get_affinity_max_proc() api function
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227450 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 15:48:21 +00:00
Andrey Churbanov 0c9c540c0d fixing the Fortran modules dependencies
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227449 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 15:43:48 +00:00
Andrey Churbanov 94f826e819 adding the jobs variable for parallel build
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227447 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 15:37:15 +00:00
Andrey Churbanov 9236d9713a Comments only: removing the Revision and Date svn variables from the top of all the source files.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227207 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 17:13:53 +00:00
Andrey Churbanov 50e77e281c minor formatting change
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 17:06:18 +00:00
Andrey Churbanov e6f5cf8f18 Enables a cpuid leaf 4 check for non-MIC x86 architectures.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 17:03:42 +00:00
Andrey Churbanov fea0d84adf Adds some new Windows processor groups trace messages
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227203 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 17:00:03 +00:00
Andrey Churbanov 75159bfdee Fixes error where proc-bind-var is not set when there is a parsing error of GOMP_AFFINITY environment variable.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227202 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 16:58:08 +00:00
Andrey Churbanov 7ab6f4b7f9 Removes some unused variables (__kmp_ht_*) and changes__kmp_ncores and __kmp_nThreadsPerCore to static globals within kmp_affinity.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227201 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 16:55:43 +00:00
Andrey Churbanov 79a76a5520 Replaces KMP_OS_WINDOWS && KMP_ARCH_X86_64 or any combination of those two options with the feature macro KMP_GROUP_AFFINITY.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227199 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 16:52:57 +00:00
Andrey Churbanov 0a2bac028a Fixed implementation of the teams construct in case it contains parallel regions with different number of threads.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@227198 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 16:50:31 +00:00
Andrey Churbanov b8903bff6a added support for PPC architectures (version 3): initial patch provided by Carlo Bertolli, latest version from Johnny Peyton
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@226479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 18:29:35 +00:00
Andrey Churbanov 3be2e89b5f Two fixes sent by C.Bergstrom: MB() does real synch for ARM; _Quad is not used when not available.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@226464 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 14:00:00 +00:00
Andrey Churbanov 1ad88fa8d4 few fixes for ittnotify iterface (used by Intel(R) VTune Amplifier)
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@226283 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 15:58:03 +00:00
Andrey Churbanov b67ee8b7ec cleanup changes of cmake-building for Intel(R) Many Integrated Core Architecture
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@226272 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 13:05:23 +00:00
Andrey Churbanov 50c666a9bd cleanup changes of building for Intel(R) Many Integrated Core Architecture
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@226271 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 12:54:51 +00:00
297 changed files with 42316 additions and 30143 deletions
+5
View File
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing")
add_subdirectory(runtime)
+10 -2
View File
@@ -18,7 +18,7 @@ D: Contributor to testsuite from OpenUH
N: Barbara Chapman
D: Contributor to testsuite from OpenUH
N: University of Houston
N: University of Houston
W: http://web.cs.uh.edu/~openuh/download/
D: OpenUH test suite
@@ -26,6 +26,10 @@ 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
@@ -45,5 +49,9 @@ N: Alp Toker
E: alp@nuanti.com
D: Making build work for FreeBSD.
N: Cheng Wang
N: Cheng Wang
D: Contributor to testsuite from OpenUH
N: Diego Caballero
E: diego.l.caballero@gmail.com
D: Fork performance improvements
+52 -2
View File
@@ -14,7 +14,7 @@ software contained in this directory tree is included below.
University of Illinois/NCSA
Open Source License
Copyright (c) 1997-2014 Intel Corporation
Copyright (c) 1997-2016 Intel Corporation
All rights reserved.
@@ -51,7 +51,7 @@ SOFTWARE.
==============================================================================
Copyright (c) 1997-2014 Intel Corporation
Copyright (c) 1997-2016 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -122,3 +122,53 @@ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE.
==============================================================================
ARM Limited
Software Grant License Agreement ("Agreement")
Except for the license granted herein to you, ARM Limited ("ARM") reserves all
right, title, and interest in and to the Software (defined below).
Definition
"Software" means the code and documentation as well as any original work of
authorship, including any modifications or additions to an existing work, that
is intentionally submitted by ARM to llvm.org (http://llvm.org) ("LLVM") for
inclusion in, or documentation of, any of the products owned or managed by LLVM
(the "Work"). For the purposes of this definition, "submitted" means any form of
electronic, verbal, or written communication sent to LLVM or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that are
managed by, or on behalf of, LLVM for the purpose of discussing and improving
the Work, but excluding communication that is conspicuously marked otherwise.
1. Grant of Copyright License. Subject to the terms and conditions of this
Agreement, ARM hereby grants to you and to recipients of the Software
distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable copyright license to reproduce, prepare derivative
works of, publicly display, publicly perform, sublicense, and distribute the
Software and such derivative works.
2. Grant of Patent License. Subject to the terms and conditions of this
Agreement, ARM hereby grants you and to recipients of the Software
distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent license
to make, have made, use, offer to sell, sell, import, and otherwise transfer
the Work, where such license applies only to those patent claims licensable
by ARM that are necessarily infringed by ARM's Software alone or by
combination of the Software with the Work to which such Software was
submitted. If any entity institutes patent litigation against ARM or any
other entity (including a cross-claim or counterclaim in a lawsuit) alleging
that ARM's Software, or the Work to which ARM has contributed constitutes
direct or contributory patent infringement, then any patent licenses granted
to that entity under this Agreement for the Software or Work shall terminate
as of the date such litigation is filed.
Unless required by applicable law or agreed to in writing, the software is
provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied, including, without limitation, any warranties or
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE.
==============================================================================
+21 -5
View File
@@ -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)"
+5
View File
@@ -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
+139 -134
View File
@@ -9,11 +9,12 @@
#//===----------------------------------------------------------------------===//
#
Building libiomp5 using CMake
=============================
==========================================================
How to Build the LLVM* OpenMP* Runtime Library using CMake
==========================================================
==== Version of CMake required: v2.8.0 or above ====
---- Version of CMake required: v2.8.0 or above ----
============================================
How to call cmake initially, then repeatedly
============================================
@@ -25,23 +26,23 @@ How to call cmake initially, then repeatedly
- Example of configuring, building, reconfiguring, rebuilding:
$ mkdir build
$ cd build
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Darch=32 .. # Initial configuration
$ make all common
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=i386 .. # Initial configuration
$ make
...
$ make clean
$ cmake -Darch=32e -DCMAKE_BUILD_TYPE=Debug .. # Second configuration
$ make all common
$ cmake -DLIBOMP_ARCH=x86_64 -DCMAKE_BUILD_TYPE=Debug .. # Second configuration
$ make
...
$ rm -rf *
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Darch=32e .. # Third configuration
$ make all common
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=x86_64 .. # Third configuration
$ make
- Notice in the example how the compiler definitions are only specified
for an empty build directory, but other Build options are used at any time.
- The file CMakeCache.txt which is created after the first call to cmake
is a configuration file which holds all the values for the Build options.
These configuration values can be changed using a text editor to modify
These configuration values can be changed using a text editor to modify
CMakeCache.txt as opposed to using definitions on the command line.
- To have cmake create a particular type of build generator file simply
- To have cmake create a particular type of build generator file simply
inlude the -G <Generator name> option:
$ cmake -G "Unix Makefiles" ...
You can see a list of generators cmake supports by executing cmake with
@@ -54,169 +55,173 @@ Instructions to Build
$ mkdir build
$ cd build
[ Linux* , Mac* Libraries ]
[ Unix* Libraries ]
$ cmake -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> ..
[ Intel(R) Many Integrated Core Library (Intel(R) MIC Library) ]
$ cmake -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -Dos=mic -Darch=32e ..
$ cmake -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -DLIBOMP_ARCH=mic ..
[ Windows Libraries ]
$ cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -DCMAKE_ASM_MASM_COMPILER=[ml | ml64] -DCMAKE_BUILD_TYPE=Release ..
$ cmake -G <Generator Type> -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -DCMAKE_ASM_MASM_COMPILER=[ml | ml64] -DCMAKE_BUILD_TYPE=Release ..
$ make all common
$ make
$ make install
=================
==================
Mac* Fat Libraries
=================
==================
On OS X* machines, it is possible to build universal (or fat) libraries which
include both IA-32 architecture and Intel(R) 64 architecture objects in a
single archive; just build the 32 and 32e libraries separately:
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -Darch=32 ..
include both i386 and x86_64 architecture objects in a
single archive.
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_OSX_ARCHITECTURES='i386;x86_64' ..
$ make
$ cmake -Darch=32e ..
$ make
then invoke make again with a special argument as follows:
$ make fat
- The fat target is only available for the arch=32e configuration.
- The fat libraries will be put in exports/mac_32e/lib while the "thin" libraries
will be in exports/mac_32e/lib.thin and exports/mac_32/lib.thin
There is also an option -DLIBOMP_OSX_ARCHITECTURES which can be set in case
this is an LLVM source tree build which will only set the libomp library
to a universal fat library and prevent having the entire llvm/clang build
produce universal binaries.
================
Compiler options
================
===========
Micro tests
===========
After the library has been built, there are five optional microtests that
can be performed. Some will be skipped based upon the platform.
To run the tests,
$ make libomp-micro-tests
=============
CMake options
=============
-DCMAKE_C_COMPILER=<C compiler name>
Specify the C compiler
-DCMAKE_CXX_COMPILER=<C++ compiler name>
Specify the C++ compiler
-DCMAKE_Fortran_COMPILER=<Fortran compiler name>
Unix* systems (Optional as compiler is default):
This option is only needed when -Dcreate_fortran_modules is true
-DCMAKE_ASM_COMPILER=<Assembler name>
This option isn't usually needed for Non-Windows* builds
This option is only needed when -DLIBOMP_FORTRAN_MODULES is on.
So typically, a Fortran compiler is not needed during the build.
Specify the Fortran compiler
-DCMAKE_ASM_MASM_COMPILER=[ml | ml64 ]
This option is Windows* Only
=============
Build options
=============
-DLIBOMP_ARCH=i386|x86_64|arm|ppc64|ppc64le|aarch64|mic
The default for the option is chosen based on the probing the compiler for
architecture macros (e.g., is __x86_64__ predefined by compiler?).
==========================
==== Operating System ====
==========================
-Dos=lin|mac|win|mic
* Operating system can be lin (Linux*), mac (Mac*), win (Windows*), or
mic (Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture)).
If not specified, cmake will try to determine your current operating system.
======================
==== Architecture ====
======================
-Darch=32|32e|arm|ppc64|aarch64
* Architecture can be 32 (IA-32 architecture), 32e (Intel(R) 64 architecture),
arm (ARM architecture), aarch64 (ARMv8 architecture) or ppc64 (PPC64 architecture).
This option, by default is chosen based on the
CMake variable CMAKE_SIZEOF_VOID_P. If it is 8, then Intel(R) 64 architecture
is assumed. If it is 4, then IA-32 architecture is assumed. If you want to
use a different architecture other than x86 based architecture, you must specify
it when calling cmake initially using this -Darch=<arch> option or by changing
the arch value via CMakeCache.txt or the CMake GUI after the initial CMake run.
---- First values listed are the default value ----
-Dlib_type=normal|profile|stubs
==== 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.
See below for interaction when -DUSE_BUILDPL_RULES is on.
-Dversion=5|4
libiomp5 version can be 5 or 4.
-DLIBOMP_OMP_VERSION=45|40|30
OpenMP version can be either 45, 40 or 30.
-Domp_version=40|30
OpenMP version can be either 40 or 30.
-Dmic_arch=knc|knf
-DLIBOMP_MIC_ARCH=knc|knf
This value is ignored if LIBOMP_ARCH != mic
Intel(R) MIC Architecture, can be knf or knc.
This value is ignored if os != mic
-Dmic_os=lin|bsd
Operating system on Intel(R) MIC Architecture.
Can be either bsd or lin. This value is ignored if os != mic
-Dcreate_fortran_modules=off|on
-DLIBOMP_FORTRAN_MODULES=off|on
Should the Fortran modules be created (requires Fortran compiler)
-Dstats=off|on
Should include stats-gathering code?
-DLIBOMP_USE_ADAPTIVE_LOCKS=on|off
Should adaptive (TSX-based) locks be included?
These are x86 specific. This feature is turned on by default
for i386 and x86_64. Otherwise, it is turned off.
=====================
==== Micro tests ====
=====================
After the library has been built, five microtests are performed.
Some will be skipped based upon the platform.
These tests can be turned on (default) or off with the following options:
-Dtest_touch=on|off -- Should the touch test be done?
-Dtest_relo=on|off -- Should the position independent code test be done?
-Dtest_execstack=on|off -- Should the stack be checked for executability?
-Dtest_instr=on|off -- Should the Intel(R) MIC Libraries be checked
for correct instruction set?
-Dtest_deps=on|off -- Should libiomp5's dependencies be checked?
-Dtests=off|on -- Should any of the above tests be done?
-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.
============================================
==== How to append flags to compilation ====
============================================
- These flags are *appended*. They do not
-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_ENABLE_SHARED=on|off
Shared library instead of static library? (Note: static libraries are not
supported on Windows). If LIBOMP_ENABLE_SHARED is off, then static OpenMP
libraries will be built instead of dynamic ones.
-DLIBOMP_OMPT_SUPPORT=off|on
Should OMPT support be included in the build? (Not supported on Windows)
If LIBOMP_OMPT_SUPPORT is off, then both ompt_blame and ompt_trace are ignored.
-DLIBOMP_OMPT_BLAME=on|off
Should OMPT blame functionality be included in the build?
-DLIBOMP_OMPT_TRACE=on|off
Should OMPT trace functionality be included in the build?
-DLIBOMP_STATS=off|on
Should include stats-gathering code be included in the build?
-DLIBOMP_USE_DEBUGGER=off|on
Should the friendly debugger interface be included in the build?
-DLIBOMP_USE_HWLOC=off|on
Should the Hwloc library be used for affinity?
This option is not supported on Windows.
http://www.open-mpi.org/projects/hwloc
-DLIBOMP_HWLOC_INSTALL_DIR=/path/to/hwloc/install/dir
Default: /usr/local
This option is only used if LIBOMP_USE_HWLOC is on.
Specifies install location of Hwloc. The configuration system will look for
hwloc.h in ${LIBOMP_HWLOC_INSTALL_DIR}/include and the library in
${LIBOMP_HWLOC_INSTALL_DIR}/lib.
-DLIBOMP_LLVM_LIT_EXECUTABLE=/path/to/llvm-lit
Default: search in PATH
Specifiy full path to llvm-lit executable for running tests.
-DOPENMP_LLVM_TOOLS_DIR=/path/to/built/llvm/tools
Default: search for tools in path
Additional path to search for LLVM tools needed by tests.
================================
How to append flags to the build
================================
- These flags are *appended*. They do not
overwrite any of the preset flags.
-DUSER_CPP_FLAGS=<space-separated flags> -- Additional C Preprocessor flags
(typically additional -Ddef=val flags)
-DUSER_C_FLAGS=<space-separated flags> -- Additional C compiler flags
-DUSER_CXX_FLAGS=<space-separated flags> -- Additional C++ compiler flags
-DUSER_ASM_FLAGS=<space-separated flags> -- Additional assembly flags
-DUSER_LD_FLAGS=<space-separated flags> -- Additional linker flags
-DUSER_LD_LIB_FLAGS=<space-separated flags> -- Additional libraries to link
to during link phase
-DUSER_F_FLAGS=<space-separated flags> -- Additional Fortran compiler 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
===================================
==== Feature Based Compilation ====
===================================
-DUSE_BUILDPL_RULES=false|true
Should the build imitate build.pl's build process.
When this is true, the Unix* Release builds will build libiomp5
with -O2 and -g flags activated (same as RelWithDebInfo). Then,
the debug info is stripped out of the library and put into libiomp5.dbg
This is done for interaction with Intel(R) Parallel Amplifier.
-DUSE_ADAPTIVE_LOCKS=true|false
Should adaptive (TSX-based) locks be included?
These are x86 specific. This feature is turned on by default
for IA-32 architecture and Intel(R) 64 architecture.
Otherwise, it is turned off.
-DUSE_PREDEFINED_LINKER_FLAGS=true|false
Should the predefined linker flags in CommonFlags.cmake be included
in the link command? This is true by default and should work for
Linux*, Mac*, and Windows*. The --version-script flag on Unix* based
operating systems will be included regardless.
========================
Examples usages of CMake
========================
=======================
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 ----
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Dos=lin -Darch=32 ..
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -Dos=mac -Darch=32 -DCMAKE_BUILD_TYPE=Debug ..
cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort -Dtests=on -Dcreate_fortran_modules=on -DUSE_BUILDPL_RULES=on ..
cmake -DUSER_CFLAGS='Werror' -DUSER_CPP_FLAGS='-DNEW_FEATURE=1 -DOLD_FEATURE=0' -DUSER_CXX_FLAGS='-Werror -Wsign-compare' ..
- Build the i386 Linux library using GCC*
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=i386 ..
---- Stubs library ----
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Dlib_type=stubs ..
- 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
+312 -782
View File
File diff suppressed because it is too large Load Diff
-8
View File
@@ -1,8 +0,0 @@
project(openmp)
cmake_minimum_required(VERSION 2.8)
set(VERSION 5)
set(OMP_VERSION "201107")
set(OMP_VERSION_NUM "40")
add_subdirectory(src)
-45
View File
@@ -1,45 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
omp_root?=.
include $(omp_root)/tools/common.inc
.PHONY: default all omp
default: omp
all: omp stubs
omp: info mkdir
@echo $(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) lib inc common
$(omp_root)/tools/build.pl $(build_args) --arch=$(arch) --mode=$(mode) lib inc common
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
.PHONY: clean info
clean:
$(shell $(RM) -rf $(omp_root)$(SLASH)tmp)
@echo clean done
mkdir:
$(shell $(MD) $(omp_root)$(SLASH)tmp >$(NUL) 2>$(NUL))
@echo Created $(omp_root)$(SLASH)tmp directory
info:
@echo omp_root=$(omp_root)
@echo omp_os=$(omp_os)
@echo arch=$(arch)
@echo compiler=$(compiler)
@echo mic=$(mic)
@echo mode=$(mode)
+53 -63
View File
@@ -1,17 +1,17 @@
README for Intel(R) OpenMP* Runtime Library
===========================================
README for the LLVM* OpenMP* Runtime Library
============================================
How to Build Documentation
==========================
The main documentation is in Doxygen* format, and this distribution
should come with pre-built PDF documentation in doc/Reference.pdf.
should come with pre-built PDF documentation in doc/Reference.pdf.
However, an HTML version can be built by executing:
% doxygen doc/doxygen/config
% doxygen doc/doxygen/config
in 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,68 +21,42 @@ 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
==============================================
In-tree build:
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,
type:
$ cd where-you-want-to-live
Check out openmp into llvm/projects
$ cd where-you-want-to-build
$ mkdir build && cd build
$ cmake path/to/llvm -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make omp
make info
Out-of-tree build:
You can change the Makefile's behavior with the following options:
$ cd where-you-want-to-live
Check out openmp
$ cd where-you-want-to-live/openmp/runtime
$ mkdir build && cd build
$ cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make
omp_root: The path to the top-level directory containing the top-level
Makefile. By default, this will take on the value of the
current working directory.
For details about building, please look at Build_With_CMake.txt
omp_os: Operating system. By default, the build will attempt to
detect this. Currently supports "linux", "freebsd", "macos", and
"windows".
arch: Architecture. By default, the build will attempt to
detect this if not specified by the user. Currently
supported values are
"32" for IA-32 architecture
"32e" for Intel(R) 64 architecture
"mic" for Intel(R) Many Integrated Core Architecture
If "mic" is specified then "icc" will be used as the
compiler, and appropriate k1om binutils will be used. The
necessary packages must be installed on the build machine
for this to be possible (but an Intel(R) Xeon Phi(TM)
coprocessor card is not required to build the library).
compiler: Which compiler to use for the build. Defaults to "icc"
or "icl" depending on the value of omp_os. Also supports
some versions of "gcc"* when omp_os is "linux". The selected
compiler should be installed and in the user's path. The
corresponding Fortran compiler should also be in the path.
See "Supported RTL Build Configurations" below for more
information on compiler versions.
mode: Library mode: default is "release". Also supports "debug".
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
Architectures Supported
=======================
* IA-32 architecture
* Intel(R) 64 architecture
* Intel(R) Many Integrated Core Architecture
* ARM* architecture
* Aarch64 (64-bit ARM) architecture
* IBM(R) Power architecture (big endian)
* IBM(R) Power architecture (little endian)
Supported RTL Build Configurations
==================================
Supported Architectures: IA-32 architecture, Intel(R) 64, and
Supported Architectures: IA-32 architecture, Intel(R) 64, and
Intel(R) Many Integrated Core Architecture
----------------------------------------------
@@ -94,15 +68,15 @@ Intel(R) Many Integrated Core Architecture
| Windows* OS | Yes(1,4) | No | No |
------------------------------------------------------------
(1) On IA-32 architecture and Intel(R) 64, icc/icl versions 12.x are
(1) On IA-32 architecture and Intel(R) 64, icc/icl versions 12.x are
supported (12.1 is recommended).
(2) GCC* version 4.6.2 is supported.
(2) GCC* version 4.7 is supported.
(3) For icc on OS X*, OS X* version 10.5.8 is supported.
(4) Intel(R) Many Integrated Core Architecture not supported.
(5) On Intel(R) Many Integrated Core Architecture, icc/icl versions 13.0
(5) On Intel(R) Many Integrated Core Architecture, icc/icl versions 13.0
or later are required.
(6) Clang* version 3.3 is supported.
(7) Clang* currently does not offer a software-implemented 128 bit extended
(7) Clang* currently does not offer a software-implemented 128 bit extended
precision type. Thus, all entry points reliant on this type are removed
from the library and cannot be called in the user program. The following
functions are not available:
@@ -111,11 +85,27 @@ Intel(R) Many Integrated Core Architecture
__kmpc_atomic_*_fp
(8) Community contribution provided AS IS, not tested by Intel.
Supported Architectures: IBM(R) Power 7 and Power 8
-----------------------------
| gcc | clang |
--------------|------------|--------------|
| Linux* OS | Yes(1,2) | Yes(3,4) |
-------------------------------------------
(1) On Power 7, gcc version 4.8.2 is supported.
(2) On Power 8, gcc version 4.8.2 is supported.
(3) On Power 7, clang version 3.7 is supported.
(4) On Power 8, clang version 3.7 is supported.
Front-end Compilers that work with this RTL
===========================================
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.
-----------------------------------------------------------------------
-111
View File
@@ -1,111 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
###############################################################################
# This file contains additional build rules that correspond to build.pl's rules
# Building libiomp5.dbg is linux only, Windows will build libiomp5md.dll.pdb
#
# ######### BUILD DEPENDENCIES ##########
#
# exports/.../libiomp5.so exports/.../libiomp5.dbg
# [copy] | | [copy]
# | |
# ./libiomp5.so ./libiomp5.dbg
# [copy] / OR \____________ [copy] | [copy]
# / \ |
# ./unstripped/libiomp5.so ./stripped/libiomp5.so ./unstripped/libiomp5.dbg
# / \ /
# / [linking] \[strip] /[strip and store]
# / \ /
# ${objs} (maybe compiled with -g) ./unstripped/libiomp5.so (library with debug info in it)
# |
# | [linking]
# |
# ${objs} (always compiled with -g)
#
# For icc Linux builds, we always include debugging information via -g and create libiomp5.dbg
# so that Intel(R) Parallel Amplifier can use the .dbg file.
# For icc Windows builds, we always include debugging information via -Zi and create libiomp5.pdb
# in a fashion similar to libiomp5.dbg
# For icc Mac builds, we don't bother with the debug info.
# We build library in unstripped directory
file(MAKE_DIRECTORY ${build_dir}/unstripped)
# Only build the .dbg file for Release builds
# Debug and RelWithDebInfo builds should not create a .dbg file.
# The debug info should remain in the library file.
if(${LINUX} AND ${RELEASE_BUILD})
set(dbg_file ${lib_item}.dbg)
endif()
################################
# --- Create $(lib_file).dbg ---
if(NOT "${dbg_file}" STREQUAL "")
# if a ${dbg_file} file is going to be created, then
file(MAKE_DIRECTORY ${build_dir}/stripped)
# ./${lib_file} : stripped/${lib_file}
# copy stripped/${lib_file} ./${lib_file}
simple_copy_recipe("${lib_file}" "${build_dir}/stripped" "${build_dir}")
# stripped/${lib_file} : unstripped/${lib_file} ./${dbg_file}
# objcopy --strip-debug unstripped/${lib_file} stripped/${lib_file}.tmp
# objcopy --add-gnu-debuglink=${dbg_file} stripped/${lib_file}.tmp stripped/${lib_file}
add_custom_command(
OUTPUT ${build_dir}/stripped/${lib_file}
COMMAND ${CMAKE_OBJCOPY} --strip-debug ${build_dir}/unstripped/${lib_file} ${build_dir}/stripped/${lib_file}.tmp
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${dbg_file} ${build_dir}/stripped/${lib_file}.tmp ${build_dir}/stripped/${lib_file}
DEPENDS "${build_dir}/${dbg_file}"
)
# ./${dbg_file} : unstripped/${dbg_file}
# copy unstripped/${dbg_file} ./${dbg_file}
simple_copy_recipe("${dbg_file}" "${build_dir}/unstripped" "${build_dir}")
# unstripped/${dbg_file} : unstripped/${lib_file}
# objcopy --only-keep-debug unstripped/${lib_file} unstripped/${dbg_file}
add_custom_command(
OUTPUT ${build_dir}/unstripped/${dbg_file}
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${build_dir}/unstripped/${lib_file} ${build_dir}/unstripped/${dbg_file}
DEPENDS iomp5
)
else()
# ./${lib_file} : unstripped/${lib_file}
# copy unstripped/${lib_file} ./${lib_file}
simple_copy_recipe("${lib_file}" "${build_dir}/unstripped" "${build_dir}")
endif()
# Windows specific command to move around debug info files post-build
if(NOT "${pdb_file}" STREQUAL "" AND ${RELEASE_BUILD})
add_custom_command(TARGET iomp5 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E rename ${pdb_file} ${pdb_file}.nonstripped
COMMAND ${CMAKE_COMMAND} -E rename ${pdb_file}.stripped ${pdb_file}
)
endif()
# Have icc build libiomp5 in unstripped directory
set_target_properties(iomp5 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${build_dir}/unstripped"
RUNTIME_OUTPUT_DIRECTORY "${build_dir}/unstripped"
ARCHIVE_OUTPUT_DIRECTORY "${build_dir}"
)
# Always use RelWithDebInfo flags for Release builds when using the build.pl's build rules (use -g -O2 instead of just -O3)
# The debug info is then stripped out at the end of the build and put into libiomp5.dbg for Linux
if(${RELEASE_BUILD} AND NOT ${MAC})
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELWITHDEBINFO} )
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
set(CMAKE_ASM_FLAGS_RELEASE ${CMAKE_ASM_FLAGS_RELWITHDEBINFO})
endif()
-27
View File
@@ -1,27 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds Clang (clang/clang++) specific compiler dependent flags
# The flag types are:
# 1) Assembly flags
#########################################################
# Assembly flags
function(append_assembler_specific_asm_flags input_asm_flags)
set(local_asm_flags)
append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed
if(${IA32})
append_asm_flags("-m32") # Generate 32 bit IA-32 architecture code
append_asm_flags("-msse2") # Allow use of Streaming SIMD Instructions
endif()
set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE)
endfunction()
-50
View File
@@ -1,50 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds Clang (clang/clang++) specific compiler dependent flags
# The flag types are:
# 1) C/C++ Compiler flags
# 2) Linker flags
#########################################################
# C/C++ Compiler flags
function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags)
set(local_c_flags)
set(local_cxx_flags)
append_c_and_cxx_flags("-std=c++0x") # Enables support for many C++11 (formerly known as C++0x) features. The following are the most recently added features:
append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled.
append_c_and_cxx_flags("-x c++") # Compile C files as C++ files
if(${IA32})
append_c_and_cxx_flags("-m32") # Generate 32 bit IA-32 architecture code
append_c_and_cxx_flags("-msse2") # Allow use of Streaming SIMD Instructions
elseif(${ARM})
append_c_and_cxx_flags("-marm") # Target the ARM architecture
endif()
append_c_and_cxx_flags("-Wno-unused-value") # Don't warn about unused values
append_c_and_cxx_flags("-Wno-switch") # Don't warn about switch statements that don't cover entire range of values
append_c_and_cxx_flags("-Wno-deprecated-register") # Don't warn about using register keyword
set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE)
set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE)
endfunction()
#########################################################
# Linker flags
function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs)
set(local_ld_flags)
set(local_ld_flags_libs)
if(${IA32})
append_linker_flags("-m32")
append_linker_flags("-msse2")
endif()
set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE)
set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE)
endfunction()
-142
View File
@@ -1,142 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds the common flags independent of compiler
# The flag types are:
# 1) Assembly flags (append_asm_flags_common)
# 2) C/C++ Compiler flags (append_c_and_cxx_flags_common)
# 3) Fortran Compiler flags (append_fort_flags_common)
# 4) Linker flags (append_linker_flags_common)
# 5) Archiver flags (append_archiver_flags_common)
# These append_* macros all append to the corresponding list variable holding the flags.
macro(append_c_flags new_flag)
list(APPEND local_c_flags "${new_flag}")
endmacro()
macro(append_cxx_flags new_flag)
list(APPEND local_cxx_flags "${new_flag}")
endmacro()
macro(append_c_and_cxx_flags new_flag)
append_c_flags("${new_flag}")
append_cxx_flags("${new_flag}")
endmacro()
macro(append_asm_flags new_flag)
list(APPEND local_asm_flags "${new_flag}")
endmacro()
macro(append_fort_flags new_flag)
list(APPEND local_fort_flags "${new_flag}")
endmacro()
# The difference between linker_flags and linker_flags_libs is linker_flags_libs
# is put at the end of the linker command where linking libraries should be done.
macro(append_linker_flags new_flag)
list(APPEND local_ld_flags "${new_flag}")
endmacro()
macro(append_linker_flags_library new_flag)
list(APPEND local_ld_flags_libs "${new_flag}")
endmacro()
macro(append_archiver_flags new_flag)
list(APPEND local_ar_flags "${new_flag}")
endmacro()
#########################################################
# Global Assembly flags
function(append_asm_flags_common input_asm_flags)
set(local_asm_flags)
set(${input_asm_flags} "${${input_asm_flags}}" "${local_asm_flags}" "${USER_ASM_FLAGS}" PARENT_SCOPE)
endfunction()
#########################################################
# Global C/C++ Compiler flags
function(append_c_and_cxx_flags_common input_c_flags input_cxx_flags)
set(local_c_flags)
set(local_cxx_flags)
set(${input_c_flags} "${${input_c_flags}}" "${local_c_flags}" "${USER_C_FLAGS}" PARENT_SCOPE)
set(${input_cxx_flags} "${${input_cxx_flags}}" "${local_cxx_flags}" "${USER_CXX_FLAGS}" PARENT_SCOPE)
endfunction()
#########################################################
# Global Fortran Compiler flags (for creating .mod files)
function(append_fort_flags_common input_fort_flags)
set(local_fort_flags)
set(${input_fort_flags} "${${input_fort_flags}}" "${local_fort_flags}" "${USER_F_FLAGS}" PARENT_SCOPE)
endfunction()
#########################################################
# Linker flags
function(append_linker_flags_common input_ld_flags input_ld_flags_libs)
set(local_ld_flags)
set(local_ld_flags_libs)
if(${USE_PREDEFINED_LINKER_FLAGS})
#################################
# Windows linker flags
if(${WINDOWS})
##################
# MAC linker flags
elseif(${MAC})
append_linker_flags("-single_module")
append_linker_flags("-current_version ${version}.0")
append_linker_flags("-compatibility_version ${version}.0")
#####################################################################################
# Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) linker flags
elseif(${MIC})
append_linker_flags("-Wl,-x")
append_linker_flags("-Wl,--warn-shared-textrel") # Warn if the linker adds a DT_TEXTREL to a shared object.
append_linker_flags("-Wl,--as-needed")
append_linker_flags("-Wl,--version-script=${src_dir}/exports_so.txt") # Use exports_so.txt as version script to create versioned symbols for ELF libraries
if(NOT ${STUBS_LIBRARY})
append_linker_flags_library("-pthread") # link in pthread library
append_linker_flags_library("-ldl") # link in libdl (dynamic loader library)
endif()
if(${STATS_GATHERING})
append_linker_flags_library("-Wl,-lstdc++") # link in standard c++ library (stats-gathering needs it)
endif()
#########################
# Unix based linker flags
else()
# For now, always include --version-script flag on Unix systems.
append_linker_flags("-Wl,--version-script=${src_dir}/exports_so.txt") # Use exports_so.txt as version script to create versioned symbols for ELF libraries
append_linker_flags("-Wl,-z,noexecstack") # Marks the object as not requiring executable stack.
append_linker_flags("-Wl,--as-needed") # Only adds library dependencies as they are needed. (if libiomp5 actually uses a function from the library, then add it)
if(NOT ${STUBS_LIBRARY})
append_linker_flags("-Wl,--warn-shared-textrel") # Warn if the linker adds a DT_TEXTREL to a shared object.
append_linker_flags("-Wl,-fini=__kmp_internal_end_fini") # When creating an ELF executable or shared object, call NAME when the
# executable or shared object is unloaded, by setting DT_FINI to the
# address of the function. By default, the linker uses "_fini" as the function to call.
append_linker_flags_library("-pthread") # link pthread library
if(NOT ${FREEBSD})
append_linker_flags_library("-Wl,-ldl") # link in libdl (dynamic loader library)
endif()
endif()
endif() # if(${OPERATING_SYSTEM}) ...
endif() # USE_PREDEFINED_LINKER_FLAGS
set(${input_ld_flags} "${${input_ld_flags}}" "${local_ld_flags}" "${USER_LD_FLAGS}" PARENT_SCOPE)
set(${input_ld_flags_libs} "${${input_ld_flags_libs}}" "${local_ld_flags_libs}" "${USER_LD_LIB_FLAGS}" PARENT_SCOPE)
endfunction()
#########################################################
# Archiver Flags
function(append_archiver_flags_common input_ar_flags)
set(local_ar_flags)
set(${input_ar_flags} "${${input_ar_flags}}" "${local_ar_flags}" PARENT_SCOPE)
endfunction()
-147
View File
@@ -1,147 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# void append_definitions(string new_flag);
# - appends new_flag to cpp_flags list
macro(append_definitions new_flag)
list(APPEND local_cpp_flags "${new_flag}")
endmacro()
function(append_cpp_flags input_cpp_flags)
set(local_cpp_flags)
append_definitions("-D USE_ITT_BUILD")
append_definitions("-D KMP_ARCH_STR=\"\\\\\"${legal_arch}\\\\\"\"")
append_definitions("-D BUILD_I8")
append_definitions("-D KMP_LIBRARY_FILE=\\\\\"${lib_file}\\\\\"") # yes... you need 5 backslashes...
append_definitions("-D KMP_VERSION_MAJOR=${version}")
# customize to 128 bytes for ppc64
if(${PPC64})
append_definitions("-D CACHE_LINE=128")
else()
append_definitions("-D CACHE_LINE=64")
endif()
append_definitions("-D KMP_ADJUST_BLOCKTIME=1")
append_definitions("-D BUILD_PARALLEL_ORDERED")
append_definitions("-D KMP_ASM_INTRINS")
if(${USE_ITT_NOTIFY})
append_definitions("-D USE_ITT_NOTIFY=1")
else()
append_definitions("-D USE_ITT_NOTIFY=0")
append_definitions("-D INTEL_NO_ITTNOTIFY_API")
endif()
append_definitions("-D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_")
if(${USE_VERSION_SYMBOLS})
append_definitions("-D KMP_USE_VERSION_SYMBOLS")
endif()
#####################
# Windows definitions
if(${WINDOWS})
append_definitions("-D _CRT_SECURE_NO_WARNINGS")
append_definitions("-D _CRT_SECURE_NO_DEPRECATE")
append_definitions("-D _WINDOWS")
append_definitions("-D _WINNT")
append_definitions("-D _WIN32_WINNT=0x0501")
append_definitions("-D KMP_WIN_CDECL")
append_definitions("-D _USRDLL")
if(${DEBUG_BUILD})
append_definitions("-D _ITERATOR_DEBUG_LEVEL=0")
endif()
else() # Other than windows... (Unix based systems, Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture), and Mac)
append_definitions("-D _GNU_SOURCE")
append_definitions("-D _REENTRANT")
append_definitions("-D BUILD_TV")
append_definitions("-D USE_CBLKDATA")
if(NOT "${version}" STREQUAL "4")
append_definitions("-D KMP_GOMP_COMPAT")
endif()
endif()
#######################################
# Intel(R) MIC Architecture definitions
if(${MIC})
append_definitions("-D KMP_TDATA_GTID")
else() # Other than Intel(R) MIC Architecture...
append_definitions("-D USE_LOAD_BALANCE")
endif()
##################
# Unix definitions
if(${LINUX})
append_definitions("-D KMP_TDATA_GTID")
endif()
##################################
# Other conditional definitions
append_definitions("-D KMP_USE_ASSERT")
append_definitions("-D GUIDEDLL_EXPORTS")
if(${STUBS_LIBRARY})
append_definitions("-D KMP_STUB")
endif()
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
append_definitions("-D KMP_DEBUG")
endif()
if(${DEBUG_BUILD})
append_definitions("-D _DEBUG")
append_definitions("-D BUILD_DEBUG")
endif()
if(${STATS_GATHERING})
append_definitions("-D KMP_STATS_ENABLED=1")
else()
append_definitions("-D KMP_STATS_ENABLED=0")
endif()
# OpenMP version flags
set(have_omp_50 0)
set(have_omp_41 0)
set(have_omp_40 0)
set(have_omp_30 0)
if(${omp_version} EQUAL 50 OR ${omp_version} GREATER 50)
set(have_omp_50 1)
endif()
if(${omp_version} EQUAL 41 OR ${omp_version} GREATER 41)
set(have_omp_41 1)
endif()
if(${omp_version} EQUAL 40 OR ${omp_version} GREATER 40)
set(have_omp_40 1)
endif()
if(${omp_version} EQUAL 30 OR ${omp_version} GREATER 30)
set(have_omp_30 1)
endif()
append_definitions("-D OMP_50_ENABLED=${have_omp_50}")
append_definitions("-D OMP_41_ENABLED=${have_omp_41}")
append_definitions("-D OMP_40_ENABLED=${have_omp_40}")
append_definitions("-D OMP_30_ENABLED=${have_omp_30}")
# Architectural definitions
if(${INTEL64} OR ${IA32})
if(${USE_ADAPTIVE_LOCKS})
append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=1")
else()
append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=0")
endif()
append_definitions("-D KMP_DEBUG_ADAPTIVE_LOCKS=0")
else()
append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=0")
append_definitions("-D KMP_DEBUG_ADAPTIVE_LOCKS=0")
endif()
if(${USE_INTERNODE_ALIGNMENT})
append_definitions("-D KMP_USE_INTERNODE_ALIGNMENT=1")
else()
append_definitions("-D KMP_USE_INTERNODE_ALIGNMENT=0")
endif()
set(${input_cpp_flags} "${${input_cpp_flags}}" "${local_cpp_flags}" "${USER_CPP_FLAGS}" "$ENV{CPPFLAGS}" PARENT_SCOPE)
endfunction()
-27
View File
@@ -1,27 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds GNU (gcc/g++) specific compiler dependent flags
# The flag types are:
# 1) Assembly flags
#########################################################
# Assembly flags
function(append_assembler_specific_asm_flags input_asm_flags)
set(local_asm_flags)
append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed
if(${IA32})
append_asm_flags("-m32") # Generate 32 bit IA-32 architecture code
append_asm_flags("-msse2") # Allow use of Streaming SIMD Instructions
endif()
set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE)
endfunction()
-56
View File
@@ -1,56 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds GNU (gcc/g++) specific compiler dependent flags
# The flag types are:
# 2) C/C++ Compiler flags
# 4) Linker flags
unset(COMPILER_SUPPORTS_QUAD_PRECISION CACHE)
set(COMPILER_SUPPORTS_QUAD_PRECISION true CACHE BOOL "Does the compiler support a 128-bit floating point type?")
set(COMPILER_QUAD_TYPE __float128)
#########################################################
# C/C++ Compiler flags
function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags)
set(local_c_flags)
set(local_cxx_flags)
append_c_and_cxx_flags("-std=c++0x") # Enables support for many C++11 (formerly known as C++0x) features. The following are the most recently added features:
append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled.
append_c_and_cxx_flags("-x c++") # Compile C files as C++ files
if(${IA32})
append_c_and_cxx_flags("-m32") # Generate 32 bit IA-32 architecture code
append_c_and_cxx_flags("-msse2") # Allow use of Streaming SIMD Instructions
elseif(${ARM})
append_c_and_cxx_flags("-marm") # Target the ARM architecture
endif()
set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE)
set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE)
endfunction()
#########################################################
# Linker flags
function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs)
set(local_ld_flags)
set(local_ld_flags_libs)
if(${WINDOWS})
elseif(${MAC})
elseif(${MIC})
else()
append_linker_flags("-static-libgcc") # Causes libgcc to be linked in statically
endif()
if(${IA32})
append_linker_flags("-m32")
append_linker_flags("-msse2")
endif()
set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE)
set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE)
endfunction()
-25
View File
@@ -1,25 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds GNU (gcc/g++) specific compiler dependent flags
# The flag types are:
# 1) Fortran Compiler flags
#########################################################
# Fortran Compiler flags (for creating .mod files)
function(append_fortran_compiler_specific_fort_flags input_fort_flags)
set(local_fort_flags)
if(${IA32})
append_fort_flags("-m32")
append_fort_flags("-msse2")
endif()
set(${input_fort_flags} ${${input_fort_flags}} "${local_fort_flags}" PARENT_SCOPE)
endfunction()
-258
View File
@@ -1,258 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
####################################### FUNCTIONS/MACROS ###########################################
# It should be noted that in cmake, functions can only be used on a single line with the return value
# stored in a parameter you send to the function. There isn't a true return value. So technically,
# all functions would have a C/C++ prototype of:
# void function_name(parameter1, parameter2, ...);
#
# If you want a return value, you have to use a parameter so the function prototype would be:
# void function_name(input_parameter1, input_parameter2, ..., return_value)
# ##################
# void say(string message_to_user);
# - prints out message_to_user
macro(say message_to_user)
message("${message_to_user}")
endmacro()
# void warning_say(string message_to_user);
# - prints out message_to_user with a warning
macro(warning_say message_to_user)
message(WARNING "${message_to_user}")
endmacro()
# void error_say(string message_to_user);
# - prints out message_to_user with an error and exits cmake
macro(error_say message_to_user)
message(FATAL_ERROR "${message_to_user}")
endmacro()
# void debug_say(string message_to_developer);
# - prints out message when GLOBAL_DEBUG == 1 (for debugging cmake build)
macro(debug_say message_to_developer)
if(${GLOBAL_DEBUG} STREQUAL "1")
say("DEBUG: ${message_to_developer}")
endif()
endmacro()
# void debug_say_var(variable var);
# - prints the variable name and its value (for debugging cmake build)
macro(debug_say_var var)
if(${GLOBAL_DEBUG} STREQUAL "1")
say("DEBUG: Variable: ${var} = ${${var}} ")
endif()
endmacro()
# void set_legal_arch(string* return_arch_string);
# - returns (through return_arch_string) the formal architecture
# string or warns user of unknown architecture
function(set_legal_arch return_arch_string)
if(${IA32})
set(${return_arch_string} "IA-32" PARENT_SCOPE)
elseif(${INTEL64})
set(${return_arch_string} "Intel(R) 64" PARENT_SCOPE)
elseif(${MIC})
set(${return_arch_string} "Intel(R) Many Integrated Core Architecture" PARENT_SCOPE)
elseif(${arch} STREQUAL "l1")
set(${return_arch_string} "L1OM" PARENT_SCOPE)
elseif(${ARM})
set(${return_arch_string} "ARM" PARENT_SCOPE)
elseif(${PPC64})
set(${return_arch_string} "PPC64" PARENT_SCOPE)
elseif(${AARCH64})
set(${return_arch_string} "AARCH64" PARENT_SCOPE)
else()
warning_say("set_legal_arch(): Warning: Unknown architecture...")
endif()
endfunction()
# void check_variable(string var, string var_name, list<string>values_list);
# - runs through values_list checking if ${var} == values_list[i] for any i.
# - if the var is found, then just print it out
# - if the var is not found, then warn user
function(check_variable var values_list)
set(valid_flag 0)
foreach(value IN LISTS values_list)
if("${${var}}" STREQUAL "${value}")
set(valid_flag 1)
set(the_value "${value}")
endif()
endforeach()
if(${valid_flag} EQUAL 0)
error_say("check_variable(): ${var} = ${${var}} is unknown")
endif()
endfunction()
# void _export_lib_dir(string export_dir, string platform, string suffix, string* return_value);
# - basically a special case for mac platforms where it adds '.thin' to the output lib directory
function(_export_lib_dir pltfrm return_value)
if(${MAC})
set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib.thin" PARENT_SCOPE)
else()
set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib" PARENT_SCOPE)
endif()
endfunction()
# void _export_lib_fat_dir(string export_dir, string platform, string suffix, string* return_value);
# - another mac specialty case for fat libraries.
# - this sets export_lib_fat_dir in the MAIN part of CMakeLists.txt
function(_export_lib_fat_dir pltfrm return_value)
set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib" PARENT_SCOPE)
endfunction()
# void get_build_number(string src_dir, string* return_build_number);
# - grab the eight digit build number (or 00000000) from kmp_version.c
function(get_build_number src_dir return_build_number)
# sets file_lines_list to a list of all lines in kmp_version.c
file(STRINGS "${src_dir}/src/kmp_version.c" file_lines_list)
# runs through each line in kmp_version.c
foreach(line IN LISTS file_lines_list)
# if the line begins with "#define KMP_VERSION_BUILD" then we take not of the build number
string(REGEX MATCH "^[ \t]*#define[ \t]+KMP_VERSION_BUILD" valid "${line}")
if(NOT "${valid}" STREQUAL "") # if we matched "#define KMP_VERSION_BUILD", then grab the build number
string(REGEX REPLACE "^[ \t]*#define[ \t]+KMP_VERSION_BUILD[ \t]+([0-9]+)" "\\1"
build_number "${line}"
)
endif()
endforeach()
set(${return_build_number} "${build_number}" PARENT_SCOPE) # return build number
endfunction()
# void set_legal_type(string* return_legal_type);
# - set the legal type name Performance/Profiling/Stub
function(set_legal_type return_legal_type)
if(${NORMAL_LIBRARY})
set(${return_legal_type} "Performance" PARENT_SCOPE)
elseif(${PROFILE_LIBRARY})
set(${return_legal_type} "Profiling" PARENT_SCOPE)
elseif(${STUBS_LIBRARY})
set(${return_legal_type} "Stub" PARENT_SCOPE)
endif()
endfunction()
# void set_mac_os_new(bool* return_mac_os_new);
# - sets the return_mac_os_new variable to true or false based on macosx version
# - no real "cmakey" way to do this. Have to call execute_process()
function(set_mac_os_new return_mac_os_new)
execute_process(COMMAND "sw_vers" "-productVersion" OUTPUT_VARIABLE mac_osx_version)
if("${mac_osx_version}" VERSION_GREATER "10.6")
set(${return_mac_os_new} TRUE PARENT_SCOPE)
else()
set(${return_mac_os_new} FALSE PARENT_SCOPE)
endif()
endfunction()
# void add_prefix(string prefix, list<string>* list_of_items);
# - returns list_of_items with prefix prepended to all items
# - original list is modified
function(add_prefix prefix list_of_items)
set(local_list "")
foreach(item IN LISTS "${list_of_items}")
if(NOT "${item}" STREQUAL "")
list(APPEND local_list "${prefix}${item}")
endif()
endforeach()
set(${list_of_items} "${local_list}" PARENT_SCOPE)
endfunction()
# void add_suffix(string suffix, list<string>* list_of_items);
# - returns list_of_items with suffix appended to all items
# - original list is modified
function(add_suffix suffix list_of_items)
set(local_list "")
foreach(item IN LISTS "${list_of_items}")
if(NOT "${item}" STREQUAL "")
list(APPEND local_list "${item}${suffix}")
endif()
endforeach()
set(${list_of_items} "${local_list}" PARENT_SCOPE)
endfunction()
# void strip_suffix(list<string> list_of_items, list<string>* return_list);
# - returns a new list with suffix stripped (i.e., foo.c => foo)
# - list_of_items is not modified, return_list is modified
function(strip_suffix list_of_items return_list)
set(local_list "")
foreach(item IN LISTS "${list_of_items}")
if(NOT "${item}" STREQUAL "")
get_filename_component(filename "${item}" NAME_WE)
list(APPEND local_list "${filename}")
endif()
endforeach()
set(${return_list} "${local_list}" PARENT_SCOPE)
endfunction()
# void list_to_string(list<string> list_of_things, string* return_string);
# - converts a list to a space separated string
function(list_to_string list_of_things return_string)
string(REPLACE ";" " " output_variable "${list_of_things}")
set(${return_string} "${output_variable}" PARENT_SCOPE)
endfunction()
# void string_to_list(string str, list<string>* return_list);
# - converts a string to a semicolon separated list
# - what it really does is just string_replace all running whitespace to a semicolon
# - in cmake, a list is strings separated by semicolons: i.e., list of four items, list = "item1;item2;item3;item4"
function(string_to_list str return_list)
set(outstr)
string(REGEX REPLACE "[ \t]+" ";" outstr "${str}")
set(${return_list} "${outstr}" PARENT_SCOPE)
endfunction()
# void get_date(string* return_date);
# - returns the current date "yyyy-mm-dd hh:mm:ss UTC"
# - this function alone causes the need for CMake v2.8.11 (TIMESTAMP)
#function(get_date return_date)
# string(TIMESTAMP local_date "%Y-%m-%d %H:%M:%S UTC" UTC)
# set(${return_date} ${local_date} PARENT_SCOPE)
#endfunction()
# void find_a_program(string program_name, list<string> extra_paths, bool fail_on_not_found, string return_variable_name);
# - returns the full path of a program_name
# - first looks in the list of extra_paths
# - if not found in extra_paths, then look through system path
# - errors out if fail_on_not_found == true and cmake could not find program_name.
function(find_a_program program_name extra_paths fail_on_not_found return_variable_name)
# first try to find the program in the extra_paths
find_program(${return_variable_name} "${program_name}" PATHS "${extra_paths}" DOC "Path to ${program_name}" NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
if("${${return_variable_name}}" MATCHES NOTFOUND)
# if no extra_paths, or couldn't find it, then look in system $PATH
find_program(${return_variable_name} "${program_name}" DOC "Path to ${program_name}")
if("${${return_variable_name}}" MATCHES NOTFOUND AND ${fail_on_not_found})
error_say("Error: Could not find program: ${program_name}")
endif()
endif()
if(NOT "${${return_variable_name}}" MATCHES NOTFOUND)
say("-- Found ${program_name}: ${${return_variable_name}}")
endif()
set(${return_variable_name} ${${return_variable_name}} PARENT_SCOPE)
endfunction()
# WINDOWS SPECIFIC
# void replace_md_with_mt(string flags_var)
# - This macro replaces the /MD compiler flags (Windows specific) with /MT compiler flags
# - This does nothing if no /MD flags were replaced.
macro(replace_md_with_mt flags_var)
set(flags_var_name ${flags_var}) # i.e., CMAKE_C_FLAGS_RELEASE
set(flags_var_value ${${flags_var}}) # i.e., "/MD /O2 ..."
string(REPLACE /MD /MT temp_out "${flags_var_value}")
string(COMPARE NOTEQUAL "${temp_out}" "${flags_var_value}" something_was_replaced)
if("${something_was_replaced}")
unset(${flags_var_name} CACHE)
set(${flags_var_name} ${temp_out} CACHE STRING "Replaced /MD with /MT compiler flags")
endif()
endmacro()
-42
View File
@@ -1,42 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags
# The flag types are:
# 1) Assembly flags
#########################################################
# Assembly flags
function(append_assembler_specific_asm_flags input_asm_flags)
set(local_asm_flags)
append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed
if(${IA32})
append_asm_flags("-safeseh") # Registers exception handlers for safe exception handling.
append_asm_flags("-coff") # Generates common object file format (COFF) type of object module.
# Generally required for Win32 assembly language development.
append_asm_flags("-D _M_IA32")
elseif(${INTEL64})
append_asm_flags("-D _M_AMD64")
endif()
if(${MIC})
append_asm_flags("-mmic") # Build Intel(R) MIC Architecture native code
endif()
if(${WINDOWS})
# CMake prefers the /MD flags when compiling Windows sources, but libiomp5 needs to use /MT instead
# So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE.
# replace_md_with_mt() is in HelperFunctions.cmake
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG)
endif()
set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE)
endfunction()
-158
View File
@@ -1,158 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags
# The flag types are:
# 2) C/C++ Compiler flags
# 4) Linker flags
# icc has a 128-bit floating point type called _Quad. Always compile with 128-bit floating point if it exists.
unset(COMPILER_SUPPORTS_QUAD_PRECISION CACHE)
set(COMPILER_SUPPORTS_QUAD_PRECISION true CACHE BOOL "Does the compiler support a 128-bit floating point type?")
set(COMPILER_QUAD_TYPE _Quad)
#########################################################
# icc C/C++ Compiler flags
function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags)
set(local_c_flags)
set(local_cxx_flags)
if(${WINDOWS})
append_c_flags("-TP") # Tells the compiler to process a file as a C++ source file.
append_cxx_flags("-EHsc") # Enable C++ exception handling.
append_c_and_cxx_flags("-nologo") # Turn off tool banner.
append_c_and_cxx_flags("-W3") # Enables diagnostics for remarks, warnings, and errors.
# Additional warnings are also enabled above level 2 warnings.
append_c_and_cxx_flags("-WX") # Change all Warnings to Errors
append_c_and_cxx_flags("-GS") # Lets you control the threshold at which the stack checking routine is called or not called.
append_c_and_cxx_flags("-Qoption,cpp,--extended_float_types") # Enabled _Quad type.
if(${IA32})
append_c_and_cxx_flags("-arch:ia32") # Tells the compiler which features it may target (ia32)
append_c_and_cxx_flags("-Oy-") # equivalent to -fno-omit-frame-pointer
endif()
append_c_and_cxx_flags("-Qlong_double") # enable long double
append_c_and_cxx_flags("-Qdiag-disable:177") # Disable warning: "... declared but never referenced"
if(${IA32})
append_c_and_cxx_flags("-Qsafeseh") # Registers exception handlers for safe exception handling.
endif()
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
append_c_and_cxx_flags("-Qinline-min-size=1") # Specifies the upper limit for the size of what the inliner considers to be a small routine.
else()
append_c_and_cxx_flags("-Od") # Disables all optimizations.
append_c_and_cxx_flags("-RTC1") # Enables run-time checks of the stack frame, and enables run-time checks for unintialized variables.
append_c_and_cxx_flags("-MTd") # Tells the linker to search for unresolved references in a multithreaded, static run-time library.
endif()
else()
append_c_and_cxx_flags("-Wsign-compare") # warn on sign comparisons
append_c_and_cxx_flags("-Qoption,cpp,--extended_float_types") # Enabled _Quad type.
append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled.
append_c_and_cxx_flags("-x c++") # Compile C files as C++ files
if(${MIC})
append_c_and_cxx_flags("-mmic") # Build Intel(R) MIC Architecture native code
append_c_and_cxx_flags("-ftls-model=initial-exec") # Changes the thread local storage (TLS) model. Generates a restrictive, optimized TLS code.
# To use this setting, the thread-local variables accessed must be defined in one of the
# modules available to the program.
append_c_and_cxx_flags("-opt-streaming-stores never") # Disables generation of streaming stores for optimization.
append_c_and_cxx_flags("-sox") # Tells the compiler to save the compilation options and version number
# in the executable file. It also lets you choose whether to include
# lists of certain functions.
elseif(${LINUX})
append_c_and_cxx_flags("-Werror") # Changes all warnings to errors.
append_c_and_cxx_flags("-sox")
if(${IA32})
append_c_and_cxx_flags("-falign-stack=maintain-16-byte") # Tells the compiler the stack alignment to use on entry to routines.
append_c_and_cxx_flags("-mia32") # Tells the compiler which features it may target (ia32)
endif()
endif()
endif()
# CMake prefers the /MD flags when compiling Windows sources, but libiomp5 needs to use /MT instead
# So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE.
# replace_md_with_mt() is in HelperFunctions.cmake
if(${WINDOWS})
replace_md_with_mt(CMAKE_C_FLAGS)
replace_md_with_mt(CMAKE_C_FLAGS_RELEASE)
replace_md_with_mt(CMAKE_C_FLAGS_RELWITHDEBINFO)
replace_md_with_mt(CMAKE_C_FLAGS_DEBUG)
replace_md_with_mt(CMAKE_CXX_FLAGS)
replace_md_with_mt(CMAKE_CXX_FLAGS_RELEASE)
replace_md_with_mt(CMAKE_CXX_FLAGS_RELWITHDEBINFO)
replace_md_with_mt(CMAKE_CXX_FLAGS_DEBUG)
endif()
set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE)
set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE)
endfunction()
#########################################################
# icc Linker flags
function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs)
set(local_ld_flags)
set(local_ld_flags_libs)
if(${WINDOWS})
# Have icc use link.exe directly when Windows
set(CMAKE_C_CREATE_SHARED_LIBRARY "link.exe /out:<TARGET> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>" PARENT_SCOPE)
set(CMAKE_SHARED_LINKER_FLAGS "$ENV{LDFLAGS}" CACHE STRING "Linker Flags" FORCE)
append_linker_flags("-nologo") # Turn off tool banner.
append_linker_flags("-dll")
append_linker_flags("-WX:NO")
append_linker_flags("-incremental:no")
append_linker_flags("-version:${version}.0")
append_linker_flags("-NXCompat")
append_linker_flags("-DynamicBase") # This option modifies the header of an executable to indicate
# whether the application should be randomly rebased at load time.
if(${IA32})
append_linker_flags("-machine:i386")
append_linker_flags("-safeseh")
elseif(${INTEL64})
append_linker_flags("-machine:amd64")
endif()
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
if(NOT "${pdb_file}" STREQUAL "")
append_linker_flags("-debug")
append_linker_flags("-pdb:${pdb_file}")
endif()
else()
if(NOT "${pdb_file}" STREQUAL "")
append_linker_flags("-debug")
append_linker_flags("-pdb:${pdb_file}")
append_linker_flags("-pdbstripped:${pdb_file}.stripped")
endif()
endif()
if(NOT "${imp_file}" STREQUAL "")
append_linker_flags("-implib:${lib_file}${lib}")
endif()
if(NOT "${def_file}" STREQUAL "")
append_linker_flags("-def:${def_file}")
endif()
elseif(${MAC})
append_linker_flags("-no-intel-extensions")
if(NOT ${STUBS_LIBRARY})
append_linker_flags_library("-pthread") # link in pthread library
append_linker_flags_library("-ldl") # link in libdl (dynamic loader library)
endif()
if(${STATS_GATHERING})
append_linker_flags_library("-Wl,-lstdc++") # link in standard c++ library (stats-gathering needs it)
endif()
elseif(${MIC})
append_linker_flags("-mmic") # enable MIC linking
append_linker_flags("-static-intel") # Causes Intel-provided libraries to be linked in statically.
append_linker_flags("-no-intel-extensions") # Enables or disables all Intel C and Intel C++ language extensions.
else()
append_linker_flags("-static-intel") # Causes Intel-provided libraries to be linked in statically.
append_linker_flags("-Werror") # Warnings become errors
if(${IA32})
append_linker_flags_library("-lirc_pic") # link in libirc_pic
endif()
endif()
set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE)
set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE)
endfunction()
-48
View File
@@ -1,48 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags
# The flag types are:
# 1) Fortran Compiler flags
#########################################################
# icc Fortran Compiler flags (for creating .mod files)
function(append_fortran_compiler_specific_fort_flags input_fort_flags)
set(local_fort_flags)
#set(CMAKE_Fortran_FLAGS "$ENV{FFLAGS}" CACHE STRING "Fortran flags" FORCE)
#set(CMAKE_Fortran_FLAGS_RELEASE "" CACHE STRING "Fortran flags" FORCE)
#set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Fortran flags" FORCE)
#set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "" CACHE STRING "Fortran flags" FORCE)
if(${WINDOWS})
append_fort_flags("-Qdiag-disable:177,5082")
append_fort_flags("-Qsox")
append_fort_flags("-nologo")
append_fort_flags("-GS")
append_fort_flags("-DynamicBase")
append_fort_flags("-Zi")
# On Linux and Windows Intel(R) 64 architecture we need offload attribute
# for all Fortran entries in order to support OpenMP function calls inside device contructs
if(${INTEL64})
append_fort_flags("/Qoffload-attribute-target:mic")
endif()
else()
if(${MIC})
append_fort_flags("-mmic")
endif()
if(NOT ${MAC})
append_fort_flags("-sox")
if(${INTEL64} AND ${LINUX})
append_fort_flags("-offload-attribute-target=mic")
endif()
endif()
endif()
set(${input_fort_flags} ${${input_fort_flags}} "${local_fort_flags}" PARENT_SCOPE)
endfunction()
@@ -0,0 +1,73 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# Checking a fortran compiler flag
# There is no real trivial way to do this in CMake, so we implement it here
# this will have ${boolean} = TRUE if the flag succeeds, otherwise false.
function(libomp_check_fortran_flag flag boolean)
if(NOT DEFINED "${boolean}")
set(retval TRUE)
set(fortran_source
" program hello
print *, \"Hello World!\"
end program hello")
set(failed_regexes "[Ee]rror;[Uu]nknown;[Ss]kipping")
if(CMAKE_VERSION VERSION_GREATER 3.1 OR CMAKE_VERSION VERSION_EQUAL 3.1)
include(CheckFortranSourceCompiles)
check_fortran_source_compiles("${fortran_source}" ${boolean} FAIL_REGEX "${failed_regexes}")
set(${boolean} ${${boolean}} PARENT_SCOPE)
return()
else()
# Our manual check for cmake versions that don't have CheckFortranSourceCompiles
set(base_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_flag_check)
file(MAKE_DIRECTORY ${base_dir})
file(WRITE ${base_dir}/fortran_source.f "${fortran_source}")
message(STATUS "Performing Test ${boolean}")
execute_process(
COMMAND ${CMAKE_Fortran_COMPILER} "${flag}" ${base_dir}/fortran_source.f
WORKING_DIRECTORY ${base_dir}
RESULT_VARIABLE exit_code
OUTPUT_VARIABLE OUTPUT
ERROR_VARIABLE OUTPUT
)
if(${exit_code} EQUAL 0)
foreach(regex IN LISTS failed_regexes)
if("${OUTPUT}" MATCHES ${regex})
set(retval FALSE)
endif()
endforeach()
else()
set(retval FALSE)
endif()
if(${retval})
set(${boolean} 1 CACHE INTERNAL "Test ${boolean}")
message(STATUS "Performing Test ${boolean} - Success")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing Fortran Compiler Flag test ${boolean} succeeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${fortran_source}\n")
else()
set(${boolean} "" CACHE INTERNAL "Test ${boolean}")
message(STATUS "Performing Test ${boolean} - Failed")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing Fortran Compiler Flag test ${boolean} failed with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${fortran_source}\n")
endif()
endif()
set(${boolean} ${retval} PARENT_SCOPE)
endif()
endfunction()
+68
View File
@@ -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()
+32
View File
@@ -0,0 +1,32 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
function(libomp_get_definitions_flags cppflags)
set(cppflags_local)
if(WIN32)
libomp_append(cppflags_local "-D _CRT_SECURE_NO_WARNINGS")
libomp_append(cppflags_local "-D _CRT_SECURE_NO_DEPRECATE")
libomp_append(cppflags_local "-D _WINDOWS")
libomp_append(cppflags_local "-D _WINNT")
libomp_append(cppflags_local "-D _WIN32_WINNT=0x0501")
libomp_append(cppflags_local "-D _USRDLL")
libomp_append(cppflags_local "-D _ITERATOR_DEBUG_LEVEL=0" IF_TRUE DEBUG_BUILD)
libomp_append(cppflags_local "-D _DEBUG" IF_TRUE DEBUG_BUILD)
else()
libomp_append(cppflags_local "-D _GNU_SOURCE")
libomp_append(cppflags_local "-D _REENTRANT")
endif()
# CMake doesn't include CPPFLAGS from environment, but we will.
set(${cppflags} ${cppflags_local} ${LIBOMP_CPPFLAGS} $ENV{CPPFLAGS} PARENT_SCOPE)
endfunction()
+98
View File
@@ -0,0 +1,98 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# LibompExports.cmake
# Copy library and header files into the exports/ subdirectory after library build
# Create the suffix for the export directory
# - Only add to suffix when not a default value
# - Example suffix: .deb.30.s1
# final export directory: exports/lin_32e.deb.30.s1/lib
# - These suffixes imply the build is a Debug, OpenMP 3.0, Stats-Gathering version of the library
set(libomp_suffix)
libomp_append(libomp_suffix .deb DEBUG_BUILD)
libomp_append(libomp_suffix .dia RELWITHDEBINFO_BUILD)
libomp_append(libomp_suffix .min MINSIZEREL_BUILD)
if(NOT "${LIBOMP_OMP_VERSION}" STREQUAL "45")
libomp_append(libomp_suffix .${LIBOMP_OMP_VERSION})
endif()
libomp_append(libomp_suffix .s1 LIBOMP_STATS)
libomp_append(libomp_suffix .ompt LIBOMP_OMPT_SUPPORT)
if(${LIBOMP_OMPT_SUPPORT})
libomp_append(libomp_suffix .no-ompt-blame IF_FALSE LIBOMP_OMPT_BLAME)
libomp_append(libomp_suffix .no-ompt-trace IF_FALSE LIBOMP_OMPT_TRACE)
endif()
string(REPLACE ";" "" libomp_suffix "${libomp_suffix}")
# Set exports locations
if(${MIC})
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_${LIBOMP_MIC_ARCH}") # e.g., lin_knf, lin_knc
else()
if(${IA32})
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_32")
elseif(${INTEL64})
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_32e")
else()
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_${LIBOMP_ARCH}") # e.g., lin_arm, lin_ppc64
endif()
endif()
set(LIBOMP_EXPORTS_DIR "${LIBOMP_BASE_DIR}/exports")
set(LIBOMP_EXPORTS_PLATFORM_DIR "${LIBOMP_EXPORTS_DIR}/${libomp_platform}${libomp_suffix}")
set(LIBOMP_EXPORTS_CMN_DIR "${LIBOMP_EXPORTS_DIR}/common${libomp_suffix}/include")
set(LIBOMP_EXPORTS_INC_DIR "${LIBOMP_EXPORTS_PLATFORM_DIR}/include")
set(LIBOMP_EXPORTS_MOD_DIR "${LIBOMP_EXPORTS_PLATFORM_DIR}/include_compat")
set(LIBOMP_EXPORTS_LIB_DIR "${LIBOMP_EXPORTS_DIR}/${libomp_platform}${libomp_suffix}/lib")
# Put headers in exports/ directory post build
add_custom_command(TARGET omp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_CMN_DIR}
COMMAND ${CMAKE_COMMAND} -E copy omp.h ${LIBOMP_EXPORTS_CMN_DIR}
)
if(${LIBOMP_OMPT_SUPPORT})
add_custom_command(TARGET omp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ompt.h ${LIBOMP_EXPORTS_CMN_DIR}
)
endif()
if(${LIBOMP_FORTRAN_MODULES})
add_custom_command(TARGET libomp-mod POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_MOD_DIR}
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.h ${LIBOMP_EXPORTS_CMN_DIR}
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.mod ${LIBOMP_EXPORTS_MOD_DIR}
COMMAND ${CMAKE_COMMAND} -E copy omp_lib_kinds.mod ${LIBOMP_EXPORTS_MOD_DIR}
)
endif()
# Copy OpenMP library into exports/ directory post build
if(WIN32)
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp RUNTIME_OUTPUT_DIRECTORY)
else()
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp LIBRARY_OUTPUT_DIRECTORY)
endif()
if(NOT LIBOMP_OUTPUT_DIRECTORY)
set(LIBOMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
add_custom_command(TARGET omp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_LIB_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE} ${LIBOMP_EXPORTS_LIB_DIR}
)
# Copy Windows import library into exports/ directory post build
if(WIN32)
get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
add_custom_command(TARGET ompimp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_LIB_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMPIMP_OUTPUT_DIRECTORY}/${LIBOMP_IMP_LIB_FILE} ${LIBOMP_EXPORTS_LIB_DIR}
)
endif()
@@ -14,54 +14,53 @@
# void get_architecture(string* return_arch)
# - Returns the architecture in return_arch
function(get_architecture return_arch)
set(detect_arch_src_txt "
function(libomp_get_architecture return_arch)
set(detect_arch_src_txt "
#if defined(__KNC__)
#error ARCHITECTURE=mic
#error ARCHITECTURE=mic
#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
#error ARCHITECTURE=32e
#error ARCHITECTURE=x86_64
#elif defined(__i386) || defined(__i386__) || defined(__IA32__) || defined(_M_I86) || defined(_M_IX86) || defined(__X86__) || defined(_X86_)
#error ARCHITECTURE=32
#error ARCHITECTURE=i386
#elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
#error ARCHITECTURE=arm
#error ARCHITECTURE=arm
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6ZK__)
#error ARCHITECTURE=arm
#error ARCHITECTURE=arm
#elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__)
#error ARCHITECTURE=arm
#elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
#error ARCHITECTURE=arm
#error ARCHITECTURE=arm
#elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
#error ARCHITECTURE=arm
#elif defined(__ARM_ARCH_3__) || defined(__ARM_ARCH_3M__)
#error ARCHITECTURE=arm
#error ARCHITECTURE=arm
#elif defined(__ARM_ARCH_2__)
#error ARCHITECTURE=arm
#error ARCHITECTURE=arm
#elif defined(__arm__) || defined(_M_ARM) || defined(_ARM)
#error ARCHITECTURE=arm
#error ARCHITECTURE=arm
#elif defined(__aarch64__)
#error ARCHITECTURE=aarch64
#error ARCHITECTURE=aarch64
#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
#error ARCHITECTURE=ppc64le
#error ARCHITECTURE=ppc64le
#elif defined(__powerpc64__)
#error ARCHITECTURE=ppc64
#error ARCHITECTURE=ppc64
#else
#error ARCHITECTURE=UnknownArchitecture
#error ARCHITECTURE=UnknownArchitecture
#endif
"
)
# Write out ${detect_arch_src_txt} to a file within the cmake/ subdirectory
file(WRITE "${LIBOMP_WORK}/cmake/detect_arch.c" ${detect_arch_src_txt})
")
# Write out ${detect_arch_src_txt} to a file within the cmake/ subdirectory
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libomp_detect_arch.c" ${detect_arch_src_txt})
# Try to compile using the C Compiler. It will always error out with an #error directive, so store error output to ${local_architecture}
try_run(run_dummy compile_dummy "${CMAKE_CURRENT_BINARY_DIR}" "${LIBOMP_WORK}/cmake/detect_arch.c" COMPILE_OUTPUT_VARIABLE local_architecture)
# Try to compile using the C Compiler. It will always error out with an #error directive, so store error output to ${local_architecture}
try_run(run_dummy compile_dummy "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/libomp_detect_arch.c" COMPILE_OUTPUT_VARIABLE local_architecture)
# Match the important architecture line and store only that matching string in ${local_architecture}
string(REGEX MATCH "ARCHITECTURE=([a-zA-Z0-9_]+)" local_architecture "${local_architecture}")
# Match the important architecture line and store only that matching string in ${local_architecture}
string(REGEX MATCH "ARCHITECTURE=([a-zA-Z0-9_]+)" local_architecture "${local_architecture}")
# Get rid of the ARCHITECTURE= part of the string
string(REPLACE "ARCHITECTURE=" "" local_architecture "${local_architecture}")
# Get rid of the ARCHITECTURE= part of the string
string(REPLACE "ARCHITECTURE=" "" local_architecture "${local_architecture}")
# set the return value to the architecture detected (e.g., 32e, 32, arm, ppc64, etc.)
set(${return_arch} "${local_architecture}" PARENT_SCOPE)
# set the return value to the architecture detected (e.g., 32e, 32, arm, ppc64, etc.)
set(${return_arch} "${local_architecture}" PARENT_SCOPE)
# Remove ${detect_arch_src_txt} from cmake/ subdirectory
file(REMOVE "${LIBOMP_WORK}/cmake/detect_arch.c")
# Remove ${detect_arch_src_txt} from cmake/ subdirectory
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/libomp_detect_arch.c")
endfunction()
+207
View File
@@ -0,0 +1,207 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# Setup the flags correctly for cmake (covert to string)
# Pretty them up (STRIP any beginning and trailing whitespace,
# remove duplicates, remove empty entries)
macro(libomp_setup_flags flags)
if(NOT "${${flags}}" STREQUAL "") # if flags are empty, don't do anything
set(flags_local)
list(REMOVE_DUPLICATES ${flags}) # remove duplicates
list(REMOVE_ITEM ${flags} "") # remove empty items
libomp_list_to_string("${${flags}}" flags_local)
string(STRIP "${flags_local}" flags_local)
set(${flags} "${flags_local}")
endif()
endmacro()
# Gets flags common to both the C and C++ compiler
function(libomp_get_c_and_cxxflags_common flags)
set(flags_local)
libomp_append(flags_local -std=c++11 LIBOMP_HAVE_STD_CPP11_FLAG)
libomp_append(flags_local -fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
if(${LIBOMP_ENABLE_WERROR})
libomp_append(flags_local -Werror LIBOMP_HAVE_WERROR_FLAG)
endif()
libomp_append(flags_local -Wno-sign-compare LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG)
libomp_append(flags_local -Wno-unused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
libomp_append(flags_local -Wno-unused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
libomp_append(flags_local -Wno-unused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)
libomp_append(flags_local -Wno-unused-variable LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG)
libomp_append(flags_local -Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG)
libomp_append(flags_local -Wno-covered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG)
libomp_append(flags_local -Wno-deprecated-register LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG)
libomp_append(flags_local -Wno-gnu-anonymous-struct LIBOMP_HAVE_WNO_GNU_ANONYMOUS_STRUCT_FLAG)
libomp_append(flags_local -Wno-unknown-pragmas LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG)
libomp_append(flags_local -Wno-missing-field-initializers LIBOMP_HAVE_WNO_MISSING_FIELD_INITIALIZERS_FLAG)
libomp_append(flags_local -Wno-missing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG)
libomp_append(flags_local -Wno-comment LIBOMP_HAVE_WNO_COMMENT_FLAG)
libomp_append(flags_local -Wno-self-assign LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG)
libomp_append(flags_local -Wno-vla-extension LIBOMP_HAVE_WNO_VLA_EXTENSION_FLAG)
libomp_append(flags_local -Wno-format-pedantic LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_FLAG)
libomp_append(flags_local /GS LIBOMP_HAVE_GS_FLAG)
libomp_append(flags_local /EHsc LIBOMP_HAVE_EHSC_FLAG)
libomp_append(flags_local /Oy- LIBOMP_HAVE_OY__FLAG)
# Intel(R) C Compiler flags
libomp_append(flags_local /Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG)
libomp_append(flags_local -Qoption,cpp,--extended_float_types LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)
libomp_append(flags_local -Qlong_double LIBOMP_HAVE_LONG_DOUBLE_FLAG)
libomp_append(flags_local -Qdiag-disable:177 LIBOMP_HAVE_DIAG_DISABLE_177_FLAG)
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
libomp_append(flags_local -Qinline-min-size=1 LIBOMP_HAVE_INLINE_MIN_SIZE_FLAG)
endif()
# Architectural C and C++ flags
if(${IA32})
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
libomp_append(flags_local -m32 LIBOMP_HAVE_M32_FLAG)
endif()
libomp_append(flags_local /arch:SSE2 LIBOMP_HAVE_ARCH_SSE2_FLAG)
libomp_append(flags_local -msse2 LIBOMP_HAVE_MSSE2_FLAG)
libomp_append(flags_local -falign-stack=maintain-16-byte LIBOMP_HAVE_FALIGN_STACK_FLAG)
elseif(${MIC})
libomp_append(flags_local -mmic LIBOMP_HAVE_MMIC_FLAG)
libomp_append(flags_local -ftls-model=initial-exec LIBOMP_HAVE_FTLS_MODEL_FLAG)
libomp_append(flags_local "-opt-streaming-stores never" LIBOMP_HAVE_OPT_STREAMING_STORES_FLAG)
endif()
set(${flags} ${flags_local} PARENT_SCOPE)
endfunction()
# C compiler flags
function(libomp_get_cflags cflags)
set(cflags_local)
libomp_get_c_and_cxxflags_common(cflags_local)
# flags only for the C Compiler
libomp_append(cflags_local /TP LIBOMP_HAVE_TP_FLAG)
libomp_append(cflags_local "-x c++" LIBOMP_HAVE_X_CPP_FLAG)
set(cflags_local ${cflags_local} ${LIBOMP_CFLAGS})
libomp_setup_flags(cflags_local)
set(${cflags} ${cflags_local} PARENT_SCOPE)
endfunction()
# C++ compiler flags
function(libomp_get_cxxflags cxxflags)
set(cxxflags_local)
libomp_get_c_and_cxxflags_common(cxxflags_local)
set(cxxflags_local ${cxxflags_local} ${LIBOMP_CXXFLAGS})
libomp_setup_flags(cxxflags_local)
set(${cxxflags} ${cxxflags_local} PARENT_SCOPE)
endfunction()
# Assembler flags
function(libomp_get_asmflags asmflags)
set(asmflags_local)
libomp_append(asmflags_local "-x assembler-with-cpp" LIBOMP_HAVE_X_ASSEMBLER_WITH_CPP_FLAG)
# Architectural assembler flags
if(${IA32})
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
libomp_append(asmflags_local -m32 LIBOMP_HAVE_M32_FLAG)
endif()
libomp_append(asmflags_local /safeseh LIBOMP_HAVE_SAFESEH_MASM_FLAG)
libomp_append(asmflags_local /coff LIBOMP_HAVE_COFF_MASM_FLAG)
elseif(${MIC})
libomp_append(asmflags_local -mmic LIBOMP_HAVE_MMIC_FLAG)
endif()
set(asmflags_local ${asmflags_local} ${LIBOMP_ASMFLAGS})
libomp_setup_flags(asmflags_local)
set(${asmflags} ${asmflags_local} PARENT_SCOPE)
endfunction()
# Linker flags
function(libomp_get_ldflags ldflags)
set(ldflags_local)
libomp_append(ldflags_local "${CMAKE_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_LIB_NAME}.def"
IF_DEFINED CMAKE_LINK_DEF_FILE_FLAG)
libomp_append(ldflags_local "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR}"
IF_DEFINED CMAKE_C_OSX_CURRENT_VERSION_FLAG)
libomp_append(ldflags_local "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR}"
IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
libomp_append(ldflags_local -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
libomp_append(ldflags_local -Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
libomp_append(ldflags_local -Wl,-fini=__kmp_internal_end_fini LIBOMP_HAVE_FINI_FLAG)
libomp_append(ldflags_local -no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)
libomp_append(ldflags_local -static-intel LIBOMP_HAVE_STATIC_INTEL_FLAG)
libomp_append(ldflags_local /SAFESEH LIBOMP_HAVE_SAFESEH_FLAG)
# Architectural linker flags
if(${IA32})
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
libomp_append(ldflags_local -m32 LIBOMP_HAVE_M32_FLAG)
endif()
libomp_append(ldflags_local -msse2 LIBOMP_HAVE_MSSE2_FLAG)
elseif(${MIC})
libomp_append(ldflags_local -mmic LIBOMP_HAVE_MMIC_FLAG)
libomp_append(ldflags_local -Wl,-x LIBOMP_HAVE_X_FLAG)
endif()
set(ldflags_local ${ldflags_local} ${LIBOMP_LDFLAGS})
libomp_setup_flags(ldflags_local)
set(${ldflags} ${ldflags_local} PARENT_SCOPE)
endfunction()
# Library flags
function(libomp_get_libflags libflags)
set(libflags_local)
libomp_append(libflags_local "${CMAKE_THREAD_LIBS_INIT}")
libomp_append(libflags_local "${LIBOMP_HWLOC_LIBRARY}" LIBOMP_USE_HWLOC)
if(${IA32})
libomp_append(libflags_local -lirc_pic LIBOMP_HAVE_IRC_PIC_LIBRARY)
endif()
IF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
libomp_append(libflags_local -lm)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS})
libomp_setup_flags(libflags_local)
set(${libflags} ${libflags_local} PARENT_SCOPE)
endfunction()
# Fortran flags
function(libomp_get_fflags fflags)
set(fflags_local)
if(${IA32})
libomp_append(fflags_local -m32 LIBOMP_HAVE_M32_FORTRAN_FLAG)
endif()
set(fflags_local ${fflags_local} ${LIBOMP_FFLAGS})
libomp_setup_flags(fflags_local)
set(${fflags} ${fflags_local} PARENT_SCOPE)
endfunction()
# Perl generate-defs.pl flags (For Windows only)
function(libomp_get_gdflags gdflags)
set(gdflags_local)
if(${IA32})
set(libomp_gdflag_arch arch_32)
elseif(${INTEL64})
set(libomp_gdflag_arch arch_32e)
else()
set(libomp_gdflag_arch arch_${LIBOMP_ARCH})
endif()
libomp_append(gdflags_local "-D ${libomp_gdflag_arch}")
libomp_append(gdflags_local "-D msvc_compat")
libomp_append(gdflags_local "-D norm" NORMAL_LIBRARY)
libomp_append(gdflags_local "-D prof" PROFILE_LIBRARY)
libomp_append(gdflags_local "-D stub" STUBS_LIBRARY)
libomp_append(gdflags_local "-D HAVE_QUAD" LIBOMP_USE_QUAD_PRECISION)
libomp_append(gdflags_local "-D USE_DEBUGGER" LIBOMP_USE_DEBUGGER)
if(${LIBOMP_OMP_VERSION} GREATER 45 OR ${LIBOMP_OMP_VERSION} EQUAL 45)
libomp_append(gdflags_local "-D OMP_45")
endif()
if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
libomp_append(gdflags_local "-D OMP_40")
endif()
if(${LIBOMP_OMP_VERSION} GREATER 30 OR ${LIBOMP_OMP_VERSION} EQUAL 30)
libomp_append(gdflags_local "-D OMP_30")
endif()
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
libomp_append(gdflags_local "-D KMP_DEBUG")
endif()
set(${gdflags} ${gdflags_local} PARENT_SCOPE)
endfunction()
+225
View File
@@ -0,0 +1,225 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# The following micro-tests are small tests to perform on the library just created.
# There are currently five micro-tests:
# (1) test-touch
# - Compile and run a small program using newly created libomp library
# - Fails if test-touch.c does not compile or if test-touch.c does not run after compilation
# - Program dependencies: gcc or g++, grep, bourne shell
# - Available for all Unix,Mac,Windows builds. Not available on Intel(R) MIC Architecture builds.
# (2) test-relo
# - Tests dynamic libraries for position-dependent code (can not have any position dependent code)
# - Fails if TEXTREL is in output of readelf -d libomp.so command
# - Program dependencies: readelf, grep, bourne shell
# - Available for Unix, Intel(R) MIC Architecture dynamic library builds. Not available otherwise.
# (3) test-execstack
# - Tests if stack is executable
# - Fails if stack is executable. Should only be readable and writable. Not exectuable.
# - Program dependencies: perl, readelf
# - Available for Unix dynamic library builds. Not available otherwise.
# (4) test-instr (Intel(R) MIC Architecutre only)
# - Tests Intel(R) MIC Architecture libraries for valid instruction set
# - Fails if finds invalid instruction for Intel(R) MIC Architecture (wasn't compiled with correct flags)
# - Program dependencies: perl, objdump
# - Available for Intel(R) MIC Architecture and i386 builds. Not available otherwise.
# (5) test-deps
# - Tests newly created libomp for library dependencies
# - Fails if sees a dependence not listed in td_exp variable below
# - Program dependencies: perl, (unix)readelf, (mac)otool[64], (windows)link.exe
# - Available for Unix,Mac,Windows, Intel(R) MIC Architecture dynamic builds and Windows
# static builds. Not available otherwise.
# get library location
if(WIN32)
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp RUNTIME_OUTPUT_DIRECTORY)
get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
else()
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp LIBRARY_OUTPUT_DIRECTORY)
endif()
if(NOT LIBOMP_OUTPUT_DIRECTORY)
set(LIBOMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
# test-touch
find_program(LIBOMP_SHELL sh)
if(WIN32)
if(LIBOMP_SHELL)
set(libomp_test_touch_targets test-touch-md/.success test-touch-mt/.success)
endif()
# pick test-touch compiler
set(libomp_test_touch_compiler ${CMAKE_C_COMPILER})
# test-touch compilation flags
libomp_append(libomp_test_touch_cflags /nologo)
libomp_append(libomp_test_touch_libs ${LIBOMPIMP_OUTPUT_DIRECTORY}/${LIBOMP_IMP_LIB_FILE})
if(${IA32})
libomp_append(libomp_test_touch_ldflags /safeseh)
endif()
else() # (Unix based systems, Intel(R) MIC Architecture, and Mac)
if(LIBOMP_SHELL)
set(libomp_test_touch_targets test-touch-rt/.success)
endif()
# pick test-touch compiler
if(${LIBOMP_USE_STDCPPLIB})
set(libomp_test_touch_compiler ${CMAKE_CXX_COMPILER})
else()
set(libomp_test_touch_compiler ${CMAKE_C_COMPILER})
endif()
# test-touch compilation flags
libomp_append(libomp_test_touch_libs "${CMAKE_THREAD_LIBS_INIT}")
if(${IA32})
libomp_append(libomp_test_touch_cflags -m32 LIBOMP_HAVE_M32_FLAG)
endif()
libomp_append(libomp_test_touch_libs ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE})
libomp_append(libomp_test_touch_libs "${LIBOMP_HWLOC_LIBRARY}" LIBOMP_USE_HWLOC)
if(APPLE)
set(libomp_test_touch_env "DYLD_LIBRARY_PATH=.:${LIBOMP_OUTPUT_DIRECTORY}:$ENV{DYLD_LIBRARY_PATH}")
libomp_append(libomp_test_touch_ldflags "-Wl,-rpath,${LIBOMP_HWLOC_LIBRARY_DIR}" LIBOMP_USE_HWLOC)
else()
set(libomp_test_touch_env "LD_LIBRARY_PATH=.:${LIBOMP_OUTPUT_DIRECTORY}:$ENV{LD_LIBRARY_PATH}")
libomp_append(libomp_test_touch_ldflags "-Wl,-rpath=${LIBOMP_HWLOC_LIBRARY_DIR}" LIBOMP_USE_HWLOC)
endif()
endif()
macro(libomp_test_touch_recipe test_touch_dir)
set(libomp_test_touch_dependencies ${LIBOMP_SRC_DIR}/test-touch.c omp)
set(libomp_test_touch_exe ${test_touch_dir}/test-touch${CMAKE_EXECUTABLE_SUFFIX})
set(libomp_test_touch_obj ${test_touch_dir}/test-touch${CMAKE_C_OUTPUT_EXTENSION})
if(WIN32)
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
if(${test_touch_dir} MATCHES "test-touch-mt")
libomp_append(libomp_test_touch_cflags /MT)
else()
libomp_append(libomp_test_touch_cflags /MD)
endif()
else()
if(${test_touch_dir} MATCHES "test-touch-mt")
libomp_append(libomp_test_touch_cflags /MTd)
else()
libomp_append(libomp_test_touch_cflags /MDd)
endif()
endif()
set(libomp_test_touch_out_flags -Fe${libomp_test_touch_exe} -Fo${libomp_test_touch_obj})
list(APPEND libomp_test_touch_dependencies ompimp)
else()
set(libomp_test_touch_out_flags -o ${libomp_test_touch_exe})
endif()
add_custom_command(
OUTPUT ${test_touch_dir}/.success ${libomp_test_touch_exe} ${libomp_test_touch_obj}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${test_touch_dir}
COMMAND ${CMAKE_COMMAND} -E remove -f ${test_touch_dir}/*
COMMAND ${libomp_test_touch_compiler} ${libomp_test_touch_out_flags} ${libomp_test_touch_cflags}
${LIBOMP_SRC_DIR}/test-touch.c ${libomp_test_touch_ldflags} ${libomp_test_touch_libs}
COMMAND ${LIBOMP_SHELL} -c \"${libomp_test_touch_env} ${libomp_test_touch_exe}\"
COMMAND ${CMAKE_COMMAND} -E touch ${test_touch_dir}/.success
DEPENDS ${libomp_test_touch_dependencies}
)
endmacro()
libomp_append(libomp_test_touch_env "KMP_VERSION=1")
add_custom_target(libomp-test-touch DEPENDS ${libomp_test_touch_targets})
if(WIN32)
libomp_test_touch_recipe(test-touch-mt)
libomp_test_touch_recipe(test-touch-md)
else()
libomp_test_touch_recipe(test-touch-rt)
endif()
# test-relo
add_custom_target(libomp-test-relo DEPENDS test-relo/.success)
add_custom_command(
OUTPUT test-relo/.success test-relo/readelf.log
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-relo
COMMAND readelf -d ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE} > test-relo/readelf.log
COMMAND grep -e TEXTREL test-relo/readelf.log \; test $$? -eq 1
COMMAND ${CMAKE_COMMAND} -E touch test-relo/.success
DEPENDS omp
)
# test-execstack
add_custom_target(libomp-test-execstack DEPENDS test-execstack/.success)
add_custom_command(
OUTPUT test-execstack/.success
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-execstack
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-execstack.pl
--arch=${LIBOMP_PERL_SCRIPT_ARCH} ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
COMMAND ${CMAKE_COMMAND} -E touch test-execstack/.success
DEPENDS omp
)
# test-instr
add_custom_target(libomp-test-instr DEPENDS test-instr/.success)
add_custom_command(
OUTPUT test-instr/.success
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-instr
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-instruction-set.pl --os=${LIBOMP_PERL_SCRIPT_OS}
--arch=${LIBOMP_PERL_SCRIPT_ARCH} --show --mic-arch=${LIBOMP_MIC_ARCH} ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
COMMAND ${CMAKE_COMMAND} -E touch test-instr/.success
DEPENDS omp ${LIBOMP_TOOLS_DIR}/check-instruction-set.pl
)
# test-deps
add_custom_target(libomp-test-deps DEPENDS test-deps/.success)
set(libomp_expected_library_deps)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(libomp_expected_library_deps libc.so.7 libthr.so.3)
libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(libomp_expected_library_deps libc.so.12 libpthread.so.1 libm.so.0)
libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC)
elseif(APPLE)
set(libomp_expected_library_deps /usr/lib/libSystem.B.dylib)
elseif(WIN32)
set(libomp_expected_library_deps kernel32.dll)
libomp_append(libomp_expected_library_deps psapi.dll LIBOMP_OMPT_SUPPORT)
else()
if(${MIC})
set(libomp_expected_library_deps libc.so.6 libpthread.so.0 libdl.so.2)
if("${LIBOMP_MIC_ARCH}" STREQUAL "knf")
libomp_append(libomp_expected_library_deps ld-linux-l1om.so.2)
libomp_append(libomp_expected_library_deps libgcc_s.so.1)
elseif("${LIBOMP_MIC_ARCH}" STREQUAL "knc")
libomp_append(libomp_expected_library_deps ld-linux-k1om.so.2)
endif()
else()
set(libomp_expected_library_deps libdl.so.2 libgcc_s.so.1)
if(${IA32})
libomp_append(libomp_expected_library_deps libc.so.6)
libomp_append(libomp_expected_library_deps ld-linux.so.2)
elseif(${INTEL64})
libomp_append(libomp_expected_library_deps libc.so.6)
libomp_append(libomp_expected_library_deps ld-linux-x86-64.so.2)
elseif(${ARM})
libomp_append(libomp_expected_library_deps libc.so.6)
libomp_append(libomp_expected_library_deps libffi.so.6)
libomp_append(libomp_expected_library_deps libffi.so.5)
libomp_append(libomp_expected_library_deps ld-linux-armhf.so.3)
elseif(${PPC64})
libomp_append(libomp_expected_library_deps libc.so.6)
libomp_append(libomp_expected_library_deps ld64.so.1)
endif()
libomp_append(libomp_expected_library_deps libpthread.so.0 IF_FALSE STUBS_LIBRARY)
libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC)
endif()
libomp_append(libomp_expected_library_deps libstdc++.so.6 LIBOMP_USE_STDCPPLIB)
libomp_append(libomp_expected_library_deps libm.so.6 LIBOMP_STATS)
endif()
# Perl script expects comma separated list
string(REPLACE ";" "," libomp_expected_library_deps "${libomp_expected_library_deps}")
add_custom_command(
OUTPUT test-deps/.success
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-deps
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/check-depends.pl --os=${LIBOMP_PERL_SCRIPT_OS}
--arch=${LIBOMP_PERL_SCRIPT_ARCH} --expected="${libomp_expected_library_deps}" ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE}
COMMAND ${CMAKE_COMMAND} -E touch test-deps/.success
DEPENDS omp ${LIBOMP_TOOLS_DIR}/check-depends.pl
)
+191
View File
@@ -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()
-37
View File
@@ -1,37 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds Microsoft Visual Studio dependent flags
# The flag types are:
# 1) Assembly flags
#########################################################
# Assembly flags
function(append_assembler_specific_asm_flags input_asm_flags)
set(local_asm_flags)
append_asm_flags("-nologo") # Turn off tool banner.
if(${IA32})
append_asm_flags("-safeseh") # Registers exception handlers for safe exception handling.
append_asm_flags("-coff") # Generates common object file format (COFF) type of object module.
# Generally required for Win32 assembly language development.
append_asm_flags("-D _M_IA32")
elseif(${INTEL64})
append_asm_flags("-D _M_AMD64")
endif()
# CMake prefers the /MD flags when compiling Windows sources, but libiomp5 needs to use /MT instead
# So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE.
# replace_md_with_mt() is in HelperFunctions.cmake
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG)
set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE)
endfunction()
-75
View File
@@ -1,75 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds Microsoft Visual Studio dependent flags
# The flag types are:
# 1) C/C++ Compiler flags
# 2) Fortran Compiler flags
#########################################################
# Visual Studio C/C++ Compiler flags
function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags)
set(local_c_flags)
set(local_cxx_flags)
append_c_flags("-TP") # Tells the compiler to process a file as a C++ source file.
append_cxx_flags("-EHsc") # Enable C++ exception handling.
append_c_and_cxx_flags("-W3") # Enables diagnostics for remarks, warnings, and errors.
# Additional warnings are also enabled above level 2 warnings.
append_c_and_cxx_flags("-GS") # Lets you control the threshold at which the stack checking routine is called or not called.
if(${IA32})
append_c_and_cxx_flags("-arch:ia32") # Tells the compiler which features it may target (ia32)
append_c_and_cxx_flags("-Oy-") # equivalent to -fno-omit-frame-pointer
endif()
# CMake prefers the /MD flags when compiling Windows sources, but libiomp5 needs to use /MT instead
# So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE.
# replace_md_with_mt() is in HelperFunctions.cmake
replace_md_with_mt(CMAKE_C_FLAGS)
replace_md_with_mt(CMAKE_C_FLAGS_RELEASE)
replace_md_with_mt(CMAKE_C_FLAGS_RELWITHDEBINFO)
replace_md_with_mt(CMAKE_C_FLAGS_DEBUG)
replace_md_with_mt(CMAKE_CXX_FLAGS)
replace_md_with_mt(CMAKE_CXX_FLAGS_RELEASE)
replace_md_with_mt(CMAKE_CXX_FLAGS_RELWITHDEBINFO)
replace_md_with_mt(CMAKE_CXX_FLAGS_DEBUG)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO)
replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG)
set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE)
set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE)
endfunction()
#########################################################
# Visual Studio Linker flags
function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs)
set(local_ld_flags)
set(local_ld_flags_libs)
append_linker_flags("-WX:NO")
append_linker_flags("-version:${version}.0")
append_linker_flags("-NXCompat")
append_linker_flags("-DynamicBase") # This option modifies the header of an executable to indicate
# whether the application should be randomly rebased at load time.
if(${IA32})
append_linker_flags("-machine:i386")
append_linker_flags("-safeseh")
elseif(${INTEL64})
append_linker_flags("-machine:amd64")
endif()
if(NOT "${def_file}" STREQUAL "")
append_linker_flags("-def:${def_file}")
endif()
# Have Visual Studio use link.exe directly
#set(CMAKE_C_CREATE_SHARED_LIBRARY "link.exe /out:<TARGET> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>" PARENT_SCOPE)
#set(CMAKE_SHARED_LINKER_FLAGS "$ENV{LDLFAGS}" CACHE STRING "Linker Flags" FORCE)
set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE)
set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE)
endfunction()
-287
View File
@@ -1,287 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
######################################################
# MICRO TESTS
# The following micro-tests are small tests to perform on
# the library just created in ${build_dir}/, there are currently
# five micro-tests:
# (1) test-touch
# - Compile and run a small program using newly created libiomp5 library
# - Fails if test-touch.c does not compile or if test-touch.c does not run after compilation
# - Program dependencies: gcc or g++, grep, bourne shell
# - Available for all Linux,Mac,Windows builds. Not availble 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 libiomp5.so command
# - Program dependencies: readelf, grep, bourne shell
# - Available for Linux, Intel(R) MIC Architecture dynamic library builds. Not available otherwise.
# (3) test-execstack
# - Tests if stack is executable
# - Fails if stack is executable. Should only be readable and writable. Not exectuable.
# - Program dependencies: perl, readelf
# - Available for Linux dynamic library builds. Not available otherwise.
# (4) test-instr (Intel(R) MIC Architecutre only)
# - Tests Intel(R) MIC Architecture libraries for valid instruction set
# - Fails if finds invalid instruction for Intel(R) MIC Architecture (wasn't compiled with correct flags)
# - Program dependencies: perl, objdump
# - Available for Intel(R) MIC Architecture builds. Not available otherwise.
# (5) test-deps
# - Tests newly created libiomp5 for library dependencies
# - Fails if sees a dependence not listed in td_exp variable below
# - Program dependencies: perl, (linux)readelf, (mac)otool[64], (windows)link.exe
# - Available for Linux,Mac,Windows, Intel(R) MIC Architecture dynamic builds and Windows static builds. Not available otherwise.
#
# All tests can be turned off by including -Dtests=off when calling cmake
# An individual test can be turned off by issuing something like -Dtest_touch=off when calling cmake
# test-touch
if(NOT ${MIC} AND ${test_touch} AND ${tests})
if(${WINDOWS})
set(do_test_touch_mt TRUE)
if(${do_test_touch_mt})
set(test_touch_items ${test_touch_items} test-touch-md test-touch-mt)
else()
set(test_touch_items ${test_touch_items} test-touch-md)
endif()
else()
set(test_touch_items ${test_touch_items} test-touch-rt)
endif()
set(regular_test_touch_items "${test_touch_items}")
add_suffix("/.success" regular_test_touch_items)
# test-touch : ${test_touch_items}/.success
set(ldeps "${regular_test_touch_items}")
add_custom_target( test-touch DEPENDS ${ldeps})
if(${WINDOWS})
# pick test-touch compiler
set(tt-c cl)
# test-touch compilation flags
list(APPEND tt-c-flags -nologo)
if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD})
list(APPEND tt-c-flags-mt -MT)
list(APPEND tt-c-flags-md -MD)
else()
list(APPEND tt-c-flags-mt -MTd)
list(APPEND tt-c-flags-md -MDd)
endif()
list(APPEND tt-libs ${build_dir}/${imp_file})
list(APPEND tt-ld-flags -link -nodefaultlib:oldnames)
if(${IA32})
list(APPEND tt-ld-flags -safeseh)
endif()
list(APPEND tt-ld-flags-v -verbose)
else() # (Unix based systems, Intel(R) MIC Architecture, and Mac)
# pick test-touch compiler
if(${STD_CPP_LIB})
set(tt-c ${CMAKE_CXX_COMPILER})
else()
set(tt-c ${CMAKE_C_COMPILER})
endif()
# test-touch compilation flags
if(${LINUX})
list(APPEND tt-c-flags -pthread)
endif()
if(${IA32})
list(APPEND tt-c-flags -m32)
elseif(${INTEL64})
list(APPEND tt-c-flags -m64)
endif()
list(APPEND tt-libs ${build_dir}/${lib_file})
if(${MAC})
list(APPEND tt-ld-flags-v -Wl,-t)
set(tt-env "DYLD_LIBRARY_PATH=.:$ENV{DYLD_LIBRARY_PATH}")
else()
list(APPEND tt-ld-flags-v -Wl,--verbose)
set(tt-env LD_LIBRARY_PATH=".:${build_dir}:$ENV{LD_LIBRARY_PATH}")
endif()
endif()
list(APPEND tt-c-flags "${tt-c-flags-rt}")
list(APPEND tt-env "KMP_VERSION=1")
macro(test_touch_recipe test_touch_dir)
file(MAKE_DIRECTORY ${build_dir}/${test_touch_dir})
set(ldeps ${src_dir}/test-touch.c ${build_dir}/${lib_file})
set(tt-exe-file ${test_touch_dir}/test-touch${exe})
if(${WINDOWS})
# ****** list(APPEND tt-c-flags -Fo$(dir $@)test-touch${obj} -Fe$(dir $@)test-touch${exe}) *******
set(tt-c-flags-out -Fo${test_touch_dir}/test-touch${obj} -Fe${test_touch_dir}/test-touch${exe})
list(APPEND ldeps ${build_dir}/${imp_file})
else()
# ****** list(APPEND tt-c-flags -o $(dir $@)test-touch${exe}) ********
set(tt-c-flags-out -o ${test_touch_dir}/test-touch${exe})
endif()
add_custom_command(
OUTPUT ${test_touch_dir}/.success
COMMAND ${CMAKE_COMMAND} -E remove -f ${test_touch_dir}/*
COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags}
COMMAND ${CMAKE_COMMAND} -E remove -f ${tt-exe-file}
COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags} ${tt-ld-flags-v} > ${test_touch_dir}/build.log 2>&1
COMMAND ${tt-env} ${tt-exe-file}
#COMMAND grep -i -e \"[^_]libirc\" ${test_touch_dir}/build.log > ${test_touch_dir}/libirc.log \; [ $$? -eq 1 ]
COMMAND ${CMAKE_COMMAND} -E touch ${test_touch_dir}/.success
DEPENDS ${ldeps}
)
endmacro()
if(${WINDOWS})
test_touch_recipe(test-touch-mt)
test_touch_recipe(test-touch-md)
else()
test_touch_recipe(test-touch-rt)
endif()
else()
add_custom_target(test-touch DEPENDS test-touch/.success)
macro(test_touch_recipe_skip test_touch_dir)
if(${tests} AND ${test_touch})
set(test_touch_message 'test-touch is not available for the Intel(R) MIC Architecture. Will not perform it.')
else()
set(test_touch_message "test-touch is turned off. Will not perform it.")
endif()
add_custom_command(
OUTPUT ${test_touch_dir}/.success
COMMAND ${CMAKE_COMMAND} -E echo ${test_touch_message}
)
endmacro()
test_touch_recipe_skip(test-touch-rt)
test_touch_recipe_skip(test-touch-mt)
test_touch_recipe_skip(test-touch-md)
endif()
# test-relo
add_custom_target(test-relo DEPENDS test-relo/.success)
if((${LINUX} OR ${MIC}) AND ${test_relo} AND ${tests})
file(MAKE_DIRECTORY ${build_dir}/test-relo)
add_custom_command(
OUTPUT test-relo/.success
COMMAND readelf -d ${build_dir}/${lib_file} > test-relo/readelf.log
COMMAND grep -e TEXTREL test-relo/readelf.log \; [ $$? -eq 1 ]
COMMAND ${CMAKE_COMMAND} -E touch test-relo/.success
DEPENDS ${build_dir}/${lib_file}
)
else()
if(${tests} AND ${test_relo})
set(test_relo_message 'test-relo is only available for dynamic library on Linux or Intel(R) MIC Architecture. Will not perform it.')
else()
set(test_relo_message "test-relo is turned off. Will not perform it.")
endif()
add_custom_command(
OUTPUT test-relo/.success
COMMAND ${CMAKE_COMMAND} -E echo ${test_relo_message}
)
endif()
# test-execstack
add_custom_target(test-execstack DEPENDS test-execstack/.success)
if(${LINUX} AND ${test_execstack} AND ${tests})
file(MAKE_DIRECTORY ${build_dir}/test-execstack)
add_custom_command(
OUTPUT test-execstack/.success
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-execstack.pl ${build_dir}/${lib_file}
COMMAND ${CMAKE_COMMAND} -E touch test-execstack/.success
DEPENDS ${build_dir}/${lib_file}
)
else()
if(${tests} AND ${test_execstack})
set(test_execstack_message "test-execstack is only available for dynamic library on Linux. Will not perform it.")
else()
set(test_execstack_message "test-execstack is turned off. Will not perform it.")
endif()
add_custom_command(
OUTPUT test-execstack/.success
COMMAND ${CMAKE_COMMAND} -E echo ${test_execstack_message}
)
endif()
# test-instr
add_custom_target(test-instr DEPENDS test-instr/.success)
if(${MIC} AND ${test_instr} AND ${tests})
file(MAKE_DIRECTORY ${build_dir}/test-instr)
add_custom_command(
OUTPUT test-instr/.success
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-instruction-set.pl ${oa_opts} --show --mic-arch=${mic_arch} --mic-os=${mic_os} ${build_dir}/${lib_file}
COMMAND ${CMAKE_COMMAND} -E touch test-instr/.success
DEPENDS ${build_dir}/${lib_file} ${tools_dir}/check-instruction-set.pl
)
else()
if(${tests} AND ${test_instr})
set(test_instr_message 'test-instr is only available for Intel(R) MIC Architecture libraries. Will not perform it.')
else()
set(test_instr_message "test-instr is turned off. Will not perform it.")
endif()
add_custom_command(
OUTPUT test-instr/.success
COMMAND ${CMAKE_COMMAND} -E echo ${test_instr_message}
)
endif()
# test-deps
add_custom_target(test-deps DEPENDS test-deps/.success)
if(${test_deps} AND ${tests})
set(td_exp)
if(${FREEBSD})
set(td_exp libc.so.7 libthr.so.3 libunwind.so.5)
elseif(${LINUX})
set(td_exp libdl.so.2,libgcc_s.so.1)
if(${IA32})
set(td_exp ${td_exp},libc.so.6,ld-linux.so.2)
elseif(${INTEL64})
set(td_exp ${td_exp},libc.so.6,ld-linux-x86-64.so.2)
elseif(${ARM})
set(td_exp ${td_exp},libffi.so.6,libffi.so.5,libc.so.6,ld-linux-armhf.so.3)
elseif(${PPC64})
set(td_exp ${td_exp},libc.so.6,ld64.so.1)
endif()
if(${STD_CPP_LIB})
set(td_exp ${td_exp},libstdc++.so.6)
endif()
if(NOT ${STUBS_LIBRARY})
set(td_exp ${td_exp},libpthread.so.0)
endif()
elseif(${MIC})
if("${mic_os}" STREQUAL "lin")
set(td_exp libc.so.6,libpthread.so.0,libdl.so.2)
if(${STD_CPP_LIB})
set(td_exp ${td_exp},libstdc++.so.6)
endif()
if("${mic_arch}" STREQUAL "knf")
set(td_exp ${td_exp},ld-linux-l1om.so.2,libgcc_s.so.1)
elseif("${mic_arch}" STREQUAL "knc")
set(td_exp ${td_exp},ld-linux-k1om.so.2)
endif()
elseif("${mic_os}" STREQUAL "bsd")
set(td_exp libc.so.7,libthr.so.3,libunwind.so.5)
endif()
elseif(${MAC})
set(td_exp /usr/lib/libSystem.B.dylib)
elseif(${WINDOWS})
set(td_exp kernel32.dll)
endif()
file(MAKE_DIRECTORY ${build_dir}/test-deps)
add_custom_command(
OUTPUT test-deps/.success
COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-depends.pl ${oa_opts} --expected="${td_exp}" ${build_dir}/${lib_file}
COMMAND ${CMAKE_COMMAND} -E touch test-deps/.success
DEPENDS ${build_dir}/${lib_file} ${tools_dir}/check-depends.pl
)
else()
if(${tests} AND ${test_deps})
set(test_deps_message 'test-deps is available for dynamic libraries on Linux, Mac, Intel(R) MIC Architecture, Windows and static libraries on Windows. Will not perform it.')
else()
set(test_deps_message "test-deps is turned off. Will not perform it.")
endif()
add_custom_command(
OUTPUT test-deps/.success
COMMAND ${CMAKE_COMMAND} -E echo ${test_deps_message}
)
endif()
# END OF TESTS
######################################################
-90
View File
@@ -1,90 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# void append_ev_flags(string new_flag);
# - appends new_flag to ev_flags list
macro(append_ev_flags new_flag)
list(APPEND local_ev_flags "${new_flag}")
endmacro()
# void append_gd_flags(string new_flag);
# - appends new_flag to gd_flags list
macro(append_gd_flags new_flag)
list(APPEND local_gd_flags "${new_flag}")
endmacro()
include(HelperFunctions) # for set_legal_type(), set_legal_arch()
# Perl expand-vars.pl flags
function(set_ev_flags input_ev_flags)
set(local_ev_flags)
set_legal_type("${lib_type}" legal_type)
set_legal_arch("${arch}" legal_arch)
# need -D Revision="\$Revision" to show up
append_ev_flags("-D Revision=\"\\\\$$Revision\"")
append_ev_flags("-D Date=\"\\\\$$Date\"")
append_ev_flags("-D KMP_TYPE=\"${legal_type}\"")
append_ev_flags("-D KMP_ARCH=\"${legal_arch}\"")
append_ev_flags("-D KMP_VERSION_MAJOR=${version}")
append_ev_flags("-D KMP_VERSION_MINOR=0")
append_ev_flags("-D KMP_VERSION_BUILD=${build_number}")
append_ev_flags("-D KMP_BUILD_DATE=\"${date}\"")
append_ev_flags("-D KMP_TARGET_COMPILER=12")
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
append_ev_flags("-D KMP_DIAG=1")
append_ev_flags("-D KMP_DEBUG_INFO=1")
else()
append_ev_flags("-D KMP_DIAG=0")
append_ev_flags("-D KMP_DEBUG_INFO=0")
endif()
if(${omp_version} EQUAL 40)
append_ev_flags("-D OMP_VERSION=201307")
elseif(${omp_version} EQUAL 30)
append_ev_flags("-D OMP_VERSION=201107")
else()
append_ev_flags("-D OMP_VERSION=200505")
endif()
set(${input_ev_flags} "${local_ev_flags}" PARENT_SCOPE)
endfunction()
function(set_gd_flags input_gd_flags)
set(local_gd_flags)
if(${IA32})
append_gd_flags("-D arch_32")
elseif(${INTEL64})
append_gd_flags("-D arch_32e")
else()
append_gd_flags("-D arch_${arch}")
endif()
if(${NORMAL_LIBRARY})
append_gd_flags("-D norm")
elseif(${PROFILE_LIBRARY})
append_gd_flags("-D prof")
elseif(${STUBS_LIBRARY})
append_gd_flags("-D stub")
endif()
if(${omp_version} GREATER 40 OR ${omp_version} EQUAL 40)
append_gd_flags("-D OMP_40")
endif()
if(${omp_version} GREATER 30 OR ${omp_version} EQUAL 30)
append_gd_flags("-D OMP_30")
endif()
if(NOT "${version}" STREQUAL "4")
append_gd_flags("-D msvc_compat")
endif()
if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
append_gd_flags("-D KMP_DEBUG")
endif()
if(${COMPILER_SUPPORTS_QUAD_PRECISION})
append_gd_flags("-D HAVE_QUAD")
endif()
set(${input_gd_flags} "${local_gd_flags}" PARENT_SCOPE)
endfunction()
-111
View File
@@ -1,111 +0,0 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
macro(append_c_source_file new_c_file)
list(APPEND local_c_source_files "${new_c_file}")
endmacro()
macro(append_cpp_source_file new_cpp_file)
list(APPEND local_cpp_source_files "${new_cpp_file}")
endmacro()
macro(append_asm_source_file new_asm_file)
list(APPEND local_asm_source_files "${new_asm_file}")
endmacro()
macro(append_imp_c_source_file new_import_c_file)
list(APPEND local_imp_c_files "${new_import_c_file}")
endmacro()
# files are relative to the src directory
function(set_c_files input_c_source_files)
set(local_c_source_files "")
append_c_source_file("kmp_ftn_cdecl.c")
append_c_source_file("kmp_ftn_extra.c")
append_c_source_file("kmp_version.c")
if(${STUBS_LIBRARY})
append_c_source_file("kmp_stub.c")
else()
append_c_source_file("kmp_alloc.c")
append_c_source_file("kmp_atomic.c")
append_c_source_file("kmp_csupport.c")
append_c_source_file("kmp_debug.c")
append_c_source_file("kmp_itt.c")
append_c_source_file("kmp_environment.c")
append_c_source_file("kmp_error.c")
append_c_source_file("kmp_global.c")
append_c_source_file("kmp_i18n.c")
append_c_source_file("kmp_io.c")
append_c_source_file("kmp_runtime.c")
append_c_source_file("kmp_settings.c")
append_c_source_file("kmp_str.c")
append_c_source_file("kmp_tasking.c")
append_c_source_file("kmp_taskq.c")
append_c_source_file("kmp_threadprivate.c")
append_c_source_file("kmp_utility.c")
if(${USE_ITT_NOTIFY})
append_c_source_file("thirdparty/ittnotify/ittnotify_static.c")
endif()
if(${WINDOWS})
append_c_source_file("z_Windows_NT_util.c")
append_c_source_file("z_Windows_NT-586_util.c")
else()
append_c_source_file("z_Linux_util.c")
append_c_source_file("kmp_gsupport.c")
endif()
endif()
set(${input_c_source_files} "${local_c_source_files}" PARENT_SCOPE)
endfunction()
function(set_cpp_files input_cpp_source_files)
set(local_cpp_source_files "")
if(NOT ${STUBS_LIBRARY})
append_cpp_source_file("kmp_barrier.cpp")
append_cpp_source_file("kmp_wait_release.cpp")
append_cpp_source_file("kmp_affinity.cpp")
append_cpp_source_file("kmp_dispatch.cpp")
append_cpp_source_file("kmp_lock.cpp")
append_cpp_source_file("kmp_sched.cpp")
if("${omp_version}" STREQUAL "40")
append_cpp_source_file("kmp_taskdeps.cpp")
append_cpp_source_file("kmp_cancel.cpp")
endif()
if(${STATS_GATHERING})
append_cpp_source_file("kmp_stats.cpp")
append_cpp_source_file("kmp_stats_timing.cpp")
endif()
endif()
set(${input_cpp_source_files} "${local_cpp_source_files}" PARENT_SCOPE)
endfunction()
function(set_asm_files input_asm_source_files)
set(local_asm_source_files "")
if(NOT ${STUBS_LIBRARY})
if(${WINDOWS})
append_asm_source_file("z_Windows_NT-586_asm.asm")
else()
append_asm_source_file("z_Linux_asm.s")
endif()
endif()
set(${input_asm_source_files} "${local_asm_source_files}" PARENT_SCOPE)
endfunction()
function(set_imp_c_files input_imp_c_files)
set(local_imp_c_files "")
if(${WINDOWS})
append_imp_c_source_file("kmp_import.c")
endif()
set(${input_imp_c_files} "${local_imp_c_files}" PARENT_SCOPE)
endfunction()
+267
View File
@@ -0,0 +1,267 @@
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckCXXCompilerFlag)
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckIncludeFiles)
include(LibompCheckLinkerFlag)
include(LibompCheckFortranFlag)
# Check for versioned symbols
function(libomp_check_version_symbols retval)
set(source_code
"#include <stdio.h>
void func1() { printf(\"Hello\"); }
void func2() { printf(\"World\"); }
__asm__(\".symver func1, func@VER1\");
__asm__(\".symver func2, func@VER2\");
int main() {
func1();
func2();
return 0;
}")
set(version_script_source "VER1 { }; VER2 { } VER1;")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt "${version_script_source}")
set(CMAKE_REQUIRED_FLAGS -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt)
check_c_source_compiles("${source_code}" ${retval})
set(${retval} ${${retval}} PARENT_SCOPE)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt)
endfunction()
# Includes the architecture flag in both compile and link phase
function(libomp_check_architecture_flag flag retval)
set(CMAKE_REQUIRED_FLAGS "${flag}")
check_c_compiler_flag("${flag}" ${retval})
set(${retval} ${${retval}} PARENT_SCOPE)
endfunction()
# Checking C, CXX, Linker Flags
check_cxx_compiler_flag(-std=c++11 LIBOMP_HAVE_STD_CPP11_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
check_c_compiler_flag("-x c++" LIBOMP_HAVE_X_CPP_FLAG)
check_c_compiler_flag(-Werror LIBOMP_HAVE_WERROR_FLAG)
check_c_compiler_flag(-Wunused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
check_c_compiler_flag(-Wunused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
check_c_compiler_flag(-Wunused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)
check_c_compiler_flag(-Wunused-variable LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG)
check_c_compiler_flag(-Wswitch LIBOMP_HAVE_WNO_SWITCH_FLAG)
check_c_compiler_flag(-Wcovered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG)
check_c_compiler_flag(-Wdeprecated-register LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG)
check_c_compiler_flag(-Wsign-compare LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG)
check_c_compiler_flag(-Wgnu-anonymous-struct LIBOMP_HAVE_WNO_GNU_ANONYMOUS_STRUCT_FLAG)
check_c_compiler_flag(-Wunknown-pragmas LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG)
check_c_compiler_flag(-Wmissing-field-initializers LIBOMP_HAVE_WNO_MISSING_FIELD_INITIALIZERS_FLAG)
check_c_compiler_flag(-Wmissing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG)
check_c_compiler_flag(-Wcomment LIBOMP_HAVE_WNO_COMMENT_FLAG)
check_c_compiler_flag(-Wself-assign LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG)
check_c_compiler_flag(-Wvla-extension LIBOMP_HAVE_WNO_VLA_EXTENSION_FLAG)
check_c_compiler_flag(-Wformat-pedantic LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_FLAG)
check_c_compiler_flag(-msse2 LIBOMP_HAVE_MSSE2_FLAG)
check_c_compiler_flag(-ftls-model=initial-exec LIBOMP_HAVE_FTLS_MODEL_FLAG)
libomp_check_architecture_flag(-mmic LIBOMP_HAVE_MMIC_FLAG)
libomp_check_architecture_flag(-m32 LIBOMP_HAVE_M32_FLAG)
if(WIN32)
# Check Windows MSVC style flags.
check_c_compiler_flag(/TP LIBOMP_HAVE_TP_FLAG)
check_cxx_compiler_flag(/EHsc LIBOMP_HAVE_EHSC_FLAG)
check_cxx_compiler_flag(/GS LIBOMP_HAVE_GS_FLAG)
check_cxx_compiler_flag(/Oy- LIBOMP_HAVE_Oy__FLAG)
check_cxx_compiler_flag(/arch:SSE2 LIBOMP_HAVE_ARCH_SSE2_FLAG)
check_cxx_compiler_flag(/Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG)
# It is difficult to create a dummy masm assembly file
# and then check the MASM assembler to see if these flags exist and work,
# so we assume they do for Windows.
set(LIBOMP_HAVE_SAFESEH_MASM_FLAG TRUE)
set(LIBOMP_HAVE_COFF_MASM_FLAG TRUE)
# Change Windows flags /MDx to /MTx
foreach(libomp_lang IN ITEMS C CXX)
foreach(libomp_btype IN ITEMS DEBUG RELWITHDEBINFO RELEASE MINSIZEREL)
string(REPLACE "/MD" "/MT"
CMAKE_${libomp_lang}_FLAGS_${libomp_btype}
"${CMAKE_${libomp_lang}_FLAGS_${libomp_btype}}"
)
endforeach()
endforeach()
else()
# It is difficult to create a dummy assembly file that compiles into an
# exectuable for every architecture and then check the C compiler to
# see if -x assembler-with-cpp exists and works, so we assume it does for non-Windows.
set(LIBOMP_HAVE_X_ASSEMBLER_WITH_CPP_FLAG TRUE)
endif()
if(${LIBOMP_FORTRAN_MODULES})
libomp_check_fortran_flag(-m32 LIBOMP_HAVE_M32_FORTRAN_FLAG)
endif()
# Check linker flags
if(WIN32)
libomp_check_linker_flag(/SAFESEH LIBOMP_HAVE_SAFESEH_FLAG)
elseif(NOT APPLE)
libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG)
libomp_check_linker_flag(-Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
libomp_check_linker_flag(-Wl,-fini=__kmp_internal_end_fini LIBOMP_HAVE_FINI_FLAG)
endif()
# Check Intel(R) C Compiler specific flags
if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
check_cxx_compiler_flag(/Qlong_double LIBOMP_HAVE_LONG_DOUBLE_FLAG)
check_cxx_compiler_flag(/Qdiag-disable:177 LIBOMP_HAVE_DIAG_DISABLE_177_FLAG)
check_cxx_compiler_flag(/Qinline-min-size=1 LIBOMP_HAVE_INLINE_MIN_SIZE_FLAG)
check_cxx_compiler_flag(-Qoption,cpp,--extended_float_types LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)
check_cxx_compiler_flag(-falign-stack=maintain-16-byte LIBOMP_HAVE_FALIGN_STACK_FLAG)
check_cxx_compiler_flag("-opt-streaming-stores never" LIBOMP_HAVE_OPT_STREAMING_STORES_FLAG)
libomp_check_linker_flag(-static-intel LIBOMP_HAVE_STATIC_INTEL_FLAG)
libomp_check_linker_flag(-no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)
check_library_exists(irc_pic _intel_fast_memcpy "" LIBOMP_HAVE_IRC_PIC_LIBRARY)
endif()
# Checking Threading requirements
find_package(Threads REQUIRED)
if(WIN32)
if(NOT CMAKE_USE_WIN32_THREADS_INIT)
libomp_error_say("Need Win32 thread interface on Windows.")
endif()
else()
if(NOT CMAKE_USE_PTHREADS_INIT)
libomp_error_say("Need pthread interface on Unix-like systems.")
endif()
endif()
# Find perl executable
# Perl is used to create omp.h (and other headers) along with kmp_i18n_id.inc and kmp_i18n_default.inc
find_package(Perl REQUIRED)
# The perl scripts take the --os=/--arch= flags which expect a certain format for operating systems and arch's.
# Until the perl scripts are removed, the most portable way to handle this is to have all operating systems that
# are neither Windows nor Mac (Most Unix flavors) be considered lin to the perl scripts. This is rooted
# in that all the Perl scripts check the operating system and will fail if it isn't "valid". This
# temporary solution lets us avoid trying to enumerate all the possible OS values inside the Perl modules.
if(WIN32)
set(LIBOMP_PERL_SCRIPT_OS win)
elseif(APPLE)
set(LIBOMP_PERL_SCRIPT_OS mac)
else()
set(LIBOMP_PERL_SCRIPT_OS lin)
endif()
if(IA32)
set(LIBOMP_PERL_SCRIPT_ARCH 32)
elseif(MIC)
set(LIBOMP_PERL_SCRIPT_ARCH mic)
elseif(INTEL64)
set(LIBOMP_PERL_SCRIPT_ARCH 32e)
else()
set(LIBOMP_PERL_SCRIPT_ARCH ${LIBOMP_ARCH})
endif()
# Checking features
# Check if version symbol assembler directives are supported
libomp_check_version_symbols(LIBOMP_HAVE_VERSION_SYMBOLS)
# Check if quad precision types are available
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(LIBOMP_HAVE_QUAD_PRECISION TRUE)
elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel")
if(LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)
set(LIBOMP_HAVE_QUAD_PRECISION TRUE)
else()
set(LIBOMP_HAVE_QUAD_PRECISION TRUE)
endif()
else()
set(LIBOMP_HAVE_QUAD_PRECISION FALSE)
endif()
# Check if adaptive locks are available
if((${IA32} OR ${INTEL64}) AND NOT MSVC)
set(LIBOMP_HAVE_ADAPTIVE_LOCKS TRUE)
else()
set(LIBOMP_HAVE_ADAPTIVE_LOCKS FALSE)
endif()
# Check if stats-gathering is available
if(${LIBOMP_STATS})
check_c_source_compiles(
"__thread int x;
int main(int argc, char** argv)
{ x = argc; return x; }"
LIBOMP_HAVE___THREAD)
check_c_source_compiles(
"int main(int argc, char** argv)
{ unsigned long long t = __builtin_readcyclecounter(); return 0; }"
LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER)
if(NOT LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER)
if(${IA32} OR ${INTEL64} OR ${MIC})
check_include_file(x86intrin.h LIBOMP_HAVE_X86INTRIN_H)
libomp_append(CMAKE_REQUIRED_DEFINITIONS -DLIBOMP_HAVE_X86INTRIN_H LIBOMP_HAVE_X86INTRIN_H)
check_c_source_compiles(
"#ifdef LIBOMP_HAVE_X86INTRIN_H
# include <x86intrin.h>
#endif
int main(int argc, char** argv) { unsigned long long t = __rdtsc(); return 0; }" LIBOMP_HAVE___RDTSC)
set(CMAKE_REQUIRED_DEFINITIONS)
endif()
endif()
if(LIBOMP_HAVE___THREAD AND (LIBOMP_HAVE___RDTSC OR LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER))
set(LIBOMP_HAVE_STATS TRUE)
else()
set(LIBOMP_HAVE_STATS FALSE)
endif()
endif()
# Check if OMPT support is available
# Currently, __builtin_frame_address() is required for OMPT
# Weak attribute is required for Unices, LIBPSAPI is used for Windows
check_c_source_compiles("int main(int argc, char** argv) {
void* p = __builtin_frame_address(0);
return 0;}" LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS)
check_c_source_compiles("__attribute__ ((weak)) int foo(int a) { return a*a; }
int main(int argc, char** argv) {
return foo(argc);}" LIBOMP_HAVE_WEAK_ATTRIBUTE)
check_include_files("windows.h;psapi.h" LIBOMP_HAVE_PSAPI_H)
check_library_exists(psapi EnumProcessModules "" LIBOMP_HAVE_LIBPSAPI)
if(LIBOMP_HAVE_PSAPI_H AND LIBOMP_HAVE_LIBPSAPI)
set(LIBOMP_HAVE_PSAPI TRUE)
endif()
if(NOT LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS)
set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)
else()
if(LIBOMP_HAVE_WEAK_ATTRIBUTE OR LIBOMP_HAVE_PSAPI)
set(LIBOMP_HAVE_OMPT_SUPPORT TRUE)
else()
set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)
endif()
endif()
# Check if HWLOC support is available
if(${LIBOMP_USE_HWLOC})
set(CMAKE_REQUIRED_INCLUDES ${LIBOMP_HWLOC_INSTALL_DIR}/include)
check_include_file(hwloc.h LIBOMP_HAVE_HWLOC_H)
set(CMAKE_REQUIRED_INCLUDES)
find_library(LIBOMP_HWLOC_LIBRARY
NAMES hwloc libhwloc
HINTS ${LIBOMP_HWLOC_INSTALL_DIR}/lib)
if(LIBOMP_HWLOC_LIBRARY)
check_library_exists(${LIBOMP_HWLOC_LIBRARY} hwloc_topology_init
${LIBOMP_HWLOC_INSTALL_DIR}/lib LIBOMP_HAVE_LIBHWLOC)
get_filename_component(LIBOMP_HWLOC_LIBRARY_DIR ${LIBOMP_HWLOC_LIBRARY} PATH)
endif()
if(LIBOMP_HAVE_HWLOC_H AND LIBOMP_HAVE_LIBHWLOC AND LIBOMP_HWLOC_LIBRARY)
set(LIBOMP_HAVE_HWLOC TRUE)
else()
set(LIBOMP_HAVE_HWLOC FALSE)
libomp_say("Could not find hwloc")
endif()
endif()
+7406 -7078
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -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&reg;&nbsp;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
@@ -669,10 +669,10 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = src doc/doxygen/libomp_interface.h
INPUT = src doc/doxygen/libomp_interface.h
# The ittnotify code also has doxygen documentation, but if we include it here
# it takes over from us!
# src/thirdparty/ittnotify
# src/thirdparty/ittnotify
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -690,7 +690,7 @@ INPUT_ENCODING = UTF-8
# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
# *.f90 *.f *.for *.vhd *.vhdl
FILE_PATTERNS = *.c *.h *.cpp
FILE_PATTERNS = *.c *.h *.cpp
# We may also want to include the asm files with appropriate ifdef to ensure
# doxygen doesn't see the content, just the documentation...
@@ -1688,7 +1688,7 @@ UML_LOOK = NO
# the class node. If there are many fields or methods and many nodes the
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
# threshold limits the number of items for each type to make the size more
# managable. Set this to 0 for no limit. Note that the threshold may be
# manageable. Set this to 0 for no limit. Note that the threshold may be
# exceeded by 50% before the limit is enforced.
UML_LIMIT_NUM_FIELDS = 10
+6 -21
View File
@@ -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}
\\
The OpenMP name and the OpenMP logo are registered trademarks of the OpenMP Architecture Review Board.
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.
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.
\clearemptydoublepage
\pagenumbering{roman}
\tableofcontents
+53 -68
View File
@@ -12,11 +12,11 @@
//===----------------------------------------------------------------------===//
/*! @mainpage Intel&reg;&nbsp; OpenMP* Runtime Library Interface
/*! @mainpage LLVM&nbsp; OpenMP* Runtime Library Interface
@section sec_intro Introduction
This document describes the interface provided by the
Intel&reg;&nbsp;OpenMP\other runtime library to the compiler.
LLVM &nbsp;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
@@ -26,69 +26,32 @@ The aim here is to explain the interface from the compiler to the runtime.
The overall design is described, and each function in the interface
has its own description. (At least, that's the ambition, we may not be there yet).
@section sec_building Building the Runtime
@section sec_building Quickly Building the Runtime
For the impatient, we cover building the runtime as the first topic here.
A top-level Makefile is provided that attempts to derive a suitable
configuration for the most commonly used environments. To see the
default settings, type:
CMake is used to build the OpenMP runtime. For details and a full list of options for the CMake build system,
see <tt>Build_With_CMake.txt</tt> inside the <tt>runtime/</tt> subdirectory. These
instructions will provide the most typical build.
In-LLVM-tree build:.
@code
% make info
$ cd where-you-want-to-live
Check out openmp into llvm/projects
$ cd where-you-want-to-build
$ mkdir build && cd build
$ cmake path/to/llvm -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make omp
@endcode
You can change the Makefile's behavior with the following options:
- <b>omp_root</b>: The path to the top-level directory containing the top-level
Makefile. By default, this will take on the value of the
current working directory.
- <b>omp_os</b>: Operating system. By default, the build will attempt to
detect this. Currently supports "linux", "macos", and
"windows".
- <b>arch</b>: Architecture. By default, the build will attempt to
detect this if not specified by the user. Currently
supported values are
- "32" for IA-32 architecture
- "32e" for Intel&reg;&nbsp;64 architecture
- "mic" for Intel&reg;&nbsp;Many Integrated Core Architecture (
If "mic" is specified then "icc" will be used as the
compiler, and appropriate k1om binutils will be used. The
necessary packages must be installed on the build machine
for this to be possible, but an
Intel&reg;&nbsp;Xeon Phi&trade;&nbsp;
coprocessor is not required to build the library).
- <b>compiler</b>: Which compiler to use for the build. Defaults to "icc"
or "icl" depending on the value of omp_os. Also supports
"gcc" when omp_os is "linux" for gcc\other versions
4.6.2 and higher. For icc on OS X\other, OS X\other versions
greater than 10.6 are not supported currently. Also, icc
version 13.0 is not supported. The selected compiler should be
installed and in the user's path. The corresponding
Fortran compiler should also be in the path.
- <b>mode</b>: Library mode: default is "release". Also supports "debug".
To use any of the options above, simple add &lt;option_name&gt;=&lt;value&gt;. For
example, if you want to build with gcc instead of icc, type:
Out-of-LLVM-tree build:
@code
% make compiler=gcc
$ cd where-you-want-to-live
Check out openmp
$ cd where-you-want-to-live/openmp/runtime
$ mkdir build && cd build
$ cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make
@endcode
Underneath the hood of the top-level Makefile, the runtime is built by
a perl script that in turn drives a detailed runtime system make. The
script can be found at <tt>tools/build.pl</tt>, and will print
information about all its flags and controls if invoked as
@code
% tools/build.pl --help
@endcode
If invoked with no arguments, it will try to build a set of libraries
that are appropriate for the machine on which the build is happening.
There are many options for building out of tree, and configuring library
features that can also be used. Consult the <tt>--help</tt> output for details.
@section sec_supported Supported RTL Build Configurations
The architectures supported are IA-32 architecture, Intel&reg;&nbsp; 64, and
@@ -96,17 +59,39 @@ Intel&reg;&nbsp; Many Integrated Core Architecture. The build configurations
supported are shown in the table below.
<table border=1>
<tr><th> <th>icc/icl<th>gcc
<tr><td>Linux\other OS<td>Yes(1,5)<td>Yes(2,4)
<tr><td>OS X\other<td>Yes(1,3,4)<td>No
<tr><td>Windows\other OS<td>Yes(1,4)<td>No
<tr><th> <th>icc/icl<th>gcc<th>clang
<tr><td>Linux\other OS<td>Yes(1,5)<td>Yes(2,4)<td>Yes(4,6,7)
<tr><td>FreeBSD\other<td>Yes(1,5)<td>Yes(2,4)<td>Yes(4,6,7,8)
<tr><td>OS X\other<td>Yes(1,3,4)<td>No<td>Yes(4,6,7)
<tr><td>Windows\other OS<td>Yes(1,4)<td>No<td>No
</table>
(1) On IA-32 architecture and Intel&reg;&nbsp; 64, icc/icl versions 12.x
are supported (12.1 is recommended).<br>
(2) gcc version 4.6.2 is supported.<br>
(2) gcc version 4.7 is supported.<br>
(3) For icc on OS X\other, OS X\other version 10.5.8 is supported.<br>
(4) Intel&reg;&nbsp; Many Integrated Core Architecture not supported.<br>
(5) On Intel&reg;&nbsp; Many Integrated Core Architecture, icc/icl versions 13.0 or later are required.
(5) On Intel&reg;&nbsp; Many Integrated Core Architecture, icc/icl versions 13.0 or later are required.<br>
(6) Clang\other version 3.3 is supported.<br>
(7) Clang\other currently does not offer a software-implemented 128 bit extended
precision type. Thus, all entry points reliant on this type are removed
from the library and cannot be called in the user program. The following
functions are not available:
@code
__kmpc_atomic_cmplx16_*
__kmpc_atomic_float16_*
__kmpc_atomic_*_fp
@endcode
(8) Community contribution provided AS IS, not tested by Intel.
Supported Architectures: IBM(R) Power 7 and Power 8
<table border=1>
<tr><th> <th>gcc<th>clang
<tr><td>Linux\other OS<td>Yes(1,2)<td>Yes(3,4)
</table>
(1) On Power 7, gcc version 4.8.2 is supported.<br>
(2) On Power 8, gcc version 4.8.2 is supported.<br>
(3) On Power 7, clang version 3.7 is supported.<br>
(4) On Power 8, clang version 3.7 is supported.<br>
@section sec_frontend Front-end Compilers that work with this RTL
@@ -208,7 +193,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 libiomp5
- @ref STATS_GATHERING macros to support developer profiling of libomp
- Documentation on tasking has still to be written...
@section SEC_EXAMPLES Examples
@@ -321,12 +306,12 @@ These functions are used for implementing barriers.
These functions support copyin/out and thread private data.
@defgroup STATS_GATHERING Statistics Gathering from OMPTB
These macros support profiling the libiomp5 library. Use --stats=on when building with build.pl to enable
and then use the KMP_* macros to profile (through counts or clock ticks) libiomp5 during execution of an OpenMP program.
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 libiomp5
This section describes the environment variables relevant to stats-gathering in libomp
@code
KMP_STATS_FILE
+320 -171
View File
@@ -1,183 +1,332 @@
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})
# Configure omp.h, kmp_config.h and ompt.h if necessary
configure_file(${LIBOMP_INC_DIR}/omp.h.var omp.h @ONLY)
configure_file(kmp_config.h.cmake kmp_config.h @ONLY)
if(${LIBOMP_OMPT_SUPPORT})
configure_file(${LIBOMP_INC_DIR}/ompt.h.var ompt.h @ONLY)
endif()
# Generate message catalog files: kmp_i18n_id.inc and kmp_i18n_default.inc
add_custom_command(
OUTPUT kmp_i18n_id.inc
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/message-converter.pl --os=${LIBOMP_PERL_SCRIPT_OS}
--prefix=kmp_i18n --enum=kmp_i18n_id.inc ${LIBOMP_SRC_DIR}/i18n/en_US.txt
DEPENDS ${LIBOMP_SRC_DIR}/i18n/en_US.txt ${LIBOMP_TOOLS_DIR}/message-converter.pl
)
add_custom_command(
OUTPUT kmp_i18n_default.inc
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/message-converter.pl --os=${LIBOMP_PERL_SCRIPT_OS}
--prefix=kmp_i18n --default=kmp_i18n_default.inc ${LIBOMP_SRC_DIR}/i18n/en_US.txt
DEPENDS ${LIBOMP_SRC_DIR}/i18n/en_US.txt ${LIBOMP_TOOLS_DIR}/message-converter.pl
)
# Set the -D definitions for all sources
# UNICODE and _UNICODE are set in LLVM's CMake system. They affect the
# ittnotify code and should only be set when compiling ittnotify_static.c
# on Windows (done below).
# TODO: Fix the UNICODE usage in ittnotify code for Windows.
remove_definitions(-DUNICODE -D_UNICODE)
libomp_get_definitions_flags(LIBOMP_CONFIGURED_DEFINITIONS_FLAGS)
add_definitions(${LIBOMP_CONFIGURED_DEFINITIONS_FLAGS})
# 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(${LIBOMP_USE_HWLOC})
include_directories(${LIBOMP_HWLOC_INSTALL_DIR}/include)
endif()
# Getting correct source files to build library
set(LIBOMP_CFILES)
set(LIBOMP_CXXFILES)
set(LIBOMP_ASMFILES)
if(${STUBS_LIBRARY})
set(LIBOMP_CFILES kmp_stub.c)
else()
# Get C files
set(LIBOMP_CFILES
kmp_alloc.c
kmp_atomic.c
kmp_csupport.c
kmp_debug.c
kmp_itt.c
kmp_environment.c
kmp_error.c
kmp_global.c
kmp_i18n.c
kmp_io.c
kmp_runtime.c
kmp_settings.c
kmp_str.c
kmp_tasking.c
kmp_taskq.c
kmp_threadprivate.c
kmp_utility.c
)
if(WIN32)
# Windows specific files
libomp_append(LIBOMP_CFILES z_Windows_NT_util.c)
libomp_append(LIBOMP_CFILES z_Windows_NT-586_util.c)
libomp_append(LIBOMP_ASMFILES z_Windows_NT-586_asm.asm) # Windows assembly file
else()
# Unix specific files
libomp_append(LIBOMP_CFILES z_Linux_util.c)
libomp_append(LIBOMP_CFILES kmp_gsupport.c)
libomp_append(LIBOMP_ASMFILES z_Linux_asm.s) # Unix assembly file
endif()
libomp_append(LIBOMP_CFILES thirdparty/ittnotify/ittnotify_static.c LIBOMP_USE_ITT_NOTIFY)
libomp_append(LIBOMP_CFILES kmp_debugger.c LIBOMP_USE_DEBUGGER)
# Get C++ files
set(LIBOMP_CXXFILES
kmp_barrier.cpp
kmp_wait_release.cpp
kmp_affinity.cpp
kmp_dispatch.cpp
kmp_lock.cpp
kmp_sched.cpp
)
libomp_append(LIBOMP_CXXFILES kmp_stats.cpp LIBOMP_STATS)
libomp_append(LIBOMP_CXXFILES kmp_stats_timing.cpp LIBOMP_STATS)
if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
libomp_append(LIBOMP_CXXFILES kmp_taskdeps.cpp)
libomp_append(LIBOMP_CXXFILES kmp_cancel.cpp)
endif()
endif()
# Files common to stubs and normal library
libomp_append(LIBOMP_CFILES kmp_ftn_cdecl.c)
libomp_append(LIBOMP_CFILES kmp_ftn_extra.c)
libomp_append(LIBOMP_CFILES kmp_version.c)
libomp_append(LIBOMP_CFILES ompt-general.c IF_TRUE LIBOMP_OMPT_SUPPORT)
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()
# Remove any cmake-automatic linking of the standard C++ library.
# We neither need (nor want) the standard C++ library dependency even though we compile c++ files.
if(NOT ${LIBOMP_USE_STDCPPLIB})
set(LIBOMP_LINKER_LANGUAGE C)
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
else()
set(LIBOMP_LINKER_LANGUAGE CXX)
endif()
# Add the OpenMP library
libomp_get_ldflags(LIBOMP_CONFIGURED_LDFLAGS)
add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES})
set_target_properties(omp PROPERTIES
PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_LIB_FILE}"
LINK_FLAGS "${LIBOMP_CONFIGURED_LDFLAGS}"
LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
)
# Get the library's location within the build tree for the unit tester
if(NOT WIN32)
get_target_property(LIBOMP_LIBRARY_DIR omp LIBRARY_OUTPUT_DIRECTORY)
else()
get_target_property(LIBOMP_LIBRARY_DIR omp RUNTIME_OUTPUT_DIRECTORY)
endif()
if(NOT LIBOMP_LIBRARY_DIR)
set(LIBOMP_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(LIBOMP_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
else()
set(LIBOMP_LIBRARY_DIR ${LIBOMP_LIBRARY_DIR} PARENT_SCOPE)
endif()
# Add symbolic links to libomp
if(NOT WIN32)
add_custom_command(TARGET omp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE}
libgomp${LIBOMP_LIBRARY_SUFFIX}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE}
libiomp5${LIBOMP_LIBRARY_SUFFIX}
WORKING_DIRECTORY ${LIBOMP_LIBRARY_DIR}
)
endif()
# Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS)
target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${CMAKE_DL_LIBS})
# Create *.inc before compiling any sources
# objects depend on : .inc files
add_custom_target(libomp-needed-headers DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc)
add_dependencies(omp libomp-needed-headers)
# Windows specific build rules
if(WIN32)
set(OS_GEN "win")
elseif(APPLE)
set(OS_GEN "mac")
elseif(UNIX)
set(OS_GEN "lin")
configure_file(libomp.rc.var libomp.rc @ONLY)
# Create .def and .rc file before compiling any sources
add_custom_target(libomp-needed-windows-files DEPENDS ${LIBOMP_LIB_NAME}.def)
add_dependencies(omp libomp-needed-windows-files)
# z_Windows_NT-586_asm.asm requires definitions to be sent via command line
# It only needs the architecutre macro and OMPT_SUPPORT=0|1
libomp_append(LIBOMP_MASM_DEFINITIONS "-D_M_IA32" IF_TRUE IA32)
libomp_append(LIBOMP_MASM_DEFINITIONS "-D_M_AMD64" IF_TRUE INTEL64)
libomp_append(LIBOMP_MASM_DEFINITIONS "-DOMPT_SUPPORT" IF_TRUE_1_0 LIBOMP_OMPT_SUPPORT)
libomp_list_to_string("${LIBOMP_MASM_DEFINITIONS}" LIBOMP_MASM_DEFINITIONS)
set_property(SOURCE z_Windows_NT-586_asm.asm APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBOMP_MASM_DEFINITIONS}")
set_source_files_properties(thirdparty/ittnotify/ittnotify_static.c PROPERTIES COMPILE_DEFINITIONS "UNICODE")
# Create Windows import library
# the import library is "re-linked" to include kmp_import.c which prevents
# linking of both Visual Studio OpenMP and newly built OpenMP
set_source_files_properties(kmp_import.c PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CFLAGS}")
set(LIBOMP_IMP_LIB_FILE ${LIBOMP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBOMP_GENERATED_IMP_LIB_FILENAME ${LIBOMP_LIB_FILE}${CMAKE_STATIC_LIBRARY_SUFFIX})
set_target_properties(omp PROPERTIES
VERSION ${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR} # uses /version flag
IMPORT_PREFIX "" IMPORT_SUFFIX "" # control generated import library name when building omp
ARCHIVE_OUTPUT_NAME ${LIBOMP_GENERATED_IMP_LIB_FILENAME}
)
# Get generated import library from creating omp
get_target_property(LIBOMP_IMPORT_LIB_DIRECTORY omp ARCHIVE_OUTPUT_DIRECTORY)
if(LIBOMP_IMPORT_LIB_DIRECTORY)
set(LIBOMP_GENERATED_IMP_LIB ${LIBOMP_IMPORT_LIB_DIRECTORY}/${LIBOMP_GENERATED_IMP_LIB_FILENAME})
else()
set(LIBOMP_GENERATED_IMP_LIB ${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_GENERATED_IMP_LIB_FILENAME})
endif()
set_source_files_properties(${LIBOMP_GENERATED_IMP_LIB} PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
# Create new import library that is just the previously created one + kmp_import.c
add_library(ompimp STATIC ${LIBOMP_GENERATED_IMP_LIB} kmp_import.c)
set_target_properties(ompimp PROPERTIES
PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}"
LINKER_LANGUAGE C
)
add_dependencies(ompimp omp) # ensure generated import library is created first
# Create def file to designate exported functions
libomp_get_gdflags(LIBOMP_GDFLAGS) # generate-def.pl flags (Windows only)
libomp_string_to_list("${LIBOMP_GDFLAGS}" LIBOMP_GDFLAGS)
add_custom_command(
OUTPUT ${LIBOMP_LIB_NAME}.def
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/generate-def.pl ${LIBOMP_GDFLAGS}
-o ${LIBOMP_LIB_NAME}.def ${CMAKE_CURRENT_SOURCE_DIR}/dllexports
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dllexports ${LIBOMP_TOOLS_DIR}/generate-def.pl
)
endif()
# Building the Fortran module files
# One compilation step creates both omp_lib.mod and omp_lib_kinds.mod
if(${LIBOMP_FORTRAN_MODULES})
configure_file(${LIBOMP_INC_DIR}/omp_lib.h.var omp_lib.h @ONLY)
configure_file(${LIBOMP_INC_DIR}/omp_lib.f.var omp_lib.f @ONLY)
configure_file(${LIBOMP_INC_DIR}/omp_lib.f90.var omp_lib.f90 @ONLY)
add_custom_target(libomp-mod ALL DEPENDS omp_lib.mod omp_lib_kinds.mod)
libomp_get_fflags(LIBOMP_CONFIGURED_FFLAGS)
if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
set(LIBOMP_FORTRAN_SOURCE_FILE omp_lib.f90)
else()
set(LIBOMP_FORTRAN_SOURCE_FILE omp_lib.f)
endif()
add_custom_command(
OUTPUT omp_lib.mod omp_lib_kinds.mod
COMMAND ${CMAKE_Fortran_COMPILER} -c ${LIBOMP_CONFIGURED_FFLAGS} ${LIBOMP_FORTRAN_SOURCE_FILE}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_FORTRAN_SOURCE_FILE}
${CMAKE_CURRENT_BINARY_DIR}/omp_lib.h
)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES omp_lib${CMAKE_C_OUTPUT_EXTENSION})
endif()
# 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()
message(FATAL_ERROR "Unsupported OS")
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(arch)
set(ARCH ${arch}) #acquire from command line
else() # Ensure ARCH is set
message(FATAL_ERROR "ARCH not set. Possible values are 32e 32 arm ppc64 aarch64. Example -DARCH=e32 for x86-64/Intel64")
endif()
if("${arch}" STREQUAL "32e")
set(ARCH_STR "Intel(R) 64")
elseif("${arch}" STREQUAL "ppc64")
set(ARCH_STR "PPC64")
elseif("${arch}" STREQUAL "aarch64")
set(ARCH_STR "AARCH64")
endif()
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}")
# customize cache line size for ppc64 to 128 bytes: 64 in all other cases
if("${arch}" STREQUAL "ppc64")
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D CACHE_LINE=128")
if(WIN32)
install(TARGETS omp RUNTIME DESTINATION bin)
install(TARGETS ompimp ARCHIVE DESTINATION lib${LIBOMP_LIBDIR_SUFFIX})
# Create aliases (regular copies) of the library for backwards compatibility
set(LIBOMP_ALIASES "libiomp5md")
foreach(alias IN LISTS LIBOMP_ALIASES)
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\"
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)")
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\"
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})")
endforeach()
else()
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D CACHE_LINE=64")
install(TARGETS omp ${LIBOMP_INSTALL_KIND} DESTINATION lib${LIBOMP_LIBDIR_SUFFIX})
# Create aliases (symlinks) of the library for backwards compatibility
set(LIBOMP_ALIASES "libgomp;libiomp5")
foreach(alias IN LISTS LIBOMP_ALIASES)
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_FILE}\"
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})")
endforeach()
endif()
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/omp.h
DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH}
)
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()
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")
#adaptive locks use x86 assembly - disable for ppc64
if("${arch}" STREQUAL "32e" OR "${arch}" STREQUAL "32")
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ADAPTIVE_LOCKS=1")
set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_DEBUG_ADAPTIVE_LOCKS=0")
endif()
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
)
set_source_files_properties(${SOURCES} PROPERTIES LANGUAGE CXX)
set_source_files_properties(${ASM_SOURCES} PROPERTIES LANGUAGE CXX)
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
)
if("${ARCH}" STREQUAL "ppc64")
set(KMP_ARCH_TEMP "KMP_ARCH_PPC64")
elseif("${ARCH}" STREQUAL "arm")
set(KMP_ARCH_TEMP "KMP_ARCH_ARM")
elseif("${ARCH}" STREQUAL "aarch64")
set(KMP_ARCH_TEMP "KMP_ARCH_AARCH64")
else
set(KMP_ARCH_TEMP "KMP_ARCH_X86_64")
endif()
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_TEMP} -x assembler-with-cpp ${CMAKE_CURRENT_SOURCE_DIR}/${ASM_SOURCES}
)
add_custom_target(gen_kmp_i18n DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc omp.h z_Linux_asm.o)
if(NOT APPLE)
if(${ARCH} STREQUAL "ppc64" AND ${OS_GEN} STREQUAL "lin")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt -ldl")
else()
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt")
endif()
endif()
add_library(iomp5 SHARED ${SOURCES} z_Linux_asm.o)
# This is a workaround to a known ppc64 issue about libpthread. For more
# information see
# http://ryanarn.blogspot.com/2011/07/curious-case-of-pthreadatfork-on.html
if("${ARCH}" STREQUAL "ppc64")
find_library(PTHREAD NAMES pthread)
target_link_libraries(iomp5 ${PTHREAD})
endif()
add_dependencies(iomp5 gen_kmp_i18n)
-65
View File
@@ -1,65 +0,0 @@
# defs.mk
# $Revision: 42951 $
# $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# --------------------------------------------------------------------------------------------------
# This file contains definitions common for OpenMP RTL and DSL makefiles.
# --------------------------------------------------------------------------------------------------
# Include really common definitions.
include $(LIBOMP_WORK)tools/src/common-defs.mk
#
# Directories.
#
# Check and normalize LIBOMP_EXPORTS.
ifeq "$(LIBOMP_EXPORTS)" ""
$(error LIBOMP_EXPORTS environment variable must be set)
endif
ifneq "$(words $(LIBOMP_EXPORTS))" "1"
$(error LIBOMP_EXPORTS must not contain spaces)
endif
override LIBOMP_EXPORTS := $(subst \,/,$(LIBOMP_EXPORTS))
ifeq "$(filter %/,$(LIBOMP_EXPORTS))" ""
override LIBOMP_EXPORTS := $(LIBOMP_EXPORTS)/
endif
# Output directories.
out_dir = $(LIBOMP_EXPORTS)
out_cmn_dir = $(out_dir)common$(suffix)/
out_ptf_dir = $(out_dir)$(platform)$(suffix)/
_out_lib_dir = $(out_dir)$(1)$(suffix)/lib$(if $(filter mac_%,$(1)),.thin)/
out_lib_dir = $(call _out_lib_dir,$(platform))
out_l10n_dir = $(out_lib_dir)$(if $(filter lin mac,$(os)),locale/)
ifeq "$(os)" "mac"
_out_lib_fat_dir = $(out_dir)$(1)$(suffix)/lib/
out_lib_fat_dir = $(call _out_lib_fat_dir,$(platform))
out_l10n_fat_dir = $(out_lib_fat_dir)locale/
endif
#
# Retrieve build number,
#
ifeq "$(clean)" ""
# Parse kmp_version.c file, look for "#define KMP_VERSION_BUILD yyyymmdd" string,
# leave only "yyyymmdd". Note: Space after $$1 is important, it helps to detect possible errors.
build := $(strip $(shell $(perl) -p -e '$$_ =~ s{^(?:\s*\#define\s+KMP_VERSION_BUILD\s+([0-9]{8})|.*)\s*\n}{$$1 }' $(LIBOMP_WORK)src/kmp_version.c))
ifneq "$(words $(build))" "1"
$(error Failed to pase "kmp_version.c", cannot extract build number)
endif
$(call say,Build : $(build)$(if $(filter 00000000,$(build)), (development)))
endif
# end of file #
+60 -13
View File
@@ -160,7 +160,6 @@
# Regular entry points
__kmp_wait_yield_4
__kmp_wait_yield_8
__kmp_fork_call
__kmp_invoke_microtask
__kmp_launch_monitor
@@ -182,20 +181,20 @@
%endif
%ifdef USE_DEBUGGER
__kmp_debugging DATA
__kmp_omp_debug_struct_info DATA
%endif
# Symbols for MS mutual detection:
_You_must_link_with_exactly_one_OpenMP_library DATA
_You_must_link_with_Intel_OpenMP_library DATA
%ifdef msvc_compat
_You_must_link_with_Microsoft_OpenMP_library DATA
%endif
# Symbols for MS mutual detection:
_You_must_link_with_exactly_one_OpenMP_library DATA
_You_must_link_with_Intel_OpenMP_library DATA
%ifdef msvc_compat
_You_must_link_with_Microsoft_OpenMP_library DATA
%endif
__kmp_wait_32
__kmp_wait_64
__kmp_wait_oncore
__kmp_release_32
__kmp_release_64
__kmp_release_oncore
__kmp_wait_64
__kmp_release_64
# VT_getthid 1
@@ -381,6 +380,21 @@ kmpc_set_defaults 224
%endif # OMP_40
%endif
# OpenMP 4.5 entry points
%ifndef stub
%ifdef OMP_45
__kmpc_proxy_task_completed 259
__kmpc_proxy_task_completed_ooo 260
__kmpc_doacross_init 261
__kmpc_doacross_wait 262
__kmpc_doacross_post 263
__kmpc_doacross_fini 264
__kmpc_taskloop 266
%endif
%endif
kmpc_aligned_malloc 265
kmpc_set_disp_num_buffers 267
# User API entry points that have both lower- and upper- case versions for Fortran.
# Number for lowercase version is indicated. Number for uppercase is obtained by adding 1000.
# User API entry points are entry points that start with 'kmp_' or 'omp_'.
@@ -432,6 +446,7 @@ kmp_get_num_known_threads 743
kmp_set_stacksize_s 744
kmp_get_stacksize_s 745
kmp_set_defaults 746
kmp_aligned_malloc 747
kmp_set_warnings_on 779
kmp_set_warnings_off 780
@@ -478,8 +493,40 @@ kmp_set_warnings_off 780
omp_get_team_num 866
omp_get_cancellation 867
kmp_get_cancellation_status 868
omp_is_initial_device 869
%ifdef stub
omp_set_default_device 879
omp_get_default_device 880
omp_get_num_devices 881
%endif
%endif # OMP_40
# OpenMP 45
%ifdef OMP_45
omp_init_lock_with_hint 870
omp_init_nest_lock_with_hint 871
omp_get_max_task_priority 872
omp_get_num_places 873
omp_get_place_num_procs 874
omp_get_place_proc_ids 875
omp_get_place_num 876
omp_get_partition_num_places 877
omp_get_partition_place_nums 878
%ifdef stub
omp_get_initial_device 882
omp_target_alloc 883
omp_target_free 884
omp_target_is_present 885
omp_target_memcpy 886
omp_target_memcpy_rect 887
omp_target_associate_ptr 888
omp_target_disassociate_ptr 889
%endif
%endif # OMP_45
kmp_set_disp_num_buffers 890
%ifndef stub
# Ordinals between 900 and 999 are reserved
+24 -6
View File
@@ -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,22 @@ VERSION {
# "Normal" symbols.
#
omp_*; # Standard OpenMP functions.
#
# OMPT API
#
ompt_tool; # 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 +46,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.
@@ -66,14 +89,9 @@ VERSION {
__kmp_launch_worker;
__kmp_reap_monitor;
__kmp_reap_worker;
__kmp_release_32;
__kmp_release_64;
__kmp_release_oncore;
__kmp_wait_32;
__kmp_wait_64;
__kmp_wait_oncore;
__kmp_wait_yield_4;
__kmp_wait_yield_8;
# ittnotify symbols to be used by debugger
__kmp_itt_fini_ittlib;
+4 -6
View File
@@ -1,7 +1,5 @@
/*
* extractExternal.cpp
* $Revision: 43084 $
* $Date: 2014-04-15 09:15:14 -0500 (Tue, 15 Apr 2014) $
*/
@@ -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
+26 -21
View File
@@ -1,6 +1,4 @@
# en_US.txt #
# $Revision: 43419 $
# $Date: 2014-08-27 14:59:52 -0500 (Wed, 27 Aug 2014) $
#
#//===----------------------------------------------------------------------===//
@@ -40,7 +38,7 @@ Language "English"
Country "USA"
LangId "1033"
Version "2"
Revision "20140827"
Revision "20160405"
@@ -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\":"
@@ -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."
@@ -391,9 +388,10 @@ OBSOLETE "%1$s: granularity=core will be used."
EnvLockWarn "%1$s must be set prior to first OMP lock call or critical section; ignored."
FutexNotSupported "futex system call not supported; %1$s=%2$s ignored."
AffGranUsing "%1$s: granularity=%2$s will be used."
AffThrPlaceInvalid "%1$s: invalid value \"%2$s\", valid format is \"nC,mT[,kO]\"."
AffThrPlaceUnsupported "KMP_PLACE_THREADS ignored: unsupported architecture."
AffThrPlaceManyCores "KMP_PLACE_THREADS ignored: too many cores requested."
AffHWSubsetInvalid "%1$s: invalid value \"%2$s\", valid format is \"Ns[@N],Nc[@N],Nt "
"(nSockets@offset, nCores@offset, nTthreads per core)\"."
AffHWSubsetUnsupported "KMP_HW_SUBSET ignored: unsupported architecture."
AffHWSubsetManyCores "KMP_HW_SUBSET ignored: too many cores requested."
SyntaxErrorUsing "%1$s: syntax error, using %2$s."
AdaptiveNotSupported "%1$s: Adaptive locks are not supported; using queuing."
EnvSyntaxError "%1$s: Invalid symbols found. Check the value \"%2$s\"."
@@ -401,10 +399,17 @@ EnvSpacesNotAllowed "%1$s: Spaces between digits are not allowed \"%2$s
BoundToOSProcSet "%1$s: pid %2$d thread %3$d bound to OS proc set %4$s"
CnsLoopIncrIllegal "%1$s error: parallel loop increment and condition are inconsistent."
NoGompCancellation "libgomp cancellation is not currently supported."
AffThrPlaceNonUniform "KMP_PLACE_THREADS ignored: non-uniform topology."
AffThrPlaceNonThreeLevel "KMP_PLACE_THREADS ignored: only three-level topology is supported."
AffHWSubsetNonUniform "KMP_HW_SUBSET ignored: non-uniform topology."
AffHWSubsetNonThreeLevel "KMP_HW_SUBSET ignored: only three-level topology is supported."
AffGranTopGroup "%1$s: granularity=%2$s is not supported with KMP_TOPOLOGY_METHOD=group. Using \"granularity=fine\"."
AffGranGroupType "%1$s: granularity=group is not supported with KMP_AFFINITY=%2$s. Using \"granularity=core\"."
AffHWSubsetManySockets "KMP_HW_SUBSET ignored: too many sockets requested."
AffHWSubsetDeprecated "KMP_HW_SUBSET \"o\" offset designator deprecated, please use @ prefix for offset value."
AffUsingHwloc "%1$s: Affinity capable, using hwloc."
AffIgnoringHwloc "%1$s: Ignoring hwloc mechanism."
AffHwlocErrorOccurred "%1$s: Hwloc failed in %2$s. Relying on internal affinity mechanisms."
EnvSerialWarn "%1$s must be set prior to OpenMP runtime library initialization; ignored."
EnvVarDeprecated "%1$s variable deprecated, please use %2$s instead."
# --------------------------------------------------------------------------------------------------
@@ -456,8 +461,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. "
-83
View File
@@ -1,83 +0,0 @@
/*
* include/25/iomp.h.var
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#ifndef __IOMP_H
# define __IOMP_H
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
# ifdef __cplusplus
extern "C" {
# endif
# define kmp_set_stacksize kmpc_set_stacksize
# define kmp_set_stacksize_s kmpc_set_stacksize_s
# define kmp_set_blocktime kmpc_set_blocktime
# define kmp_set_library kmpc_set_library
# define kmp_set_defaults kmpc_set_defaults
# define kmp_malloc kmpc_malloc
# define kmp_calloc kmpc_calloc
# define kmp_realloc kmpc_realloc
# define kmp_free kmpc_free
# if defined(_WIN32)
# define __KAI_KMPC_CONVENTION __cdecl
# else
# define __KAI_KMPC_CONVENTION
# endif
# include <stdlib.h>
/* kmp API functions */
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
# undef __KAI_KMPC_CONVENTION
/* Warning:
The following typedefs are not standard, deprecated and will be removed in a future release.
*/
typedef int omp_int_t;
typedef double omp_wtime_t;
# ifdef __cplusplus
}
# endif
#endif /* __IOMP_H */
-66
View File
@@ -1,66 +0,0 @@
! include/25/iomp_lib.h.var
! $Revision: 42951 $
! $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
!
!//===----------------------------------------------------------------------===//
!//
!// The LLVM Compiler Infrastructure
!//
!// This file is dual licensed under the MIT and the University of Illinois Open
!// Source Licenses. See LICENSE.txt for details.
!//
!//===----------------------------------------------------------------------===//
!
!***
!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and
!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f).
!*** omp_real_kind is not predefined, however.
!***
integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD
character(*) kmp_build_date
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
integer, parameter :: omp_real_kind = 4
!***
!*** kmp_* type extensions
!***
integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND
integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND
!***
!*** kmp_* entry points
!***
external kmp_set_stacksize
external kmp_set_stacksize_s
external kmp_set_blocktime
external kmp_set_library_serial
external kmp_set_library_turnaround
external kmp_set_library_throughput
external kmp_set_library
external kmp_set_defaults
external kmp_get_stacksize
integer kmp_get_stacksize
external kmp_get_stacksize_s
integer (kind = kmp_size_t_kind) kmp_get_stacksize_s
external kmp_get_blocktime
integer kmp_get_blocktime
external kmp_get_library
integer kmp_get_library
external kmp_malloc
integer (kind = kmp_pointer_kind) kmp_malloc
external kmp_calloc
integer (kind = kmp_pointer_kind) kmp_calloc
external kmp_realloc
integer (kind = kmp_pointer_kind) kmp_realloc
external kmp_free
external kmp_set_warnings_on
external kmp_set_warnings_off
-128
View File
@@ -1,128 +0,0 @@
/*
* include/25/omp.h.var
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
//===----------------------------------------------------------------------===//
//
// 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 __OMP_H
# define __OMP_H
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
# ifdef __cplusplus
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
/* 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);
/* query API functions */
extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void);
extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void);
extern int __KAI_KMPC_CONVENTION omp_get_nested (void);
extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void);
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);
/* lock API functions */
typedef struct omp_lock_t {
void * _lk;
} omp_lock_t;
extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *);
extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *);
/* nested lock API functions */
typedef struct omp_nest_lock_t {
void * _lk;
} omp_nest_lock_t;
extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *);
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 *);
/* time API functions */
extern double __KAI_KMPC_CONVENTION omp_get_wtime (void);
extern double __KAI_KMPC_CONVENTION omp_get_wtick (void);
# include <stdlib.h>
/* kmp API functions */
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
# undef __KAI_KMPC_CONVENTION
/* Warning:
The following typedefs are not standard, deprecated and will be removed in a future release.
*/
typedef int omp_int_t;
typedef double omp_wtime_t;
# ifdef __cplusplus
}
# endif
#endif /* __OMP_H */
-472
View File
@@ -1,472 +0,0 @@
! include/25/omp_lib.f.var
! $Revision: 42951 $
! $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
!
!//===----------------------------------------------------------------------===//
!//
!// 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
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()
end module omp_lib_kinds
module omp_lib
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
character(*), parameter :: kmp_build_date = '$KMP_BUILD_DATE'
integer, parameter :: openmp_version = 200505
interface
! ***
! *** omp_* entry points
! ***
subroutine omp_set_num_threads(nthreads)
use omp_lib_kinds
integer (kind=omp_integer_kind) nthreads
end subroutine omp_set_num_threads
subroutine omp_set_dynamic(enable)
use omp_lib_kinds
logical (kind=omp_logical_kind) enable
end subroutine omp_set_dynamic
subroutine omp_set_nested(enable)
use omp_lib_kinds
logical (kind=omp_logical_kind) enable
end subroutine omp_set_nested
function omp_get_num_threads()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_num_threads
end function omp_get_num_threads
function omp_get_max_threads()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_max_threads
end function omp_get_max_threads
function omp_get_thread_num()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_thread_num
end function omp_get_thread_num
function omp_get_num_procs()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_num_procs
end function omp_get_num_procs
function omp_in_parallel()
use omp_lib_kinds
logical (kind=omp_logical_kind) omp_in_parallel
end function omp_in_parallel
function omp_get_dynamic()
use omp_lib_kinds
logical (kind=omp_logical_kind) omp_get_dynamic
end function omp_get_dynamic
function omp_get_nested()
use omp_lib_kinds
logical (kind=omp_logical_kind) omp_get_nested
end function omp_get_nested
function omp_get_wtime()
use omp_lib_kinds
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
subroutine omp_init_lock(lockvar)
use omp_lib_kinds
integer (kind=omp_lock_kind) lockvar
end subroutine omp_init_lock
subroutine omp_destroy_lock(lockvar)
use omp_lib_kinds
integer (kind=omp_lock_kind) lockvar
end subroutine omp_destroy_lock
subroutine omp_set_lock(lockvar)
use omp_lib_kinds
integer (kind=omp_lock_kind) lockvar
end subroutine omp_set_lock
subroutine omp_unset_lock(lockvar)
use omp_lib_kinds
integer (kind=omp_lock_kind) lockvar
end subroutine omp_unset_lock
function omp_test_lock(lockvar)
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)
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) lockvar
end subroutine omp_init_nest_lock
subroutine omp_destroy_nest_lock(lockvar)
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) lockvar
end subroutine omp_destroy_nest_lock
subroutine omp_set_nest_lock(lockvar)
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) lockvar
end subroutine omp_set_nest_lock
subroutine omp_unset_nest_lock(lockvar)
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) lockvar
end subroutine omp_unset_nest_lock
function omp_test_nest_lock(lockvar)
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)
use omp_lib_kinds
integer (kind=omp_integer_kind) size
end subroutine kmp_set_stacksize
subroutine kmp_set_stacksize_s(size)
use omp_lib_kinds
integer (kind=kmp_size_t_kind) size
end subroutine kmp_set_stacksize_s
subroutine kmp_set_blocktime(msec)
use omp_lib_kinds
integer (kind=omp_integer_kind) msec
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)
use omp_lib_kinds
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()
use omp_lib_kinds
integer (kind=omp_integer_kind) kmp_get_stacksize
end function kmp_get_stacksize
function kmp_get_stacksize_s()
use omp_lib_kinds
integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
end function kmp_get_stacksize_s
function kmp_get_blocktime()
use omp_lib_kinds
integer (kind=omp_integer_kind) kmp_get_blocktime
end function kmp_get_blocktime
function kmp_get_library()
use omp_lib_kinds
integer (kind=omp_integer_kind) kmp_get_library
end function kmp_get_library
function kmp_malloc(size)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_malloc
integer (kind=kmp_size_t_kind) size
end function kmp_malloc
function kmp_calloc(nelem, elsize)
use omp_lib_kinds
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)
use omp_lib_kinds
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)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) ptr
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
!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_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_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_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_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
end module omp_lib
-256
View File
@@ -1,256 +0,0 @@
! include/25/omp_lib.f90.var
! $Revision: 42951 $
! $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
!
!//===----------------------------------------------------------------------===//
!//
!// 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
-460
View File
@@ -1,460 +0,0 @@
! include/25/omp_lib.h.var
! $Revision: 42951 $
! $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
!
!//===----------------------------------------------------------------------===//
!//
!// 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
-98
View File
@@ -1,98 +0,0 @@
/*
* include/30/iomp.h.var
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#ifndef __IOMP_H
# define __IOMP_H
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
# ifdef __cplusplus
extern "C" {
# endif
# define kmp_set_stacksize kmpc_set_stacksize
# define kmp_set_stacksize_s kmpc_set_stacksize_s
# define kmp_set_blocktime kmpc_set_blocktime
# define kmp_set_library kmpc_set_library
# define kmp_set_defaults kmpc_set_defaults
# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc
# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc
# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc
# define kmp_malloc kmpc_malloc
# define kmp_calloc kmpc_calloc
# define kmp_realloc kmpc_realloc
# define kmp_free kmpc_free
# if defined(_WIN32)
# define __KAI_KMPC_CONVENTION __cdecl
# else
# define __KAI_KMPC_CONVENTION
# endif
# include <stdlib.h>
/* kmp API functions */
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
/* affinity API functions */
typedef void * kmp_affinity_mask_t;
extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
# undef __KAI_KMPC_CONVENTION
/* Warning:
The following typedefs are not standard, deprecated and will be removed in a future release.
*/
typedef int omp_int_t;
typedef double omp_wtime_t;
# ifdef __cplusplus
}
# endif
#endif /* __IOMP_H */
-83
View File
@@ -1,83 +0,0 @@
! include/30/iomp_lib.h.var
! $Revision: 42951 $
! $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
!
!//===----------------------------------------------------------------------===//
!//
!// The LLVM Compiler Infrastructure
!//
!// This file is dual licensed under the MIT and the University of Illinois Open
!// Source Licenses. See LICENSE.txt for details.
!//
!//===----------------------------------------------------------------------===//
!
!***
!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and
!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f).
!*** omp_real_kind is not predefined, however.
!***
integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD
character(*) kmp_build_date
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
integer, parameter :: omp_real_kind = 4
!***
!*** kmp_* type extensions
!***
integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND
integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND
integer, parameter :: kmp_affinity_mask_kind = $KMP_INT_PTR_KIND
!***
!*** kmp_* entry points
!***
external kmp_set_stacksize
external kmp_set_stacksize_s
external kmp_set_blocktime
external kmp_set_library_serial
external kmp_set_library_turnaround
external kmp_set_library_throughput
external kmp_set_library
external kmp_set_defaults
external kmp_get_stacksize
integer kmp_get_stacksize
external kmp_get_stacksize_s
integer (kind = kmp_size_t_kind) kmp_get_stacksize_s
external kmp_get_blocktime
integer kmp_get_blocktime
external kmp_get_library
integer kmp_get_library
external kmp_set_affinity
integer kmp_set_affinity
external kmp_get_affinity
integer kmp_get_affinity
external kmp_get_affinity_max_proc
integer kmp_get_affinity_max_proc
external kmp_create_affinity_mask
external kmp_destroy_affinity_mask
external kmp_set_affinity_mask_proc
integer kmp_set_affinity_mask_proc
external kmp_unset_affinity_mask_proc
integer kmp_unset_affinity_mask_proc
external kmp_get_affinity_mask_proc
integer kmp_get_affinity_mask_proc
external kmp_malloc
integer (kind = kmp_pointer_kind) kmp_malloc
external kmp_calloc
integer (kind = kmp_pointer_kind) kmp_calloc
external kmp_realloc
integer (kind = kmp_pointer_kind) kmp_realloc
external kmp_free
external kmp_set_warnings_on
external kmp_set_warnings_off
+6 -6
View File
@@ -1,7 +1,5 @@
/*
* include/30/omp.h.var
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
@@ -18,10 +16,10 @@
#ifndef __OMP_H
# define __OMP_H
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
# ifdef __cplusplus
extern "C" {
@@ -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);
@@ -142,6 +141,7 @@
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
+16 -7
View File
@@ -1,6 +1,4 @@
! include/30/omp_lib.f.var
! $Revision: 42951 $
! $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
!
!//===----------------------------------------------------------------------===//
@@ -38,11 +36,11 @@
use omp_lib_kinds
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
character(*), parameter :: kmp_build_date = '$KMP_BUILD_DATE'
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
@@ -325,6 +323,13 @@
integer (kind=kmp_size_t_kind) size
end function kmp_malloc
function kmp_aligned_malloc(size, alignment)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind) size
integer (kind=kmp_size_t_kind) alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_calloc
@@ -418,6 +423,7 @@
!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
!dec$ attributes alias:'KMP_FREE'::kmp_free
@@ -484,6 +490,7 @@
!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
!dec$ attributes alias:'_KMP_FREE'::kmp_free
@@ -553,6 +560,7 @@
!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
!dec$ attributes alias:'kmp_free_'::kmp_free
@@ -622,6 +630,7 @@
!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
!dec$ attributes alias:'_kmp_free_'::kmp_free
+17 -7
View File
@@ -1,6 +1,4 @@
! include/30/omp_lib.f90.var
! $Revision: 42951 $
! $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
!
!//===----------------------------------------------------------------------===//
@@ -34,12 +32,12 @@
use omp_lib_kinds
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*) kmp_build_date
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
@@ -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
@@ -325,6 +328,13 @@
integer (kind=kmp_size_t_kind), value :: size
end function kmp_malloc
function kmp_aligned_malloc(size, alignment) bind(c)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind), value :: size
integer (kind=kmp_size_t_kind), value :: alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize) bind(c)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_calloc
+25 -7
View File
@@ -1,6 +1,4 @@
! include/30/omp_lib.h.var
! $Revision: 42951 $
! $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
!
!//===----------------------------------------------------------------------===//
@@ -35,12 +33,12 @@
integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*) kmp_build_date
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
interface
@@ -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
@@ -318,6 +321,13 @@
integer (kind=kmp_size_t_kind) size
end function kmp_malloc
function kmp_aligned_malloc(size, alignment)
import
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind) size
integer (kind=kmp_size_t_kind) alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize)
import
integer (kind=kmp_pointer_kind) kmp_calloc
@@ -366,6 +376,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
@@ -412,6 +423,7 @@
!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
!dec$ attributes alias:'KMP_FREE'::kmp_free
@@ -433,6 +445,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
@@ -479,6 +492,7 @@
!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
!dec$ attributes alias:'_KMP_FREE'::kmp_free
@@ -503,6 +517,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
@@ -549,6 +564,7 @@
!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
!dec$ attributes alias:'kmp_free_'::kmp_free
@@ -573,6 +589,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
@@ -619,6 +636,7 @@
!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
!dec$ attributes alias:'_kmp_free_'::kmp_free
+488
View File
@@ -0,0 +1,488 @@
/*
* 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_end_parallel_callback_t, 2) /* parallel end */ \
\
macro (ompt_event_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
\
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_pair_callback_t, 26) /* task switch */ \
\
macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \
macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \
\
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 enum {
ompt_invoker_program = 0, /* program invokes master task */
ompt_invoker_runtime = 1 /* runtime invokes master task */
} ompt_invoker_t;
typedef void (*ompt_thread_type_callback_t) (
ompt_thread_type_t thread_type, /* type of thread */
ompt_thread_id_t thread_id /* ID of thread */
);
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 */
ompt_invoker_t invoker /* who invokes master task? */
);
typedef void (*ompt_end_parallel_callback_t) (
ompt_parallel_id_t parallel_id, /* id of parallel region */
ompt_task_id_t task_id, /* id of task */
ompt_invoker_t invoker /* who invokes master task? */
);
/* tasks */
typedef void (*ompt_task_callback_t) (
ompt_task_id_t task_id /* id of task */
);
typedef void (*ompt_task_pair_callback_t) (
ompt_task_id_t first_task_id,
ompt_task_id_t second_task_id
);
typedef void (*ompt_new_task_callback_t) (
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
***************************************************************************/
OMPT_API_FUNCTION(void, ompt_initialize, (
ompt_function_lookup_t ompt_fn_lookup,
const char *runtime_version,
unsigned int ompt_version
));
/* initialization interface to be defined by tool */
ompt_initialize_t ompt_tool(void);
typedef enum opt_init_mode_e {
ompt_init_mode_never = 0,
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 */
// FIXME: remove workaround for clang
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
#pragma omp declare target
#endif
void ompt_control(
uint64_t command,
uint64_t modifier
);
#if !defined(__clang__) && 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
-108
View File
@@ -1,108 +0,0 @@
/*
* include/40/iomp.h.var
* $Revision: 41674 $
* $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
*/
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#ifndef __IOMP_H
# define __IOMP_H
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
# ifdef __cplusplus
extern "C" {
# endif
# define kmp_set_stacksize kmpc_set_stacksize
# define kmp_set_stacksize_s kmpc_set_stacksize_s
# define kmp_set_blocktime kmpc_set_blocktime
# define kmp_set_library kmpc_set_library
# define kmp_set_defaults kmpc_set_defaults
# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc
# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc
# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc
# define kmp_malloc kmpc_malloc
# define kmp_calloc kmpc_calloc
# define kmp_realloc kmpc_realloc
# define kmp_free kmpc_free
# if defined(_WIN32)
# define __KAI_KMPC_CONVENTION __cdecl
# else
# define __KAI_KMPC_CONVENTION
# endif
# include <stdlib.h>
/* kmp API functions */
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
/* affinity API functions */
typedef void * kmp_affinity_mask_t;
extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
/* schedule kind constants */
typedef enum kmp_cancel_kind_t {
kmp_cancel_parallel = 1,
kmp_cancel_loop = 2,
kmp_cancel_sections = 3,
kmp_cancel_taskgroup = 4
} kmp_cancel_kind_t;
extern int __KAI_KMPC_CONVENTION kmp_get_cancellation_status(kmp_cancel_kind_t);
# undef __KAI_KMPC_CONVENTION
/* Warning:
The following typedefs are not standard, deprecated and will be removed in a future release.
*/
typedef int omp_int_t;
typedef double omp_wtime_t;
# ifdef __cplusplus
}
# endif
#endif /* __IOMP_H */
-83
View File
@@ -1,83 +0,0 @@
! include/40/iomp_lib.h.var
! $Revision: 41674 $
! $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
!
!//===----------------------------------------------------------------------===//
!//
!// The LLVM Compiler Infrastructure
!//
!// This file is dual licensed under the MIT and the University of Illinois Open
!// Source Licenses. See LICENSE.txt for details.
!//
!//===----------------------------------------------------------------------===//
!
!***
!*** omp_integer_kind and omp_logical_kind appear to be predefined by gcc and
!*** gfortran (definitions do not appear in the omp.h / omp_lib.h /omp_lib.f).
!*** omp_real_kind is not predefined, however.
!***
integer, parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer, parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer, parameter :: kmp_version_build = $KMP_VERSION_BUILD
character(*) kmp_build_date
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
integer, parameter :: omp_real_kind = 4
!***
!*** kmp_* type extensions
!***
integer, parameter :: kmp_pointer_kind = $KMP_INT_PTR_KIND
integer, parameter :: kmp_size_t_kind = $KMP_INT_PTR_KIND
integer, parameter :: kmp_affinity_mask_kind = $KMP_INT_PTR_KIND
!***
!*** kmp_* entry points
!***
external kmp_set_stacksize
external kmp_set_stacksize_s
external kmp_set_blocktime
external kmp_set_library_serial
external kmp_set_library_turnaround
external kmp_set_library_throughput
external kmp_set_library
external kmp_set_defaults
external kmp_get_stacksize
integer kmp_get_stacksize
external kmp_get_stacksize_s
integer (kind = kmp_size_t_kind) kmp_get_stacksize_s
external kmp_get_blocktime
integer kmp_get_blocktime
external kmp_get_library
integer kmp_get_library
external kmp_set_affinity
integer kmp_set_affinity
external kmp_get_affinity
integer kmp_get_affinity
external kmp_get_affinity_max_proc
integer kmp_get_affinity_max_proc
external kmp_create_affinity_mask
external kmp_destroy_affinity_mask
external kmp_set_affinity_mask_proc
integer kmp_set_affinity_mask_proc
external kmp_unset_affinity_mask_proc
integer kmp_unset_affinity_mask_proc
external kmp_get_affinity_mask_proc
integer kmp_get_affinity_mask_proc
external kmp_malloc
integer (kind = kmp_pointer_kind) kmp_malloc
external kmp_calloc
integer (kind = kmp_pointer_kind) kmp_calloc
external kmp_realloc
integer (kind = kmp_pointer_kind) kmp_realloc
external kmp_free
external kmp_set_warnings_on
external kmp_set_warnings_off
+7 -6
View File
@@ -1,7 +1,5 @@
/*
* include/40/omp.h.var
* $Revision: 41674 $
* $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
*/
@@ -18,10 +16,10 @@
#ifndef __OMP_H
# define __OMP_H
# define KMP_VERSION_MAJOR $KMP_VERSION_MAJOR
# define KMP_VERSION_MINOR $KMP_VERSION_MINOR
# define KMP_VERSION_BUILD $KMP_VERSION_BUILD
# define KMP_BUILD_DATE "$KMP_BUILD_DATE"
# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
# ifdef __cplusplus
extern "C" {
@@ -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);
@@ -93,6 +92,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);
@@ -137,6 +137,7 @@
extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void);
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
+26 -7
View File
@@ -1,6 +1,4 @@
! include/40/omp_lib.f.var
! $Revision: 41674 $
! $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
!
!//===----------------------------------------------------------------------===//
@@ -40,11 +38,11 @@
use omp_lib_kinds
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
character(*), parameter :: kmp_build_date = '$KMP_BUILD_DATE'
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
@@ -210,6 +208,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
@@ -403,6 +406,13 @@
integer (kind=kmp_size_t_kind) size
end function kmp_malloc
function kmp_aligned_malloc(size, alignment)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind) size
integer (kind=kmp_size_t_kind) alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_calloc
@@ -433,6 +443,7 @@
integer (kind=kmp_cancel_kind) cancelkind
logical (kind=omp_logical_kind) kmp_get_cancellation_status
end function kmp_get_cancellation_status
end interface
!dec$ if defined(_WIN32)
@@ -476,6 +487,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
@@ -508,6 +520,7 @@
!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
!dec$ attributes alias:'KMP_FREE'::kmp_free
@@ -551,6 +564,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
@@ -583,6 +597,7 @@
!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
!dec$ attributes alias:'_KMP_FREE'::kmp_free
@@ -629,6 +644,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
@@ -661,6 +677,7 @@
!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
!dec$ attributes alias:'kmp_free_'::kmp_free
@@ -703,6 +720,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
@@ -735,6 +753,7 @@
!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
!dec$ attributes alias:'_kmp_free_'::kmp_free
+22 -7
View File
@@ -1,6 +1,4 @@
! include/40/omp_lib.f90.var
! $Revision: 41674 $
! $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
!
!//===----------------------------------------------------------------------===//
@@ -36,12 +34,12 @@
use omp_lib_kinds
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*) kmp_build_date
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
@@ -106,6 +104,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 +213,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
@@ -404,6 +412,13 @@
integer (kind=kmp_size_t_kind), value :: size
end function kmp_malloc
function kmp_aligned_malloc(size, alignment) bind(c)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind), value :: size
integer (kind=kmp_size_t_kind), value :: alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize) bind(c)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_calloc
+28 -7
View File
@@ -1,6 +1,4 @@
! include/40/omp_lib.h.var
! $Revision: 41674 $
! $Date: 2012-06-05 08:33:35 -0500 (Tue, 05 Jun 2012) $
!
!//===----------------------------------------------------------------------===//
@@ -31,12 +29,12 @@
integer, parameter :: kmp_size_t_kind = int_ptr_kind()
integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
integer (kind=omp_integer_kind), parameter :: openmp_version = $OMP_VERSION
integer (kind=omp_integer_kind), parameter :: kmp_version_major = $KMP_VERSION_MAJOR
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = $KMP_VERSION_MINOR
integer (kind=omp_integer_kind), parameter :: kmp_version_build = $KMP_VERSION_BUILD
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*) kmp_build_date
parameter( kmp_build_date = '$KMP_BUILD_DATE' )
parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
@@ -95,6 +93,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 +195,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
@@ -385,6 +393,13 @@
integer (kind=kmp_size_t_kind), value :: size
end function kmp_malloc
function kmp_aligned_malloc(size, alignment) bind(c)
import
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind), value :: size
integer (kind=kmp_size_t_kind), value :: alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize) bind(c)
import
integer (kind=kmp_pointer_kind) kmp_calloc
@@ -421,6 +436,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 +453,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
@@ -471,6 +488,7 @@
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_unset_affinity_mask_proc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_mask_proc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_malloc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_aligned_malloc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_calloc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_realloc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_free
@@ -486,6 +504,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 +521,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 )
@@ -536,6 +556,7 @@
!$omp declare target(kmp_unset_affinity_mask_proc )
!$omp declare target(kmp_get_affinity_mask_proc )
!$omp declare target(kmp_malloc )
!$omp declare target(kmp_aligned_malloc )
!$omp declare target(kmp_calloc )
!$omp declare target(kmp_realloc )
!$omp declare target(kmp_free )
+515
View File
@@ -0,0 +1,515 @@
/*
* 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_end_parallel_callback_t, 2) /* parallel end */ \
\
macro (ompt_event_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
\
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_pair_callback_t, 26) /* task switch */ \
\
macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \
macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \
\
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 */ \
\
macro (ompt_event_task_dependences, ompt_task_dependences_callback_t, 69) /* report task dependences */\
macro (ompt_event_task_dependence_pair, ompt_task_pair_callback_t, 70) /* report task dependence pair */
/*****************************************************************************
* 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;
/*---------------------
* dependences types
*---------------------*/
typedef enum ompt_task_dependence_flag_e {
// a two bit field for the dependence type
ompt_task_dependence_type_out = 1,
ompt_task_dependence_type_in = 2,
ompt_task_dependence_type_inout = 3,
} ompt_task_dependence_flag_t;
typedef struct ompt_task_dependence_s {
void *variable_addr;
uint32_t dependence_flags;
} ompt_task_dependence_t;
/*****************************************************************************
* enumerations for thread states and runtime events
*****************************************************************************/
/*---------------------
* 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 enum {
ompt_invoker_program = 0, /* program invokes master task */
ompt_invoker_runtime = 1 /* runtime invokes master task */
} ompt_invoker_t;
typedef void (*ompt_thread_type_callback_t) (
ompt_thread_type_t thread_type, /* type of thread */
ompt_thread_id_t thread_id /* ID of thread */
);
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 */
ompt_invoker_t invoker /* who invokes master task? */
);
typedef void (*ompt_end_parallel_callback_t) (
ompt_parallel_id_t parallel_id, /* id of parallel region */
ompt_task_id_t task_id, /* id of task */
ompt_invoker_t invoker /* who invokes master task? */
);
/* tasks */
typedef void (*ompt_task_callback_t) (
ompt_task_id_t task_id /* id of task */
);
typedef void (*ompt_task_pair_callback_t) (
ompt_task_id_t first_task_id,
ompt_task_id_t second_task_id
);
typedef void (*ompt_new_task_callback_t) (
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 */
);
/* task dependences */
typedef void (*ompt_task_dependences_callback_t) (
ompt_task_id_t task_id, /* ID of task with dependences */
const ompt_task_dependence_t *deps,/* vector of task dependences */
int ndeps /* number of dependences */
);
/* program */
typedef void (*ompt_control_callback_t) (
uint64_t command, /* command of control call */
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
***************************************************************************/
OMPT_API_FUNCTION(void, ompt_initialize, (
ompt_function_lookup_t ompt_fn_lookup,
const char *runtime_version,
unsigned int ompt_version
));
/* initialization interface to be defined by tool */
ompt_initialize_t ompt_tool(void);
typedef enum opt_init_mode_e {
ompt_init_mode_never = 0,
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 */
// FIXME: remove workaround for clang
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
#pragma omp declare target
#endif
void ompt_control(
uint64_t command,
uint64_t modifier
);
#if !defined(__clang__) && 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
+198
View File
@@ -0,0 +1,198 @@
/*
* include/45/omp.h.var
*/
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#ifndef __OMP_H
# define __OMP_H
# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
# ifdef __cplusplus
extern "C" {
# endif
# 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);
extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void);
extern int __KAI_KMPC_CONVENTION omp_get_nested (void);
extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void);
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 *);
extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void);
/* lock API functions */
typedef struct omp_lock_t {
void * _lk;
} omp_lock_t;
extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *);
extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *);
/* nested lock API functions */
typedef struct omp_nest_lock_t {
void * _lk;
} omp_nest_lock_t;
extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *);
extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *);
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 omp_lock_hint_t {
omp_lock_hint_none = 0,
omp_lock_hint_uncontended = 1,
omp_lock_hint_contended = (1<<1 ),
omp_lock_hint_nonspeculative = (1<<2 ),
omp_lock_hint_speculative = (1<<3 ),
kmp_lock_hint_hle = (1<<16),
kmp_lock_hint_rtm = (1<<17),
kmp_lock_hint_adaptive = (1<<18)
} omp_lock_hint_t;
/* hinted lock initializers */
extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t);
extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t);
/* time API functions */
extern double __KAI_KMPC_CONVENTION omp_get_wtime (void);
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>
/* OpenMP 4.5 */
extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void);
extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int);
extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int);
extern int __KAI_KMPC_CONVENTION omp_target_is_present(void *, int);
extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, void *, size_t, size_t, size_t, int, int);
extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, void *, size_t, int, const size_t *,
const size_t *, const size_t *, const size_t *, const size_t *, int, int);
extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(void *, void *, size_t, size_t, int);
extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(void *, int);
/* kmp API functions */
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int);
/* 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);
/* OpenMP 4.5 affinity API */
extern int __KAI_KMPC_CONVENTION omp_get_num_places (void);
extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int);
extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *);
extern int __KAI_KMPC_CONVENTION omp_get_place_num (void);
extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void);
extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *);
extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
extern void __KAI_KMPC_CONVENTION kmp_free (void *);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
# undef __KAI_KMPC_CONVENTION
/* Warning:
The following typedefs are not standard, deprecated and will be removed in a future release.
*/
typedef int omp_int_t;
typedef double omp_wtime_t;
# ifdef __cplusplus
}
# endif
#endif /* __OMP_H */
+840
View File
@@ -0,0 +1,840 @@
! include/45/omp_lib.f.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.
!***
!dec$ fixedformlinesize:132
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 :: 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 :: omp_lock_hint_kind = omp_integer_kind
end module omp_lib_kinds
module omp_lib
use omp_lib_kinds
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
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=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
interface
! ***
! *** omp_* entry points
! ***
subroutine omp_set_num_threads(nthreads)
use omp_lib_kinds
integer (kind=omp_integer_kind) nthreads
end subroutine omp_set_num_threads
subroutine omp_set_dynamic(enable)
use omp_lib_kinds
logical (kind=omp_logical_kind) enable
end subroutine omp_set_dynamic
subroutine omp_set_nested(enable)
use omp_lib_kinds
logical (kind=omp_logical_kind) enable
end subroutine omp_set_nested
function omp_get_num_threads()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_num_threads
end function omp_get_num_threads
function omp_get_max_threads()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_max_threads
end function omp_get_max_threads
function omp_get_thread_num()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_thread_num
end function omp_get_thread_num
function omp_get_num_procs()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_num_procs
end function omp_get_num_procs
function omp_in_parallel()
use omp_lib_kinds
logical (kind=omp_logical_kind) omp_in_parallel
end function omp_in_parallel
function omp_get_dynamic()
use omp_lib_kinds
logical (kind=omp_logical_kind) omp_get_dynamic
end function omp_get_dynamic
function omp_get_nested()
use omp_lib_kinds
logical (kind=omp_logical_kind) omp_get_nested
end function omp_get_nested
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_num_places()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_num_places
end function omp_get_num_places
function omp_get_place_num_procs(place_num)
use omp_lib_kinds
integer (kind=omp_integer_kind) place_num
integer (kind=omp_integer_kind) omp_get_place_num_procs
end function omp_get_place_num_procs
subroutine omp_get_place_proc_ids(place_num, ids)
use omp_lib_kinds
integer (kind=omp_integer_kind) place_num
integer (kind=kmp_pointer_kind) ids
end subroutine omp_get_place_proc_ids
function omp_get_place_num()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_place_num
end function omp_get_place_num
function omp_get_partition_num_places()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_partition_num_places
end function omp_get_partition_num_places
subroutine omp_get_partition_place_nums(place_nums)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) place_nums
end subroutine omp_get_partition_place_nums
function omp_get_wtime()
double precision omp_get_wtime
end function omp_get_wtime
function omp_get_wtick ()
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
end function omp_test_nest_lock
function omp_get_max_task_priority()
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_max_task_priority
end function omp_get_max_task_priority
! ***
! *** kmp_* entry points
! ***
subroutine kmp_set_stacksize(size)
use omp_lib_kinds
integer (kind=omp_integer_kind) size
end subroutine kmp_set_stacksize
subroutine kmp_set_stacksize_s(size)
use omp_lib_kinds
integer (kind=kmp_size_t_kind) size
end subroutine kmp_set_stacksize_s
subroutine kmp_set_blocktime(msec)
use omp_lib_kinds
integer (kind=omp_integer_kind) msec
end subroutine kmp_set_blocktime
subroutine kmp_set_library_serial()
end subroutine kmp_set_library_serial
subroutine kmp_set_library_turnaround()
end subroutine kmp_set_library_turnaround
subroutine kmp_set_library_throughput()
end subroutine kmp_set_library_throughput
subroutine kmp_set_library(libnum)
use omp_lib_kinds
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()
use omp_lib_kinds
integer (kind=omp_integer_kind) kmp_get_stacksize
end function kmp_get_stacksize
function kmp_get_stacksize_s()
use omp_lib_kinds
integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
end function kmp_get_stacksize_s
function kmp_get_blocktime()
use omp_lib_kinds
integer (kind=omp_integer_kind) kmp_get_blocktime
end function kmp_get_blocktime
function kmp_get_library()
use omp_lib_kinds
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
integer (kind=kmp_size_t_kind) size
end function kmp_malloc
function kmp_aligned_malloc(size, alignment)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind) size
integer (kind=kmp_size_t_kind) alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_calloc
integer (kind=kmp_size_t_kind) nelem
integer (kind=kmp_size_t_kind) elsize
end function kmp_calloc
function kmp_realloc(ptr, size)
use omp_lib_kinds
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)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) ptr
end subroutine kmp_free
subroutine kmp_set_warnings_on()
end subroutine kmp_set_warnings_on
subroutine kmp_set_warnings_off()
end subroutine kmp_set_warnings_off
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_with_hint(lockvar, lockhint)
use omp_lib_kinds
integer (kind=omp_lock_kind) lockvar
integer (kind=omp_lock_hint_kind) lockhint
end subroutine kmp_init_lock_with_hint
subroutine kmp_init_nest_lock_with_hint(lockvar, lockhint)
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) lockvar
integer (kind=omp_lock_hint_kind) lockhint
end subroutine kmp_init_nest_lock_with_hint
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_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_GET_MAX_TASK_PRIORITY' :: omp_get_max_task_priority
!dec$ attributes alias:'omp_init_lock' :: omp_init_lock
!dec$ attributes alias:'omp_init_lock_with_hint' :: omp_init_lock_with_hint
!dec$ attributes alias:'omp_destroy_lock' :: omp_destroy_lock
!dec$ attributes alias:'omp_set_lock' :: omp_set_lock
!dec$ attributes alias:'omp_unset_lock' :: omp_unset_lock
!dec$ attributes alias:'omp_test_lock' :: omp_test_lock
!dec$ attributes alias:'omp_init_nest_lock' :: omp_init_nest_lock
!dec$ attributes alias:'omp_init_nest_lock_with_hint' :: omp_init_nest_lock_with_hint
!dec$ attributes alias:'omp_destroy_nest_lock' :: omp_destroy_nest_lock
!dec$ attributes alias:'omp_set_nest_lock' :: omp_set_nest_lock
!dec$ attributes alias:'omp_unset_nest_lock' :: omp_unset_nest_lock
!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_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_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_ALIGNED_MALLOC'::kmp_aligned_malloc
!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
!dec$ attributes alias:'KMP_FREE'::kmp_free
!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$ 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_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_GET_MAX_TASK_PRIORTY' :: omp_get_max_task_priority
!dec$ attributes alias:'_omp_init_lock' :: omp_init_lock
!dec$ attributes alias:'_omp_init_lock_with_hint' :: omp_init_lock_with_hint
!dec$ attributes alias:'_omp_destroy_lock' :: omp_destroy_lock
!dec$ attributes alias:'_omp_set_lock' :: omp_set_lock
!dec$ attributes alias:'_omp_unset_lock' :: omp_unset_lock
!dec$ attributes alias:'_omp_test_lock' :: omp_test_lock
!dec$ attributes alias:'_omp_init_nest_lock' :: omp_init_nest_lock
!dec$ attributes alias:'_omp_init_nest_lock_with_hint' :: omp_init_nest_lock_with_hint
!dec$ attributes alias:'_omp_destroy_nest_lock' :: omp_destroy_nest_lock
!dec$ attributes alias:'_omp_set_nest_lock' :: omp_set_nest_lock
!dec$ attributes alias:'_omp_unset_nest_lock' :: omp_unset_nest_lock
!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_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_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_ALIGNED_MALLOC'::kmp_aligned_malloc
!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
!dec$ attributes alias:'_KMP_FREE'::kmp_free
!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$ 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_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_get_max_task_priority_'::omp_get_max_task_priority
!dec$ attributes alias:'omp_init_lock_'::omp_init_lock
!dec$ attributes alias:'omp_init_lock_with_hint_'::omp_init_lock_with_hint
!dec$ attributes alias:'omp_destroy_lock_'::omp_destroy_lock
!dec$ attributes alias:'omp_set_lock_'::omp_set_lock
!dec$ attributes alias:'omp_unset_lock_'::omp_unset_lock
!dec$ attributes alias:'omp_test_lock_'::omp_test_lock
!dec$ attributes alias:'omp_init_nest_lock_'::omp_init_nest_lock
!dec$ attributes alias:'omp_init_nest_lock_with_hint_'::omp_init_nest_lock_with_hint
!dec$ attributes alias:'omp_destroy_nest_lock_'::omp_destroy_nest_lock
!dec$ attributes alias:'omp_set_nest_lock_'::omp_set_nest_lock
!dec$ attributes alias:'omp_unset_nest_lock_'::omp_unset_nest_lock
!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_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_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_aligned_malloc_'::kmp_aligned_malloc
!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
!dec$ attributes alias:'kmp_free_'::kmp_free
!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$ 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_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_get_max_task_priorty_'::omp_get_max_task_priority
!dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
!dec$ attributes alias:'_omp_init_lock_with_hint_'::omp_init_lock_with_hint
!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
!dec$ attributes alias:'_omp_set_lock_'::omp_set_lock
!dec$ attributes alias:'_omp_unset_lock_'::omp_unset_lock
!dec$ attributes alias:'_omp_test_lock_'::omp_test_lock
!dec$ attributes alias:'_omp_init_nest_lock_'::omp_init_nest_lock
!dec$ attributes alias:'_omp_init_nest_lock_with_hint_'::omp_init_nest_lock_with_hint
!dec$ attributes alias:'_omp_destroy_nest_lock_'::omp_destroy_nest_lock
!dec$ attributes alias:'_omp_set_nest_lock_'::omp_set_nest_lock
!dec$ attributes alias:'_omp_unset_nest_lock_'::omp_unset_nest_lock
!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_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_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_aligned_malloc_'::kmp_aligned_malloc
!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
!dec$ attributes alias:'_kmp_free_'::kmp_free
!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$ endif
end module omp_lib
+524
View File
@@ -0,0 +1,524 @@
! include/45/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 :: omp_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 = @LIBOMP_OMP_YEAR_MONTH@
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*) kmp_build_date
parameter( kmp_build_date = '@LIBOMP_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=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
interface
! ***
! *** omp_* entry points
! ***
subroutine omp_set_num_threads(num_threads) bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind), value :: num_threads
end subroutine omp_set_num_threads
subroutine omp_set_dynamic(dynamic_threads) bind(c)
use omp_lib_kinds
logical (kind=omp_logical_kind), value :: dynamic_threads
end subroutine omp_set_dynamic
subroutine omp_set_nested(nested) bind(c)
use omp_lib_kinds
logical (kind=omp_logical_kind), value :: nested
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, chunk_size) bind(c)
use omp_lib_kinds
integer (kind=omp_sched_kind), value :: kind
integer (kind=omp_integer_kind), value :: chunk_size
end subroutine omp_set_schedule
subroutine omp_get_schedule(kind, chunk_size) bind(c)
use omp_lib_kinds
integer (kind=omp_sched_kind) kind
integer (kind=omp_integer_kind) chunk_size
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_num_places() bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_num_places
end function omp_get_num_places
function omp_get_place_num_procs(place_num) bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind), value :: place_num
integer (kind=omp_integer_kind) omp_get_place_num_procs
end function omp_get_place_num_procs
subroutine omp_get_place_proc_ids(place_num, ids) bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind), value :: place_num
integer (kind=kmp_pointer_kind) ids(*)
end subroutine omp_get_place_proc_ids
function omp_get_place_num() bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_place_num
end function omp_get_place_num
function omp_get_partition_num_places() bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_partition_num_places
end function omp_get_partition_num_places
subroutine omp_get_partition_place_nums(place_nums) bind(c)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) place_nums(*)
end subroutine omp_get_partition_place_nums
function omp_get_wtime() bind(c)
use omp_lib_kinds
real (kind=kmp_double_kind) omp_get_wtime
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(device_num) bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind), value :: device_num
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
function omp_get_initial_device() bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_initial_device
end function omp_get_initial_device
subroutine omp_init_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_init_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_lock_kind) svar
end subroutine omp_init_lock
subroutine omp_destroy_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_destroy_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_lock_kind) svar
end subroutine omp_destroy_lock
subroutine omp_set_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_set_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_lock_kind) svar
end subroutine omp_set_lock
subroutine omp_unset_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_unset_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_lock_kind) svar
end subroutine omp_unset_lock
function omp_test_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_test_lock
!DIR$ ENDIF
use omp_lib_kinds
logical (kind=omp_logical_kind) omp_test_lock
integer (kind=omp_lock_kind) svar
end function omp_test_lock
subroutine omp_init_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_init_nest_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) nvar
end subroutine omp_init_nest_lock
subroutine omp_destroy_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) nvar
end subroutine omp_destroy_nest_lock
subroutine omp_set_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_set_nest_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) nvar
end subroutine omp_set_nest_lock
subroutine omp_unset_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) nvar
end subroutine omp_unset_nest_lock
function omp_test_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_test_nest_lock
!DIR$ ENDIF
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_test_nest_lock
integer (kind=omp_nest_lock_kind) nvar
end function omp_test_nest_lock
function omp_get_max_task_priority() bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind) omp_get_max_task_priority
end function omp_get_max_task_priority
! ***
! *** kmp_* entry points
! ***
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
subroutine kmp_set_disp_num_buffers(num) bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind), value :: num
end subroutine kmp_set_disp_num_buffers
function kmp_set_affinity(mask) bind(c)
use omp_lib_kinds
integer (kind=omp_integer_kind) kmp_set_affinity
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_aligned_malloc(size, alignment) bind(c)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind), value :: size
integer (kind=kmp_size_t_kind), value :: alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize) bind(c)
use omp_lib_kinds
integer (kind=kmp_pointer_kind) kmp_calloc
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 omp_init_lock_with_hint(svar, hint) bind(c)
use omp_lib_kinds
integer (kind=omp_lock_kind) svar
integer (kind=omp_lock_hint_kind), value :: hint
end subroutine omp_init_lock_with_hint
subroutine omp_init_nest_lock_with_hint(nvar, hint) bind(c)
use omp_lib_kinds
integer (kind=omp_nest_lock_kind) nvar
integer (kind=omp_lock_hint_kind), value :: hint
end subroutine omp_init_nest_lock_with_hint
end interface
end module omp_lib
+644
View File
@@ -0,0 +1,644 @@
! include/45/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 :: omp_lock_hint_kind = omp_integer_kind
integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
character(*) kmp_build_date
parameter( kmp_build_date = '@LIBOMP_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=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
interface
! ***
! *** omp_* entry points
! ***
subroutine omp_set_num_threads(num_threads) bind(c)
import
integer (kind=omp_integer_kind), value :: num_threads
end subroutine omp_set_num_threads
subroutine omp_set_dynamic(dynamic_threads) bind(c)
import
logical (kind=omp_logical_kind), value :: dynamic_threads
end subroutine omp_set_dynamic
subroutine omp_set_nested(nested) bind(c)
import
logical (kind=omp_logical_kind), value :: nested
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, chunk_size) bind(c)
import
integer (kind=omp_sched_kind), value :: kind
integer (kind=omp_integer_kind), value :: chunk_size
end subroutine omp_set_schedule
subroutine omp_get_schedule(kind, chunk_size) bind(c)
import
integer (kind=omp_sched_kind) kind
integer (kind=omp_integer_kind) chunk_size
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_num_places() bind(c)
import
integer (kind=omp_integer_kind) omp_get_num_places
end function omp_get_num_places
function omp_get_place_num_procs(place_num) bind(c)
import
integer (kind=omp_integer_kind), value :: place_num
integer (kind=omp_integer_kind) omp_get_place_num_procs
end function omp_get_place_num_procs
subroutine omp_get_place_proc_ids(place_num, ids) bind(c)
import
integer (kind=omp_integer_kind), value :: place_num
integer (kind=kmp_pointer_kind) ids(*)
end subroutine omp_get_place_proc_ids
function omp_get_place_num() bind(c)
import
integer (kind=omp_integer_kind) omp_get_place_num
end function omp_get_place_num
function omp_get_partition_num_places() bind(c)
import
integer (kind=omp_integer_kind) omp_get_partition_num_places
end function omp_get_partition_num_places
subroutine omp_get_partition_place_nums(place_nums) bind(c)
import
integer (kind=kmp_pointer_kind) place_nums(*)
end subroutine omp_get_partition_place_nums
function omp_get_wtime() bind(c)
double precision omp_get_wtime
end function omp_get_wtime
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(device_num) bind(c)
import
integer (kind=omp_integer_kind), value :: device_num
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
function omp_get_initial_device() bind(c)
import
integer (kind=omp_integer_kind) omp_get_initial_device
end function omp_get_initial_device
subroutine omp_init_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_init_lock
!DIR$ ENDIF
import
integer (kind=omp_lock_kind) svar
end subroutine omp_init_lock
subroutine omp_destroy_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_destroy_lock
!DIR$ ENDIF
import
integer (kind=omp_lock_kind) svar
end subroutine omp_destroy_lock
subroutine omp_set_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_set_lock
!DIR$ ENDIF
import
integer (kind=omp_lock_kind) svar
end subroutine omp_set_lock
subroutine omp_unset_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_unset_lock
!DIR$ ENDIF
import
integer (kind=omp_lock_kind) svar
end subroutine omp_unset_lock
function omp_test_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_test_lock
!DIR$ ENDIF
import
logical (kind=omp_logical_kind) omp_test_lock
integer (kind=omp_lock_kind) svar
end function omp_test_lock
subroutine omp_init_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_init_nest_lock
!DIR$ ENDIF
import
integer (kind=omp_nest_lock_kind) nvar
end subroutine omp_init_nest_lock
subroutine omp_destroy_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
!DIR$ ENDIF
import
integer (kind=omp_nest_lock_kind) nvar
end subroutine omp_destroy_nest_lock
subroutine omp_set_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_set_nest_lock
!DIR$ ENDIF
import
integer (kind=omp_nest_lock_kind) nvar
end subroutine omp_set_nest_lock
subroutine omp_unset_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
!DIR$ ENDIF
import
integer (kind=omp_nest_lock_kind) nvar
end subroutine omp_unset_nest_lock
function omp_test_nest_lock(nvar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_test_nest_lock
!DIR$ ENDIF
import
integer (kind=omp_integer_kind) omp_test_nest_lock
integer (kind=omp_nest_lock_kind) nvar
end function omp_test_nest_lock
function omp_get_max_task_priority() bind(c)
import
integer (kind=omp_integer_kind) omp_get_max_task_priority
end function omp_get_max_task_priority
! ***
! *** kmp_* entry points
! ***
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
subroutine kmp_set_disp_num_buffers(num) bind(c)
import
integer (kind=omp_integer_kind), value :: num
end subroutine kmp_set_disp_num_buffers
function kmp_set_affinity(mask) bind(c)
import
integer (kind=omp_integer_kind) kmp_set_affinity
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_aligned_malloc(size, alignment) bind(c)
import
integer (kind=kmp_pointer_kind) kmp_aligned_malloc
integer (kind=kmp_size_t_kind), value :: size
integer (kind=kmp_size_t_kind), value :: alignment
end function kmp_aligned_malloc
function kmp_calloc(nelem, elsize) bind(c)
import
integer (kind=kmp_pointer_kind) kmp_calloc
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 omp_init_lock_with_hint(svar, hint) bind(c)
import
integer (kind=omp_lock_kind) svar
integer (kind=omp_lock_hint_kind), value :: hint
end subroutine omp_init_lock_with_hint
subroutine omp_init_nest_lock_with_hint(nvar, hint) bind(c)
import
integer (kind=omp_nest_lock_kind) nvar
integer (kind=omp_lock_hint_kind), value :: hint
end subroutine omp_init_nest_lock_with_hint
end interface
!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 :: omp_get_max_task_priority
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize_s
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_blocktime
!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_disp_num_buffers
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_affinity
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_max_proc
!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_aligned_malloc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_calloc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_realloc
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_free
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_on
!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_off
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_lock_with_hint
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_nest_lock_with_hint
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!$omp declare target(omp_set_num_threads )
!$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(omp_get_max_task_priority )
!$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_disp_num_buffers )
!$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_aligned_malloc )
!$omp declare target(kmp_calloc )
!$omp declare target(kmp_realloc )
!$omp declare target(kmp_free )
!$omp declare target(kmp_set_warnings_on )
!$omp declare target(kmp_set_warnings_off )
!$omp declare target(omp_init_lock_with_hint )
!$omp declare target(omp_init_nest_lock_with_hint )
!DIR$ ENDIF
!DIR$ ENDIF
+515
View File
@@ -0,0 +1,515 @@
/*
* include/45/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_end_parallel_callback_t, 2) /* parallel end */ \
\
macro (ompt_event_task_begin, ompt_new_task_callback_t, 3) /* task begin */ \
macro (ompt_event_task_end, ompt_task_callback_t, 4) /* task destroy */ \
\
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_pair_callback_t, 26) /* task switch */ \
\
macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \
macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \
\
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 */ \
\
macro (ompt_event_task_dependences, ompt_task_dependences_callback_t, 69) /* report task dependences */\
macro (ompt_event_task_dependence_pair, ompt_task_pair_callback_t, 70) /* report task dependence pair */
/*****************************************************************************
* 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;
/*---------------------
* dependences types
*---------------------*/
typedef enum ompt_task_dependence_flag_e {
// a two bit field for the dependence type
ompt_task_dependence_type_out = 1,
ompt_task_dependence_type_in = 2,
ompt_task_dependence_type_inout = 3,
} ompt_task_dependence_flag_t;
typedef struct ompt_task_dependence_s {
void *variable_addr;
uint32_t dependence_flags;
} ompt_task_dependence_t;
/*****************************************************************************
* enumerations for thread states and runtime events
*****************************************************************************/
/*---------------------
* 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 enum {
ompt_invoker_program = 0, /* program invokes master task */
ompt_invoker_runtime = 1 /* runtime invokes master task */
} ompt_invoker_t;
typedef void (*ompt_thread_type_callback_t) (
ompt_thread_type_t thread_type, /* type of thread */
ompt_thread_id_t thread_id /* ID of thread */
);
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 */
ompt_invoker_t invoker /* who invokes master task? */
);
typedef void (*ompt_end_parallel_callback_t) (
ompt_parallel_id_t parallel_id, /* id of parallel region */
ompt_task_id_t task_id, /* id of task */
ompt_invoker_t invoker /* who invokes master task? */
);
/* tasks */
typedef void (*ompt_task_callback_t) (
ompt_task_id_t task_id /* id of task */
);
typedef void (*ompt_task_pair_callback_t) (
ompt_task_id_t first_task_id,
ompt_task_id_t second_task_id
);
typedef void (*ompt_new_task_callback_t) (
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 */
);
/* task dependences */
typedef void (*ompt_task_dependences_callback_t) (
ompt_task_id_t task_id, /* ID of task with dependences */
const ompt_task_dependence_t *deps,/* vector of task dependences */
int ndeps /* number of dependences */
);
/* program */
typedef void (*ompt_control_callback_t) (
uint64_t command, /* command of control call */
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
***************************************************************************/
OMPT_API_FUNCTION(void, ompt_initialize, (
ompt_function_lookup_t ompt_fn_lookup,
const char *runtime_version,
unsigned int ompt_version
));
/* initialization interface to be defined by tool */
ompt_initialize_t ompt_tool(void);
typedef enum opt_init_mode_e {
ompt_init_mode_never = 0,
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 */
// FIXME: remove workaround for clang
#if !defined(__clang__) && defined(_OPENMP) && (_OPENMP >= 201307)
#pragma omp declare target
#endif
void ompt_control(
uint64_t command,
uint64_t modifier
);
#if !defined(__clang__) && 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
+456 -168
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+319
View File
@@ -0,0 +1,319 @@
/*
* kmp_affinity.h -- header for affinity management
*/
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#ifndef KMP_AFFINITY_H
#define KMP_AFFINITY_H
extern int __kmp_affinity_compact; /* Affinity 'compact' value */
class Address {
public:
static const unsigned maxDepth = 32;
unsigned labels[maxDepth];
unsigned childNums[maxDepth];
unsigned depth;
unsigned leader;
Address(unsigned _depth)
: depth(_depth), leader(FALSE) {
}
Address &operator=(const Address &b) {
depth = b.depth;
for (unsigned i = 0; i < depth; i++) {
labels[i] = b.labels[i];
childNums[i] = b.childNums[i];
}
leader = FALSE;
return *this;
}
bool operator==(const Address &b) const {
if (depth != b.depth)
return false;
for (unsigned i = 0; i < depth; i++)
if(labels[i] != b.labels[i])
return false;
return true;
}
bool isClose(const Address &b, int level) const {
if (depth != b.depth)
return false;
if ((unsigned)level >= depth)
return true;
for (unsigned i = 0; i < (depth - level); i++)
if(labels[i] != b.labels[i])
return false;
return true;
}
bool operator!=(const Address &b) const {
return !operator==(b);
}
void print() const {
unsigned i;
printf("Depth: %u --- ", depth);
for(i=0;i<depth;i++) {
printf("%u ", labels[i]);
}
}
};
class AddrUnsPair {
public:
Address first;
unsigned second;
AddrUnsPair(Address _first, unsigned _second)
: first(_first), second(_second) {
}
AddrUnsPair &operator=(const AddrUnsPair &b)
{
first = b.first;
second = b.second;
return *this;
}
void print() const {
printf("first = "); first.print();
printf(" --- second = %u", second);
}
bool operator==(const AddrUnsPair &b) const {
if(first != b.first) return false;
if(second != b.second) return false;
return true;
}
bool operator!=(const AddrUnsPair &b) const {
return !operator==(b);
}
};
static int
__kmp_affinity_cmp_Address_labels(const void *a, const void *b)
{
const Address *aa = (const Address *)&(((AddrUnsPair *)a)
->first);
const Address *bb = (const Address *)&(((AddrUnsPair *)b)
->first);
unsigned depth = aa->depth;
unsigned i;
KMP_DEBUG_ASSERT(depth == bb->depth);
for (i = 0; i < depth; i++) {
if (aa->labels[i] < bb->labels[i]) return -1;
if (aa->labels[i] > bb->labels[i]) return 1;
}
return 0;
}
static int
__kmp_affinity_cmp_Address_child_num(const void *a, const void *b)
{
const Address *aa = (const Address *)&(((AddrUnsPair *)a)
->first);
const Address *bb = (const Address *)&(((AddrUnsPair *)b)
->first);
unsigned depth = aa->depth;
unsigned i;
KMP_DEBUG_ASSERT(depth == bb->depth);
KMP_DEBUG_ASSERT((unsigned)__kmp_affinity_compact <= depth);
KMP_DEBUG_ASSERT(__kmp_affinity_compact >= 0);
for (i = 0; i < (unsigned)__kmp_affinity_compact; i++) {
int j = depth - i - 1;
if (aa->childNums[j] < bb->childNums[j]) return -1;
if (aa->childNums[j] > bb->childNums[j]) return 1;
}
for (; i < depth; i++) {
int j = i - __kmp_affinity_compact;
if (aa->childNums[j] < bb->childNums[j]) return -1;
if (aa->childNums[j] > bb->childNums[j]) return 1;
}
return 0;
}
/** A structure for holding machine-specific hierarchy info to be computed once at init.
This structure represents a mapping of threads to the actual machine hierarchy, or to
our best guess at what the hierarchy might be, for the purpose of performing an
efficient barrier. In the worst case, when there is no machine hierarchy information,
it produces a tree suitable for a barrier, similar to the tree used in the hyper barrier. */
class hierarchy_info {
public:
/** Good default values for number of leaves and branching factor, given no affinity information.
Behaves a bit like hyper barrier. */
static const kmp_uint32 maxLeaves=4;
static const kmp_uint32 minBranch=4;
/** Number of levels in the hierarchy. Typical levels are threads/core, cores/package
or socket, packages/node, nodes/machine, etc. We don't want to get specific with
nomenclature. When the machine is oversubscribed we add levels to duplicate the
hierarchy, doubling the thread capacity of the hierarchy each time we add a level. */
kmp_uint32 maxLevels;
/** This is specifically the depth of the machine configuration hierarchy, in terms of the
number of levels along the longest path from root to any leaf. It corresponds to the
number of entries in numPerLevel if we exclude all but one trailing 1. */
kmp_uint32 depth;
kmp_uint32 base_num_threads;
enum init_status { initialized=0, not_initialized=1, initializing=2 };
volatile kmp_int8 uninitialized; // 0=initialized, 1=not initialized, 2=initialization in progress
volatile kmp_int8 resizing; // 0=not resizing, 1=resizing
/** Level 0 corresponds to leaves. numPerLevel[i] is the number of children the parent of a
node at level i has. For example, if we have a machine with 4 packages, 4 cores/package
and 2 HT per core, then numPerLevel = {2, 4, 4, 1, 1}. All empty levels are set to 1. */
kmp_uint32 *numPerLevel;
kmp_uint32 *skipPerLevel;
void deriveLevels(AddrUnsPair *adr2os, int num_addrs) {
int hier_depth = adr2os[0].first.depth;
int level = 0;
for (int i=hier_depth-1; i>=0; --i) {
int max = -1;
for (int j=0; j<num_addrs; ++j) {
int next = adr2os[j].first.childNums[i];
if (next > max) max = next;
}
numPerLevel[level] = max+1;
++level;
}
}
hierarchy_info() : maxLevels(7), depth(1), uninitialized(not_initialized), resizing(0) {}
void fini() { if (!uninitialized && numPerLevel) __kmp_free(numPerLevel); }
void init(AddrUnsPair *adr2os, int num_addrs)
{
kmp_int8 bool_result = KMP_COMPARE_AND_STORE_ACQ8(&uninitialized, not_initialized, initializing);
if (bool_result == 0) { // Wait for initialization
while (TCR_1(uninitialized) != initialized) KMP_CPU_PAUSE();
return;
}
KMP_DEBUG_ASSERT(bool_result==1);
/* Added explicit initialization of the data fields here to prevent usage of dirty value
observed when static library is re-initialized multiple times (e.g. when
non-OpenMP thread repeatedly launches/joins thread that uses OpenMP). */
depth = 1;
resizing = 0;
maxLevels = 7;
numPerLevel = (kmp_uint32 *)__kmp_allocate(maxLevels*2*sizeof(kmp_uint32));
skipPerLevel = &(numPerLevel[maxLevels]);
for (kmp_uint32 i=0; i<maxLevels; ++i) { // init numPerLevel[*] to 1 item per level
numPerLevel[i] = 1;
skipPerLevel[i] = 1;
}
// Sort table by physical ID
if (adr2os) {
qsort(adr2os, num_addrs, sizeof(*adr2os), __kmp_affinity_cmp_Address_labels);
deriveLevels(adr2os, num_addrs);
}
else {
numPerLevel[0] = maxLeaves;
numPerLevel[1] = num_addrs/maxLeaves;
if (num_addrs%maxLeaves) numPerLevel[1]++;
}
base_num_threads = num_addrs;
for (int i=maxLevels-1; i>=0; --i) // count non-empty levels to get depth
if (numPerLevel[i] != 1 || depth > 1) // only count one top-level '1'
depth++;
kmp_uint32 branch = minBranch;
if (numPerLevel[0] == 1) branch = num_addrs/maxLeaves;
if (branch<minBranch) branch=minBranch;
for (kmp_uint32 d=0; d<depth-1; ++d) { // optimize hierarchy width
while (numPerLevel[d] > branch || (d==0 && numPerLevel[d]>maxLeaves)) { // max 4 on level 0!
if (numPerLevel[d] & 1) numPerLevel[d]++;
numPerLevel[d] = numPerLevel[d] >> 1;
if (numPerLevel[d+1] == 1) depth++;
numPerLevel[d+1] = numPerLevel[d+1] << 1;
}
if(numPerLevel[0] == 1) {
branch = branch >> 1;
if (branch<4) branch = minBranch;
}
}
for (kmp_uint32 i=1; i<depth; ++i)
skipPerLevel[i] = numPerLevel[i-1] * skipPerLevel[i-1];
// Fill in hierarchy in the case of oversubscription
for (kmp_uint32 i=depth; i<maxLevels; ++i)
skipPerLevel[i] = 2*skipPerLevel[i-1];
uninitialized = initialized; // One writer
}
// Resize the hierarchy if nproc changes to something larger than before
void resize(kmp_uint32 nproc)
{
kmp_int8 bool_result = KMP_COMPARE_AND_STORE_ACQ8(&resizing, 0, 1);
while (bool_result == 0) { // someone else is trying to resize
KMP_CPU_PAUSE();
if (nproc <= base_num_threads) // happy with other thread's resize
return;
else // try to resize
bool_result = KMP_COMPARE_AND_STORE_ACQ8(&resizing, 0, 1);
}
KMP_DEBUG_ASSERT(bool_result!=0);
if (nproc <= base_num_threads) return; // happy with other thread's resize
// Calculate new maxLevels
kmp_uint32 old_sz = skipPerLevel[depth-1];
kmp_uint32 incs = 0, old_maxLevels = maxLevels;
// First see if old maxLevels is enough to contain new size
for (kmp_uint32 i=depth; i<maxLevels && nproc>old_sz; ++i) {
skipPerLevel[i] = 2*skipPerLevel[i-1];
numPerLevel[i-1] *= 2;
old_sz *= 2;
depth++;
}
if (nproc > old_sz) { // Not enough space, need to expand hierarchy
while (nproc > old_sz) {
old_sz *=2;
incs++;
depth++;
}
maxLevels += incs;
// Resize arrays
kmp_uint32 *old_numPerLevel = numPerLevel;
kmp_uint32 *old_skipPerLevel = skipPerLevel;
numPerLevel = skipPerLevel = NULL;
numPerLevel = (kmp_uint32 *)__kmp_allocate(maxLevels*2*sizeof(kmp_uint32));
skipPerLevel = &(numPerLevel[maxLevels]);
// Copy old elements from old arrays
for (kmp_uint32 i=0; i<old_maxLevels; ++i) { // init numPerLevel[*] to 1 item per level
numPerLevel[i] = old_numPerLevel[i];
skipPerLevel[i] = old_skipPerLevel[i];
}
// Init new elements in arrays to 1
for (kmp_uint32 i=old_maxLevels; i<maxLevels; ++i) { // init numPerLevel[*] to 1 item per level
numPerLevel[i] = 1;
skipPerLevel[i] = 1;
}
// Free old arrays
__kmp_free(old_numPerLevel);
}
// Fill in oversubscription levels of hierarchy
for (kmp_uint32 i=old_maxLevels; i<maxLevels; ++i)
skipPerLevel[i] = 2*skipPerLevel[i-1];
base_num_threads = nproc;
resizing = 0; // One writer
}
};
#endif // KMP_AFFINITY_H
+110 -77
View File
@@ -1,7 +1,5 @@
/*
* kmp_alloc.c -- private/shared dyanmic memory allocation and management
* $Revision: 43450 $
* $Date: 2014-09-09 10:07:22 -0500 (Tue, 09 Sep 2014) $
*/
@@ -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) - i * 3, "%02X ", bdump[i]);
if (bdump[i] > 0x20 && bdump[i] < 0x7F)
bascii[ i ] = bdump[ i ];
else
@@ -1429,8 +1427,37 @@ void *
kmpc_malloc( size_t size )
{
void * ptr;
ptr = bget( __kmp_entry_thread(), (bufsize) size );
ptr = bget( __kmp_entry_thread(), (bufsize)(size + sizeof(ptr)) );
if( ptr != NULL ) {
// save allocated pointer just before one returned to user
*(void**)ptr = ptr;
ptr = (void**)ptr + 1;
}
return ptr;
}
#define IS_POWER_OF_TWO(n) (((n)&((n)-1))==0)
void *
kmpc_aligned_malloc( size_t size, size_t alignment )
{
void * ptr;
void * ptr_allocated;
KMP_DEBUG_ASSERT( alignment < 32 * 1024 ); // Alignment should not be too big
if( !IS_POWER_OF_TWO(alignment) ) {
// AC: do we need to issue a warning here?
errno = EINVAL;
return NULL;
}
size = size + sizeof( void* ) + alignment;
ptr_allocated = bget( __kmp_entry_thread(), (bufsize)size );
if( ptr_allocated != NULL ) {
// save allocated pointer just before one returned to user
ptr = (void*)(((kmp_uintptr_t)ptr_allocated + sizeof( void* ) + alignment) & ~(alignment - 1));
*((void**)ptr - 1) = ptr_allocated;
} else {
ptr = NULL;
}
return ptr;
}
@@ -1438,8 +1465,12 @@ void *
kmpc_calloc( size_t nelem, size_t elsize )
{
void * ptr;
ptr = bgetz( __kmp_entry_thread(), (bufsize) (nelem * elsize) );
ptr = bgetz( __kmp_entry_thread(), (bufsize) (nelem * elsize + sizeof(ptr)) );
if( ptr != NULL ) {
// save allocated pointer just before one returned to user
*(void**)ptr = ptr;
ptr = (void**)ptr + 1;
}
return ptr;
}
@@ -1447,19 +1478,27 @@ void *
kmpc_realloc( void * ptr, size_t size )
{
void * result = NULL;
if ( ptr == NULL ) {
// If pointer is NULL, realloc behaves like malloc.
result = bget( __kmp_entry_thread(), (bufsize) size );
} else if ( size == 0 ) {
// If size is 0, realloc behaves like free.
// The thread must be registered by the call to kmpc_malloc() or kmpc_calloc() before.
// So it should be safe to call __kmp_get_thread(), not __kmp_entry_thread().
brel( __kmp_get_thread(), ptr );
} else {
result = bgetr( __kmp_entry_thread(), ptr, (bufsize) size );
}; // if
if ( ptr == NULL ) {
// If pointer is NULL, realloc behaves like malloc.
result = bget( __kmp_entry_thread(), (bufsize)(size + sizeof(ptr)) );
// save allocated pointer just before one returned to user
if( result != NULL ) {
*(void**)result = result;
result = (void**)result + 1;
}
} else if ( size == 0 ) {
// If size is 0, realloc behaves like free.
// The thread must be registered by the call to kmpc_malloc() or kmpc_calloc() before.
// So it should be safe to call __kmp_get_thread(), not __kmp_entry_thread().
KMP_ASSERT(*((void**)ptr - 1));
brel( __kmp_get_thread(), *((void**)ptr - 1) );
} else {
result = bgetr( __kmp_entry_thread(), *((void**)ptr - 1), (bufsize)(size + sizeof(ptr)) );
if( result != NULL ) {
*(void**)result = result;
result = (void**)result + 1;
}
}; // if
return result;
}
@@ -1472,9 +1511,11 @@ kmpc_free( void * ptr )
return;
}; // if
if ( ptr != NULL ) {
kmp_info_t *th = __kmp_get_thread();
__kmp_bget_dequeue( th ); /* Release any queued buffers */
brel( th, ptr );
kmp_info_t *th = __kmp_get_thread();
__kmp_bget_dequeue( th ); /* Release any queued buffers */
// extract allocated pointer and free it
KMP_ASSERT(*((void**)ptr - 1));
brel( th, *((void**)ptr - 1) );
};
}
@@ -1491,7 +1532,7 @@ ___kmp_thread_malloc( kmp_info_t *th, size_t size KMP_SRC_LOC_DECL )
(int) size
KMP_SRC_LOC_PARM
) );
ptr = bget( th, (bufsize) size );
ptr = bget( th, (bufsize) size );
KE_TRACE( 30, ( "<- __kmp_thread_malloc() returns %p\n", ptr ) );
return ptr;
}
@@ -1507,7 +1548,7 @@ ___kmp_thread_calloc( kmp_info_t *th, size_t nelem, size_t elsize KMP_SRC_LOC_DE
(int) elsize
KMP_SRC_LOC_PARM
) );
ptr = bgetz( th, (bufsize) (nelem * elsize) );
ptr = bgetz( th, (bufsize) (nelem * elsize) );
KE_TRACE( 30, ( "<- __kmp_thread_calloc() returns %p\n", ptr ) );
return ptr;
}
@@ -1522,7 +1563,7 @@ ___kmp_thread_realloc( kmp_info_t *th, void *ptr, size_t size KMP_SRC_LOC_DECL )
(int) size
KMP_SRC_LOC_PARM
) );
ptr = bgetr( th, ptr, (bufsize) size );
ptr = bgetr( th, ptr, (bufsize) size );
KE_TRACE( 30, ( "<- __kmp_thread_realloc() returns %p\n", ptr ) );
return ptr;
}
@@ -1537,8 +1578,8 @@ ___kmp_thread_free( kmp_info_t *th, void *ptr KMP_SRC_LOC_DECL )
KMP_SRC_LOC_PARM
) );
if ( ptr != NULL ) {
__kmp_bget_dequeue( th ); /* Release any queued buffers */
brel( th, ptr );
__kmp_bget_dequeue( th ); /* Release any queued buffers */
brel( th, ptr );
}
KE_TRACE( 30, ( "<- __kmp_thread_free()\n" ) );
}
@@ -1604,11 +1645,11 @@ ___kmp_allocate_align( size_t size, size_t alignment KMP_SRC_LOC_DECL )
descr.size_aligned = size;
descr.size_allocated = descr.size_aligned + sizeof( kmp_mem_descr_t ) + alignment;
#if KMP_DEBUG
descr.ptr_allocated = _malloc_src_loc( descr.size_allocated, _file_, _line_ );
#else
#if KMP_DEBUG
descr.ptr_allocated = _malloc_src_loc( descr.size_allocated, _file_, _line_ );
#else
descr.ptr_allocated = malloc_src_loc( descr.size_allocated KMP_SRC_LOC_PARM );
#endif
#endif
KE_TRACE( 10, (
" malloc( %d ) returned %p\n",
(int) descr.size_allocated,
@@ -1640,11 +1681,10 @@ ___kmp_allocate_align( size_t size, size_t alignment KMP_SRC_LOC_DECL )
KMP_DEBUG_ASSERT( addr_descr + sizeof( kmp_mem_descr_t ) == addr_aligned );
KMP_DEBUG_ASSERT( addr_aligned + descr.size_aligned <= addr_allocated + descr.size_allocated );
KMP_DEBUG_ASSERT( addr_aligned % alignment == 0 );
#ifdef KMP_DEBUG
memset( descr.ptr_allocated, 0xEF, descr.size_allocated );
// Fill allocated memory block with 0xEF.
#endif
#ifdef KMP_DEBUG
memset( descr.ptr_allocated, 0xEF, descr.size_allocated );
// Fill allocated memory block with 0xEF.
#endif
memset( descr.ptr_aligned, 0x00, descr.size_aligned );
// Fill the aligned memory block (which is intended for using by caller) with 0x00. Do not
// put this filling under KMP_DEBUG condition! Many callers expect zeroed memory. (Padding
@@ -1655,7 +1695,6 @@ ___kmp_allocate_align( size_t size, size_t alignment KMP_SRC_LOC_DECL )
KE_TRACE( 25, ( "<- ___kmp_allocate_align() returns %p\n", descr.ptr_aligned ) );
return descr.ptr_aligned;
} // func ___kmp_allocate_align
@@ -1668,13 +1707,11 @@ ___kmp_allocate_align( size_t size, size_t alignment KMP_SRC_LOC_DECL )
void *
___kmp_allocate( size_t size KMP_SRC_LOC_DECL )
{
void * ptr;
KE_TRACE( 25, ( "-> __kmp_allocate( %d ) called from %s:%d\n", (int) size KMP_SRC_LOC_PARM ) );
ptr = ___kmp_allocate_align( size, __kmp_align_alloc KMP_SRC_LOC_PARM );
ptr = ___kmp_allocate_align( size, __kmp_align_alloc KMP_SRC_LOC_PARM );
KE_TRACE( 25, ( "<- __kmp_allocate() returns %p\n", ptr ) );
return ptr;
} // func ___kmp_allocate
#if (BUILD_MEMORY==FIRST_TOUCH)
@@ -1728,7 +1765,7 @@ ___kmp_page_allocate( size_t size KMP_SRC_LOC_DECL )
(int) size
KMP_SRC_LOC_PARM
) );
ptr = ___kmp_allocate_align( size, page_size KMP_SRC_LOC_PARM );
ptr = ___kmp_allocate_align( size, page_size KMP_SRC_LOC_PARM );
KE_TRACE( 25, ( "<- __kmp_page_allocate( %d ) returns %p\n", (int) size, ptr ) );
return ptr;
} // ___kmp_page_allocate
@@ -1740,49 +1777,45 @@ ___kmp_page_allocate( size_t size KMP_SRC_LOC_DECL )
void
___kmp_free( void * ptr KMP_SRC_LOC_DECL )
{
kmp_mem_descr_t descr;
kmp_uintptr_t addr_allocated; // Address returned by malloc().
kmp_uintptr_t addr_aligned; // Aligned address passed by caller.
kmp_mem_descr_t descr;
kmp_uintptr_t addr_allocated; // Address returned by malloc().
kmp_uintptr_t addr_aligned; // Aligned address passed by caller.
KE_TRACE( 25, ( "-> __kmp_free( %p ) called from %s:%d\n", ptr KMP_SRC_LOC_PARM ) );
KMP_ASSERT( ptr != NULL );
KE_TRACE( 25, ( "-> __kmp_free( %p ) called from %s:%d\n", ptr KMP_SRC_LOC_PARM ) );
KMP_ASSERT( ptr != NULL );
descr = * ( kmp_mem_descr_t *) ( (kmp_uintptr_t) ptr - sizeof( kmp_mem_descr_t ) );
descr = * ( kmp_mem_descr_t *) ( (kmp_uintptr_t) ptr - sizeof( kmp_mem_descr_t ) );
KE_TRACE( 26, ( " __kmp_free: "
"ptr_allocated=%p, size_allocated=%d, "
"ptr_aligned=%p, size_aligned=%d\n",
descr.ptr_allocated, (int) descr.size_allocated,
descr.ptr_aligned, (int) descr.size_aligned ));
KE_TRACE( 26, ( " __kmp_free: "
"ptr_allocated=%p, size_allocated=%d, "
"ptr_aligned=%p, size_aligned=%d\n",
descr.ptr_allocated, (int) descr.size_allocated,
descr.ptr_aligned, (int) descr.size_aligned ));
addr_allocated = (kmp_uintptr_t) descr.ptr_allocated;
addr_aligned = (kmp_uintptr_t) descr.ptr_aligned;
addr_allocated = (kmp_uintptr_t) descr.ptr_allocated;
addr_aligned = (kmp_uintptr_t) descr.ptr_aligned;
KMP_DEBUG_ASSERT( addr_aligned % CACHE_LINE == 0 );
KMP_DEBUG_ASSERT( descr.ptr_aligned == ptr );
KMP_DEBUG_ASSERT( addr_allocated + sizeof( kmp_mem_descr_t ) <= addr_aligned );
KMP_DEBUG_ASSERT( descr.size_aligned < descr.size_allocated );
KMP_DEBUG_ASSERT( addr_aligned + descr.size_aligned <= addr_allocated + descr.size_allocated );
KMP_DEBUG_ASSERT( addr_aligned % CACHE_LINE == 0 );
KMP_DEBUG_ASSERT( descr.ptr_aligned == ptr );
KMP_DEBUG_ASSERT( addr_allocated + sizeof( kmp_mem_descr_t ) <= addr_aligned );
KMP_DEBUG_ASSERT( descr.size_aligned < descr.size_allocated );
KMP_DEBUG_ASSERT( addr_aligned + descr.size_aligned <= addr_allocated + descr.size_allocated );
#ifdef KMP_DEBUG
memset( descr.ptr_allocated, 0xEF, descr.size_allocated );
// Fill memory block with 0xEF, it helps catch using freed memory.
#endif
#ifndef LEAK_MEMORY
KE_TRACE( 10, ( " free( %p )\n", descr.ptr_allocated ) );
# ifdef KMP_DEBUG
_free_src_loc( descr.ptr_allocated, _file_, _line_ );
# else
free_src_loc( descr.ptr_allocated KMP_SRC_LOC_PARM );
# endif
#endif
#ifdef KMP_DEBUG
memset( descr.ptr_allocated, 0xEF, descr.size_allocated );
// Fill memory block with 0xEF, it helps catch using freed memory.
#endif
#ifndef LEAK_MEMORY
KE_TRACE( 10, ( " free( %p )\n", descr.ptr_allocated ) );
# ifdef KMP_DEBUG
_free_src_loc( descr.ptr_allocated, _file_, _line_ );
# else
free_src_loc( descr.ptr_allocated KMP_SRC_LOC_PARM );
# endif
#endif
KMP_MB();
KE_TRACE( 25, ( "<- __kmp_free() returns\n" ) );
} // func ___kmp_free
/* ------------------------------------------------------------------------ */
-3
View File
@@ -1,7 +1,5 @@
/*
* kmp_atomic.c -- ATOMIC implementation routines
* $Revision: 43421 $
* $Date: 2014-08-28 08:56:10 -0500 (Thu, 28 Aug 2014) $
*/
@@ -726,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; \
+36 -4
View File
@@ -1,7 +1,5 @@
/*
* kmp_atomic.h - ATOMIC header file
* $Revision: 43191 $
* $Date: 2014-05-27 07:44:11 -0500 (Tue, 27 May 2014) $
*/
@@ -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,6 +35,13 @@
#if defined( __cplusplus ) && ( KMP_OS_WINDOWS )
// create shortcuts for c99 complex types
// Visual Studio cannot have function parameters that have the
// align __declspec attribute, so we must remove it. (Compiler Error C2719)
#if KMP_COMPILER_MSVC
# undef KMP_DO_ALIGN
# define KMP_DO_ALIGN(alignment) /* Nothing */
#endif
#if (_MSC_VER < 1600) && defined(_DEBUG)
// Workaround for the problem of _DebugHeapTag unresolved external.
// This problem prevented to use our static debug library for C tests
@@ -209,7 +218,7 @@
// Compiler 12.0 changed alignment of 16 and 32-byte arguments (like _Quad
// and kmp_cmplx128) on IA-32 architecture. The following aligned structures
// are implemented to support the old alignment in 10.1, 11.0, 11.1 and
// are implemented to support the old alignment in 10.1, 11.0, 11.1 and
// introduce the new alignment in 12.0. See CQ88405.
#if KMP_ARCH_X86 && KMP_HAVE_QUAD
@@ -217,7 +226,7 @@
#pragma pack( push, 4 )
struct KMP_DO_ALIGN( 4 ) Quad_a4_t {
_Quad q;
@@ -368,7 +377,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_enabled &&
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_enabled &&
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 +406,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_enabled &&
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
+259 -105
View File
@@ -1,7 +1,5 @@
/*
* kmp_barrier.cpp
* $Revision: 43473 $
* $Date: 2014-09-26 15:02:57 -0500 (Fri, 26 Sep 2014) $
*/
@@ -19,6 +17,8 @@
#include "kmp_wait_release.h"
#include "kmp_stats.h"
#include "kmp_itt.h"
#include "kmp_os.h"
#if KMP_MIC
#include <immintrin.h>
@@ -34,7 +34,7 @@
#else
#define ngo_load(src) ((void)0)
#define ngo_store_icvs(dst, src) copy_icvs((dst), (src))
#define ngo_store_go(dst, src) memcpy((dst), (src), CACHE_LINE)
#define ngo_store_go(dst, src) KMP_MEMCPY((dst), (src), CACHE_LINE)
#define ngo_sync() ((void)0)
#endif /* KMP_MIC && USE_NGO_STORES */
@@ -48,7 +48,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
void (*reduce)(void *, void *)
USE_ITT_BUILD_ARG(void * itt_sync_obj) )
{
KMP_TIME_BLOCK(KMP_linear_gather);
KMP_TIME_DEVELOPER_BLOCK(KMP_linear_gather);
register kmp_team_t *team = this_thr->th.th_team;
register kmp_bstate_t *thr_bar = & this_thr->th.th_bar[bt].bb;
register kmp_info_t **other_threads = team->t.t_threads;
@@ -59,14 +59,14 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - save arrive time to the thread
if(__kmp_forkjoin_frames_mode == 2 || __kmp_forkjoin_frames_mode == 3) {
if(__kmp_forkjoin_frames_mode == 3 || __kmp_forkjoin_frames_mode == 2) {
this_thr->th.th_bar_arrive_time = this_thr->th.th_bar_min_time = __itt_get_timestamp();
}
#endif
// We now perform a linear reduction to signal that all of the threads have arrived.
if (!KMP_MASTER_TID(tid)) {
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) releasing T#%d(%d:%d)"
"arrived(%p): %u => %u\n", gtid, team->t.t_id, tid,
"arrived(%p): %llu => %llu\n", gtid, team->t.t_id, tid,
__kmp_gtid_from_tid(0, team), team->t.t_id, 0, &thr_bar->b_arrived,
thr_bar->b_arrived, thr_bar->b_arrived + KMP_BARRIER_STATE_BUMP));
// Mark arrival to master thread
@@ -79,7 +79,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
register int nproc = this_thr->th.th_team_nproc;
register int i;
// Don't have to worry about sleep bit here or atomic since team setting
register kmp_uint new_state = team_bar->b_arrived + KMP_BARRIER_STATE_BUMP;
register kmp_uint64 new_state = team_bar->b_arrived + KMP_BARRIER_STATE_BUMP;
// Collect all the worker team member threads.
for (i=1; i<nproc; ++i) {
@@ -89,7 +89,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
KMP_CACHE_PREFETCH(&other_threads[i+1]->th.th_bar[bt].bb.b_arrived);
#endif /* KMP_CACHE_MANAGE */
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%d) "
"arrived(%p) == %u\n", gtid, team->t.t_id, tid,
"arrived(%p) == %llu\n", gtid, team->t.t_id, tid,
__kmp_gtid_from_tid(i, team), team->t.t_id, i,
&other_threads[i]->th.th_bar[bt].bb.b_arrived, new_state));
@@ -99,7 +99,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
USE_ITT_BUILD_ARG(itt_sync_obj) );
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - write min of the thread time and the other thread time to the thread.
if (__kmp_forkjoin_frames_mode == 2 || __kmp_forkjoin_frames_mode == 3) {
if (__kmp_forkjoin_frames_mode == 2) {
this_thr->th.th_bar_min_time = KMP_MIN(this_thr->th.th_bar_min_time,
other_threads[i]->th.th_bar_min_time);
}
@@ -113,7 +113,7 @@ __kmp_linear_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid
}
// Don't have to worry about sleep bit here or atomic since team setting
team_bar->b_arrived = new_state;
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n",
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %llu\n",
gtid, team->t.t_id, tid, team->t.t_id, &team_bar->b_arrived, new_state));
}
KA_TRACE(20, ("__kmp_linear_barrier_gather: T#%d(%d:%d) exit for barrier type %d\n",
@@ -125,7 +125,7 @@ __kmp_linear_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gti
int propagate_icvs
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
{
KMP_TIME_BLOCK(KMP_linear_release);
KMP_TIME_DEVELOPER_BLOCK(KMP_linear_release);
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
register kmp_team_t *team;
@@ -143,17 +143,18 @@ __kmp_linear_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gti
if (nproc > 1) {
#if KMP_BARRIER_ICV_PUSH
KMP_START_EXPLICIT_TIMER(USER_icv_copy);
if (propagate_icvs) {
ngo_load(&team->t.t_implicit_task_taskdata[0].td_icvs);
for (i=1; i<nproc; ++i) {
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[i], team, i, FALSE);
ngo_store_icvs(&team->t.t_implicit_task_taskdata[i].td_icvs,
&team->t.t_implicit_task_taskdata[0].td_icvs);
{
KMP_TIME_DEVELOPER_BLOCK(USER_icv_copy);
if (propagate_icvs) {
ngo_load(&team->t.t_implicit_task_taskdata[0].td_icvs);
for (i=1; i<nproc; ++i) {
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[i], team, i, FALSE);
ngo_store_icvs(&team->t.t_implicit_task_taskdata[i].td_icvs,
&team->t.t_implicit_task_taskdata[0].td_icvs);
}
ngo_sync();
}
ngo_sync();
}
KMP_STOP_EXPLICIT_TIMER(USER_icv_copy);
#endif // KMP_BARRIER_ICV_PUSH
// Now, release all of the worker threads
@@ -219,7 +220,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
void (*reduce)(void *, void *)
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
{
KMP_TIME_BLOCK(KMP_tree_gather);
KMP_TIME_DEVELOPER_BLOCK(KMP_tree_gather);
register kmp_team_t *team = this_thr->th.th_team;
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
register kmp_info_t **other_threads = team->t.t_threads;
@@ -228,7 +229,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
register kmp_uint32 branch_factor = 1 << branch_bits;
register kmp_uint32 child;
register kmp_uint32 child_tid;
register kmp_uint new_state;
register kmp_uint64 new_state;
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) enter for barrier type %d\n",
gtid, team->t.t_id, tid, bt));
@@ -236,7 +237,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - save arrive time to the thread
if(__kmp_forkjoin_frames_mode == 2 || __kmp_forkjoin_frames_mode == 3) {
if(__kmp_forkjoin_frames_mode == 3 || __kmp_forkjoin_frames_mode == 2) {
this_thr->th.th_bar_arrive_time = this_thr->th.th_bar_min_time = __itt_get_timestamp();
}
#endif
@@ -255,7 +256,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
KMP_CACHE_PREFETCH(&other_threads[child_tid+1]->th.th_bar[bt].bb.b_arrived);
#endif /* KMP_CACHE_MANAGE */
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%u) "
"arrived(%p) == %u\n", gtid, team->t.t_id, tid,
"arrived(%p) == %llu\n", gtid, team->t.t_id, tid,
__kmp_gtid_from_tid(child_tid, team), team->t.t_id, child_tid,
&child_bar->b_arrived, new_state));
// Wait for child to arrive
@@ -264,7 +265,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
USE_ITT_BUILD_ARG(itt_sync_obj) );
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - write min of the thread time and a child time to the thread.
if (__kmp_forkjoin_frames_mode == 2 || __kmp_forkjoin_frames_mode == 3) {
if (__kmp_forkjoin_frames_mode == 2) {
this_thr->th.th_bar_min_time = KMP_MIN(this_thr->th.th_bar_min_time,
child_thr->th.th_bar_min_time);
}
@@ -285,7 +286,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
register kmp_int32 parent_tid = (tid - 1) >> branch_bits;
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) releasing T#%d(%d:%d) "
"arrived(%p): %u => %u\n", gtid, team->t.t_id, tid,
"arrived(%p): %llu => %llu\n", gtid, team->t.t_id, tid,
__kmp_gtid_from_tid(parent_tid, team), team->t.t_id, parent_tid,
&thr_bar->b_arrived, thr_bar->b_arrived,
thr_bar->b_arrived + KMP_BARRIER_STATE_BUMP));
@@ -301,7 +302,7 @@ __kmp_tree_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
team->t.t_bar[bt].b_arrived = new_state;
else
team->t.t_bar[bt].b_arrived += KMP_BARRIER_STATE_BUMP;
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n",
KA_TRACE(20, ("__kmp_tree_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %llu\n",
gtid, team->t.t_id, tid, team->t.t_id,
&team->t.t_bar[bt].b_arrived, team->t.t_bar[bt].b_arrived));
}
@@ -314,7 +315,7 @@ __kmp_tree_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
int propagate_icvs
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
{
KMP_TIME_BLOCK(KMP_tree_release);
KMP_TIME_DEVELOPER_BLOCK(KMP_tree_release);
register kmp_team_t *team;
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
register kmp_uint32 nproc;
@@ -383,14 +384,15 @@ __kmp_tree_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
#endif /* KMP_CACHE_MANAGE */
#if KMP_BARRIER_ICV_PUSH
KMP_START_EXPLICIT_TIMER(USER_icv_copy);
if (propagate_icvs) {
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[child_tid],
team, child_tid, FALSE);
copy_icvs(&team->t.t_implicit_task_taskdata[child_tid].td_icvs,
&team->t.t_implicit_task_taskdata[0].td_icvs);
{
KMP_TIME_DEVELOPER_BLOCK(USER_icv_copy);
if (propagate_icvs) {
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[child_tid],
team, child_tid, FALSE);
copy_icvs(&team->t.t_implicit_task_taskdata[child_tid].td_icvs,
&team->t.t_implicit_task_taskdata[0].td_icvs);
}
}
KMP_STOP_EXPLICIT_TIMER(USER_icv_copy);
#endif // KMP_BARRIER_ICV_PUSH
KA_TRACE(20, ("__kmp_tree_barrier_release: T#%d(%d:%d) releasing T#%d(%d:%u)"
"go(%p): %u => %u\n", gtid, team->t.t_id, tid,
@@ -416,11 +418,11 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
void (*reduce)(void *, void *)
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
{
KMP_TIME_BLOCK(KMP_hyper_gather);
KMP_TIME_DEVELOPER_BLOCK(KMP_hyper_gather);
register kmp_team_t *team = this_thr->th.th_team;
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
register kmp_info_t **other_threads = team->t.t_threads;
register kmp_uint new_state = KMP_BARRIER_UNUSED_STATE;
register kmp_uint64 new_state = KMP_BARRIER_UNUSED_STATE;
register kmp_uint32 num_threads = this_thr->th.th_team_nproc;
register kmp_uint32 branch_bits = __kmp_barrier_gather_branch_bits[bt];
register kmp_uint32 branch_factor = 1 << branch_bits;
@@ -434,7 +436,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - save arrive time to the thread
if(__kmp_forkjoin_frames_mode == 2 || __kmp_forkjoin_frames_mode == 3) {
if(__kmp_forkjoin_frames_mode == 3 || __kmp_forkjoin_frames_mode == 2) {
this_thr->th.th_bar_arrive_time = this_thr->th.th_bar_min_time = __itt_get_timestamp();
}
#endif
@@ -450,7 +452,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
register kmp_int32 parent_tid = tid & ~((1 << (level + branch_bits)) -1);
KA_TRACE(20, ("__kmp_hyper_barrier_gather: T#%d(%d:%d) releasing T#%d(%d:%d) "
"arrived(%p): %u => %u\n", gtid, team->t.t_id, tid,
"arrived(%p): %llu => %llu\n", gtid, team->t.t_id, tid,
__kmp_gtid_from_tid(parent_tid, team), team->t.t_id, parent_tid,
&thr_bar->b_arrived, thr_bar->b_arrived,
thr_bar->b_arrived + KMP_BARRIER_STATE_BUMP));
@@ -459,7 +461,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
a worker thread may not assume that the team is valid any more - it could be
deallocated by the master thread at any time. */
p_flag.set_waiter(other_threads[parent_tid]);
p_flag.release();
p_flag.release();
break;
}
@@ -478,7 +480,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
KMP_CACHE_PREFETCH(&other_threads[next_child_tid]->th.th_bar[bt].bb.b_arrived);
#endif /* KMP_CACHE_MANAGE */
KA_TRACE(20, ("__kmp_hyper_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%u) "
"arrived(%p) == %u\n", gtid, team->t.t_id, tid,
"arrived(%p) == %llu\n", gtid, team->t.t_id, tid,
__kmp_gtid_from_tid(child_tid, team), team->t.t_id, child_tid,
&child_bar->b_arrived, new_state));
// Wait for child to arrive
@@ -487,7 +489,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
USE_ITT_BUILD_ARG(itt_sync_obj) );
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - write min of the thread time and a child time to the thread.
if (__kmp_forkjoin_frames_mode == 2 || __kmp_forkjoin_frames_mode == 3) {
if (__kmp_forkjoin_frames_mode == 2) {
this_thr->th.th_bar_min_time = KMP_MIN(this_thr->th.th_bar_min_time,
child_thr->th.th_bar_min_time);
}
@@ -507,7 +509,7 @@ __kmp_hyper_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, int gtid,
team->t.t_bar[bt].b_arrived += KMP_BARRIER_STATE_BUMP;
else
team->t.t_bar[bt].b_arrived = new_state;
KA_TRACE(20, ("__kmp_hyper_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n",
KA_TRACE(20, ("__kmp_hyper_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %llu\n",
gtid, team->t.t_id, tid, team->t.t_id,
&team->t.t_bar[bt].b_arrived, team->t.t_bar[bt].b_arrived));
}
@@ -522,7 +524,7 @@ __kmp_hyper_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, int gtid
int propagate_icvs
USE_ITT_BUILD_ARG(void *itt_sync_obj) )
{
KMP_TIME_BLOCK(KMP_hyper_release);
KMP_TIME_DEVELOPER_BLOCK(KMP_hyper_release);
register kmp_team_t *team;
register kmp_bstate_t *thr_bar = & this_thr -> th.th_bar[ bt ].bb;
register kmp_info_t **other_threads;
@@ -704,6 +706,8 @@ __kmp_init_hierarchical_barrier_thread(enum barrier_type bt, kmp_bstate_t *thr_b
thr_bar->offset = 7-(tid-thr_bar->parent_tid-1);
thr_bar->old_tid = tid;
thr_bar->wait_flag = KMP_BARRIER_NOT_WAITING;
thr_bar->team = team;
thr_bar->parent_bar = &team->t.t_threads[thr_bar->parent_tid]->th.th_bar[bt].bb;
}
if (uninitialized || team_changed || tid_changed) {
thr_bar->team = team;
@@ -727,20 +731,33 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
int gtid, int tid, void (*reduce) (void *, void *)
USE_ITT_BUILD_ARG(void * itt_sync_obj) )
{
KMP_TIME_BLOCK(KMP_hier_gather);
KMP_TIME_DEVELOPER_BLOCK(KMP_hier_gather);
register kmp_team_t *team = this_thr->th.th_team;
register kmp_bstate_t *thr_bar = & this_thr->th.th_bar[bt].bb;
register kmp_uint32 nproc = this_thr->th.th_team_nproc;
register kmp_info_t **other_threads = team->t.t_threads;
register kmp_uint64 new_state;
if (this_thr->th.th_team->t.t_level == 1) thr_bar->use_oncore_barrier = 1;
int level = team->t.t_level;
#if OMP_40_ENABLED
if (other_threads[0]->th.th_teams_microtask) // are we inside the teams construct?
if (this_thr->th.th_teams_size.nteams > 1)
++level; // level was not increased in teams construct for team_of_masters
#endif
if (level == 1) thr_bar->use_oncore_barrier = 1;
else thr_bar->use_oncore_barrier = 0; // Do not use oncore barrier when nested
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) enter for barrier type %d\n",
gtid, team->t.t_id, tid, bt));
KMP_DEBUG_ASSERT(this_thr == other_threads[this_thr->th.th_info.ds.ds_tid]);
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - save arrive time to the thread
if(__kmp_forkjoin_frames_mode == 3 || __kmp_forkjoin_frames_mode == 2) {
this_thr->th.th_bar_arrive_time = __itt_get_timestamp();
}
#endif
(void)__kmp_init_hierarchical_barrier_thread(bt, thr_bar, nproc, gtid, tid, team);
if (thr_bar->my_level) { // not a leaf (my_level==0 means leaf)
@@ -748,7 +765,9 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
new_state = (kmp_uint64)team->t.t_bar[bt].b_arrived + KMP_BARRIER_STATE_BUMP;
if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME && thr_bar->use_oncore_barrier) {
if (thr_bar->leaf_kids) { // First, wait for leaf children to check-in on my b_arrived flag
kmp_uint64 leaf_state = KMP_MASTER_TID(tid) ? thr_bar->b_arrived | thr_bar->leaf_state : (kmp_uint64)team->t.t_bar[bt].b_arrived | thr_bar->leaf_state;
kmp_uint64 leaf_state = KMP_MASTER_TID(tid) ? thr_bar->b_arrived | thr_bar->leaf_state : team->t.t_bar[bt].b_arrived | thr_bar->leaf_state;
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) waiting for leaf kids\n",
gtid, team->t.t_id, tid));
kmp_flag_64 flag(&thr_bar->b_arrived, leaf_state);
flag.wait(this_thr, FALSE
USE_ITT_BUILD_ARG(itt_sync_obj) );
@@ -770,7 +789,7 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
register kmp_info_t *child_thr = other_threads[child_tid];
register kmp_bstate_t *child_bar = &child_thr->th.th_bar[bt].bb;
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%d) "
"arrived(%p) == %u\n",
"arrived(%p) == %llu\n",
gtid, team->t.t_id, tid, __kmp_gtid_from_tid(child_tid, team),
team->t.t_id, child_tid, &child_bar->b_arrived, new_state));
kmp_flag_64 flag(&child_bar->b_arrived, new_state);
@@ -793,7 +812,7 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
register kmp_info_t *child_thr = other_threads[child_tid];
register kmp_bstate_t *child_bar = &child_thr->th.th_bar[bt].bb;
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) wait T#%d(%d:%d) "
"arrived(%p) == %u\n",
"arrived(%p) == %llu\n",
gtid, team->t.t_id, tid, __kmp_gtid_from_tid(child_tid, team),
team->t.t_id, child_tid, &child_bar->b_arrived, new_state));
kmp_flag_64 flag(&child_bar->b_arrived, new_state);
@@ -813,7 +832,7 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
if (!KMP_MASTER_TID(tid)) { // worker threads release parent in hierarchy
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) releasing T#%d(%d:%d) "
"arrived(%p): %u => %u\n", gtid, team->t.t_id, tid,
"arrived(%p): %llu => %llu\n", gtid, team->t.t_id, tid,
__kmp_gtid_from_tid(thr_bar->parent_tid, team), team->t.t_id, thr_bar->parent_tid,
&thr_bar->b_arrived, thr_bar->b_arrived, thr_bar->b_arrived+KMP_BARRIER_STATE_BUMP));
/* Mark arrival to parent: After performing this write, a worker thread may not assume that
@@ -824,19 +843,16 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr,
flag.release();
}
else { // Leaf does special release on the "offset" bits of parent's b_arrived flag
thr_bar->b_arrived = (kmp_uint64)team->t.t_bar[bt].b_arrived + KMP_BARRIER_STATE_BUMP;
thr_bar->b_arrived = team->t.t_bar[bt].b_arrived + KMP_BARRIER_STATE_BUMP;
kmp_flag_oncore flag(&thr_bar->parent_bar->b_arrived, thr_bar->offset);
flag.set_waiter(other_threads[thr_bar->parent_tid]);
flag.release();
}
} else { // Master thread needs to update the team's b_arrived value
team->t.t_bar[bt].b_arrived = (kmp_uint32)new_state;
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n",
team->t.t_bar[bt].b_arrived = new_state;
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %llu\n",
gtid, team->t.t_id, tid, team->t.t_id, &team->t.t_bar[bt].b_arrived, team->t.t_bar[bt].b_arrived));
}
// If nested, but outer level is top-level, resume use of oncore optimization
if (this_thr->th.th_team->t.t_level <=2) thr_bar->use_oncore_barrier = 1;
else thr_bar->use_oncore_barrier = 0;
// Is the team access below unsafe or just technically invalid?
KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) exit for barrier type %d\n",
gtid, team->t.t_id, tid, bt));
@@ -847,7 +863,7 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i
int propagate_icvs
USE_ITT_BUILD_ARG(void * itt_sync_obj) )
{
KMP_TIME_BLOCK(KMP_hier_release);
KMP_TIME_DEVELOPER_BLOCK(KMP_hier_release);
register kmp_team_t *team;
register kmp_bstate_t *thr_bar = &this_thr->th.th_bar[bt].bb;
register kmp_uint32 nproc;
@@ -876,8 +892,7 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i
kmp_flag_oncore flag(&thr_bar->parent_bar->b_go, KMP_BARRIER_STATE_BUMP, thr_bar->offset,
bt, this_thr
USE_ITT_BUILD_ARG(itt_sync_obj) );
flag.wait(this_thr, TRUE
USE_ITT_BUILD_ARG(itt_sync_obj) );
flag.wait(this_thr, TRUE);
if (thr_bar->wait_flag == KMP_BARRIER_SWITCHING) { // Thread was switched to own b_go
TCW_8(thr_bar->b_go, KMP_INIT_BARRIER_STATE); // Reset my b_go flag for next time
}
@@ -899,9 +914,18 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i
KMP_MB(); // Flush all pending memory write invalidates.
}
if (this_thr->th.th_team->t.t_level <= 1) thr_bar->use_oncore_barrier = 1;
else thr_bar->use_oncore_barrier = 0;
nproc = this_thr->th.th_team_nproc;
int level = team->t.t_level;
#if OMP_40_ENABLED
if (team->t.t_threads[0]->th.th_teams_microtask ) { // are we inside the teams construct?
if (team->t.t_pkfn != (microtask_t)__kmp_teams_master && this_thr->th.th_teams_level == level)
++level; // level was not increased in teams construct for team_of_workers
if( this_thr->th.th_teams_size.nteams > 1 )
++level; // level was not increased in teams construct for team_of_masters
}
#endif
if (level == 1) thr_bar->use_oncore_barrier = 1;
else thr_bar->use_oncore_barrier = 0; // Do not use oncore barrier when nested
// If the team size has increased, we still communicate with old leaves via oncore barrier.
unsigned short int old_leaf_kids = thr_bar->leaf_kids;
@@ -912,6 +936,7 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i
#if KMP_BARRIER_ICV_PUSH
if (propagate_icvs) {
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[tid], team, tid, FALSE);
if (KMP_MASTER_TID(tid)) { // master already has copy in final destination; copy
copy_icvs(&thr_bar->th_fixed_icvs, &team->t.t_implicit_task_taskdata[tid].td_icvs);
}
@@ -1022,16 +1047,48 @@ int
__kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
void *reduce_data, void (*reduce)(void *, void *))
{
KMP_TIME_BLOCK(KMP_barrier);
KMP_TIME_DEVELOPER_BLOCK(KMP_barrier);
KMP_SET_THREAD_STATE_BLOCK(PLAIN_BARRIER);
KMP_TIME_PARTITIONED_BLOCK(OMP_plain_barrier);
register int tid = __kmp_tid_from_gtid(gtid);
register kmp_info_t *this_thr = __kmp_threads[gtid];
register kmp_team_t *team = this_thr->th.th_team;
register int status = 0;
ident_t *loc = __kmp_threads[gtid]->th.th_ident;
#if OMPT_SUPPORT
ompt_task_id_t my_task_id;
ompt_parallel_id_t my_parallel_id;
#endif
KA_TRACE(15, ("__kmp_barrier: T#%d(%d:%d) has arrived\n",
gtid, __kmp_team_from_gtid(gtid)->t.t_id, __kmp_tid_from_gtid(gtid)));
#if OMPT_SUPPORT
if (ompt_enabled) {
#if OMPT_BLAME
my_task_id = team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id;
my_parallel_id = team->t.ompt_team_info.parallel_id;
#if OMPT_TRACE
if (this_thr->th.ompt_thread_info.state == ompt_state_wait_single) {
if (ompt_callbacks.ompt_callback(ompt_event_single_others_end)) {
ompt_callbacks.ompt_callback(ompt_event_single_others_end)(
my_parallel_id, my_task_id);
}
}
#endif
if (ompt_callbacks.ompt_callback(ompt_event_barrier_begin)) {
ompt_callbacks.ompt_callback(ompt_event_barrier_begin)(
my_parallel_id, my_task_id);
}
#endif
// It is OK to report the barrier state after the barrier begin callback.
// According to the OMPT specification, a compliant implementation may
// even delay reporting this state until the barrier begins to wait.
this_thr->th.ompt_thread_info.state = ompt_state_wait_barrier;
}
#endif
if (! team->t.t_serialized) {
#if USE_ITT_BUILD
// This value will be used in itt notify events below.
@@ -1059,11 +1116,22 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
if (__itt_sync_create_ptr || KMP_ITT_DEBUG)
__kmp_itt_barrier_starting(gtid, itt_sync_obj);
#endif /* USE_ITT_BUILD */
#if USE_DEBUGGER
// Let the debugger know: the thread arrived to the barrier and waiting.
if (KMP_MASTER_TID(tid)) { // Master counter is stored in team structure.
team->t.t_bar[bt].b_master_arrived += 1;
} else {
this_thr->th.th_bar[bt].bb.b_worker_arrived += 1;
} // if
#endif /* USE_DEBUGGER */
if (reduce != NULL) {
//KMP_DEBUG_ASSERT( is_split == TRUE ); // #C69956
this_thr->th.th_local.reduce_data = reduce_data;
}
if (KMP_MASTER_TID(tid) && __kmp_tasking_mode != tskm_immediate_exec)
__kmp_task_team_setup(this_thr, team, 0); // use 0 to only setup the current team if nthreads > 1
switch (__kmp_barrier_gather_pattern[bt]) {
case bp_hyper_bar: {
KMP_ASSERT(__kmp_barrier_gather_branch_bits[bt]); // don't set branch bits to 0; use linear
@@ -1095,9 +1163,11 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
if (__kmp_tasking_mode != tskm_immediate_exec) {
__kmp_task_team_wait(this_thr, team
USE_ITT_BUILD_ARG(itt_sync_obj) );
__kmp_task_team_setup(this_thr, team);
}
#if USE_DEBUGGER
// Let the debugger know: All threads are arrived and starting leaving the barrier.
team->t.t_bar[bt].b_team_arrived += 1;
#endif
#if USE_ITT_BUILD
/* TODO: In case of split reduction barrier, master thread may send acquired event early,
@@ -1107,26 +1177,34 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
__kmp_itt_barrier_middle(gtid, itt_sync_obj);
#endif /* USE_ITT_BUILD */
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier - report frame end
if (__itt_frame_submit_v3_ptr && __kmp_forkjoin_frames_mode) {
// Barrier - report frame end (only if active_level == 1)
if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) && __kmp_forkjoin_frames_mode &&
#if OMP_40_ENABLED
this_thr->th.th_teams_microtask == NULL &&
#endif
team->t.t_active_level == 1)
{
kmp_uint64 cur_time = __itt_get_timestamp();
kmp_info_t **other_threads = this_thr->th.th_team->t.t_threads;
kmp_info_t **other_threads = team->t.t_threads;
int nproc = this_thr->th.th_team_nproc;
int i;
// Initialize with master's wait time
kmp_uint64 delta = cur_time - this_thr->th.th_bar_arrive_time;
switch(__kmp_forkjoin_frames_mode) {
case 1:
__kmp_itt_frame_submit(gtid, this_thr->th.th_frame_time, cur_time, 0, loc, nproc);
this_thr->th.th_frame_time = cur_time;
break;
case 2:
case 2: // AC 2015-01-19: currently does not work for hierarchical (to be fixed)
__kmp_itt_frame_submit(gtid, this_thr->th.th_bar_min_time, cur_time, 1, loc, nproc);
break;
case 3:
if( __itt_metadata_add_ptr ) {
// Initialize with master's wait time
kmp_uint64 delta = cur_time - this_thr->th.th_bar_arrive_time;
// Set arrive time to zero to be able to check it in __kmp_invoke_task(); the same is done inside the loop below
this_thr->th.th_bar_arrive_time = 0;
for (i=1; i<nproc; ++i) {
delta += ( cur_time - other_threads[i]->th.th_bar_arrive_time );
other_threads[i]->th.th_bar_arrive_time = 0;
}
__kmp_itt_metadata_imbalance(gtid, this_thr->th.th_frame_time, cur_time, delta, (kmp_uint64)( reduce != NULL));
}
@@ -1182,13 +1260,48 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
} else { // Team is serialized.
status = 0;
if (__kmp_tasking_mode != tskm_immediate_exec) {
#if OMP_45_ENABLED
if ( this_thr->th.th_task_team != NULL ) {
void *itt_sync_obj = NULL;
#if USE_ITT_NOTIFY
if (__itt_sync_create_ptr || KMP_ITT_DEBUG) {
itt_sync_obj = __kmp_itt_barrier_object(gtid, bt, 1);
__kmp_itt_barrier_starting(gtid, itt_sync_obj);
}
#endif
KMP_DEBUG_ASSERT(this_thr->th.th_task_team->tt.tt_found_proxy_tasks == TRUE);
__kmp_task_team_wait(this_thr, team
USE_ITT_BUILD_ARG(itt_sync_obj));
__kmp_task_team_setup(this_thr, team, 0);
#if USE_ITT_BUILD
if (__itt_sync_create_ptr || KMP_ITT_DEBUG)
__kmp_itt_barrier_finished(gtid, itt_sync_obj);
#endif /* USE_ITT_BUILD */
}
#else
// The task team should be NULL for serialized code (tasks will be executed immediately)
KMP_DEBUG_ASSERT(team->t.t_task_team == NULL);
KMP_DEBUG_ASSERT(team->t.t_task_team[this_thr->th.th_task_state] == NULL);
KMP_DEBUG_ASSERT(this_thr->th.th_task_team == NULL);
#endif
}
}
KA_TRACE(15, ("__kmp_barrier: T#%d(%d:%d) is leaving with return value %d\n",
gtid, __kmp_team_from_gtid(gtid)->t.t_id, __kmp_tid_from_gtid(gtid), status));
#if OMPT_SUPPORT
if (ompt_enabled) {
#if OMPT_BLAME
if (ompt_callbacks.ompt_callback(ompt_event_barrier_end)) {
ompt_callbacks.ompt_callback(ompt_event_barrier_end)(
my_parallel_id, my_task_id);
}
#endif
this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
}
#endif
return status;
}
@@ -1196,7 +1309,7 @@ __kmp_barrier(enum barrier_type bt, int gtid, int is_split, size_t reduce_size,
void
__kmp_end_split_barrier(enum barrier_type bt, int gtid)
{
KMP_TIME_BLOCK(KMP_end_split_barrier);
KMP_TIME_DEVELOPER_BLOCK(KMP_end_split_barrier);
int tid = __kmp_tid_from_gtid(gtid);
kmp_info_t *this_thr = __kmp_threads[gtid];
kmp_team_t *team = this_thr->th.th_team;
@@ -1237,7 +1350,9 @@ __kmp_end_split_barrier(enum barrier_type bt, int gtid)
void
__kmp_join_barrier(int gtid)
{
KMP_TIME_BLOCK(KMP_join_barrier);
KMP_TIME_PARTITIONED_BLOCK(OMP_fork_join_barrier);
KMP_SET_THREAD_STATE_BLOCK(FORK_JOIN_BARRIER);
KMP_TIME_DEVELOPER_BLOCK(KMP_join_barrier);
register kmp_info_t *this_thr = __kmp_threads[gtid];
register kmp_team_t *team;
register kmp_uint nproc;
@@ -1280,6 +1395,18 @@ __kmp_join_barrier(int gtid)
KMP_DEBUG_ASSERT(this_thr == team->t.t_threads[tid]);
KA_TRACE(10, ("__kmp_join_barrier: T#%d(%d:%d) arrived at join barrier\n", gtid, team_id, tid));
#if OMPT_SUPPORT
#if OMPT_TRACE
if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_barrier_begin)) {
ompt_callbacks.ompt_callback(ompt_event_barrier_begin)(
team->t.ompt_team_info.parallel_id,
team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id);
}
#endif
this_thr->th.ompt_thread_info.state = ompt_state_wait_barrier;
#endif
if (__kmp_tasking_mode == tskm_extra_barrier) {
__kmp_tasking_barrier(team, this_thr, gtid);
KA_TRACE(10, ("__kmp_join_barrier: T#%d(%d:%d) past taking barrier\n", gtid, team_id, tid));
@@ -1287,9 +1414,9 @@ __kmp_join_barrier(int gtid)
# ifdef KMP_DEBUG
if (__kmp_tasking_mode != tskm_immediate_exec) {
KA_TRACE(20, ( "__kmp_join_barrier: T#%d, old team = %d, old task_team = %p, th_task_team = %p\n",
__kmp_gtid_from_thread(this_thr), team_id, team->t.t_task_team,
__kmp_gtid_from_thread(this_thr), team_id, team->t.t_task_team[this_thr->th.th_task_state],
this_thr->th.th_task_team));
KMP_DEBUG_ASSERT(this_thr->th.th_task_team == team->t.t_task_team);
KMP_DEBUG_ASSERT(this_thr->th.th_task_team == team->t.t_task_team[this_thr->th.th_task_state]);
}
# endif /* KMP_DEBUG */
@@ -1337,11 +1464,21 @@ __kmp_join_barrier(int gtid)
the kmp_task_team_t structs. */
if (KMP_MASTER_TID(tid)) {
if (__kmp_tasking_mode != tskm_immediate_exec) {
// Master shouldn't call decrease_load(). // TODO: enable master threads.
// Master should have th_may_decrease_load == 0. // TODO: enable master threads.
__kmp_task_team_wait(this_thr, team
USE_ITT_BUILD_ARG(itt_sync_obj) );
}
#if KMP_STATS_ENABLED
// Have master thread flag the workers to indicate they are now waiting for
// next parallel region, Also wake them up so they switch their timers to idle.
for (int i=0; i<team->t.t_nproc; ++i) {
kmp_info_t* team_thread = team->t.t_threads[i];
if (team_thread == this_thr)
continue;
team_thread->th.th_stats->setIdleFlag();
if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME && team_thread->th.th_sleep_loc != NULL)
__kmp_null_resume_wrapper(__kmp_gtid_from_thread(team_thread), team_thread->th.th_sleep_loc);
}
#endif
#if USE_ITT_BUILD
if (__itt_sync_create_ptr || KMP_ITT_DEBUG)
__kmp_itt_barrier_middle(gtid, itt_sync_obj);
@@ -1349,14 +1486,17 @@ __kmp_join_barrier(int gtid)
# if USE_ITT_BUILD && USE_ITT_NOTIFY
// Join barrier - report frame end
if (__itt_frame_submit_v3_ptr && __kmp_forkjoin_frames_mode) {
if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) && __kmp_forkjoin_frames_mode &&
#if OMP_40_ENABLED
this_thr->th.th_teams_microtask == NULL &&
#endif
team->t.t_active_level == 1)
{
kmp_uint64 cur_time = __itt_get_timestamp();
ident_t * loc = team->t.t_ident;
kmp_info_t **other_threads = this_thr->th.th_team->t.t_threads;
kmp_info_t **other_threads = team->t.t_threads;
int nproc = this_thr->th.th_team_nproc;
int i;
// Initialize with master's wait time
kmp_uint64 delta = cur_time - this_thr->th.th_bar_arrive_time;
switch(__kmp_forkjoin_frames_mode) {
case 1:
__kmp_itt_frame_submit(gtid, this_thr->th.th_frame_time, cur_time, 0, loc, nproc);
@@ -1366,8 +1506,13 @@ __kmp_join_barrier(int gtid)
break;
case 3:
if( __itt_metadata_add_ptr ) {
// Initialize with master's wait time
kmp_uint64 delta = cur_time - this_thr->th.th_bar_arrive_time;
// Set arrive time to zero to be able to check it in __kmp_invoke_task(); the same is done inside the loop below
this_thr->th.th_bar_arrive_time = 0;
for (i=1; i<nproc; ++i) {
delta += ( cur_time - other_threads[i]->th.th_bar_arrive_time );
other_threads[i]->th.th_bar_arrive_time = 0;
}
__kmp_itt_metadata_imbalance(gtid, this_thr->th.th_frame_time, cur_time, delta, 0);
}
@@ -1395,6 +1540,21 @@ __kmp_join_barrier(int gtid)
// TODO now, mark worker threads as done so they may be disbanded
KMP_MB(); // Flush all pending memory write invalidates.
KA_TRACE(10, ("__kmp_join_barrier: T#%d(%d:%d) leaving\n", gtid, team_id, tid));
#if OMPT_SUPPORT
if (ompt_enabled) {
#if OMPT_BLAME
if (ompt_callbacks.ompt_callback(ompt_event_barrier_end)) {
ompt_callbacks.ompt_callback(ompt_event_barrier_end)(
team->t.ompt_team_info.parallel_id,
team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id);
}
#endif
// return to default state
this_thr->th.ompt_thread_info.state = ompt_state_overhead;
}
#endif
}
@@ -1402,7 +1562,9 @@ __kmp_join_barrier(int gtid)
void
__kmp_fork_barrier(int gtid, int tid)
{
KMP_TIME_BLOCK(KMP_fork_barrier);
KMP_TIME_PARTITIONED_BLOCK(OMP_fork_join_barrier);
KMP_SET_THREAD_STATE_BLOCK(FORK_JOIN_BARRIER);
KMP_TIME_DEVELOPER_BLOCK(KMP_fork_barrier);
kmp_info_t *this_thr = __kmp_threads[gtid];
kmp_team_t *team = (tid == 0) ? this_thr->th.th_team : NULL;
#if USE_ITT_BUILD
@@ -1442,7 +1604,7 @@ __kmp_fork_barrier(int gtid, int tid)
#endif
if (__kmp_tasking_mode != tskm_immediate_exec) {
__kmp_task_team_setup(this_thr, team);
__kmp_task_team_setup(this_thr, team, 0); // 0 indicates setup current task team if nthreads > 1
}
/* The master thread may have changed its blocktime between the join barrier and the
@@ -1481,14 +1643,7 @@ __kmp_fork_barrier(int gtid, int tid)
// Early exit for reaping threads releasing forkjoin barrier
if (TCR_4(__kmp_global.g.g_done)) {
if (this_thr->th.th_task_team != NULL) {
if (KMP_MASTER_TID(tid)) {
TCW_PTR(this_thr->th.th_task_team, NULL);
}
else {
__kmp_unref_task_team(this_thr->th.th_task_team, this_thr);
}
}
this_thr->th.th_task_team = NULL;
#if USE_ITT_BUILD && USE_ITT_NOTIFY
if (__itt_sync_create_ptr || KMP_ITT_DEBUG) {
@@ -1517,15 +1672,16 @@ __kmp_fork_barrier(int gtid, int tid)
this data before this function is called. We cannot modify __kmp_fork_call() to look at
the fixed ICVs in the master's thread struct, because it is not always the case that the
threads arrays have been allocated when __kmp_fork_call() is executed. */
KMP_START_EXPLICIT_TIMER(USER_icv_copy);
if (!KMP_MASTER_TID(tid)) { // master thread already has ICVs
// Copy the initial ICVs from the master's thread struct to the implicit task for this tid.
KA_TRACE(10, ("__kmp_fork_barrier: T#%d(%d) is PULLing ICVs\n", gtid, tid));
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[tid], team, tid, FALSE);
copy_icvs(&team->t.t_implicit_task_taskdata[tid].td_icvs,
&team->t.t_threads[0]->th.th_bar[bs_forkjoin_barrier].bb.th_fixed_icvs);
{
KMP_TIME_DEVELOPER_BLOCK(USER_icv_copy);
if (!KMP_MASTER_TID(tid)) { // master thread already has ICVs
// Copy the initial ICVs from the master's thread struct to the implicit task for this tid.
KA_TRACE(10, ("__kmp_fork_barrier: T#%d(%d) is PULLing ICVs\n", gtid, tid));
__kmp_init_implicit_task(team->t.t_ident, team->t.t_threads[tid], team, tid, FALSE);
copy_icvs(&team->t.t_implicit_task_taskdata[tid].td_icvs,
&team->t.t_threads[0]->th.th_bar[bs_forkjoin_barrier].bb.th_fixed_icvs);
}
}
KMP_STOP_EXPLICIT_TIMER(USER_icv_copy);
#endif // KMP_BARRIER_ICV_PULL
if (__kmp_tasking_mode != tskm_immediate_exec) {
@@ -1544,8 +1700,7 @@ __kmp_fork_barrier(int gtid, int tid)
#endif // KMP_AFFINITY_SUPPORTED
#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
}
else if ((proc_bind != proc_bind_false)
&& (proc_bind != proc_bind_disabled)) {
else if (proc_bind != proc_bind_false) {
if (this_thr->th.th_new_place == this_thr->th.th_current_place) {
KA_TRACE(100, ("__kmp_fork_barrier: T#%d already in correct place %d\n",
__kmp_gtid_from_thread(this_thr), this_thr->th.th_current_place));
@@ -1572,8 +1727,7 @@ __kmp_fork_barrier(int gtid, int tid)
void
__kmp_setup_icv_copy(kmp_team_t *team, int new_nproc, kmp_internal_control_t *new_icvs, ident_t *loc )
{
KMP_TIME_BLOCK(KMP_setup_icv_copy);
int f;
KMP_TIME_DEVELOPER_BLOCK(KMP_setup_icv_copy);
KMP_DEBUG_ASSERT(team && new_nproc && new_icvs);
KMP_DEBUG_ASSERT((!TCR_4(__kmp_init_parallel)) || new_icvs->nproc);
@@ -1596,7 +1750,7 @@ __kmp_setup_icv_copy(kmp_team_t *team, int new_nproc, kmp_internal_control_t *ne
// Copy the ICVs to each of the non-master threads. This takes O(nthreads) time.
ngo_load(new_icvs);
KMP_DEBUG_ASSERT(team->t.t_threads[0]); // The threads arrays should be allocated at this point
for (f=1; f<new_nproc; ++f) { // Skip the master thread
for (int f=1; f<new_nproc; ++f) { // Skip the master thread
// TODO: GEH - pass in better source location info since usually NULL here
KF_TRACE(10, ("__kmp_setup_icv_copy: LINEAR: T#%d this_thread=%p team=%p\n",
f, team->t.t_threads[f], team));
+25 -25
View File
@@ -29,12 +29,12 @@ Request cancellation of the binding OpenMP region.
*/
kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
kmp_info_t *this_thr = __kmp_threads [ gtid ];
KC_TRACE( 10, ("__kmpc_cancel: T#%d request %d OMP_CANCELLATION=%d\n", gtid, cncl_kind, __kmp_omp_cancellation) );
KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
if (__kmp_omp_cancellation) {
@@ -49,7 +49,7 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
KMP_DEBUG_ASSERT(this_team);
kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(&(this_team->t.t_cancel_request), cancel_noreq, cncl_kind);
if (old == cancel_noreq || old == cncl_kind) {
//printf("__kmpc_cancel: this_team->t.t_cancel_request=%d @ %p\n",
//printf("__kmpc_cancel: this_team->t.t_cancel_request=%d @ %p\n",
// this_team->t.t_cancel_request, &(this_team->t.t_cancel_request));
// we do not have a cancellation request in this team or we do have one
// that matches the current request -> cancel
@@ -58,15 +58,15 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
break;
}
case cancel_taskgroup:
// cancellation requests for parallel and worksharing constructs
// cancellation requests for a task group
// are handled through the taskgroup structure
{
kmp_taskdata_t* task;
kmp_taskdata_t* task;
kmp_taskgroup_t* taskgroup;
task = this_thr->th.th_current_task;
KMP_DEBUG_ASSERT( task );
taskgroup = task->td_taskgroup;
if (taskgroup) {
kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(&(taskgroup->cancel_request), cancel_noreq, cncl_kind);
@@ -100,7 +100,7 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
@param gtid Global thread ID of encountering thread
@param cncl_kind Cancellation kind (parallel, for, sections, taskgroup)
@return returns true if a matching cancellation request has been flagged in the RTL and the
@return returns true if a matching cancellation request has been flagged in the RTL and the
encountering thread has to cancel..
Cancellation point for the encountering thread.
@@ -111,8 +111,8 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
KC_TRACE( 10, ("__kmpc_cancellationpoint: T#%d request %d OMP_CANCELLATION=%d\n", gtid, cncl_kind, __kmp_omp_cancellation) );
KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
if (__kmp_omp_cancellation) {
@@ -141,18 +141,18 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
break;
}
case cancel_taskgroup:
// cancellation requests for parallel and worksharing constructs
// cancellation requests for a task group
// are handled through the taskgroup structure
{
kmp_taskdata_t* task;
kmp_taskdata_t* task;
kmp_taskgroup_t* taskgroup;
task = this_thr->th.th_current_task;
KMP_DEBUG_ASSERT( task );
taskgroup = task->td_taskgroup;
if (taskgroup) {
// return the current status of cancellation for the
// return the current status of cancellation for the
// taskgroup
return !!taskgroup->cancel_request;
}
@@ -178,11 +178,11 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
@param loc_ref location of the original task directive
@param gtid Global thread ID of encountering thread
@return returns true if a matching cancellation request has been flagged in the RTL and the
@return returns true if a matching cancellation request has been flagged in the RTL and the
encountering thread has to cancel..
Barrier with cancellation point to send threads from the barrier to the
end of the parallel region. Needs a special code pattern as documented
end of the parallel region. Needs a special code pattern as documented
in the design document for the cancellation feature.
*/
kmp_int32
@@ -208,7 +208,7 @@ __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
__kmpc_barrier(loc, gtid);
this_team->t.t_cancel_request = cancel_noreq;
// the next barrier is the fork/join barrier, which
// synchronizes the threads leaving here
// synchronizes the threads leaving here
break;
case cancel_loop:
case cancel_sections:
@@ -233,7 +233,7 @@ __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
KMP_ASSERT ( 0 /* false */);
}
}
return ret;
}
@@ -242,21 +242,21 @@ __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
@param loc_ref location of the original task directive
@param gtid Global thread ID of encountering thread
@return returns true if a matching cancellation request has been flagged in the RTL and the
@return returns true if a matching cancellation request has been flagged in the RTL and the
encountering thread has to cancel..
Query function to query the current status of cancellation requests.
Can be used to implement the following pattern:
if (kmp_get_cancellation_status(kmp_cancel_parallel)) {
perform_cleanup();
#pragma omp cancellation point parallel
#pragma omp cancellation point parallel
}
*/
int __kmp_get_cancellation_status(int cancel_kind) {
if (__kmp_omp_cancellation) {
kmp_info_t *this_thr = __kmp_entry_thread();
switch (cancel_kind) {
case cancel_parallel:
case cancel_loop:
@@ -267,7 +267,7 @@ int __kmp_get_cancellation_status(int cancel_kind) {
}
case cancel_taskgroup:
{
kmp_taskdata_t* task;
kmp_taskdata_t* task;
kmp_taskgroup_t* taskgroup;
task = this_thr->th.th_current_task;
taskgroup = task->td_taskgroup;
+110
View File
@@ -0,0 +1,110 @@
/*
* kmp_config.h -- Feature macros
*/
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#ifndef KMP_CONFIG_H
#define KMP_CONFIG_H
#include "kmp_platform.h"
// cmakedefine01 MACRO will define MACRO as either 0 or 1
// cmakedefine MACRO 1 will define MACRO as 1 or leave undefined
#cmakedefine01 DEBUG_BUILD
#cmakedefine01 RELWITHDEBINFO_BUILD
#cmakedefine01 LIBOMP_USE_ITT_NOTIFY
#define USE_ITT_NOTIFY LIBOMP_USE_ITT_NOTIFY
#if ! LIBOMP_USE_ITT_NOTIFY
# define INTEL_NO_ITTNOTIFY_API
#endif
#cmakedefine01 LIBOMP_USE_VERSION_SYMBOLS
#if LIBOMP_USE_VERSION_SYMBOLS
# define KMP_USE_VERSION_SYMBOLS
#endif
#cmakedefine01 LIBOMP_HAVE_WEAK_ATTRIBUTE
#define KMP_HAVE_WEAK_ATTRIBUTE LIBOMP_HAVE_WEAK_ATTRIBUTE
#cmakedefine01 LIBOMP_HAVE_PSAPI
#define KMP_HAVE_PSAPI LIBOMP_HAVE_PSAPI
#cmakedefine01 LIBOMP_STATS
#define KMP_STATS_ENABLED LIBOMP_STATS
#cmakedefine01 LIBOMP_HAVE_X86INTRIN_H
#define KMP_HAVE_X86INTRIN_H LIBOMP_HAVE_X86INTRIN_H
#cmakedefine01 LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER
#define KMP_HAVE___BUILTIN_READCYCLECOUNTER LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER
#cmakedefine01 LIBOMP_HAVE___RDTSC
#define KMP_HAVE___RDTSC LIBOMP_HAVE___RDTSC
#cmakedefine01 LIBOMP_USE_DEBUGGER
#define USE_DEBUGGER LIBOMP_USE_DEBUGGER
#cmakedefine01 LIBOMP_OMPT_DEBUG
#define OMPT_DEBUG LIBOMP_OMPT_DEBUG
#cmakedefine01 LIBOMP_OMPT_SUPPORT
#define OMPT_SUPPORT LIBOMP_OMPT_SUPPORT
#cmakedefine01 LIBOMP_OMPT_BLAME
#define OMPT_BLAME LIBOMP_OMPT_BLAME
#cmakedefine01 LIBOMP_OMPT_TRACE
#define OMPT_TRACE LIBOMP_OMPT_TRACE
#cmakedefine01 LIBOMP_USE_ADAPTIVE_LOCKS
#define KMP_USE_ADAPTIVE_LOCKS LIBOMP_USE_ADAPTIVE_LOCKS
#define KMP_DEBUG_ADAPTIVE_LOCKS 0
#cmakedefine01 LIBOMP_USE_INTERNODE_ALIGNMENT
#define KMP_USE_INTERNODE_ALIGNMENT LIBOMP_USE_INTERNODE_ALIGNMENT
#cmakedefine01 LIBOMP_ENABLE_ASSERTIONS
#define KMP_USE_ASSERT LIBOMP_ENABLE_ASSERTIONS
#cmakedefine01 STUBS_LIBRARY
#cmakedefine01 LIBOMP_USE_HWLOC
#define KMP_USE_HWLOC LIBOMP_USE_HWLOC
#define KMP_ARCH_STR "@LIBOMP_LEGAL_ARCH@"
#define KMP_LIBRARY_FILE "@LIBOMP_LIB_FILE@"
#define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
#define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
#define LIBOMP_OMP_VERSION @LIBOMP_OMP_VERSION@
#define OMP_50_ENABLED (LIBOMP_OMP_VERSION >= 50)
#define OMP_45_ENABLED (LIBOMP_OMP_VERSION >= 45)
#define OMP_40_ENABLED (LIBOMP_OMP_VERSION >= 40)
#define OMP_30_ENABLED (LIBOMP_OMP_VERSION >= 30)
// Configured cache line based on architecture
#if KMP_ARCH_PPC64
# define CACHE_LINE 128
#else
# define CACHE_LINE 64
#endif
#if ! KMP_32_BIT_ARCH
# define BUILD_I8 1
#endif
#define KMP_DYNAMIC_LIB 1
#define KMP_NESTED_HOT_TEAMS 1
#define KMP_ADJUST_BLOCKTIME 1
#define BUILD_PARALLEL_ORDERED 1
#define KMP_ASM_INTRINS 1
#define USE_ITT_BUILD LIBOMP_USE_ITT_NOTIFY
#define INTEL_ITTNOTIFY_PREFIX __kmp_itt_
#if ! KMP_MIC
# define USE_LOAD_BALANCE 1
#endif
#if ! (KMP_OS_WINDOWS || KMP_OS_DARWIN)
# define KMP_TDATA_GTID 1
#endif
#if STUBS_LIBRARY
# define KMP_STUB 1
#endif
#if DEBUG_BUILD || RELWITHDEBINFO_BUILD
# define KMP_DEBUG 1
#endif
#if KMP_OS_WINDOWS
# define KMP_WIN_CDECL
#else
# define BUILD_TV
# define KMP_GOMP_COMPAT
#endif
#endif // KMP_CONFIG_H
+1251 -95
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -1,7 +1,5 @@
/*
* kmp_debug.c -- debug utilities for the Guide library
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
+6 -4
View File
@@ -1,7 +1,5 @@
/*
* kmp_debug.h -- debug / assertion code for Assure library
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
@@ -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.
+315
View File
@@ -0,0 +1,315 @@
#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,
INITIAL_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 ),
#if OMP_40_ENABLED
// teams information
offset_and_size_of( kmp_base_info_t, th_teams_microtask),
offset_and_size_of( kmp_base_info_t, th_teams_level),
offset_and_size_of( kmp_teams_size_t, nteams ),
offset_and_size_of( kmp_teams_size_t, nth ),
#endif
// kmp_desc structure (for info field above)
sizeof( kmp_desc_base_t ),
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 ),
#if OMP_40_ENABLED
offset_and_size_of( kmp_base_team_t, t_cancel_request ),
#endif
offset_and_size_of( kmp_base_team_t, t_bar ),
offset_and_size_of( kmp_balign_team_t, b_master_arrived ),
offset_and_size_of( kmp_balign_team_t, b_team_arrived ),
// 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 ),
#if OMP_40_ENABLED
offset_and_size_of( kmp_taskdata_t, td_taskgroup ),
offset_and_size_of( kmp_taskgroup_t, count ),
offset_and_size_of( kmp_taskgroup_t, cancel_request ),
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 ),
#endif
offset_and_size_of( kmp_task_t, routine ),
// thread_data_t.
sizeof( kmp_thread_data_t ),
offset_and_size_of( kmp_base_thread_data_t, td_deque ),
offset_and_size_of( kmp_base_thread_data_t, td_deque_size ),
offset_and_size_of( kmp_base_thread_data_t, td_deque_head ),
offset_and_size_of( kmp_base_thread_data_t, td_deque_tail ),
offset_and_size_of( kmp_base_thread_data_t, td_deque_ntasks ),
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 */
+51
View File
@@ -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
+324 -172
View File
@@ -1,7 +1,5 @@
/*
* kmp_dispatch.cpp: dynamic scheduling - iteration initialization and dispatch.
* $Revision: 43457 $
* $Date: 2014-09-17 03:57:22 -0500 (Wed, 17 Sep 2014) $
*/
@@ -27,6 +25,12 @@
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
// Need to raise Win version from XP to Vista here for support of InterlockedExchange64
#if defined(_WIN32_WINNT) && defined(_M_IX86)
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0502
#endif
#include "kmp.h"
#include "kmp_i18n.h"
#include "kmp_itt.h"
@@ -37,6 +41,11 @@
#include <float.h>
#endif
#if OMPT_SUPPORT
#include "ompt-internal.h"
#include "ompt-specific.h"
#endif
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
@@ -68,7 +77,7 @@ struct i_maxmin< unsigned long long > {
};
//-------------------------------------------------------------------------
#ifdef KMP_STATIC_STEAL_ENABLED
#if KMP_STATIC_STEAL_ENABLED
// replaces dispatch_private_info{32,64} structures and dispatch_private_info{32,64}_t types
template< typename T >
@@ -160,7 +169,7 @@ struct dispatch_shared_infoXX_template {
volatile UT iteration;
volatile UT num_done;
volatile UT ordered_iteration;
UT ordered_dummy[KMP_MAX_ORDERED-1]; // to retain the structure size making ordered_iteration scalar
UT ordered_dummy[KMP_MAX_ORDERED-3]; // to retain the structure size making ordered_iteration scalar
};
// replaces dispatch_shared_info structure and dispatch_shared_info_t type
@@ -172,6 +181,17 @@ struct dispatch_shared_info_template {
dispatch_shared_info64_t s64;
} u;
volatile kmp_uint32 buffer_index;
#if OMP_45_ENABLED
volatile kmp_int32 doacross_buf_idx; // teamwise index
kmp_uint32 *doacross_flags; // array of iteration flags (0/1)
kmp_int32 doacross_num_done; // count finished threads
#endif
#if KMP_USE_HWLOC
// When linking with libhwloc, the ORDERED EPCC test slowsdown on big
// machines (> 48 cores). Performance analysis showed that a cache thrash
// was occurring and this padding helps alleviate the problem.
char padding[64];
#endif
};
/* ------------------------------------------------------------------------ */
@@ -182,7 +202,7 @@ struct dispatch_shared_info_template {
// test_then_add template (general template should NOT be used)
template< typename T >
static __forceinline T
test_then_add( volatile T *p, T d ) { KMP_ASSERT(0); };
test_then_add( volatile T *p, T d );
template<>
__forceinline kmp_int32
@@ -205,7 +225,7 @@ test_then_add< kmp_int64 >( volatile kmp_int64 *p, kmp_int64 d )
// test_then_inc_acq template (general template should NOT be used)
template< typename T >
static __forceinline T
test_then_inc_acq( volatile T *p ) { KMP_ASSERT(0); };
test_then_inc_acq( volatile T *p );
template<>
__forceinline kmp_int32
@@ -228,7 +248,7 @@ test_then_inc_acq< kmp_int64 >( volatile kmp_int64 *p )
// test_then_inc template (general template should NOT be used)
template< typename T >
static __forceinline T
test_then_inc( volatile T *p ) { KMP_ASSERT(0); };
test_then_inc( volatile T *p );
template<>
__forceinline kmp_int32
@@ -251,7 +271,7 @@ test_then_inc< kmp_int64 >( volatile kmp_int64 *p )
// compare_and_swap template (general template should NOT be used)
template< typename T >
static __forceinline kmp_int32
compare_and_swap( volatile T *p, T c, T s ) { KMP_ASSERT(0); };
compare_and_swap( volatile T *p, T c, T s );
template<>
__forceinline kmp_int32
@@ -357,7 +377,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
}
}
}
@@ -379,7 +403,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
}
}
@@ -622,6 +650,12 @@ __kmp_dispatch_init(
#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 >* >
@@ -634,11 +668,19 @@ __kmp_dispatch_init(
/* What happens when number of threads changes, need to resize buffer? */
pr = reinterpret_cast< dispatch_private_info_template< T > * >
( &th -> th.th_dispatch -> th_disp_buffer[ my_buffer_index % KMP_MAX_DISP_BUF ] );
( &th -> th.th_dispatch -> th_disp_buffer[ my_buffer_index % __kmp_dispatch_num_buffers ] );
sh = reinterpret_cast< dispatch_shared_info_template< UT > volatile * >
( &team -> t.t_disp_buffer[ my_buffer_index % KMP_MAX_DISP_BUF ] );
( &team -> t.t_disp_buffer[ my_buffer_index % __kmp_dispatch_num_buffers ] );
}
#if ( KMP_STATIC_STEAL_ENABLED )
if ( SCHEDULE_HAS_NONMONOTONIC(schedule) )
// AC: we now have only one implementation of stealing, so use it
schedule = kmp_sch_static_steal;
else
#endif
schedule = SCHEDULE_WITHOUT_MODIFIERS(schedule);
/* Pick up the nomerge/ordered bits from the scheduling type */
if ( (schedule >= kmp_nm_lower) && (schedule < kmp_nm_upper) ) {
pr->nomerge = TRUE;
@@ -653,6 +695,7 @@ __kmp_dispatch_init(
} else {
pr->ordered = FALSE;
}
if ( schedule == kmp_sch_static ) {
schedule = __kmp_static;
} else {
@@ -667,7 +710,9 @@ __kmp_dispatch_init(
}
// Use the chunk size specified by OMP_SCHEDULE (or default if not specified)
chunk = team -> t.t_sched.chunk;
#if USE_ITT_BUILD
cur_chunk = chunk;
#endif
#ifdef KMP_DEBUG
{
const char * buff;
@@ -705,7 +750,7 @@ __kmp_dispatch_init(
}
/* guided analytical not safe for too many threads */
if ( team->t.t_nproc > 1<<20 && schedule == kmp_sch_guided_analytical_chunked ) {
if ( schedule == kmp_sch_guided_analytical_chunked && th->th.th_team_nproc > 1<<20 ) {
schedule = kmp_sch_guided_iterative_chunked;
KMP_WARNING( DispatchManyThreads );
}
@@ -724,24 +769,42 @@ __kmp_dispatch_init(
);
}
}
tc = ( ub - lb + st );
if ( st != 1 ) {
if ( st < 0 ) {
if ( lb < ub ) {
tc = 0; // zero-trip
} else { // lb >= ub
tc = (ST)tc / st; // convert to signed division
}
} else { // st > 0
if ( ub < lb ) {
tc = 0; // zero-trip
} else { // lb >= ub
tc /= st;
}
// compute trip count
if ( st == 1 ) { // most common case
if ( ub >= lb ) {
tc = ub - lb + 1;
} else { // ub < lb
tc = 0; // zero-trip
}
} else if ( ub < lb ) { // st == 1
tc = 0; // zero-trip
} else if ( st < 0 ) {
if ( lb >= ub ) {
// AC: cast to unsigned is needed for loops like (i=2B; i>-2B; i-=1B),
// where the division needs to be unsigned regardless of the result type
tc = (UT)(lb - ub) / (-st) + 1;
} else { // lb < ub
tc = 0; // zero-trip
}
} else { // st > 0
if ( ub >= lb ) {
// AC: cast to unsigned is needed for loops like (i=-2B; i<2B; i+=1B),
// where the division needs to be unsigned regardless of the result type
tc = (UT)(ub - lb) / st + 1;
} else { // ub < lb
tc = 0; // zero-trip
}
}
// Any half-decent optimizer will remove this test when the blocks are empty since the macros expand to nothing
// when statistics are disabled.
if (schedule == __kmp_static)
{
KMP_COUNT_BLOCK(OMP_FOR_static);
KMP_COUNT_VALUE(FOR_static_iterations, tc);
}
else
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_COUNT_VALUE(FOR_dynamic_iterations, tc);
}
pr->u.p.lb = lb;
@@ -782,10 +845,10 @@ __kmp_dispatch_init(
}
switch ( schedule ) {
#if ( KMP_STATIC_STEAL_ENABLED && KMP_ARCH_X86_64 )
#if ( KMP_STATIC_STEAL_ENABLED )
case kmp_sch_static_steal:
{
T nproc = team->t.t_nproc;
T nproc = th->th.th_team_nproc;
T ntc, init;
KD_TRACE(100, ("__kmp_dispatch_init: T#%d kmp_sch_static_steal case\n", gtid ) );
@@ -804,8 +867,19 @@ __kmp_dispatch_init(
pr->u.p.parm2 = lb;
//pr->pfields.parm3 = 0; // it's not used in static_steal
pr->u.p.parm4 = id;
pr->u.p.parm4 = (id + 1) % nproc; // remember neighbour tid
pr->u.p.st = st;
if ( ___kmp_size_type > 4 ) {
// AC: TODO: check if 16-byte CAS available and use it to
// improve performance (probably wait for explicit request
// before spending time on this).
// For now use dynamically allocated per-thread lock,
// free memory in __kmp_dispatch_next when status==0.
KMP_DEBUG_ASSERT(th->th.th_dispatch->th_steal_lock == NULL);
th->th.th_dispatch->th_steal_lock =
(kmp_lock_t*)__kmp_allocate(sizeof(kmp_lock_t));
__kmp_init_lock(th->th.th_dispatch->th_steal_lock);
}
break;
} else {
KD_TRACE(100, ("__kmp_dispatch_init: T#%d falling-through to kmp_sch_static_balanced\n",
@@ -818,7 +892,7 @@ __kmp_dispatch_init(
#endif
case kmp_sch_static_balanced:
{
T nproc = team->t.t_nproc;
T nproc = th->th.th_team_nproc;
T init, limit;
KD_TRACE(100, ("__kmp_dispatch_init: T#%d kmp_sch_static_balanced case\n",
@@ -858,9 +932,8 @@ __kmp_dispatch_init(
}
#if USE_ITT_BUILD
// Calculate chunk for metadata report
if( __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 ) {
if ( itt_need_metadata_reporting )
cur_chunk = limit - init + 1;
}
#endif
if ( st == 1 ) {
pr->u.p.lb = lb + init;
@@ -883,7 +956,7 @@ __kmp_dispatch_init(
} // case
case kmp_sch_guided_iterative_chunked :
{
T nproc = team->t.t_nproc;
T nproc = th->th.th_team_nproc;
KD_TRACE(100,("__kmp_dispatch_init: T#%d kmp_sch_guided_iterative_chunked case\n",gtid));
if ( nproc > 1 ) {
@@ -906,7 +979,7 @@ __kmp_dispatch_init(
break;
case kmp_sch_guided_analytical_chunked:
{
T nproc = team->t.t_nproc;
T nproc = th->th.th_team_nproc;
KD_TRACE(100, ("__kmp_dispatch_init: T#%d kmp_sch_guided_analytical_chunked case\n", gtid));
if ( nproc > 1 ) {
@@ -1024,12 +1097,15 @@ __kmp_dispatch_init(
break;
case kmp_sch_static_greedy:
KD_TRACE(100,("__kmp_dispatch_init: T#%d kmp_sch_static_greedy case\n",gtid));
pr->u.p.parm1 = ( team -> t.t_nproc > 1 ) ?
( tc + team->t.t_nproc - 1 ) / team->t.t_nproc :
pr->u.p.parm1 = ( th->th.th_team_nproc > 1 ) ?
( tc + th->th.th_team_nproc - 1 ) / th->th.th_team_nproc :
tc;
break;
case kmp_sch_static_chunked :
case kmp_sch_dynamic_chunked :
if ( pr->u.p.parm1 <= 0 ) {
pr->u.p.parm1 = KMP_DEFAULT_CHUNK;
}
KD_TRACE(100,("__kmp_dispatch_init: T#%d kmp_sch_static_chunked/kmp_sch_dynamic_chunked cases\n", gtid));
break;
case kmp_sch_trapezoidal :
@@ -1042,7 +1118,7 @@ __kmp_dispatch_init(
parm1 = chunk;
/* F : size of the first cycle */
parm2 = ( tc / (2 * team->t.t_nproc) );
parm2 = ( tc / (2 * th->th.th_team_nproc) );
if ( parm2 < 1 ) {
parm2 = 1;
@@ -1113,16 +1189,10 @@ __kmp_dispatch_init(
if ( pr->ordered ) {
__kmp_itt_ordered_init( gtid );
}; // if
#endif /* USE_ITT_BUILD */
}; // if
#if USE_ITT_BUILD
// Report loop metadata
if( __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 ) {
kmp_uint32 tid = __kmp_tid_from_gtid( gtid );
if (KMP_MASTER_TID(tid)) {
// 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
@@ -1145,8 +1215,8 @@ __kmp_dispatch_init(
}
__kmp_itt_metadata_loop(loc, schedtype, tc, cur_chunk);
}
}
#endif /* USE_ITT_BUILD */
}; // if
#ifdef KMP_DEBUG
{
@@ -1169,7 +1239,6 @@ __kmp_dispatch_init(
}
#endif
#if ( KMP_STATIC_STEAL_ENABLED )
if ( ___kmp_size_type < 8 ) {
// It cannot be guaranteed that after execution of a loop with some other schedule kind
// all the parm3 variables will contain the same value.
// Even if all parm3 will be the same, it still exists a bad case like using 0 and 1
@@ -1181,8 +1250,17 @@ __kmp_dispatch_init(
volatile T * p = &pr->u.p.static_steal_counter;
*p = *p + 1;
}
#endif // ( KMP_STATIC_STEAL_ENABLED )
#if OMPT_SUPPORT && OMPT_TRACE
if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_loop_begin)) {
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
ompt_callbacks.ompt_callback(ompt_event_loop_begin)(
team_info->parallel_id, task_info->task_id, team_info->microtask);
}
#endif // ( KMP_STATIC_STEAL_ENABLED && USE_STEALING )
#endif
}
/*
@@ -1333,6 +1411,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_enabled && \
ompt_callbacks.ompt_callback(ompt_event_loop_end)) { \
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL); \
ompt_task_info_t *task_info = __ompt_get_taskinfo(0); \
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(
@@ -1342,14 +1438,21 @@ __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 )
static const int ___kmp_size_type = sizeof( UT );
#endif
// This is potentially slightly misleading, schedule(runtime) will appear here even if the actual runtme schedule
// is static. (Which points out a disadavantage of schedule(runtime): even when static scheduling is used it costs
// more than a compile time choice to use static scheduling would.)
KMP_TIME_PARTITIONED_BLOCK(FOR_dynamic_scheduling);
int status;
dispatch_private_info_template< T > * pr;
kmp_info_t * th = __kmp_threads[ gtid ];
kmp_team_t * team = th -> th.th_team;
KMP_DEBUG_ASSERT( p_last && p_lb && p_ub && p_st ); // AC: these cannot be NULL
KMP_DEBUG_ASSERT( p_lb && p_ub && p_st ); // AC: these cannot be NULL
#ifdef KMP_DEBUG
{
const char * buff;
@@ -1470,6 +1573,7 @@ __kmp_dispatch_next(
#if INCLUDE_SSC_MARKS
SSC_MARK_DISPATCH_NEXT();
#endif
OMPT_LOOP_END;
return status;
} else {
kmp_int32 last = 0;
@@ -1493,21 +1597,97 @@ __kmp_dispatch_next(
status = 0;
} else {
switch (pr->schedule) {
#if ( KMP_STATIC_STEAL_ENABLED && KMP_ARCH_X86_64 )
#if ( KMP_STATIC_STEAL_ENABLED )
case kmp_sch_static_steal:
{
T chunk = pr->u.p.parm1;
int nproc = th->th.th_team_nproc;
KD_TRACE(100, ("__kmp_dispatch_next: T#%d kmp_sch_static_steal case\n", gtid) );
trip = pr->u.p.tc - 1;
if ( ___kmp_size_type > 4 ) {
// Other threads do not look into the data of this thread,
// so it's not necessary to make volatile casting.
init = ( pr->u.p.count )++;
status = ( init < (UT)pr->u.p.ub );
// use lock for 8-byte and CAS for 4-byte induction
// variable. TODO (optional): check and use 16-byte CAS
kmp_lock_t * lck = th->th.th_dispatch->th_steal_lock;
KMP_DEBUG_ASSERT(lck != NULL);
if( pr->u.p.count < (UT)pr->u.p.ub ) {
__kmp_acquire_lock(lck, gtid);
// try to get own chunk of iterations
init = ( pr->u.p.count )++;
status = ( init < (UT)pr->u.p.ub );
__kmp_release_lock(lck, gtid);
} else {
status = 0; // no own chunks
}
if( !status ) { // try to steal
kmp_info_t **other_threads = team->t.t_threads;
int while_limit = nproc; // nproc attempts to find a victim
int while_index = 0;
// TODO: algorithm of searching for a victim
// should be cleaned up and measured
while ( ( !status ) && ( while_limit != ++while_index ) ) {
T remaining;
T victimIdx = pr->u.p.parm4;
T oldVictimIdx = victimIdx ? victimIdx - 1 : nproc - 1;
dispatch_private_info_template< T > * victim =
reinterpret_cast< dispatch_private_info_template< T >* >
(other_threads[victimIdx]->th.th_dispatch->th_dispatch_pr_current);
while( ( victim == NULL || victim == pr ||
( *(volatile T*)&victim->u.p.static_steal_counter !=
*(volatile T*)&pr->u.p.static_steal_counter ) ) &&
oldVictimIdx != victimIdx )
{
victimIdx = (victimIdx + 1) % nproc;
victim = reinterpret_cast< dispatch_private_info_template< T >* >
(other_threads[victimIdx]->th.th_dispatch->th_dispatch_pr_current);
};
if( !victim ||
( *(volatile T *)&victim->u.p.static_steal_counter !=
*(volatile T *)&pr->u.p.static_steal_counter ) )
{
continue; // try once more (nproc attempts in total)
// no victim is ready yet to participate in stealing
// because all victims are still in kmp_init_dispatch
}
if( victim->u.p.count + 2 > (UT)victim->u.p.ub ) {
pr->u.p.parm4 = (victimIdx + 1) % nproc; // shift start tid
continue; // not enough chunks to steal, goto next victim
}
lck = other_threads[victimIdx]->th.th_dispatch->th_steal_lock;
KMP_ASSERT(lck != NULL);
__kmp_acquire_lock(lck, gtid);
limit = victim->u.p.ub; // keep initial ub
if( victim->u.p.count >= limit ||
(remaining = limit - victim->u.p.count) < 2 )
{
__kmp_release_lock(lck, gtid);
pr->u.p.parm4 = (victimIdx + 1) % nproc; // next victim
continue; // not enough chunks to steal
}
// stealing succeded, reduce victim's ub by 1/4 of undone chunks or by 1
if( remaining > 3 ) {
init = ( victim->u.p.ub -= (remaining>>2) ); // steal 1/4 of remaining
} else {
init = ( victim->u.p.ub -= 1 ); // steal 1 chunk of 2 or 3 remaining
}
__kmp_release_lock(lck, gtid);
KMP_DEBUG_ASSERT(init + 1 <= limit);
pr->u.p.parm4 = victimIdx; // remember victim to steal from
status = 1;
while_index = 0;
// now update own count and ub with stolen range but init chunk
__kmp_acquire_lock(th->th.th_dispatch->th_steal_lock, gtid);
pr->u.p.count = init + 1;
pr->u.p.ub = limit;
__kmp_release_lock(th->th.th_dispatch->th_steal_lock, gtid);
} // while (search for victim)
} // if (try to find victim and steal)
} else {
// 4-byte induction variable, use 8-byte CAS for pair (count, ub)
typedef union {
struct {
UT count;
@@ -1516,7 +1696,6 @@ __kmp_dispatch_next(
kmp_int64 b;
} union_i4;
// All operations on 'count' or 'ub' must be combined atomically together.
// stealing implemented only for 4-byte indexes
{
union_i4 vold, vnew;
vold.b = *( volatile kmp_int64 * )(&pr->u.p.count);
@@ -1538,86 +1717,77 @@ __kmp_dispatch_next(
if( !status ) {
kmp_info_t **other_threads = team->t.t_threads;
int while_limit = 10;
int while_limit = nproc; // nproc attempts to find a victim
int while_index = 0;
// TODO: algorithm of searching for a victim
// should be cleaned up and measured
while ( ( !status ) && ( while_limit != ++while_index ) ) {
union_i4 vold, vnew;
kmp_int32 remaining; // kmp_int32 because KMP_I4 only
kmp_int32 remaining;
T victimIdx = pr->u.p.parm4;
T oldVictimIdx = victimIdx;
dispatch_private_info_template< T > * victim;
do {
if( !victimIdx ) {
victimIdx = team->t.t_nproc - 1;
} else {
--victimIdx;
}
T oldVictimIdx = victimIdx ? victimIdx - 1 : nproc - 1;
dispatch_private_info_template< T > * victim =
reinterpret_cast< dispatch_private_info_template< T >* >
(other_threads[victimIdx]->th.th_dispatch->th_dispatch_pr_current);
while( (victim == NULL || victim == pr ||
(*(volatile T*)&victim->u.p.static_steal_counter !=
*(volatile T*)&pr->u.p.static_steal_counter)) &&
oldVictimIdx != victimIdx )
{
victimIdx = (victimIdx + 1) % nproc;
victim = reinterpret_cast< dispatch_private_info_template< T >* >
( other_threads[victimIdx]->th.th_dispatch->th_dispatch_pr_current );
} while ( (victim == NULL || victim == pr) && oldVictimIdx != victimIdx );
// TODO: think about a proper place of this test
if ( ( !victim ) ||
( (*( volatile T * )&victim->u.p.static_steal_counter) !=
(*( volatile T * )&pr->u.p.static_steal_counter) ) ) {
// TODO: delay would be nice
continue;
// the victim is not ready yet to participate in stealing
// because the victim is still in kmp_init_dispatch
};
if( !victim ||
( *(volatile T *)&victim->u.p.static_steal_counter !=
*(volatile T *)&pr->u.p.static_steal_counter ) )
{
continue; // try once more (nproc attempts in total)
// no victim is ready yet to participate in stealing
// because all victims are still in kmp_init_dispatch
}
if ( oldVictimIdx == victimIdx ) {
break;
}
pr->u.p.parm4 = victimIdx;
while( 1 ) {
pr->u.p.parm4 = victimIdx; // new victim found
while( 1 ) { // CAS loop if victim has enough chunks to steal
vold.b = *( volatile kmp_int64 * )( &victim->u.p.count );
vnew = vold;
KMP_DEBUG_ASSERT( (vnew.p.ub - 1) * (UT)chunk <= trip );
if ( vnew.p.count >= (UT)vnew.p.ub || (remaining = vnew.p.ub - vnew.p.count) < 4 ) {
break;
if ( vnew.p.count >= (UT)vnew.p.ub ||
(remaining = vnew.p.ub - vnew.p.count) < 2 )
{
pr->u.p.parm4 = (victimIdx + 1) % nproc; // shift start victim id
break; // not enough chunks to steal, goto next victim
}
if( remaining > 3 ) {
vnew.p.ub -= (remaining>>2); // try to steal 1/4 of remaining
} else {
vnew.p.ub -= 1; // steal 1 chunk of 2 or 3 remaining
}
vnew.p.ub -= (remaining >> 2);
KMP_DEBUG_ASSERT((vnew.p.ub - 1) * (UT)chunk <= trip);
#pragma warning( push )
// disable warning on pointless comparison of unsigned with 0
#pragma warning( disable: 186 )
KMP_DEBUG_ASSERT(vnew.p.ub >= 0);
#pragma warning( pop )
// TODO: Should this be acquire or release?
if ( KMP_COMPARE_AND_STORE_ACQ64(
( volatile kmp_int64 * )&victim->u.p.count,
*VOLATILE_CAST(kmp_int64 *)&vold.b,
*VOLATILE_CAST(kmp_int64 *)&vnew.b ) ) {
// stealing succedded
status = 1;
while_index = 0;
// now update own count and ub
init = vnew.p.ub;
vold.p.count = init + 1;
#if KMP_ARCH_X86
// stealing executed on non-KMP_ARCH_X86 only
// Atomic 64-bit write on ia32 is
// unavailable, so we do this in steps.
// This code is not tested.
init = vold.p.count;
pr->u.p.ub = 0;
pr->u.p.count = init + 1;
pr->u.p.ub = vnew.p.count;
KMP_XCHG_FIXED64(( volatile kmp_int64 * )(&pr->u.p.count), vold.b);
#else
init = vnew.p.ub;
vold.p.count = init + 1;
// TODO: is it safe and enough?
*( volatile kmp_int64 * )(&pr->u.p.count) = vold.b;
#endif // KMP_ARCH_X86
*( volatile kmp_int64 * )(&pr->u.p.count) = vold.b;
#endif
break;
} // if
KMP_CPU_PAUSE();
} // while (1)
} // while
} // if
} // if
} // if (check CAS result)
KMP_CPU_PAUSE(); // CAS failed, repeate attempt
} // while (try to steal from particular victim)
} // while (search for victim)
} // if (try to find victim and steal)
} // if (4-byte induction variable)
if ( !status ) {
*p_lb = 0;
*p_ub = 0;
@@ -1659,7 +1829,7 @@ __kmp_dispatch_next(
} // if
break;
} // case
#endif // ( KMP_STATIC_STEAL_ENABLED && KMP_ARCH_X86_64 )
#endif // ( KMP_STATIC_STEAL_ENABLED )
case kmp_sch_static_balanced:
{
KD_TRACE(100, ("__kmp_dispatch_next: T#%d kmp_sch_static_balanced case\n", gtid) );
@@ -1710,7 +1880,7 @@ __kmp_dispatch_next(
if ( p_st != NULL ) *p_st = incr;
pr->u.p.count += team->t.t_nproc;
pr->u.p.count += th->th.th_team_nproc;
if ( incr == 1 ) {
*p_lb = start + init;
@@ -1880,8 +2050,8 @@ __kmp_dispatch_next(
trip = pr->u.p.tc;
KMP_DEBUG_ASSERT(team->t.t_nproc > 1);
KMP_DEBUG_ASSERT((2UL * chunkspec + 1) * (UT)team->t.t_nproc < trip);
KMP_DEBUG_ASSERT(th->th.th_team_nproc > 1);
KMP_DEBUG_ASSERT((2UL * chunkspec + 1) * (UT)th->th.th_team_nproc < trip);
while(1) { /* this while loop is a safeguard against unexpected zero chunk sizes */
chunkIdx = test_then_inc_acq< ST >((volatile ST *) & sh->u.s.iteration );
@@ -2052,7 +2222,21 @@ __kmp_dispatch_next(
}
#endif
if ( (ST)num_done == team->t.t_nproc-1 ) {
if ( (ST)num_done == th->th.th_team_nproc - 1 ) {
#if ( KMP_STATIC_STEAL_ENABLED )
if( pr->schedule == kmp_sch_static_steal && ___kmp_size_type > 4 ) {
int i;
kmp_info_t **other_threads = team->t.t_threads;
// loop complete, safe to destroy locks used for stealing
for( i = 0; i < th->th.th_team_nproc; ++i ) {
kmp_lock_t * lck = other_threads[i]->th.th_dispatch->th_steal_lock;
KMP_ASSERT(lck != NULL);
__kmp_destroy_lock( lck );
__kmp_free( lck );
other_threads[i]->th.th_dispatch->th_steal_lock = NULL;
}
}
#endif
/* NOTE: release this buffer to be reused */
KMP_MB(); /* Flush all pending memory write invalidates. */
@@ -2067,7 +2251,7 @@ __kmp_dispatch_next(
KMP_MB(); /* Flush all pending memory write invalidates. */
sh -> buffer_index += KMP_MAX_DISP_BUF;
sh -> buffer_index += __kmp_dispatch_num_buffers;
KD_TRACE(100, ("__kmp_dispatch_next: T#%d change buffer_index:%d\n",
gtid, sh->buffer_index) );
@@ -2109,6 +2293,7 @@ __kmp_dispatch_next(
#if INCLUDE_SSC_MARKS
SSC_MARK_DISPATCH_NEXT();
#endif
OMPT_LOOP_END;
return status;
}
@@ -2122,7 +2307,6 @@ __kmp_dist_get_bounds(
T *pupper,
typename traits_t< T >::signed_t incr
) {
KMP_COUNT_BLOCK(OMP_DISTR_FOR_dynamic);
typedef typename traits_t< T >::unsigned_t UT;
typedef typename traits_t< T >::signed_t ST;
register kmp_uint32 team_id;
@@ -2164,9 +2348,9 @@ __kmp_dist_get_bounds(
}
}
th = __kmp_threads[gtid];
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
team = th->th.th_team;
#if OMP_40_ENABLED
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
nteams = th->th.th_teams_size.nteams;
#endif
team_id = team->t.t_master_tid;
@@ -2177,9 +2361,13 @@ __kmp_dist_get_bounds(
trip_count = *pupper - *plower + 1;
} else if(incr == -1) {
trip_count = *plower - *pupper + 1;
} else if ( incr > 0 ) {
// upper-lower can exceed the limit of signed type
trip_count = (UT)(*pupper - *plower) / incr + 1;
} else {
trip_count = (ST)(*pupper - *plower) / incr + 1; // cast to signed to cover incr<0 case
trip_count = (UT)(*plower - *pupper) / ( -incr ) + 1;
}
if( trip_count <= nteams ) {
KMP_DEBUG_ASSERT(
__kmp_static == kmp_sch_static_greedy || \
@@ -2255,7 +2443,6 @@ void
__kmpc_dispatch_init_4( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
kmp_int32 lb, kmp_int32 ub, kmp_int32 st, kmp_int32 chunk )
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_dispatch_init< kmp_int32 >( loc, gtid, schedule, lb, ub, st, chunk, true );
}
@@ -2266,7 +2453,6 @@ void
__kmpc_dispatch_init_4u( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
kmp_uint32 lb, kmp_uint32 ub, kmp_int32 st, kmp_int32 chunk )
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_dispatch_init< kmp_uint32 >( loc, gtid, schedule, lb, ub, st, chunk, true );
}
@@ -2279,7 +2465,6 @@ __kmpc_dispatch_init_8( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
kmp_int64 lb, kmp_int64 ub,
kmp_int64 st, kmp_int64 chunk )
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_dispatch_init< kmp_int64 >( loc, gtid, schedule, lb, ub, st, chunk, true );
}
@@ -2292,7 +2477,6 @@ __kmpc_dispatch_init_8u( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
kmp_uint64 lb, kmp_uint64 ub,
kmp_int64 st, kmp_int64 chunk )
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_dispatch_init< kmp_uint64 >( loc, gtid, schedule, lb, ub, st, chunk, true );
}
@@ -2310,7 +2494,6 @@ void
__kmpc_dist_dispatch_init_4( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
kmp_int32 *p_last, kmp_int32 lb, kmp_int32 ub, kmp_int32 st, kmp_int32 chunk )
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_dist_get_bounds< kmp_int32 >( loc, gtid, p_last, &lb, &ub, st );
__kmp_dispatch_init< kmp_int32 >( loc, gtid, schedule, lb, ub, st, chunk, true );
@@ -2320,7 +2503,6 @@ void
__kmpc_dist_dispatch_init_4u( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
kmp_int32 *p_last, kmp_uint32 lb, kmp_uint32 ub, kmp_int32 st, kmp_int32 chunk )
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_dist_get_bounds< kmp_uint32 >( loc, gtid, p_last, &lb, &ub, st );
__kmp_dispatch_init< kmp_uint32 >( loc, gtid, schedule, lb, ub, st, chunk, true );
@@ -2330,7 +2512,6 @@ void
__kmpc_dist_dispatch_init_8( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
kmp_int32 *p_last, kmp_int64 lb, kmp_int64 ub, kmp_int64 st, kmp_int64 chunk )
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_dist_get_bounds< kmp_int64 >( loc, gtid, p_last, &lb, &ub, st );
__kmp_dispatch_init< kmp_int64 >( loc, gtid, schedule, lb, ub, st, chunk, true );
@@ -2340,7 +2521,6 @@ void
__kmpc_dist_dispatch_init_8u( ident_t *loc, kmp_int32 gtid, enum sched_type schedule,
kmp_int32 *p_last, kmp_uint64 lb, kmp_uint64 ub, kmp_int64 st, kmp_int64 chunk )
{
KMP_COUNT_BLOCK(OMP_FOR_dynamic);
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_dist_get_bounds< kmp_uint64 >( loc, gtid, p_last, &lb, &ub, st );
__kmp_dispatch_init< kmp_uint64 >( loc, gtid, schedule, lb, ub, st, chunk, true );
@@ -2457,25 +2637,6 @@ kmp_uint32 __kmp_ge_4( kmp_uint32 value, kmp_uint32 checker) {
kmp_uint32 __kmp_le_4( kmp_uint32 value, kmp_uint32 checker) {
return value <= checker;
}
kmp_uint32 __kmp_eq_8( kmp_uint64 value, kmp_uint64 checker) {
return value == checker;
}
kmp_uint32 __kmp_neq_8( kmp_uint64 value, kmp_uint64 checker) {
return value != checker;
}
kmp_uint32 __kmp_lt_8( kmp_uint64 value, kmp_uint64 checker) {
return value < checker;
}
kmp_uint32 __kmp_ge_8( kmp_uint64 value, kmp_uint64 checker) {
return value >= checker;
}
kmp_uint32 __kmp_le_8( kmp_uint64 value, kmp_uint64 checker) {
return value <= checker;
}
kmp_uint32
__kmp_wait_yield_4(volatile kmp_uint32 * spinner,
@@ -2510,39 +2671,30 @@ __kmp_wait_yield_4(volatile kmp_uint32 * spinner,
return r;
}
kmp_uint64
__kmp_wait_yield_8( volatile kmp_uint64 * spinner,
kmp_uint64 checker,
kmp_uint32 (* pred)( kmp_uint64, kmp_uint64 )
, void * obj // Higher-level synchronization object, or NULL.
)
void
__kmp_wait_yield_4_ptr(void *spinner,
kmp_uint32 checker,
kmp_uint32 (*pred)( void *, kmp_uint32 ),
void *obj // Higher-level synchronization object, or NULL.
)
{
// note: we may not belong to a team at this point
register volatile kmp_uint64 * spin = spinner;
register kmp_uint64 check = checker;
register kmp_uint32 spins;
register kmp_uint32 (*f) ( kmp_uint64, kmp_uint64 ) = pred;
register kmp_uint64 r;
register void *spin = spinner;
register kmp_uint32 check = checker;
register kmp_uint32 spins;
register kmp_uint32 (*f) ( void *, kmp_uint32 ) = pred;
KMP_FSYNC_SPIN_INIT( obj, (void*) spin );
KMP_FSYNC_SPIN_INIT( obj, spin );
KMP_INIT_YIELD( spins );
// main wait spin loop
while(!f(r = *spin, check))
{
while ( !f( spin, check ) ) {
KMP_FSYNC_SPIN_PREPARE( obj );
/* GEH - remove this since it was accidentally introduced when kmp_wait was split.
It causes problems with infinite recursion because of exit lock */
/* if ( TCR_4(__kmp_global.g.g_done) && __kmp_global.g.g_abort)
__kmp_abort_thread(); */
// if we are oversubscribed,
// or have waited a bit (and KMP_LIBARRY=throughput, then yield
// pause is in the following code
KMP_YIELD( TCR_4(__kmp_nth) > __kmp_avail_proc );
/* if we have waited a bit, or are oversubscribed, yield */
/* pause is in the following code */
KMP_YIELD( TCR_4( __kmp_nth ) > __kmp_avail_proc );
KMP_YIELD_SPIN( spins );
}
KMP_FSYNC_SPIN_ACQUIRED( obj );
return r;
}
} // extern "C"
+21 -24
View File
@@ -1,7 +1,5 @@
/*
* kmp_environment.c -- Handle environment variables OS-independently.
* $Revision: 43084 $
* $Date: 2014-04-15 09:15:14 -0500 (Tue, 15 Apr 2014) $
*/
@@ -25,17 +23,17 @@
------------------------------------------------------------------------------------------------
On Windows* OS, there are two environments (at least, see below):
1. Environment maintained by Windows* OS on IA-32 architecture.
1. Environment maintained by Windows* OS on IA-32 architecture.
Accessible through GetEnvironmentVariable(),
SetEnvironmentVariable(), and GetEnvironmentStrings().
2. Environment maintained by C RTL. Accessible through getenv(), putenv().
putenv() function updates both C and Windows* OS on IA-32 architecture. getenv() function
search for variables in C RTL environment only. Windows* OS on IA-32 architecture functions work *only*
putenv() function updates both C and Windows* OS on IA-32 architecture. getenv() function
search for variables in C RTL environment only. Windows* OS on IA-32 architecture functions work *only*
with Windows* OS on IA-32 architecture.
Windows* OS on IA-32 architecture maintained by OS, so there is always only one Windows* OS on
Windows* OS on IA-32 architecture maintained by OS, so there is always only one Windows* OS on
IA-32 architecture per process. Changes in Windows* OS on IA-32 architecture are process-visible.
C environment maintained by C RTL. Multiple copies of C RTL may be present in the process, and
@@ -44,11 +42,11 @@
Thus, proper way to work with environment on Windows* OS is:
1. Set variables with putenv() function -- both C and Windows* OS on
IA-32 architecture are being updated. Windows* OS on
IA-32 architecture are being updated. Windows* OS on
IA-32 architecture may be considered as primary target,
while updating C RTL environment is a free bonus.
2. Get variables with GetEnvironmentVariable() -- getenv() does not
2. Get variables with GetEnvironmentVariable() -- getenv() does not
search Windows* OS on IA-32 architecture, and can not see variables
set with SetEnvironmentVariable().
@@ -66,13 +64,11 @@
#if KMP_OS_UNIX
#include <stdlib.h> // getenv, setenv, unsetenv.
#include <string.h> // strlen, strcpy.
#if KMP_OS_LINUX || KMP_OS_FREEBSD
extern char * * environ;
#elif KMP_OS_DARWIN
#if KMP_OS_DARWIN
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#else
#error Unknown or unsupported OS.
extern char * * environ;
#endif
#elif KMP_OS_WINDOWS
#include <windows.h> // GetEnvironmentVariable, SetEnvironmentVariable, GetLastError.
@@ -104,12 +100,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
/*
@@ -218,7 +214,7 @@ __kmp_env_set( char const * name, char const * value, int overwrite ) {
// Dead code. I tried to put too many variables into Linux* OS
// environment on IA-32 architecture. When application consumes
// more than ~2.5 GB of memory, entire system feels bad. Sometimes
// application is killed (by OS?), sometimes system stops
// application is killed (by OS?), sometimes system stops
// responding... But this error message never appears. --ln
__kmp_msg(
kmp_ms_fatal,
@@ -372,6 +368,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 +392,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 +414,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 +423,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 +435,7 @@ ___kmp_env_blk_parse_windows(
block->count = count;
}; // ___kmp_env_blk_parse_windows
#endif
/*
@@ -464,7 +461,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 +480,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;
-2
View File
@@ -1,7 +1,5 @@
/*
* kmp_environment.h -- Handle environment varoiables OS-independently.
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
+21 -24
View File
@@ -1,7 +1,5 @@
/*
/*
* kmp_error.c -- KPTS functions for error checking at runtime
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
@@ -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;
+8 -2
View File
@@ -1,7 +1,5 @@
/*
* kmp_error.h -- PTS functions for error checking at runtime.
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
@@ -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 -3
View File
@@ -1,7 +1,5 @@
/*
* kmp_ftn_cdecl.c -- Fortran __cdecl linkage support for OpenMP.
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
@@ -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
+302 -19
View File
@@ -1,7 +1,5 @@
/*
* kmp_ftn_entry.h -- Fortran entry linkage support for OpenMP.
* $Revision: 43435 $
* $Date: 2014-09-04 15:16:08 -0500 (Thu, 04 Sep 2014) $
*/
@@ -217,6 +215,19 @@ FTN_GET_LIBRARY (void)
#endif
}
void FTN_STDCALL
FTN_SET_DISP_NUM_BUFFERS( int KMP_DEREF arg )
{
#ifdef KMP_STUB
; // empty routine
#else
// ignore after initialization because some teams have already
// allocated dispatch buffers
if( __kmp_init_serial == 0 && (KMP_DEREF arg) > 0 )
__kmp_dispatch_num_buffers = KMP_DEREF arg;
#endif
}
int FTN_STDCALL
FTN_SET_AFFINITY( void **mask )
{
@@ -259,11 +270,11 @@ FTN_GET_AFFINITY_MAX_PROC( void )
return 0;
}
#if KMP_OS_WINDOWS && KMP_ARCH_X86_64
if ( __kmp_num_proc_groups <= 1 ) {
return (int)KMP_CPU_SETSIZE;
#if KMP_GROUP_AFFINITY
if ( __kmp_num_proc_groups > 1 ) {
return (int)(__kmp_num_proc_groups*sizeof(DWORD_PTR)*CHAR_BIT);
}
#endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */
#endif /* KMP_GROUP_AFFINITY */
return __kmp_xproc;
#endif
}
@@ -280,7 +291,11 @@ FTN_CREATE_AFFINITY_MASK( void **mask )
if ( ! TCR_4(__kmp_init_middle) ) {
__kmp_middle_initialize();
}
# if KMP_USE_HWLOC
*mask = (hwloc_cpuset_t)hwloc_bitmap_alloc();
# else
*mask = kmpc_malloc( __kmp_affin_mask_size );
# endif
KMP_CPU_ZERO( (kmp_affin_mask_t *)(*mask) );
#endif
}
@@ -302,7 +317,11 @@ FTN_DESTROY_AFFINITY_MASK( void **mask )
KMP_FATAL( AffinityInvalidMask, "kmp_destroy_affinity_mask" );
}
}
# if KMP_USE_HWLOC
hwloc_bitmap_free((hwloc_cpuset_t)(*mask));
# else
kmpc_free( *mask );
# endif
*mask = NULL;
#endif
}
@@ -400,7 +419,7 @@ xexpand(FTN_GET_THREAD_NUM)( void )
#else
int gtid;
#if KMP_OS_DARWIN || KMP_OS_FREEBSD
#if KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_NETBSD
gtid = __kmp_entry_gtid();
#elif KMP_OS_WINDOWS
if (!__kmp_init_parallel ||
@@ -670,6 +689,143 @@ xexpand(FTN_GET_PROC_BIND)( void )
#endif
}
#if OMP_45_ENABLED
int FTN_STDCALL
FTN_GET_NUM_PLACES( void )
{
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
return 0;
#else
if ( ! TCR_4(__kmp_init_middle) ) {
__kmp_middle_initialize();
}
return __kmp_affinity_num_masks;
#endif
}
int FTN_STDCALL
FTN_GET_PLACE_NUM_PROCS( int place_num )
{
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
return 0;
#else
int i;
int retval = 0;
if ( ! TCR_4(__kmp_init_middle) ) {
__kmp_middle_initialize();
}
if ( place_num < 0 || place_num >= (int)__kmp_affinity_num_masks )
return 0;
kmp_affin_mask_t *mask = KMP_CPU_INDEX(__kmp_affinity_masks, place_num);
KMP_CPU_SET_ITERATE(i, mask) {
if ((! KMP_CPU_ISSET(i, __kmp_affin_fullMask)) ||
(!KMP_CPU_ISSET(i, mask))) {
continue;
}
++retval;
}
return retval;
#endif
}
void FTN_STDCALL
FTN_GET_PLACE_PROC_IDS( int place_num, int *ids )
{
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
// Nothing.
#else
int i,j;
if ( ! TCR_4(__kmp_init_middle) ) {
__kmp_middle_initialize();
}
if ( place_num < 0 || place_num >= (int)__kmp_affinity_num_masks )
return;
kmp_affin_mask_t *mask = KMP_CPU_INDEX(__kmp_affinity_masks, place_num);
j = 0;
KMP_CPU_SET_ITERATE(i, mask) {
if ((! KMP_CPU_ISSET(i, __kmp_affin_fullMask)) ||
(!KMP_CPU_ISSET(i, mask))) {
continue;
}
ids[j++] = i;
}
#endif
}
int FTN_STDCALL
FTN_GET_PLACE_NUM( void )
{
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
return -1;
#else
int gtid;
kmp_info_t *thread;
if ( ! TCR_4(__kmp_init_middle) ) {
__kmp_middle_initialize();
}
gtid = __kmp_entry_gtid();
thread = __kmp_thread_from_gtid(gtid);
if ( thread->th.th_current_place < 0 )
return -1;
return thread->th.th_current_place;
#endif
}
int FTN_STDCALL
FTN_GET_PARTITION_NUM_PLACES( void )
{
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
return 0;
#else
int gtid, num_places, first_place, last_place;
kmp_info_t *thread;
if ( ! TCR_4(__kmp_init_middle) ) {
__kmp_middle_initialize();
}
gtid = __kmp_entry_gtid();
thread = __kmp_thread_from_gtid(gtid);
first_place = thread->th.th_first_place;
last_place = thread->th.th_last_place;
if ( first_place < 0 || last_place < 0 )
return 0;
if ( first_place <= last_place )
num_places = last_place - first_place + 1;
else
num_places = __kmp_affinity_num_masks - first_place + last_place + 1;
return num_places;
#endif
}
void FTN_STDCALL
FTN_GET_PARTITION_PLACE_NUMS( int *place_nums ) {
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
// Nothing.
#else
int i, gtid, place_num, first_place, last_place, start, end;
kmp_info_t *thread;
if ( ! TCR_4(__kmp_init_middle) ) {
__kmp_middle_initialize();
}
gtid = __kmp_entry_gtid();
thread = __kmp_thread_from_gtid(gtid);
first_place = thread->th.th_first_place;
last_place = thread->th.th_last_place;
if ( first_place < 0 || last_place < 0 )
return;
if ( first_place <= last_place ) {
start = first_place;
end = last_place;
} else {
start = last_place;
end = first_place;
}
for (i = 0, place_num = start; place_num <= end; ++place_num, ++i) {
place_nums[i] = place_num;
}
#endif
}
#endif
int FTN_STDCALL
xexpand(FTN_GET_NUM_TEAMS)( void )
{
@@ -748,20 +904,17 @@ xexpand(FTN_GET_TEAM_NUM)( void )
#endif
}
#if KMP_MIC || KMP_OS_DARWIN
static int __kmp_default_device = 0;
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
int FTN_STDCALL
FTN_GET_DEFAULT_DEVICE( void )
{
return __kmp_default_device;
return 0;
}
void FTN_STDCALL
FTN_SET_DEFAULT_DEVICE( int KMP_DEREF arg )
{
__kmp_default_device = KMP_DEREF arg;
}
int FTN_STDCALL
@@ -770,14 +923,119 @@ FTN_GET_NUM_DEVICES( void )
return 0;
}
#endif // KMP_MIC || KMP_OS_DARWIN
#endif // KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#if ! KMP_OS_LINUX
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
#if OMP_45_ENABLED && defined(KMP_STUB)
// OpenMP 4.5 entries for stubs library
int FTN_STDCALL
FTN_GET_INITIAL_DEVICE(void)
{
return -1;
}
// As all *target* functions are C-only parameters always passed by value
void * FTN_STDCALL
FTN_TARGET_ALLOC(size_t size, int device_num)
{
return 0;
}
void FTN_STDCALL
FTN_TARGET_FREE(void * device_ptr, int device_num)
{
}
int FTN_STDCALL
FTN_TARGET_IS_PRESENT(void * ptr, int device_num)
{
return 0;
}
int FTN_STDCALL
FTN_TARGET_MEMCPY(void *dst, void *src, size_t length, size_t dst_offset,
size_t src_offset, int dst_device, int src_device)
{
return -1;
}
int FTN_STDCALL
FTN_TARGET_MEMCPY_RECT(void *dst, void *src, size_t element_size, int num_dims,
const size_t *volume, const size_t *dst_offsets,
const size_t *src_offsets, const size_t *dst_dimensions,
const size_t *src_dimensions, int dst_device, int src_device)
{
return -1;
}
int FTN_STDCALL
FTN_TARGET_ASSOCIATE_PTR(void *host_ptr, void *device_ptr, size_t size,
size_t device_offset, int device_num)
{
return -1;
}
int FTN_STDCALL
FTN_TARGET_DISASSOCIATE_PTR(void *host_ptr, int device_num)
{
return -1;
}
#endif // OMP_45_ENABLED && defined(KMP_STUB)
#ifdef KMP_STUB
typedef enum { UNINIT = -1, UNLOCKED, LOCKED } kmp_stub_lock_t;
#endif /* KMP_STUB */
#if KMP_USE_DYNAMIC_LOCK
void FTN_STDCALL
FTN_INIT_LOCK_WITH_HINT( void **user_lock, uintptr_t KMP_DEREF hint )
{
#ifdef KMP_STUB
*((kmp_stub_lock_t *)user_lock) = UNLOCKED;
#else
__kmpc_init_lock_with_hint( NULL, __kmp_entry_gtid(), user_lock, KMP_DEREF hint );
#endif
}
void FTN_STDCALL
FTN_INIT_NEST_LOCK_WITH_HINT( void **user_lock, uintptr_t KMP_DEREF hint )
{
#ifdef KMP_STUB
*((kmp_stub_lock_t *)user_lock) = UNLOCKED;
#else
__kmpc_init_nest_lock_with_hint( NULL, __kmp_entry_gtid(), user_lock, KMP_DEREF hint );
#endif
}
#endif
/* initialize the lock */
void FTN_STDCALL
xexpand(FTN_INIT_LOCK)( void **user_lock )
@@ -954,6 +1212,13 @@ FTN_MALLOC( size_t KMP_DEREF size )
return kmpc_malloc( KMP_DEREF size );
}
void * FTN_STDCALL
FTN_ALIGNED_MALLOC( size_t KMP_DEREF size, size_t KMP_DEREF alignment )
{
// kmpc_aligned_malloc initializes the library if needed
return kmpc_aligned_malloc( KMP_DEREF size, KMP_DEREF alignment );
}
void * FTN_STDCALL
FTN_CALLOC( size_t KMP_DEREF nelem, size_t KMP_DEREF elsize )
{
@@ -1000,7 +1265,7 @@ FTN_SET_DEFAULTS( char const * str
{
#ifndef KMP_STUB
#ifdef PASS_ARGS_BY_VALUE
int len = (int)strlen( str );
int len = (int)KMP_STRLEN( str );
#endif
__kmp_aux_set_defaults( str, len );
#endif
@@ -1035,6 +1300,22 @@ FTN_GET_CANCELLATION_STATUS(int cancel_kind) {
#endif // OMP_40_ENABLED
#if OMP_45_ENABLED
/* returns the maximum allowed task priority */
int FTN_STDCALL
FTN_GET_MAX_TASK_PRIORITY( void )
{
#ifdef KMP_STUB
return 0;
#else
if ( ! __kmp_init_serial ) {
__kmp_serial_initialize();
}
return __kmp_max_task_priority;
#endif
}
#endif
// GCC compatibility (versioned symbols)
#ifdef KMP_USE_VERSION_SYMBOLS
@@ -1042,7 +1323,7 @@ FTN_GET_CANCELLATION_STATUS(int cancel_kind) {
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)
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_
@@ -1110,10 +1391,11 @@ 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
// OMP_4.1 aliases
#if OMP_45_ENABLED
// OMP_4.5 aliases
#endif
#if OMP_50_ENABLED
@@ -1178,10 +1460,11 @@ 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
// OMP_4.1 versioned symbols
#if OMP_45_ENABLED
// OMP_4.5 versioned symbols
#endif
#if OMP_50_ENABLED
-2
View File
@@ -1,7 +1,5 @@
/*
* kmp_ftn_extra.c -- Fortran 'extra' linkage support for OpenMP.
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
+114 -8
View File
@@ -1,7 +1,5 @@
/*
* kmp_ftn_os.h -- KPTS Fortran defines header file.
* $Revision: 43354 $
* $Date: 2014-07-22 17:15:02 -0500 (Tue, 22 Jul 2014) $
*/
@@ -37,6 +35,7 @@
#define FTN_SET_LIBRARY kmp_set_library
#define FTN_GET_LIBRARY kmp_get_library
#define FTN_SET_DEFAULTS kmp_set_defaults
#define FTN_SET_DISP_NUM_BUFFERS kmp_set_disp_num_buffers
#define FTN_SET_AFFINITY kmp_set_affinity
#define FTN_GET_AFFINITY kmp_get_affinity
#define FTN_GET_AFFINITY_MAX_PROC kmp_get_affinity_max_proc
@@ -47,6 +46,7 @@
#define FTN_GET_AFFINITY_MASK_PROC kmp_get_affinity_mask_proc
#define FTN_MALLOC kmp_malloc
#define FTN_ALIGNED_MALLOC kmp_aligned_malloc
#define FTN_CALLOC kmp_calloc
#define FTN_REALLOC kmp_realloc
#define FTN_FREE kmp_free
@@ -81,6 +81,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_WITH_HINT omp_init_lock_with_hint
#define FTN_INIT_NEST_LOCK_WITH_HINT omp_init_nest_lock_with_hint
#endif
#define FTN_DESTROY_LOCK omp_destroy_lock
#define FTN_SET_LOCK omp_set_lock
#define FTN_UNSET_LOCK omp_unset_lock
@@ -98,11 +102,12 @@
#define FTN_GET_WTICK omp_get_wtick
#if OMP_40_ENABLED
#if KMP_MIC || KMP_OS_DARWIN
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device
#define FTN_GET_NUM_DEVICES omp_get_num_devices
#endif
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device
#endif
#if OMP_40_ENABLED
@@ -110,6 +115,26 @@
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status
#endif
#if OMP_45_ENABLED
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority
#define FTN_GET_NUM_PLACES omp_get_num_places
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs
#define FTN_GET_PLACE_PROC_IDS omp_get_place_proc_ids
#define FTN_GET_PLACE_NUM omp_get_place_num
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums
# ifdef KMP_STUB
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device
#define FTN_TARGET_ALLOC omp_target_alloc
#define FTN_TARGET_FREE omp_target_free
#define FTN_TARGET_IS_PRESENT omp_target_is_present
#define FTN_TARGET_MEMCPY omp_target_memcpy
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr
# endif
#endif
#endif /* KMP_FTN_PLAIN */
/* ------------------------------------------------------------------------ */
@@ -128,6 +153,7 @@
#define FTN_SET_LIBRARY kmp_set_library_
#define FTN_GET_LIBRARY kmp_get_library_
#define FTN_SET_DEFAULTS kmp_set_defaults_
#define FTN_SET_DISP_NUM_BUFFERS kmp_set_disp_num_buffers_
#define FTN_SET_AFFINITY kmp_set_affinity_
#define FTN_GET_AFFINITY kmp_get_affinity_
#define FTN_GET_AFFINITY_MAX_PROC kmp_get_affinity_max_proc_
@@ -138,6 +164,7 @@
#define FTN_GET_AFFINITY_MASK_PROC kmp_get_affinity_mask_proc_
#define FTN_MALLOC kmp_malloc_
#define FTN_ALIGNED_MALLOC kmp_aligned_malloc_
#define FTN_CALLOC kmp_calloc_
#define FTN_REALLOC kmp_realloc_
#define FTN_FREE kmp_free_
@@ -172,6 +199,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_WITH_HINT omp_init_lock_with_hint_
#define FTN_INIT_NEST_LOCK_WITH_HINT omp_init_nest_lock_with_hint_
#endif
#define FTN_DESTROY_LOCK omp_destroy_lock_
#define FTN_SET_LOCK omp_set_lock_
#define FTN_UNSET_LOCK omp_unset_lock_
@@ -189,11 +220,12 @@
#define FTN_GET_WTICK omp_get_wtick_
#if OMP_40_ENABLED
#if KMP_MIC || KMP_OS_DARWIN
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device_
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device_
#define FTN_GET_NUM_DEVICES omp_get_num_devices_
#endif
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device_
#endif
@@ -202,6 +234,26 @@
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status_
#endif
#if OMP_45_ENABLED
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority_
#define FTN_GET_NUM_PLACES omp_get_num_places_
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs_
#define FTN_GET_PLACE_PROC_IDS omp_get_place_proc_ids_
#define FTN_GET_PLACE_NUM omp_get_place_num_
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places_
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums_
# ifdef KMP_STUB
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device_
#define FTN_TARGET_ALLOC omp_target_alloc_
#define FTN_TARGET_FREE omp_target_free_
#define FTN_TARGET_IS_PRESENT omp_target_is_present_
#define FTN_TARGET_MEMCPY omp_target_memcpy_
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect_
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr_
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr_
# endif
#endif
#endif /* KMP_FTN_APPEND */
/* ------------------------------------------------------------------------ */
@@ -220,6 +272,7 @@
#define FTN_SET_LIBRARY KMP_SET_LIBRARY
#define FTN_GET_LIBRARY KMP_GET_LIBRARY
#define FTN_SET_DEFAULTS KMP_SET_DEFAULTS
#define FTN_SET_DISP_NUM_BUFFERS KMP_SET_DISP_NUM_BUFFERS
#define FTN_SET_AFFINITY KMP_SET_AFFINITY
#define FTN_GET_AFFINITY KMP_GET_AFFINITY
#define FTN_GET_AFFINITY_MAX_PROC KMP_GET_AFFINITY_MAX_PROC
@@ -230,6 +283,7 @@
#define FTN_GET_AFFINITY_MASK_PROC KMP_GET_AFFINITY_MASK_PROC
#define FTN_MALLOC KMP_MALLOC
#define FTN_ALIGNED_MALLOC KMP_ALIGNED_MALLOC
#define FTN_CALLOC KMP_CALLOC
#define FTN_REALLOC KMP_REALLOC
#define FTN_FREE KMP_FREE
@@ -264,6 +318,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_WITH_HINT OMP_INIT_LOCK_WITH_HINT
#define FTN_INIT_NEST_LOCK_WITH_HINT OMP_INIT_NEST_LOCK_WITH_HINT
#endif
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK
#define FTN_SET_LOCK OMP_SET_LOCK
#define FTN_UNSET_LOCK OMP_UNSET_LOCK
@@ -281,11 +339,12 @@
#define FTN_GET_WTICK OMP_GET_WTICK
#if OMP_40_ENABLED
#if KMP_MIC || KMP_OS_DARWIN
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES
#endif
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE
#endif
@@ -294,6 +353,26 @@
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS
#endif
#if OMP_45_ENABLED
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS
#define FTN_GET_PLACE_PROC_IDS OMP_GET_PLACE_PROC_IDS
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS
# ifdef KMP_STUB
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC
#define FTN_TARGET_FREE OMP_TARGET_FREE
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR
# endif
#endif
#endif /* KMP_FTN_UPPER */
/* ------------------------------------------------------------------------ */
@@ -312,6 +391,7 @@
#define FTN_SET_LIBRARY KMP_SET_LIBRARY_
#define FTN_GET_LIBRARY KMP_GET_LIBRARY_
#define FTN_SET_DEFAULTS KMP_SET_DEFAULTS_
#define FTN_SET_DISP_NUM_BUFFERS KMP_SET_DISP_NUM_BUFFERS_
#define FTN_SET_AFFINITY KMP_SET_AFFINITY_
#define FTN_GET_AFFINITY KMP_GET_AFFINITY_
#define FTN_GET_AFFINITY_MAX_PROC KMP_GET_AFFINITY_MAX_PROC_
@@ -322,6 +402,7 @@
#define FTN_GET_AFFINITY_MASK_PROC KMP_GET_AFFINITY_MASK_PROC_
#define FTN_MALLOC KMP_MALLOC_
#define FTN_ALIGNED_MALLOC KMP_ALIGNED_MALLOC_
#define FTN_CALLOC KMP_CALLOC_
#define FTN_REALLOC KMP_REALLOC_
#define FTN_FREE KMP_FREE_
@@ -356,6 +437,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_WITH_HINT OMP_INIT_LOCK_WITH_HINT_
#define FTN_INIT_NEST_LOCK_WITH_HINT OMP_INIT_NEST_LOCK_WITH_HINT_
#endif
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK_
#define FTN_SET_LOCK OMP_SET_LOCK_
#define FTN_UNSET_LOCK OMP_UNSET_LOCK_
@@ -373,11 +458,12 @@
#define FTN_GET_WTICK OMP_GET_WTICK_
#if OMP_40_ENABLED
#if KMP_MIC || KMP_OS_DARWIN
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE_
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE_
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES_
#endif
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE_
#endif
@@ -386,6 +472,26 @@
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS_
#endif
#if OMP_45_ENABLED
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY_
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES_
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS_
#define FTN_GET_PLACE_PROC_IDS OMP_GET_PLACE_PROC_IDS_
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM_
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES_
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS_
# ifdef KMP_STUB
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE_
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC_
#define FTN_TARGET_FREE OMP_TARGET_FREE_
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT_
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY_
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT_
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR_
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR_
# endif
#endif
#endif /* KMP_FTN_UAPPEND */
/* ------------------------------------------------------------------ */
@@ -456,8 +562,8 @@
// All GOMP_3.0 symbols
#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
// All GOMP_4.0 symbols
// TODO: As of 2013-10-14, none of the GOMP_4.0 functions are implemented in libomp
#define KMP_API_NAME_GOMP_BARRIER_CANCEL GOMP_barrier_cancel
#define KMP_API_NAME_GOMP_CANCEL GOMP_cancel
#define KMP_API_NAME_GOMP_CANCELLATION_POINT GOMP_cancellation_point
-2
View File
@@ -1,7 +1,5 @@
/*
* kmp_ftn_stdcall.c -- Fortran __stdcall linkage support for OpenMP.
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
+27 -21
View File
@@ -1,7 +1,5 @@
/*
* kmp_global.c -- KPTS global variables for runtime support library
* $Revision: 43473 $
* $Date: 2014-09-26 15:02:57 -0500 (Fri, 26 Sep 2014) $
*/
@@ -17,18 +15,16 @@
#include "kmp.h"
#ifdef KMP_SETVERSION
char __kmp_setversion_string[] = VERSION_STRING;
#endif
kmp_key_t __kmp_gtid_threadprivate_key;
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
kmp_cpuinfo_t __kmp_cpuinfo = { 0 }; // Not initialized
#endif
#if KMP_STATS_ENABLED
#include "kmp_stats.h"
// lock for modifying the global __kmp_stats_list
kmp_tas_lock_t __kmp_stats_lock = KMP_TAS_LOCK_INITIALIZER(__kmp_stats_lock);
kmp_tas_lock_t __kmp_stats_lock;
// global list of per thread stats, the head is a sentinel node which accumulates all stats produced before __kmp_create_worker is called.
kmp_stats_list __kmp_stats_list;
@@ -109,8 +105,7 @@ char const *__kmp_barrier_type_name [ bs_last_barrier ] =
, "reduction"
#endif // KMP_FAST_REDUCTION_BARRIER
};
char const *__kmp_barrier_pattern_name [ bp_last_bar ] = { "linear", "tree", "hyper", "hierarchical" };
char const *__kmp_barrier_pattern_name[bp_last_bar] = {"linear","tree","hyper","hierarchical"};
int __kmp_allThreadsSpecified = 0;
size_t __kmp_align_alloc = CACHE_LINE;
@@ -129,6 +124,7 @@ int __kmp_dflt_team_nth_ub = 0;
int __kmp_tp_capacity = 0;
int __kmp_tp_cached = 0;
int __kmp_dflt_nested = FALSE;
int __kmp_dispatch_num_buffers = KMP_DFLT_DISP_NUM_BUFF;
int __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT; /* max_active_levels limit */
#if KMP_NESTED_HOT_TEAMS
int __kmp_hot_teams_mode = 0; /* 0 - free extra threads when reduced */
@@ -146,10 +142,9 @@ int __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME( KMP_DEFAULT_BLOC
#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)
@@ -215,9 +210,18 @@ 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_USE_HWLOC
int __kmp_hwloc_error = FALSE;
hwloc_topology_t __kmp_hwloc_topology = NULL;
# endif
# if KMP_GROUP_AFFINITY
int __kmp_num_proc_groups = 1;
@@ -226,7 +230,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;
@@ -252,13 +256,16 @@ 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_sockets = 0;
int __kmp_place_socket_offset = 0;
int __kmp_place_num_cores = 0;
int __kmp_place_core_offset = 0;
int __kmp_place_num_threads_per_core = 0;
kmp_tasking_mode_t __kmp_tasking_mode = tskm_task_teams;
#if OMP_45_ENABLED
kmp_int32 __kmp_max_task_priority = 0;
#endif
/* This check ensures that the compiler is passing the correct data type
* for the flags formal parameter of the function kmpc_omp_task_alloc().
@@ -278,7 +285,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 +328,6 @@ int __kmp_storage_map_verbose_specified = FALSE;
int __kmp_need_register_atfork = TRUE; /* At initialization, call pthread_atfork to install fork handler */
int __kmp_need_register_atfork_specified = TRUE;
int __kmp_env_chunk = FALSE; /* KMP_CHUNK specified? */
int __kmp_env_stksize = FALSE; /* KMP_STACKSIZE specified? */
int __kmp_env_omp_stksize = FALSE; /* OMP_STACKSIZE specified? */
+346 -40
View File
@@ -1,7 +1,5 @@
/*
* kmp_gsupport.c
* $Revision: 43473 $
* $Date: 2014-09-26 15:02:57 -0500 (Fri, 26 Sep 2014) $
*/
@@ -15,12 +13,13 @@
//===----------------------------------------------------------------------===//
#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
@@ -108,6 +107,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);
}
@@ -179,7 +183,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));
//
@@ -248,7 +251,36 @@ 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_enabled) {
// 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_enabled) {
// clear task frame
ompt_frame->exit_runtime_frame = NULL;
// restore enclosing state
thr->th.ompt_thread_info.state = enclosing_state;
}
#endif
}
@@ -266,10 +298,37 @@ __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_enabled) {
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_enabled) {
// clear task frame
ompt_frame->exit_runtime_frame = NULL;
// reset enclosing state
thr->th.ompt_thread_info.state = enclosing_state;
}
#endif
}
@@ -277,14 +336,21 @@ __kmp_GOMP_parallel_microtask_wrapper(int *gtid, int *npr,
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, fork_context_gnu, argc, wrapper, __kmp_invoke_task_func,
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
@@ -295,10 +361,74 @@ __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_enabled) {
#if OMPT_TRACE
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
// implicit task callback
if (ompt_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 *))
{
#if OMPT_SUPPORT
ompt_parallel_id_t ompt_parallel_id;
if (ompt_enabled) {
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
task_info->frame.exit_runtime_frame = NULL;
ompt_parallel_id = __ompt_parallel_id_new(gtid);
// parallel region callback
if (ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) {
int team_size = 1;
ompt_callbacks.ompt_callback(ompt_event_parallel_begin)(
task_info->task_id, &task_info->frame, ompt_parallel_id,
team_size, (void *) task,
OMPT_INVOKER(fork_context_gnu));
}
}
#endif
__kmp_serialized_parallel(loc, gtid);
#if OMPT_SUPPORT
if (ompt_enabled) {
kmp_info_t *thr = __kmp_threads[gtid];
ompt_task_id_t my_ompt_task_id = __ompt_task_id_new(gtid);
// 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_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
}
@@ -306,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_enabled) {
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));
@@ -313,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_enabled) {
parent_frame->reenter_runtime_frame = NULL;
}
#endif
}
@@ -326,17 +472,105 @@ 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 (! __kmp_threads[gtid]->th.th_team->t.t_serialized) {
kmp_info_t *thr = __kmp_threads[gtid];
#if OMPT_SUPPORT
ompt_parallel_id_t parallel_id;
ompt_task_id_t serialized_task_id;
ompt_frame_t *ompt_frame = NULL;
if (ompt_enabled) {
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
parallel_id = team_info->parallel_id;
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
serialized_task_id = task_info->task_id;
// Record that we re-entered the runtime system in the implicit
// task frame representing the parallel region.
ompt_frame = &task_info->frame;
ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
// unlink if necessary. no-op if there is not a lightweight task.
ompt_lw_taskteam_t *lwt = __ompt_lw_taskteam_unlink(thr);
// GOMP allocates/frees lwt since it can't be kept on the stack
if (lwt) {
__kmp_free(lwt);
#if OMPT_SUPPORT
if (ompt_enabled) {
// Since a lightweight task was destroyed, make sure that the
// remaining deepest task knows the stack frame where the runtime
// was reentered.
ompt_frame = __ompt_get_task_frame_internal(0);
ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
}
#endif
}
}
#endif
if (! thr->th.th_team->t.t_serialized) {
__kmp_run_after_invoked_task(gtid, __kmp_tid_from_gtid(gtid), thr,
thr->th.th_team);
__kmp_join_call(&loc, gtid);
#if OMPT_SUPPORT
if (ompt_enabled) {
// Set reenter frame in parent task, which will become current task
// in the midst of join. This is needed before the end_parallel callback.
ompt_frame = __ompt_get_task_frame_internal(1);
ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
}
#endif
__kmp_join_call(&loc, gtid
#if OMPT_SUPPORT
, fork_context_gnu
#endif
);
#if OMPT_SUPPORT
if (ompt_enabled) {
ompt_frame->reenter_runtime_frame = NULL;
}
#endif
}
else {
#if OMPT_SUPPORT && OMPT_TRACE
if (ompt_enabled &&
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
parallel_id, serialized_task_id);
}
#endif
__kmpc_end_serialized_parallel(&loc, gtid);
#if OMPT_SUPPORT
if (ompt_enabled) {
// Record that we re-entered the runtime system in the frame that
// created the parallel region.
ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
ompt_callbacks.ompt_callback(ompt_event_parallel_end)(
parallel_id, task_info->task_id,
OMPT_INVOKER(fork_context_gnu));
}
ompt_frame->reenter_runtime_frame = NULL;
thr->th.ompt_thread_info.state =
(((thr->th.th_team)->t.t_serialized) ?
ompt_state_work_serial : ompt_state_work_parallel);
}
#endif
}
}
@@ -623,41 +857,73 @@ LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
// There are no ull versions (yet).
//
#define PARALLEL_LOOP_START(func, schedule) \
#define PARALLEL_LOOP_START(func, schedule, ompt_pre, ompt_post) \
void func (void (*task) (void *), void *data, unsigned num_threads, \
long lb, long ub, long str, long chunk_sz) \
{ \
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 )); \
\
ompt_pre(); \
\
if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) { \
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, \
(str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
(schedule) != kmp_sch_static); \
\
ompt_post(); \
\
KA_TRACE(20, ( #func " exit: T#%d\n", gtid)); \
}
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START), kmp_sch_static)
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START), kmp_sch_dynamic_chunked)
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START), kmp_sch_guided_chunked)
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START), kmp_sch_runtime)
#if OMPT_SUPPORT
#define OMPT_LOOP_PRE() \
ompt_frame_t *parent_frame; \
if (ompt_enabled) { \
parent_frame = __ompt_get_task_frame_internal(0); \
parent_frame->reenter_runtime_frame = __builtin_frame_address(0); \
}
#define OMPT_LOOP_POST() \
if (ompt_enabled) { \
parent_frame->reenter_runtime_frame = NULL; \
}
#else
#define OMPT_LOOP_PRE()
#define OMPT_LOOP_POST()
#endif
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START),
kmp_sch_static, OMPT_LOOP_PRE, OMPT_LOOP_POST)
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START),
kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START),
kmp_sch_guided_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START),
kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
//
@@ -666,7 +932,7 @@ PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START), kmp_
void
xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_func)(void *, void *),
long arg_size, long arg_align, int if_cond, unsigned gomp_flags)
long arg_size, long arg_align, bool if_cond, unsigned gomp_flags)
{
MKLOC(loc, "GOMP_task");
int gtid = __kmp_entry_gtid();
@@ -679,6 +945,10 @@ xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_fu
if (gomp_flags & 1) {
input_flags->tiedness = 1;
}
// The second low-order bit is the "final" flag
if (gomp_flags & 2) {
input_flags->final = 1;
}
input_flags->native = 1;
// __kmp_task_alloc() sets up all other flags
@@ -701,7 +971,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);
}
}
@@ -709,9 +979,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_enabled) {
// 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_enabled) {
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));
@@ -802,7 +1095,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_enabled) {
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));
@@ -810,15 +1112,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_enabled) {
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));
@@ -867,11 +1175,11 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL)(void (*task)(void *), void *data, unsigned n
if(flags != 0) {
__kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags);
}
__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);
}
task(data);
xexpand(KMP_API_NAME_GOMP_PARALLEL_END)();
@@ -882,7 +1190,6 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task) (void *), void *data,
unsigned num_threads, unsigned count, unsigned flags)
{
int gtid = __kmp_entry_gtid();
int last = FALSE;
MKLOC(loc, "GOMP_parallel_sections");
KA_TRACE(20, ("GOMP_parallel_sections: T#%d\n", gtid));
@@ -893,13 +1200,13 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task) (void *), void *data,
if(flags != 0) {
__kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags);
}
__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);
}
KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
@@ -914,7 +1221,6 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task) (void *), void *data,
long lb, long ub, long str, long chunk_sz, unsigned flags) \
{ \
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 )); \
@@ -926,13 +1232,13 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task) (void *), void *data,
if (flags != 0) { \
__kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags); \
} \
__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, \
@@ -977,7 +1283,7 @@ xexpand(KMP_API_NAME_GOMP_TASKGROUP_END)(void)
#ifndef KMP_DEBUG
static
#endif /* KMP_DEBUG */
kmp_int32 __kmp_gomp_to_iomp_cancellation_kind(int gomp_kind) {
kmp_int32 __kmp_gomp_to_omp_cancellation_kind(int gomp_kind) {
kmp_int32 cncl_kind = 0;
switch(gomp_kind) {
case 1:
@@ -1006,7 +1312,7 @@ xexpand(KMP_API_NAME_GOMP_CANCELLATION_POINT)(int which)
MKLOC(loc, "GOMP_cancellation_point");
KA_TRACE(20, ("GOMP_cancellation_point: T#%d\n", gtid));
kmp_int32 cncl_kind = __kmp_gomp_to_iomp_cancellation_kind(which);
kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
}
@@ -1038,7 +1344,7 @@ xexpand(KMP_API_NAME_GOMP_CANCEL)(int which, bool do_cancel)
MKLOC(loc, "GOMP_cancel");
KA_TRACE(20, ("GOMP_cancel: T#%d\n", gtid));
kmp_int32 cncl_kind = __kmp_gomp_to_iomp_cancellation_kind(which);
kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
if(do_cancel == FALSE) {
return xexpand(KMP_API_NAME_GOMP_CANCELLATION_POINT)(which);
+8 -10
View File
@@ -1,7 +1,5 @@
/*
* kmp_i18n.c
* $Revision: 43084 $
* $Date: 2014-04-15 09:15:14 -0500 (Tue, 15 Apr 2014) $
*/
@@ -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
@@ -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 -3
View File
@@ -1,7 +1,5 @@
/*
* kmp_i18n.h
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
@@ -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.
+2 -4
View File
@@ -1,7 +1,5 @@
/*
* kmp_import.c
* $Revision: 42951 $
* $Date: 2014-01-21 14:41:41 -0600 (Tue, 21 Jan 2014) $
*/
@@ -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.
------------------------------------------------------------------------------------------------
*/

Some files were not shown because too many files have changed in this diff Show More