Commit 6462d90d authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

rts: Throw better error if --numa is used without libnuma support

Test Plan: Validate, run program with `+RTS --numa` without libnuma
support compiled in

Reviewers: erikd, simonmar

Subscribers: thomie, carter

GHC Trac Issues: #14956

Differential Revision: https://phabricator.haskell.org/D4556
parent 721e8264
......@@ -906,6 +906,12 @@ error = true;
}
#if defined(THREADED_RTS)
else if (!strncmp("numa", &rts_argv[arg][2], 4)) {
if (!osBuiltWithNumaSupport()) {
errorBelch("%s: This GHC build was compiled without NUMA support.",
rts_argv[arg]);
error = true;
break;
}
OPTION_SAFE;
StgWord mask;
if (rts_argv[arg][6] == '=') {
......
......@@ -591,6 +591,15 @@ void osReleaseHeapMemory(void)
#endif
bool osBuiltWithNumaSupport(void)
{
#if HAVE_LIBNUMA
return true;
#else
return false;
#endif
}
bool osNumaAvailable(void)
{
#if HAVE_LIBNUMA
......
......@@ -18,6 +18,7 @@ void osFreeAllMBlocks(void);
size_t getPageSize (void);
StgWord64 getPhysicalMemorySize (void);
void setExecutable (void *p, W_ len, bool exec);
bool osBuiltWithNumaSupport(void); // See #14956
bool osNumaAvailable(void);
uint32_t osNumaNodes(void);
uint64_t osNumaMask(void);
......
......@@ -499,6 +499,11 @@ void osReleaseHeapMemory (void)
#endif
bool osBuiltWithNumaSupport(void)
{
return true;
}
bool osNumaAvailable(void)
{
return osNumaNodes() > 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment