- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So does this mean that I'm some how "out of locks"?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[SergeyK] I just checked an OpenMP v3.1 Specifications and I haven't found any referencesrelated to a
maximum number of locks.
Please take a look at a chapter 3.3 Lock Routings andexample A.43 on a page 292.
In the example an array of locks (1000 in total) is initialized.
I'm using ifort 11.1, and after a large amount of lock allocations, omp_init_lock() starts returning 0s.
So does this mean that I'm some how "out of locks"?
[SergeyK] I'm not sure. Would you be able to provide more technical details?
[SergeyK] It cannot return 0 because 'omp_init_lock' functiondoesn't return anything. It is declared as follows:
void omp_init_lock( omp_lock_t *lock );
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using ALLOCATE() to obtain your OpenMP locks? The underlying lock representation is based on the INTEGER KIND that will hold an address, ie, the return value of intrinsic function INT_PTR_KIND(). The result is 4 bytes on IA-32 architecture, or8 bytes on Intel 64 architecture.
So if you're using ALLOCATE(), the maximum number of OpenMP locks you can obtain is limited by the largest chuck of heap you can successfully allocate. We've tested up to 5 million locks in a single program!
You could declare your array of OpenMP locks:
integer (kind=omp_lock_kind), allocatable :: omp_locks(:)
Then check the status return value for any error:
allocate (omp_locks(num_in_block), stat=alloc_err)
Completeexample:
program omp_lock_alloc
use omp_lib_kinds
integer (kind=omp_lock_kind), allocatable :: omp_locks(:)
integer alloc_err
integer, parameter :: num_in_block =256
allocate (omp_locks(num_in_block), stat=alloc_err)
if(alloc_err .EQ. 0) then
print *,'allocated ',num_in_block,' omp locks'
else
print *,' failed to allocate omp locks'
endif
end program omp_lock_alloc
>ifort -Qopenmp omp_lock_alloc.f90
Intel Visual Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.4.325 Build 20120410
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
-out:omp_lock_alloc.exe
>omp_lock_alloc.exe
allocated 256 omp locks
Patrick Kennedy
Intel Developer Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page