Running High Performance Computing Workloads on Red Hat Enterprise Linux

Similar documents
Performance Optimisations for HPC workloads. August 2008 Imed Chihi

Operating System Design Issues. I/O Management

I/O Management Software. Chapter 5

Tales of the Tail Hardware, OS, and Application-level Sources of Tail Latency

Linux multi-core scalability

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Compute Node Linux (CNL) The Evolution of a Compute OS

CSE 120 Principles of Operating Systems

Notes based on prof. Morris's lecture on scheduling (6.824, fall'02).

ò mm_struct represents an address space in kernel ò task represents a thread in the kernel ò A task points to 0 or 1 mm_structs

Scheduling. Don Porter CSE 306

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18

<Insert Picture Here> Boost Linux Performance with Enhancements from Oracle

A Comparison of Two Distributed Systems: Amoeba & Sprite. By: Fred Douglis, John K. Ousterhout, M. Frans Kaashock, Andrew Tanenbaum Dec.

The MOSIX Scalable Cluster Computing for Linux. mosix.org

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

I/O Management Software. Chapter 5

Virtual Memory Paging

Network Design Considerations for Grid Computing

Outline. Definition of a Distributed System Goals of a Distributed System Types of Distributed Systems

FAQ. Release rc2

Parallel and High Performance Computing CSE 745

Multi-core Architectures. Dr. Yingwu Zhu

Virtual Memory. Chapter 8

Maximum Performance. How to get it and how to avoid pitfalls. Christoph Lameter, PhD

Architecture and Performance Implications

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Multiprocessor Systems. COMP s1

OS: An Overview. ICS332 Operating Systems

Fast packet processing in the cloud. Dániel Géhberger Ericsson Research

Introduction to Concurrency (Processes, Threads, Interrupts, etc.)

AutoNUMA Red Hat, Inc.

The Art and Science of Memory Allocation

Chapter 13: I/O Systems

Introduction to TCP/IP Offload Engine (TOE)

A common scenario... Most of us have probably been here. Where did my performance go? It disappeared into overheads...

Virtual Machines Disco and Xen (Lecture 10, cs262a) Ion Stoica & Ali Ghodsi UC Berkeley February 26, 2018

What s New in VMware vsphere 4.1 Performance. VMware vsphere 4.1

Scaling Without Sharding. Baron Schwartz Percona Inc Surge 2010

Multiprocessor System. Multiprocessor Systems. Bus Based UMA. Types of Multiprocessors (MPs) Cache Consistency. Bus Based UMA. Chapter 8, 8.

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

Automatic NUMA Balancing. Rik van Riel, Principal Software Engineer, Red Hat Vinod Chegu, Master Technologist, HP

QuickSpecs. HP Z 10GbE Dual Port Module. Models

Parallelism and Concurrency. COS 326 David Walker Princeton University

Building Blocks. Operating Systems, Processes, Threads

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?

by Marina Cholakyan, Hyduke Noshadi, Sepehr Sahba and Young Cha

Realtime Tuning 101. Tuning Applications on Red Hat MRG Realtime Clark Williams

Process size is independent of the main memory present in the system.

Lecture 9: MIMD Architectures

Multiprocessor Systems. Chapter 8, 8.1

AN 831: Intel FPGA SDK for OpenCL

CS 5460/6460 Operating Systems

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

The control of I/O devices is a major concern for OS designers

Main Memory. ICS332 Operating Systems

Lecture 1: January 23

Building Blocks. Operating Systems, Processes, Threads

Linux Network Tuning Guide for AMD EPYC Processor Based Servers

Martin Kruliš, v

The Google File System

The Google File System

CLOUD-SCALE FILE SYSTEMS

The Future of High-Performance Networking (The 5?, 10?, 15? Year Outlook)

Multiple Processor Systems. Lecture 15 Multiple Processor Systems. Multiprocessor Hardware (1) Multiprocessors. Multiprocessor Hardware (2)

Memory Management Outline. Operating Systems. Motivation. Paging Implementation. Accessing Invalid Pages. Performance of Demand Paging

