NUMA
NUMA
NUMA
Nakul Manchanda and Karan Anand New York University {nm1157, ka804} @cs.nyu.edu ABSTRACT
NUMA refers to the computer memory design choice available for multiprocessors. NUMA means that it will take longer to access some regions of memory than others. This work aims at explaining what NUMA is, the background developments, and how the memory access time depends on the memory location relative to a processor. First, we present a background of multiprocessor architectures, and some trends in hardware that exist along with NUMA. We, then briefly discuss the changes NUMA demands to be made in two key areas. One is in the policies the Operating System should implement for scheduling and run-time memory allocation scheme used for threads and the other is in the programming approach the programmers should take, in order to harness NUMAs full potential. In the end we also present some numbers for comparing UMA vs. NUMAs performance. Keywords: NUMA, Intel i7, NUMA Awareness, NUMA Distance
SECTIONS
In the following sections we first describe the background, hardware trends, Operating Systems goals, changes in programming paradigms, and then we conclude after giving some numbers for comparison.
Background
Hardware Goals / Performance Criteria There are 3 criteria on which performance of a multiprocessor system can be judged, viz. Scalability, Latency and Bandwidth. Scalability is the ability of a system to demonstrate a proportionate increase in parallel speedup with the addition of more processors. Latency is the time taken in sending a message from node A to node B, while bandwidth is the amount of data that can be communicated per unit of time. So, the goal of a multiprocessor system is to achieve a highly scalable, low latency, high bandwidth system. Parallel Architectures Typically, there are 2 major types of Parallel Architectures that are prevalent in the industry: Shared Memory Architecture and Distributed Memory Architecture. Shared Memory Architecture, again, is of 2 types: Uniform Memory Access (UMA), and NonUniform Memory Access (NUMA). Shared Memory Architecture As seen from the figure 1 (more details shown in Hardwa re Trends section) all processors share the same memory, and treat it as a global address space. The major challenge to overcome in such architecture is the issue of Cache Coherency (i.e. every read must
The Figure 3 shows a sample layout of processors and memory across a bus interconnection. All the processors are identical, and have equal access times to all memory regions. These are also sometimes known as Symmetric Multiprocessor (SMP) machines. The architectures that take care of cache coherency in hardware level, are knows as CC-UMA (cache coherent UMA). Shared Memory Architecture NUMA
As shown in Figure 5, FSB based UMA architecture has a Memory Controller Hub, which has all the memory connected to it. The CPUs interact with the MCH whenever they need to access the memory. The I/O controller hub is also connected to the MCH, hence the major bottleneck in this implementation is the bus, which has a finite speed, and has scalability issues. This is because, for any communication, the CPUs need to take control of the bus which leads to contention problems. Quick Path Interconnect Architecture (used in NUMA)
Hardware Trends
We now discuss 2 practical implementations of the memory architectures that we just saw, one is the Front Side Bus and the other is Intels Quick Path Interconnect based implementation. Traditional FSB Architecture (used in UMA)
Performance Comparison
Features of NUMA aware OS The basic requirements of a NUMA aware OS are to be able to discover the underlying hardware topology, and to be able to calculate the NUMA distance accurately. NUMA distances tell the processors (and / or the programmer) how much time it would take to access that particular memory. Besides these, the OS should provide a mechanism for processor affinity. This is basically done to make sure that some threads are scheduled on certain processor(s), to ensure data locality. This not only avoids remote access, but can also take the advantage of hot cache. Also, the operating system needs to exploit the first touch memory allocation policy. Optimized Scheduling Decisions The operating systems needs to make sure that load is balanced amongst the different processors (by making sure that data is distributed amongst CPUs for large jobs), and also to implement dynamic page migration (i.e. use latency topology to make page migration decisions). Conflicting Goals The goals that the Operating System is trying to achieve are conflicting in nature, in the sense, on one hand we are trying to optimize the memory placement (for load balancing), and on the other hand, we would like to minimize the migration of data (to overcome resource contention). Eventually, there is a trade off which is decided on the basis of the type of application. Scalability UMA vs NUMA
Programming Paradigms
NUMA Aware Programming Approach The main goals of NUMA aware programming approach are to reduce lock contention and maximize memory allocation on local node. Also, programmers need to manage their own memory for maximum portability. This is can prove to be quite a challenge, since most languages do not have an in-built memory manager. Support for Programmers Programmers rely on tools and libraries for application development. Hence the tools and libraries need to help the programmers in achieving maximum efficiency, also to implement implicit parallelism. The user or the system interface, in turn needs to have programming constructs for associating virtual memory addresses. They also need to provide certain functions for obtaining page residency. Programming Approach The programmers need to explore the various NUMA libraries that are available to help simplify the task. If the data allocation pattern is analyzed properly, First Touch Access can be exploited fully. There are several lock-free approaches available, which can be used. Besides these approaches, the programmers can exploit various parallel programming paradigms, such as Threads, Message Passing, and Data Parallelism.
CONCLUSION
The hardware industry has adapted NUMA as a architecture design choice, primarily because of its characteristics like scalability and low latency. However, modern hardware changes also demand changes in the programming approaches (development libraries, data analysis) as well Operating System
policies (processor affinity, page migration). Without these changes, full potential of NUMA cannot be exploited.
REFERENCES
[1] Introduction to Parallel Computing.: https://computing.llnl.gov/tutorials/parallel_comp/ [2] Optimizing software applications for NUMA: http://software.intel.com/en-us/articles/optimizing-softwareapplications-for-numa/ [3] Parallel Computer Architecture - Slides: http://www.eecs.berkeley.edu/~culler/cs258-s99/ [4] Cache Latency Comparison: http://arstechnica.com/hardware/reviews/2008/11/nehalemlaunch-review.ars/3 [5] Intel Processor Specifications:
http://www.intel.com/products/processor/index.htm
[6] UMA-NUMA Scalability
www.cs.drexel.edu/~wmm24/cs281/lectures/ppt/cs28 2_lec12.ppt