make (dev-)tests build support for threading libraries in threadmode=SEQ
As documented in docs/implementation-defined.md, we now have documented support for correctly and safely issuing UPC++ calls in multi-threaded programs built against the UPCXX_THREADMODE=seq
UPC++ library, provided those programs follow a few simple restrictions.
We even have several multi-threaded tests that "follow the rules" in order to exercise that support, namely:
- view.cpp
- lpc_barrier.cpp
- lpc-stress.cpp (added in pull request #316)
However, our make (dev-)tests
infrastructure currently lacks the build logic to portably build these tests in SEQ mode with appropriate threading libraries, and consequently these tests are currently skipped in SEQ mode (harness does the same, for similar reasons). This means that at present we effectively have no automated test coverage for this "multithreaded SEQ" operation mode.
The underlying problem here, discussed in related issue #319, is that some systems need -lpthread
or -pthread
added to the link line in order to successfully link programs invoking std::thread
, and there is no one fixed recipe that reliably works for all supported platforms. GASNet's PAR-mode Makefile fragments automatically provide the correct incantation into upcxx-meta LIBS/LDFLAGS
, but this is usually missing in UPCXX_THREADMODE=seq
which uses the GASNet SEQ-mode fragments.
Fixing this probably means having Makefile.tests extract @GASNET_THREAD_LIBS@
(and possibly @GASNET_THREAD_DEFINES@
?) and conditionally adding these to the test build commands (conditional on a new opt-in list of multi-threaded SEQ-safe tests).
Comments (3)
-
-
- changed status to open
Proposed implementation in pull request 317
-
- changed status to resolved
Add threaded SEQ testing (issue 451)
This commit resolves issue 451 by providing the means to compile selected multi-threaded tests with THREADMODE=seq.
→ <<cset 481bb95d0c43>>
- Log in to comment
I believe that requires no more than adding corresponding lines to
bld/gasnet_config.mak.in
Sounds like a job for the same idiom currently applied to
$(test_pgi_debug_symbols_broken)
intests.mak
So, overall it doesn't sound to me like a daunting task to provide what has been asked for so far (under 10 lines, I am guessing)
I do have a minor concern over the backend compiler behavior when the arguments are doubled as can happen for two reasons I can think of:
$(TEST_FLAGS_[TEST])
for SEQ vs PAR, the PAR builds will double the flagsGASNET_THREAD_*
settingsThat said, I've confirmed that current g++, clang++, icpc and pgc++ are all OK with
[foo++] -D_REENTRANT -D_REENTRANT -lpthread -lpthread hello.cc
, so there is probably no reason to be concerned until/unless we encounter a problem.