public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/109452] New: omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined
@ 2023-04-08 20:34 grg-webvisible+gcc.gnu.org at ai dot mit.edu
2024-05-30 21:24 ` [Bug libgomp/109452] " burnus at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: grg-webvisible+gcc.gnu.org at ai dot mit.edu @ 2023-04-08 20:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109452
Bug ID: 109452
Summary: omp_init_lock_with_hint() and
omp_init_nest_lock_with_hint() are undefined
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgomp
Assignee: unassigned at gcc dot gnu.org
Reporter: grg-webvisible+gcc.gnu.org at ai dot mit.edu
CC: jakub at gcc dot gnu.org
Target Milestone: ---
omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() appear to be
declared but not defined:
#include <omp.h>
int main() {
omp_lock_t lock;
omp_init_lock_with_hint(&lock, omp_sync_hint_none);
}
compiled with:
gcc -fopenmp main.cpp
fails to link:
In function `main':
main.cpp:(.text+0x15): undefined reference to `omp_init_lock_with_hint'
collect2: error: ld returned 1 exit status
on v12.1.0:
GNU C++17 (GCC) version 12.1.0 (x86_64-pc-linux-gnu)
compiled by GNU C version 12.1.0, GMP version 6.2.1, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP
Adding extra link options like -lgomp and -lpthread and -static does not help,
nor does using a different omp_sync_hint (and none of these should in fact
help). Also confirmed with v11.3.0 and v9.5.0.
As a sanity check, the non-hint version works fine:
#include <omp.h>
int main() {
omp_lock_t lock;
omp_init_lock(&lock);
}
These results are consistent with the observation that all of the init...lock
versions ({with and without hints} x {with and without nesting}) are declared
in omp.h, while only the versions without hints are defined in
gcc/libgomp/lock.c
omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are part of the
OpenMP 4.5 spec (Nov 2015), which is documented as being fully supported since
gcc v6.
The expedient solution of course would be to define in gcc/libgomp/lock.c the
two init...with_hint functions to ignore the hint and call their corresponding
unhinted init functions, e.g:
void omp_init_lock_with_hint(omp_lock_t *lock, omp_sync_hint_t)
{
omp_init_lock(lock);
}
void omp_init_nest_lock_with_hint(omp_nest_lock_t *lock, omp_sync_hint_t)
{
omp_init_nest_lock(lock);
}
Combined with the appropriate alias magic in the various
gcc/libgomp/config/*/lock.c files.
It would be particularly impressive to actually use the hints to make the locks
faster, but that's a larger project which probably deserves its own Bugz
entry...
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libgomp/109452] omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined
2023-04-08 20:34 [Bug libgomp/109452] New: omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined grg-webvisible+gcc.gnu.org at ai dot mit.edu
@ 2024-05-30 21:24 ` burnus at gcc dot gnu.org
2024-06-03 22:25 ` reachrajesh747 at gmail dot com
2024-06-06 14:50 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2024-05-30 21:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109452
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |openmp
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-05-30
CC| |burnus at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Confirmed for
* omp_init_lock_with_hint
* omp_init_nest_lock_with_hint
Both have a prototype since ages but no actual implementation.
Side note: libgomp.texi would need to be updated as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libgomp/109452] omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined
2023-04-08 20:34 [Bug libgomp/109452] New: omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined grg-webvisible+gcc.gnu.org at ai dot mit.edu
2024-05-30 21:24 ` [Bug libgomp/109452] " burnus at gcc dot gnu.org
@ 2024-06-03 22:25 ` reachrajesh747 at gmail dot com
2024-06-06 14:50 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: reachrajesh747 at gmail dot com @ 2024-06-03 22:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109452
Rajesh Shashi Kumar <reachrajesh747 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |reachrajesh747 at gmail dot com
--- Comment #2 from Rajesh Shashi Kumar <reachrajesh747 at gmail dot com> ---
I encountered the same issue. I would like to note that this also breaks the
OpenMP benchmark suites such as
https://github.com/EPCCed/epcc-openmp-microbenchmarks from
https://www.openmp.org/resources/openmp-benchmarks/.
These benchmarks compile fine with LLVM+libomp so I believe this needs to be
fixed to be in accordance with the OpenMP 5.0 specification.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libgomp/109452] omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined
2023-04-08 20:34 [Bug libgomp/109452] New: omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined grg-webvisible+gcc.gnu.org at ai dot mit.edu
2024-05-30 21:24 ` [Bug libgomp/109452] " burnus at gcc dot gnu.org
2024-06-03 22:25 ` reachrajesh747 at gmail dot com
@ 2024-06-06 14:50 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2024-06-06 14:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109452
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The following is missing as well:
--- a/gcc/omp-general.cc
+++ b/gcc/omp-general.cc
@@ -3316,3 +3316,5 @@ omp_runtime_api_procname (const char *name)
"init_lock",
+ "init_lock_with_hint",
"init_nest_lock",
+ "init_nest_lock_with_hint",
"is_initial_device",
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-06 14:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-08 20:34 [Bug libgomp/109452] New: omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined grg-webvisible+gcc.gnu.org at ai dot mit.edu
2024-05-30 21:24 ` [Bug libgomp/109452] " burnus at gcc dot gnu.org
2024-06-03 22:25 ` reachrajesh747 at gmail dot com
2024-06-06 14:50 ` burnus at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).