NUMA replicated pagecache for Linux

Linux Kernel Hacking Free Course

DISTRIBUTED HIGH-SPEED COMPUTING OF MULTIMEDIA DATA

Chapter 13: I/O Systems

Lecture 1: January 22

Linux Network Tuning Guide for AMD EPYC Processor Based Servers

Multi-core Architectures. Dr. Yingwu Zhu

PCI Express x8 Single Port SFP+ 10 Gigabit Server Adapter (Intel 82599ES Based) Single-Port 10 Gigabit SFP+ Ethernet Server Adapters Provide Ultimate

What is concurrency? Concurrency. What is parallelism? concurrency vs parallelism. Concurrency: (the illusion of) happening at the same time.

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institute of Technology, Delhi

Operating Systems. Process scheduling. Thomas Ropars.

Measuring a 25 Gb/s and 40 Gb/s data plane

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture

Lecture 4: Memory Management & The Programming Interface

Swapping. Operating Systems I. Swapping. Motivation. Paging Implementation. Demand Paging. Active processes use more physical memory than system has

Nova Scheduler: Optimizing, Configuring and Deploying NFV VNF's on OpenStack

Operating Systems. Operating Systems

Chapter 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

Performance Tools for Technical Computing

ò Paper reading assigned for next Tuesday ò Understand low-level building blocks of a scheduler User Kernel ò Understand competing policy goals

A common scenario... Most of us have probably been here. Where did my performance go? It disappeared into overheads...

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

Computer-System Organization (cont.)

OneCore Storage Performance Tuning

CSCE Introduction to Computer Systems Spring 2019

Concurrency. Johan Montelius KTH

Kernel Korner What's New in the 2.6 Scheduler

Chapter 13: I/O Systems

Scheduling Mar. 19, 2018

Virtualization and Virtual Machines. CS522 Principles of Computer Systems Dr. Edouard Bugnion

I/O Systems. Jo, Heeseung

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018

Transcription:

Running High Performance Computing Workloads on Red Hat Enterprise Linux Imed Chihi Senior Technical Account Manager Red Hat Global Support Services 21 January 2014

Agenda 2 The case of HPC on commodity platforms From irrelevance to ubiquity The compute model Tuning Red Hat Enterprise Linux Process placement Memory placement Interrupt placement

The case of HPC on commodity platforms 3

HPC on commodity hardware HPC on a personal computer sounded weird If you want HPC, get a Cray Early work on cycle harvesting since 80's 4 Beowulf clusters in mid-to-late 90's spread the popularity of the concept

From irrelevance to ubiquity 5

From irrelevance to ubiquity 97% of the top500 super computers run Linux November 2013 listing 6

The compute model Tuning examples 7

Tuning? There is no magical recipe This is only a tuning primer 8 Need to know how the system works, how the application work and what are your priorities

The traditional example Jump! for (i=0; i<max_depth; i++) if (i==dirac_point) process_dirac(); else process_non_dirac(); Jump! for (i=0; i<max_depth; i++) if (i!=dirac_point) process_non_dirac(); else process_dirac(); 9

The compute model Processes (workload) Processors Those placement decisions are reviewed continuously. Memory We need smart algorithms to place the workload on the computing resources. External events (interrupts workload) 10

Process placement and scheduling Processor affinity Process migrations Forcing process placement 11 taskset sched_setaffinity() Process priority nice chrt and sched_setscheduler()

Memory placement and NUMA 12 CPU0 CPU3 CPU1 CPU2 NUMA node 3 Memory page migration in NUMA systems NUMA node 1 Memory (uniform access) Forcing memory placement with numactl NUMA node 2 Uniform vs. Non-Uniform Memory Access CPU3 CPU2 CPU1 CPU0 NUMA node 0

Memory management Page cache considerations Huge pages Overcommit Out of memory killer 13

Interrupts placement IRQ-to-CPU affinity irqbalance [ksoftirqd/x] kernel threads Multi-queue networking Zero-copy IO Offloading engines 14

