diff options
author | Simon Marlow <marlowsd@gmail.com> | 2016-04-23 21:14:49 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2016-06-10 21:25:54 +0100 |
commit | 9e5ea67e268be2659cd30ebaed7044d298198ab0 (patch) | |
tree | c395e74ee772ae0d59c852b3cbde743784b08d09 /includes/rts/Flags.h | |
parent | b9fa72a24ba2cc3120912e6afedc9280d28d2077 (diff) | |
download | haskell-9e5ea67e268be2659cd30ebaed7044d298198ab0.tar.gz |
NUMA support
Summary:
The aim here is to reduce the number of remote memory accesses on
systems with a NUMA memory architecture, typically multi-socket servers.
Linux provides a NUMA API for doing two things:
* Allocating memory local to a particular node
* Binding a thread to a particular node
When given the +RTS --numa flag, the runtime will
* Determine the number of NUMA nodes (N) by querying the OS
* Assign capabilities to nodes, so cap C is on node C%N
* Bind worker threads on a capability to the correct node
* Keep a separate free lists in the block layer for each node
* Allocate the nursery for a capability from node-local memory
* Allocate blocks in the GC from node-local memory
For example, using nofib/parallel/queens on a 24-core 2-socket machine:
```
$ ./Main 15 +RTS -N24 -s -A64m
Total time 173.960s ( 7.467s elapsed)
$ ./Main 15 +RTS -N24 -s -A64m --numa
Total time 150.836s ( 6.423s elapsed)
```
The biggest win here is expected to be allocating from node-local
memory, so that means programs using a large -A value (as here).
According to perf, on this program the number of remote memory accesses
were reduced by more than 50% by using `--numa`.
Test Plan:
* validate
* There's a new flag --debug-numa=<n> that pretends to do NUMA without
actually making the OS calls, which is useful for testing the code
on non-NUMA systems.
* TODO: I need to add some unit tests
Reviewers: erikd, austin, rwbarton, ezyang, bgamari, hvr, niteria
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2199
Diffstat (limited to 'includes/rts/Flags.h')
-rw-r--r-- | includes/rts/Flags.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h index 8020a177b0..ff303dc5e6 100644 --- a/includes/rts/Flags.h +++ b/includes/rts/Flags.h @@ -73,6 +73,11 @@ typedef struct _GC_FLAGS { * to handle the exception before we * raise it again. */ + + rtsBool numa; /* Use NUMA */ + uint32_t nNumaNodes; /* Number of nodes */ + uint32_t numaMap[MAX_NUMA_NODES]; /* Map our internal node numbers to OS + * node numbers */ } GC_FLAGS; /* See Note [Synchronization of flags and base APIs] */ @@ -93,6 +98,7 @@ typedef struct _DEBUG_FLAGS { rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */ rtsBool hpc; /* 'c' coverage */ rtsBool sparks; /* 'r' */ + rtsBool numa; /* '--debug-numa' */ } DEBUG_FLAGS; /* See Note [Synchronization of flags and base APIs] */ @@ -184,7 +190,7 @@ typedef struct _MISC_FLAGS { #ifdef THREADED_RTS /* See Note [Synchronization of flags and base APIs] */ typedef struct _PAR_FLAGS { - uint32_t nNodes; /* number of threads to run simultaneously */ + uint32_t nCapabilities; /* number of threads to run simultaneously */ rtsBool migrate; /* migrate threads between capabilities */ uint32_t maxLocalSparks; rtsBool parGcEnabled; /* enable parallel GC */ |