Imed Chihi http://people.redhat.com/ichihi/p/ ichihi@redhat.com Red Hat Global Support Services 1. http://www.redhat.com/training/courses/rh442/ 2. Red Hat Enterprise Linux 6 Performance Tuning Guide 3. Red Hat Summit 2013: Performance Analysis and Tuning of Red Hat Enterprise Linux 15

Running High Performance Computing Workloads on Red Hat Enterprise Linux Imed Chihi Senior Technical Account Manager Red Hat Global Support Services 21 January 2014 Salaam and good morning. My name is Imed Chihi and I am a Senior Technical Account Manager at Red Hat. I am part of the Support and Engineering organisation within the company.

Agenda 2 The case of HPC on commodity platforms From irrelevance to ubiquity The compute model Tuning Red Hat Enterprise Linux Process placement Memory placement Interrupt placement The purpose of today's presentation is to talk about the use of Red Hat Enterprise Linux in HPC environments and the common tuning areas to which the HPC user and administrator needs to pay attention.

The case of HPC on commodity platforms 3

HPC on commodity hardware HPC on a personal computer sounded weird If you want HPC, get a Cray Early work on cycle harvesting since 80's 4 Beowulf clusters in mid-to-late 90's spread the popularity of the concept Although it sounds like a de facto standard nowadays, the idea of running HPC workloads on PC-like architectures has not always been mainstream. 20 to 30 years ago, this idea was totally strange as the rule was to run HPC on custom proprietary hardware, namely Cray Research and others. In the 80's some early research started to consider options to take advantage of the idle cycles on personal workstations to run demanding processing in a distributed fashion. In early 90's appeared a trend called Beowulf clusters which were collections of Linux personal computers connected to a LAN and running scientific processing tasks in a distributed fashion. Work on Beowulf has, for instance, been the main drive for the proliferation of Ethernet NIC drivers on Linux as early as 1995.

From irrelevance to ubiquity 5

From irrelevance to ubiquity 97% of the top500 super computers run Linux November 2013 listing 6 Today, this is no longer a clever idea, but the standard. The fact that 97% of the top faster super-computers on the planet run Linux speaks volumes about the success of the concept. The operating system's kernel tries to make the most optimal decisions for general purpose workloads. However, we will see in the rest of this talk that there areas of optimisation and that it's important to understand how the hardware works and how the operating system works both to analyse problems and optimise execution.

The compute model Tuning examples 7

Tuning? There is no magical recipe This is only a tuning primer 8 Need to know how the system works, how the application work and what are your priorities It is important to realise that tuning is not a magic recipe which, somehow, makes my jobs run twice as fast. Depending on the workloads characteristics and the available platform, some adjustments could be done to improve execution times. Other workloads have other priorities than executions time: those could be low latency for financial trade engines for instance or reliability for database transactions.

The traditional example Jump! for (i=0; i<max_depth; i++) if (i==dirac_point) process_dirac(); else process_non_dirac(); Jump! for (i=0; i<max_depth; i++) if (i!=dirac_point) process_non_dirac(); else process_dirac(); 9 I am starting here with the simplest example I could think of about the impact of the platform on the execution performance. The two loops here are semantically identical. However, they would run in very different ways on the hardware resulting in different performance results. The if test would result in a code jump if the condition is false. However, it would cost nearly nothing if the condition is true. This is the reason why the first loop will incur MAX_DEPTH-1 additional jumps compared to the second one. $ cat dirac.c int i; #define MAX_DEPTH 99999 #define DIRAC_POINT 500 void process_dirac() { return;} void process_non_dirac() { return;} int main(int argc, char **argv) { for (i=0; i<max_depth; i++) if (i!=dirac_point) process_non_dirac(); else process_dirac(); return(0);} The compiler generates this: $ gcc S dirac.c $ more dirac.s (..).L9: movl i(%rip), %eax cmpl $500, %eax je.l7 movl $0, %eax call process_non_dirac jmp.l8.l7: movl $0, %eax call process_dirac.l8: movl i(%rip), %eax addl $1, %eax movl %eax, i(%rip) (..)

The compute model Processes (workload) Processors Those placement decisions are reviewed continuously. Memory We need smart algorithms to place the workload on the computing resources. External events (interrupts workload) 10 As stated previously, in order to do any kind of optimisation or tuning, we will need to understand how the computing platform works. Given the excessive complexity of modern computers, we'll use this simplistic model to present the core tuning concepts. A computing platform provides computing resources (memory and processors): this is the basic von Neuman model on which modern computers are built. On top of those resources we'll try to run a workload. This workload is typically our user processes which are a sequence of instructions. There's also an asynchronous workload which is generated by the events from the attached devices. Those events are implemented using interrupts to request processing for network and storage operations in an asynchronous manner.

Process placement and scheduling Processor affinity Process migrations Forcing process placement taskset sched_setaffinity() Process priority nice chrt and sched_setscheduler() 11 We will start here with the first right hand side arrow on the previous slide which is about placing processes on CPU. There's a key concept here which is processor affinity which is the tendency of the scheduler to keep scheduling a process on the same CPU as much as possible. When a process runs and access memory locations, it would load the most frequently used ones into the various processor caches, therefore, scheduling the process on a new processor would make it lose the benefit of rapid cached access until the caches of the new processor are filled. In some cases, however, the scheduler is forced to migrate a process because imbalance between the load of processors increases too much. There are dedicated kernel threads to perform this migration: [migration/x] Those scheduling decisions could be overidden by manually forcing task assignments or limiting them to particular CPUs. Namely, you may use the taskset command to bind processes to particular CPUs. Applications, could do the same by calling sched_setaffinity() to bind themselves to particular CPUs. # taskset -c 2 memhog -r9999 1g The workload process would typically run along multiple other supporting tasks for system management. Therefore, it might make sense to give a higher priority for the workload process to take longer time slices on the CPUs and to get the scheduling priority on other tasks. This could be implemented using the traditional Unix nice command and/or nice() system call. The real-time capabilities of the Linux kernel could allow tasks to gain even higher privileges to use the CPU by marking them as real time tasks as in: # chrt -r 99 memhog -r9999 1g

Memory placement and NUMA Memory page migration in NUMA systems 12 CPU0 CPU3 CPU1 CPU2 NUMA node 3 Memory (uniform access) Forcing memory placement with numactl NUMA node 1 CPU3 CPU2 CPU1 CPU0 NUMA node 2 Uniform vs. Non-Uniform Memory Access NUMA node 0 Memory management is often the most intricate part of an operating system. It is very difficult to implement a virtual memory manager which can work properly both on a single CPU with 512MB of RAM and on 512 CPUs with 2TB of RAM. The traditional PC architecture uses a linear memory hardware which can be accessed from all CPUs at the same cost: accessing a given memory location takes the same time regardless from which CPU the access takes place. However, this architecture model does not scale to match the requirements of the modern platforms which tend to have tens of CPUs and hundreds of gigabytes of memory. Therefore, modern servers are built around a Non Uniform Memory Access model where the system is comprised of multiple groupings of memory modules and CPUs: those groupings are called NUMA nodes. On those models, access to a memory location from CPU0 takes much less time than from CPU1. The NUMA architecture can be viewed with numactl as in: # numactl --hardware available: 4 nodes (0-3) node 0 cpus: 0 1 2 3 4 5 24 25 26 27 28 29 node 0 size: 65521 MB node 0 free: 62106 MB node 1 cpus: 6 7 8 9 10 11 30 31 32 33 34 35 node 1 size: 65536 MB node 1 free: 62977 MB node 2 cpus: 12 13 14 15 16 17 36 37 38 39 40 41 node 2 size: 65536 MB node 2 free: 63453 MB node 3 cpus: 18 19 20 21 22 23 42 43 44 45 46 47 node 3 size: 65536 MB node 3 free: 63028 MB node distances: node 0 1 2 3 0: 10 21 21 21 1: 21 10 21 21 2: 21 21 10 21 3: 21 21 21 10 Just like process migration threads exist to move a process to a different CPU, recent kernels implement NUMA page migration in order to move memory allocated to a process to a NUMA node closer to where the process is running.

Memory management Page cache considerations Huge pages Overcommit Out of memory killer 13 The page cache is a dynamic memory space used primarily for caching IO. The Linux kernel typically uses large amounts of physical memory for caching when it's free. Those allocations are not initiated by user processes, so they could be confusing as it's not obvious to track them with precision. The Linux kernel implements controls to restrict how much memory could be used. However, the page cache shall not affect how much memory applications could allocate since the memory it uses is usually reclaimable when there's a user demand. HugePages are an implementation of larger page sizes than the typical 4KB size common on commodity platforms. The main motive is, again, a concern of scalability as the use of 4KB pages would imply page tables and memory management data structures with millions of entries. Traversing linked lists with millions of entries could have a serious impact on performance. Therefore, considering the use of HugePages is no longer an option as the typical compute node is likely to have large amounts of memory. Overcommit is a feature of virtual memory managers by which they can satisfy more memory allocation requests than it has available in physical memory. It is very common to find that the aggregate amount of virtual memory allocations is much higher than the actual available physical memory. Check /proc/meminfo for details. This is very analogous to overbooking done by some airlines: it provides for optimal utilisation of the resources, but, we may run the risk of having users really claiming to use what they have allocated which would yield to a problematic situation. The typical behaviour of virtual memory managers is to rely on a swap space as a slow extension of physical memory. However, when applications demand goes beyond the actual available memory situations of thrashing are likely to occur. A thrashing is a situation where the memory manager keeps moving pages between RAM and the swap space indefinitely ending up in a near-lockup situation. The out of memory killer is a kernel mechanism which attempts to kill processes in order to bring the system out of thrashing situations. Therefore, it is important to watch for excessive memory usage as it may trigger the out of memory killer.

Interrupts placement IRQ-to-CPU affinity irqbalance [ksoftirqd/x] kernel threads Multi-queue networking Zero-copy IO Offloading engines 14 Interrupts are asynchronous events which need to be processed by CPUs. Those are asynchronous because they are not initiated by the user and their timing cannot be controlled. Interrupts are the main method of communicating with external devices, namely networking and storage. With high speed network interfaces at 10GbE and 40GbE or fibre channel links at 16Gbps per port, the number of interrupts could require a huge processing power from CPUs. Therefore, the assignment of interrupts to CPUs could be tuned for optimal processing. The irqbalance service could be used to distribute the interrupts load among processors. However, this may not be the optimal choice for certain workloads. Interrupt handling is actually done in two phases: a first synchronous phase where the CPU receives the interrupt and acknowledges it, then is schedules the remainder of the processing to be completed later on, this needs to be done the moment the interrupt is raised and without delay otherwise, packet loss could occur. A second phase is processed by kernel threads called [ksoftirqd/x] asynchronously. Those threads are scheduled just like any other process as they are not under time constraints. Modern network devices and device drivers are capable of delivering incoming packets to multiple receive queues. This allows for multiple processors to pick and process packets in parallel because receive queues can only be accessed under a CPU lock. Another more common optimisation is offloading engines which are hardware-implemented processing on network traffic. Actions like packet re-assembly or checksum calculation which are usually done by the CPU would be offloaded to be processed by the network interface. The Unix programming model expects that transmission and reception of data from network or storage interfaces is done with two copies: the kernel copies the data from user space to a buffer in kernel space, then from this kernel buffer to the transmission device. This double-copy has plagued the performance of high demanding applications on Linux/Unix especially that CPU speed and network speed has grown much faster than memory speed which mostly stagnated over the past 20 years. Zero copy is a mechanism which permits direct transmission from user buffers directly to the hardware which improves performance, however, there are still no standard and common interfaces to do this and it still requires some hacking to be implemented.

Imed Chihi http://people.redhat.com/ichihi/p/ ichihi@redhat.com Red Hat Global Support Services 1. http://www.redhat.com/training/courses/rh442/ 2. Red Hat Enterprise Linux 6 Performance Tuning Guide 3. Red Hat Summit 2013: Performance Analysis and Tuning of Red Hat Enterprise Linux 15