scieee AI-readable full text Open interactive document viewer

Assessing the impact of the CPU power-saving modes on the task-parallel solution of sparse linear systems

Aliaga Estellés, José Ignacio; Barreda Vayá, Maria; Dolz, Manuel F.; Martín Huertas, Alberto F.; Mayo, Rafael; Quintana-Orti, Enrique S.

Abstract

We investigate the benefits that an energyaware implementation of the runtime in charge of the concurrent execution of ILUPACK —a sophisticated preconditioned iterative solver for sparse linear systems— produces on the time-power-energy balance of the application. Furthermore, to connect the experimental results with the theory, we propose several simple yet accurate power models that capture the variations of average power that result from the introduction of the energy-aware strategies as well as the impact of the P-states into ILUPACK’s runtime, at high accuracy, on two distinct platforms based on multicore technology from AMD and Intel.

Full text

Noname manuscript No. (will be inserted by the editor) Assessing the Impact of the CPU Power-Saving Modes on the Task-Parallel Solution of Sparse Linear Systems Jos´e I. Aliaga ·Mar´ıa Barreda ·Manuel F. Dolz · Alberto F. Mart´ın ·Rafael Mayo ·Enrique S. Quintana-Ort´ı the date of receipt and acceptance should be inserted later Abstract We investigate the benefits that an energyaware implementation of the runtime in charge of the concurrent execution of ILUPACK —a sophisticated preconditioned iterative solver for sparse linear systems— produces on the time-power-energy balance of the application. Furthermore, to connect the experimental results with the theory, we propose several simple yet accurate power models that capture the variations of average power that result from the introduction of the energy-aware strategies as well as the impact of the P-states into ILUPACK’s runtime, at high accuracy, on two distinct platforms based on multicore technology from AMD and Intel. Keywords Sparse linear systems ·Iterative solvers ·ILUPACK ·Energy-aware methods ·CPU power-saving modes ·High performance computing Jos´e I. Aliaga ·Mar´ıa Barreda ·Rafael Mayo ·Enrique S. Quintana-Ort´ı Depto. de Ingenier´ıa y Ciencia de Computadores, Universidad Jaume I, 12.071–Castell´on, Spain, E-mail: {aliaga, mvaya, mayo, quintana}@uji.es Manuel F. Dolz Dept. of Informatics, University of Hamburg, 22.527– Hamburg, Germany, E-mail: man[email protected]burg.de Alberto F. Mart´ın Centre Internacional de M`etodes Num`erics a l’Enginyeria (CIMNE), Parc Mediterrani de la Tecnologia, Universitat Polit`ecnica de Catalunya, 08.860-Castelldefels, Spain, UPC, Edifici C1, 08.034-Barcelona, Spain, E-mail: [email protected]c.edu 1 Introduction Power consumption has been identified as a crucial challenge that will need to be tackled in order to deliver a sustained EXAFLOPS1through- put, at an affordable cost, in high-performance computing (HPC) facilities deployed by the end of this decade [14,16,21]. In particular, although we have enjoyed considerable advances in the performancepower ratio of HPC systems during the last few years —around 5×in the MFLOPS/Watt ratio for the systems ranked in the first position of the Green500 list during the last five years [1]— the ambitious goal of building an Exascale system by 2020, which dissipates only 20 MWatts, demands even more favorable improvements rates. A major part of the progress experienced in the energy efficiency of HPC systems in these past years has been due to the hardware, concretely, to the aggregation of low-power processors with an increasing number of cores and the adoption of hardware accelerators for HPC [3]. However, much remains to be done in order to leverage the power-saving mechanisms available in today’s hardware and a holistic investigation and multidisciplinary effort has to be conducted in energy-efficient HPC, comprising applications, system software as well as hardware [4]. ILUPACK [2] is a numerical package for the solution of sparse linear systems via Krylov-based iterative methods. The software implements multilevel ILU (incomplete LU) preconditioners for general, sym- 1A ratio of 1 EXAFLOPS=1018 floating-point arithmetic operations, or flops, per second. 2 Jos´e I. Aliaga et al. metric indefinite and Hermitian positive definite systems, as those arising in numerous scientific and engineering applications, in combination with inversebased ILUs and Krylov subspace solvers. In [5] and [6] we presented two concurrent versions of ILUPACK, for multicore architectures and distributed-memory (message-passing) platforms respectively, that efficiently exploit the task-parallelism intrinsic to the iterative solution of the sparse linear systems (including the calculation of the preconditioner). In response to the increasing energy awareness in HPC, in [7] we analyzed the energy efficiency of the task-parallel calculation of the preconditioner on an AMD-based multicore platform, leveraging the CPU power-saving modes available in this architecture [20]. In this paper we extend our previous work, with the following new contributions: –We introduce energy-aware strategies into ILUPACK runtime and we address the characterization (modeling) of power consumption in the preconditioned solution of symmetric positive definite (s.p.d.) sparse linear systems, thus expanding our previous work [7] on the computation of the preconditioner only, to cover the complete solver. –We collect precise information on the CPU powersaving modes, identifying the sources of the power bottlenecks and the energy gains, and relating the power consumption and attained savings observed in our detailed experimental results to the power models. –We target a server based on the AMD Opteron 6128 processor, already analyzed in [7], but we also model and evaluate an alternative platform equipped with two Intel Xeon E5504 processors. These servers are representative of current multicore technology and both abide to the CPU power-saving modes in the ACPI (advanced configuration and power interface) specification [20]. From the points of view of power consumption and performance, these platforms present two relevant differences, though. First, all cores of the Intel processor share the same power plane and the core frequency can be only adjusted at the processor (socket) level. Instead, on the AMD server the frequency can be varied per core. Second, as our experiments will show, on the Intel platform memory bandwidth is independent of the processor operation frequency while, on the AMD server, changes to frequency also affect memory throughput. –Finally, we refine the experimental evaluation in [7], using a more accurate wattmeter with a much higher sampling rate than that utilized in our previous study. As one of the goals of this paper is to analyze the effect that the exploitation of the CPU powersaving mechanisms exerts on the energy efficiency of a complex scientific application, we consider only the power dissipated by the components integrated in the system motherboard (e.g., CPU and RAM chips), discarding other power sinks due, e.g., to network interface, disk, inefficiencies of the power supply unit, etc. For applications such as ILUPACK, which mainly exercise the floating-point arithmetic units of the processors and the memory, we can expect that the contribution of the discarded components is a constant that can be simply added to our models. There are a large number of software efforts to reduce energy consumption in HPC clusters. For brevity, we next reference only a few. The work in [30] presents a characterization of energy saving techniques for clusters with two large groups: static power management (SPM) and dynamic power management (DPM). Within DPM the authors further distinguish between component-based and power-scalable load balancing (LB) techniques. Our approach, based on the exploitation of C-states, can be considered analogous to that in [11,26], however we apply it at processor level rather than at the node level. From that perspective, our techniques can be classified as LB. The authors in [31] leverage DVFS (dynamic voltage-frequency scaling) to reduce the power-energy consumption of precedence-constrained tasks running on a cluster. The heuristic-based strategy used by the authors minimizes the slack of non-critical tasks by means of reducing its frequency operation while maintaining the time-to-solution. A similar approach is applied to the execution of dense linear algebra algorithms in multicore processors in [9]. In [22], the authors leverage hierarchical genetic strategybased grid scheduling algorithms to exploit span via DVFS and reduce energy consumption in computational grids. The simulation results show that proposed scheduling methodologies fairly reduce the energy usage and can be easily adapted to the dynamically changing grid states and various scheduling scenarios. Our strategy considers a static VFS- Title Suppressed Due to Excessive Length 3 based approach, in which the voltage/frequency pair is fixed at the beginning of the execution and does not vary thereafter. Our energy savings come instead from the exploitation of the C-states which, in general, lead to considerable energy savings by relying on a race-to-halt/race-to-idle strategy. DVFS strategies are part of future work. The rest of the paper is structured as follows. In Section 2 we briefly review the numerical approach underlying ILUPACK and the task-parallel implementation oriented to multicore architectures from [5]. In Section 3 we introduce the setup for our experiments. The next three sections contain the main contribution of the paper: The power model in Section 4; the power-aware runtime together with a theoretical and experimental analysis of the impact of the C-states on the time-power-energy balance in Section 5; and an analogous study, from the point of view of the P-states, in Section 6. Finally, the paper is closed with a discussion of the results in Section 7. 2 Parallel ILUPACK for Multicore Processors The approach to multilevel preconditioning in ILUPACK relies on the so-called inverse-based ILU factorizations. Unlike classical threshold-based ILUs, this approach directly bounds the size of the preconditioned error and results in increased robustness and scalability, especially for applications governed by PDEs, due to its close connection with algebraic multilevel methods [5]. Specifically, for efficient preconditioning, only a small amount of fill-in is allowed during the factorization, resulting in a modest number of floating-point arithmetic operations per nonzero entry of the sparse coefficient matrix. Parallelism in the computation of ILUPACK preconditioners is exposed by means of nested dissection applied to the adjacency graph representing the nonzero connectivity of the sparse coefficient matrix. Nested dissection is a partitioning heuristic which relies on the recursive separation of graphs. The graph is first split by a vertex separator into a pair of independent subgraphs and the same process is next recursively applied to each independent subgraph. The resulting hierarchy of independent subgraphs is highly amenable to parallelization. In particular, the inverse-based preconditioning approach is applied in parallel to the blocks corresponding to the independent subgraphs while those corresponding to the separators are updated. When the bulk of the former blocks has been eliminated, the updates computed in parallel within each independent subgraph are merged together, and the algorithm enters the next level in the nested dissection hierarchy. The same process is recursively applied to the separators in the next level and the algorithm proceeds bottomup in the hierarchy until the root finally completes the parallel computation of the preconditioner; see Figure 1. The type of parallelism described above can be expressed by a binary task dependency tree, where nodes represent concurrent tasks and arcs specify dependencies among them. The parallel execution of this tree on multi-core processors is orchestrated by a runtime which dynamically maps tasks to threads (cores) in order to improve load balance requirements during the computation of the ILU preconditioner. At execution time, thread migration is prevented using POSIX routine sched set affinity. The runtime keeps a shared queue of ready tasks (i.e., tasks with their dependencies fulfilled) which are executed by the threads in FIFO order. This queue is initialized with the tasks corresponding to the independent subgraphs. Idle threads have to wait for new ready tasks. When a given thread completes the execution of a task, its parent task is enqueued provided the sibling of the former task has been already completed as well. The most expensive operation involved in the preconditioned iterative solution of the linear system is the application of the multilevel preconditioner, which is in turn decomposed into two steps: the multilevel forward (FS) and backward substitutions (BS). The aforementioned task dependency tree also describes the parallelism available within both computations. However, while the FS proceeds bottom-up towards the root of the tree, the BS proceeds in the opposite direction. In order to maximize data locality during the parallel multi-threaded execution of both operations, the mapping of threads to tasks resulting from the (dynamic load-balancing) computation of the preconditioner is re-used, so that each thread knows in advance which tasks it is in charge of (i.e., static mapping). The runtime uses a different task queue for each thread and substitution algorithm. For the FS, the queue of each thread is initialized with the leaves it is in charge of, and new (ready) tasks are enqueued on the corresponding queues as soon as their dependencies are ful- 4 Jos´e I. Aliaga et al. 000 000 111 111 00 00 00 11 11 11 0 0 0 1 1 1 01 0 0 0 1 1 1 000 000 000 111 111 111 00 00 00 11 11 11 0011 000111 000 000 000 111 111 111 00 00 00 11 11 11 00 00 00 11 11 11 000 000 111 111 GA G(2,1) G(2,2) G(3,1) G(3,4) (3,2) G(3,3) G First ND level finds separator (1,1) (1,1) (1,1) (2,1) (2,2) Second ND level finds separators (2,1) and (2,2) (2,2) (2,1) (1,1) (3,1) (3,4) (3,3) (3,2) Nested Dissection Task dependency Tree A A −> P AP T Fig. 1 Nested dissection applied to the adjacency graph associated with a sparse matrix and the corresponding task dependency tree. filled (i.e., as soon as their children tasks are completed). For the BS, only the root task is initially included in the corresponding queue. As soon as the root task is completed, its children are enqueued on the corresponding queues, and the parallel execution (orchestrated by the runtime) proceeds topbottom while taking care of task dependencies until the computation of the leaves is completed. The other operations involved in the preconditioned iterative solution stage (i.e., sparse matrix-vector product and vector operations) are split and mapped conformally with the FS and BS steps in order to maximize data locality. Moreover, a careful management of shared data, by maintaining consistent or inconsistent copies of the matrix and the vectors, avoids synchronization steps, except those reductions required in order to compute inner products. Further details on the mathematical foundations of the parallel algorithms, their implementation, and the runtime operation can be found in [5]. 3 Environment Setup In all our experiments, we employ a scalable symmetric positive definite sparse linear system of dimension n=N3, resulting from a partial differential equation −∆u =fin a 3D unit cube Ω= [0,1]3 with Dirichlet boundary conditions u=gon δΩ, discretized using a uniform mesh of size h=1 N+1 . We set N= 252, which yields the largest linear system that fitted into the main memory of the target machine, with about 16 ·106unknowns and 111 ·106 nonzero entries in the coefficient matrix. All tests were performed using IEEE double-precision arithmetic. Execution time, power and energy are always reported in seconds (s), Watts (W) and Joules (J), respectively. We employ two target servers in our experiments. The first platform, wt amd, is equipped with a single AMD Opteron 6128 processor (8 cores), 24 Gbytes of RAM, and runs the Linux Ubuntu operating system (kernel 2.6.32-220.4.1.el6.x86 64). The second server, wt int, contains two Intel Xeon E5504 processors (4 cores per socket), 32 Gbytes of RAM, and runs Linux Ubuntu (kernel 2.6.32-220.4.1.el6.x86 64) as well. These two types of processors are representative of current multicore technology, and adhere to the ACPI standard [20] for the CPU power-saving modes. Concretely, the AMD processor features 5 performance states (P-states P0 to P4) and three operating or power states (C-states C0, C1 and C1E). The Intel processor has 4 P-states (P0 to P3) and 4 C-states (C0, C1, C3 and C6). Information on the voltage–frequency pairs (Vi−fi) associated with each P-state (Pi) is collected in Table 1. State C0 is the normal operating mode (i.e., the CPU is operative) while higher numbers correspond to deeper sleep modes, where more circuits and signals of the processor are turned off, saving more power, but requiring longer time to go back to C0 mode. Title Suppressed Due to Excessive Length 5 Platform P-state, PiVifiBWi wt amd P0 1.23 2.00 30.29 P1 1.17 1.50 24.63 P2 1.12 1.20 20.46 P3 1.09 1.00 17.48 P4 1.06 0.80 14.00 Platform P-state, PiVifiBWi wt int P0 1.04 2.00 12.72 P1 1.01 1.87 12.58 P2 0.98 1.73 12.61 P3 0.95 1.60 12.55 Table 1 P-states, associated voltage–frequency pairs (Viin Volts and fiin GHz), and core to memory bandwidth (BWi, in GB/sec.) measured with the stream benchmark. From the practical point of view, the AMD and Intel servers differ in two important aspects: –The frequency of the AMD cores can be adjusted independently while, on the Intel platform, all cores in the same processor run at the same frequency. In particular, if the cores of a processor from wt int operate at frequency fi, and we instruct one of these cores to run at fj> fi(using the Linux cpufreq utility), the remaining three cores in the same socket will also transition to operate at fj. On the other hand, if the cores of a processor from wt int run at frequency fi, and we instruct one core to run at frequency fj< fi, there will be no change. –On the AMD platform, the bandwidth between the cores and the main memory varies with the processor frequency while, on the Intel platform, this bandwidth is independent of the processor frequency. To illustrate this behavior, column BWi of Table 1 reports the bandwidth to the main memory experienced by a single core running the stream microbenchmark [29] at different frequencies. We note that the bandwidth-frequency dependence is a design decision specific of each processor type: more recent processors as, e.g., the Intel Xeon E52670 “Sandy Bridge” seems to follow AMD 6128’s strategy and reduce the bandwidth with the processor frequency [18]; on the other hand, some other processors like the AMD 6274 “Interlagos” apparently abandon this approach [27]. In our experiments, power samples were obtained from the 12-Volt lines connecting the power supply unit to the motherboard of the target platform2, us- 2On a separate experiment [15], it was determined that the aggregate power supplied by the 3-Volt and 5-Volt lines during the execution of ILUPACK on these two platforms remains practically constant and, furthermore, it is negligible compared with that measured from the 12-Volt lines. ing an internal wattmeter composed of a National Instruments (NI) analog input module (9205) plugged into a NI chassis (cDAQ-9178) and a board of current transducers (LEM HXS 20-NP). The wattmeter is connected via an Ethernet link to a separate power tracing server that runs a daemon application to collect power samples form the internal wattmeter. The measurement application is built by calling routines from the pmlib library [8,13]. We set the sampling rate to 1 kSamples/sec., which is high enough to obtain reliable measures for the power model and remaining experiments. Our multithreaded implementation of ILUPACK is built on top of the OpenMP interface available with Intel icc (version 12.1.3) on both platforms. Performance (core activity) traces were captured using the Extrae+Paraver (versions 2.2.1+4.3.4) tracing environment [25]. Traces of CPU power modes were recorded using the Linux interface to read and write model-specific registers (MSRs) and dumped into Paraver-compatible files for interactive visualization and analysis. 4 The Power Model and the CPU Power-Saving Modes We open this section by revisiting the following simple model from [10] for the total (aggregate) power dissipated by an application at a given instant of time t: PT=PY+PP=PY+PU+PC,(1) where PPis the power dissipated by the CPU processor(s) and PYis the power dissipated by the remaining components (system power corresponding, e.g, to DDR RAM chips, motherboard, etc.). Furthermore, PUis the power dissipated by the uncore [19] elements of the processor (e.g., last-level cache, memory controllers, core interconnect, etc.); and PCis the power for the cores (including the in-core cache 6 Jos´e I. Aliaga et al. Platform P-state, PiPY iαiβburn,i βbusy,i βgemm,i PU i wt amd P0 84.83 140.94 14.70 13.50 13.82 56.11 P1 77.85 137.47 7.71 6.10 10.01 59.62 P2 73.83 131.35 5.48 4.58 7.40 57.52 P3 71.86 127.87 4.12 3.33 5.46 56.01 P4 72.46 124.89 3.10 2.28 4.27 52.43 wt int P0 33.43 64.44 9.48 7.10 11.12 31.01 P1 63.38 8.19 6.16 9.84 29.95 P2 64.10 7.33 5.43 9.03 30.67 P3 64.72 6.34 4.64 7.81 31.29 Table 2 Parameters for the simple power model for the cpuburn,busy and gemm benchmarks (kernels) on wt amd and wt int. Note that PU i=αi−PYand PC k,i(c) = PC1 k,i ·c=βk,i ·c, with i,kand cdenoting, respectively, the kernel type, P-state and number of cores. levels, floating-point units, branch logic, etc.). While our power models refer to the power dissipated at a given instant of time t, in most experiments next, we will report instead the average power for the application, as this allows us to compile the information for the complete execution in a single figure. Furthermore, this easily connects the results with the total energy consumption. Given a platform with all cores in state Pi, for simplicity we will assume that PY iand PU i(i.e., the system and uncore powers in state Pi) remain constant during the execution of the application. In practice, starting from an idle (cold) platform, these two factors grow with the system temperature till their addition reaches a plateau [12]. To avoid this effect, we assume that there is a continuous workload to run in the platform and, in order to mimic this situation, all our tests will be performed on a “hot” system, with this state reached by initially warming the cores with an execution of the same kernel or application for a given period of time. Also, we will assume that PU iis independent of the application that runs in the platform. In practice, this is not the case, but our results will show that the errors introduced by this simplification are small, and can be easily accommodated into the model. To obtain practical values for the power model, we proceed as follows. For simplicity, let us assume that all cactive cores of the platform run the same type of task (kernel) k, in the same state Pi, during all the execution time. In this scenario, we can easily consider that the total power at instant tequals the average power. For PY i, we thus simply set all the cores of the platform to each P-state using cpufreq, and then measure the power with the platform idle for 30 seconds and average the results: between 71.86 and 84.83 W, depending on the state Pi, for wt amd; and 33.43 W for all P-states in wt int; see column PY iin Table 2. The estimation of PU iand PC iis more elaborated, as it is difficult to separate these two components, and the second depends also on the application that is being run. In order to achieve this, let us start by refining (1), to capture the total power for the execution of ccopies of task k, with the active cores in state Pi: PT k,i(c) = PY i+PU i+PC k,i(c)≈PY i+PU i+PC1 k,i ·c, (2) where PC1 k,i denotes the power dissipated by a single core in state Pirunning task k. To estimate the missing parameters in (2), PU i and PC1 k,i , we will leverage three compute-intensive kernels: the cpuburn microbenchmark3, a simple busywait test consisting of a “while (1) ;” loop, and the general dense matrix-matrix product (gemm) routine implemented as part of Intel MKL operating with double-precision data. Specifically, we executed these tests for 60 seconds and averaged the power draw, for an increasing number of cores c(all in the same P-state) of the machines (8 cores of both wt amd and wt int), while the remaining cores remain in an inactive C-state. Applying linear regression to the data obtained from this experimental evaluation, we obtained linear models for the total power of the form PT k,i(c) = αk,i +βk,i ·c, (3) 3http://manpages.ubuntu.com/manpages/precise/man1/ cpuburn.1.html. Title Suppressed Due to Excessive Length 7 50 100 150 200 250 300 350 1 2 3 4 5 6 7 8 Power (W) # active cores Total power for cpuburn test on wt amd cpuburn at 2.0 GHz cpuburn at 1.5 GHz cpuburn at 1.2 GHz cpuburn at 1.0 GHz cpuburn at 0.8 GHz idle at 2.0 GHz idle at 1.5 GHz idle at 1.2 GHz idle at 1.0 GHz idle at 0.8 GHz 20 40 60 80 100 120 140 160 1 2 3 4 5 6 7 8 Power (W) # active cores Total power for cpuburn test on wt int cpuburn at 2.00 GHz cpuburn at 1.87 GHz cpuburn at 1.73 GHz cpuburn at 1.60 GHz idle at 2.00 GHz 50 100 150 200 250 300 350 1 2 3 4 5 6 7 8 Power (W) # active cores Total power for busy test on wt amd busy at 2.0 GHz busy at 1.5 GHz busy at 1.2 GHz busy at 1.0 GHz busy at 0.8 GHz idle at 2.0 GHz idle at 1.5 GHz idle at 1.2 GHz idle at 1.0 GHz idle at 0.8 GHz 20 40 60 80 100 120 140 160 1 2 3 4 5 6 7 8 Power (W) # active cores Total power for busy test on wt int busy at 2.00 GHz busy at 1.87 GHz busy at 1.73 GHz busy at 1.60 GHz idle at 2.00 GHz 50 100 150 200 250 300 350 1 2 3 4 5 6 7 8 Power (W) # active cores Total power for dgemm test on wt amd dgemm at 2.0 GHz dgemm at 1.5 GHz dgemm at 1.2 GHz dgemm at 1.0 GHz dgemm at 0.8 GHz idle at 2.0 GHz idle at 1.5 GHz idle at 1.2 GHz idle at 1.0 GHz idle at 0.8 GHz 20 40 60 80 100 120 140 160 1 2 3 4 5 6 7 8 Power (W) # active cores Total power for dgemm test on wt int dgemm at 2.00 GHz dgemm at 1.87 GHz dgemm at 1.73 GHz dgemm at 1.60 GHz idle at 2.00 GHz Fig. 2 Power dissipated as a function of the number of active cores for kernels cpuburn,busy and gemm (top, middle and bottom, respectively) on wt amd (left) and wt int (right). with the values for αk,i and βk,i in the corresponding columns of Table 2, and the relation between the models and the experimental data graphically captured in Figure 2. These regression models show quite a perfect fit with the experimental data, offering the same (rough) value αk,i for all three kernel types (the largest variation between the three was 2.11 % and the average difference 0.61 %.) Therefore, in the following we use αi−PY ias an estimation for PU i(see Table 2), the uncore power dissipated by a socket in state Pi (which agrees with our assumption that the uncore power is independent of the kernel type); and we set PC k,i(c) = βk,i ·cso that PC1 k,i =βk,i. 8 Jos´e I. Aliaga et al. Thread 1 Thread 3 Thread 4 Thread 5 Thread 8 Thread 7 Thread 6 0µs54.867.754 µs Thread 2 Activity Polling Watts 67 193 Thread 1 Thread 3 Thread 4 Thread 5 Thread 8 Thread 7 Thread 6 0µs 0µs 54.867.754 µs 54.867.754 µs Thread 2 C0 C1 C6 Fig. 3 Traces of core activity, power and C-states (top, middle and bottom, respectively) during the computation of the ILU preconditioner using the performance-oriented, power-oblivious runtime, with all cores of wt int in state P0. Thread 1 Thread 3 Thread 4 Thread 5 Thread 8 Thread 7 Thread 6 54.342.740 µs64.234.465 µs Thread 2 Activity Polling Watts 67 193 Thread 1 Thread 3 Thread 4 Thread 5 Thread 8 Thread 7 Thread 6 54.342.740 µs 54.342.740 µs 64.234.465 µs 64.234.465 µs Thread 2 C0 C1 C6 Fig. 4 Traces of core activity, power and C-states (top, middle and bottom, respectively) during (part of) the iterative solution stage using the performance-oriented, power-oblivious runtime, with all cores of wt int in state P0. 5 Leveraging the C-States in ILUPACK We next investigate the exploitation of the C-states made by two implementations of the runtime underlying ILUPACK, and relate their costs to the previous power model. In the experiments in this section, we employ all the cores of the target platforms; and we set the Linux governor to ondemand operating all the active cores in the same state P0 during all the execution (i.e., we do not allow voltage-frequency changes). In Section 2 we exposed that the task-parallel calculation of the preconditioner in ILUPACK is organized as a directed task graph, with the struc- Title Suppressed Due to Excessive Length 9 ture of a binary tree and bottom-up dependencies, from the nodes (tasks) at each level to those in the level immediately above it. The subsequent iterative process basically requires the solution of (lower and upper) triangular linear systems per iteration, with tasks that are also organized as binary tasktrees, with bottom-up (lower triangular system) or top-down (upper triangular system) dependencies. In any case, when the tasks of these trees are dynamically mapped to a multicore platform by the runtime, the execution should result in periods of time during which certain cores are idle, depending on the number of tasks of the tree, their computational complexity, the number of cores of the system, etc. It is basically these idle periods that we could expect that the operating system leverages, by promoting the corresponding cores into a power-saving C-state (sleep mode). Figure 3 presents the execution trace, power consumption, and C-states observed during the computation of the ILUPACK preconditioner, using the original (power-oblivious) runtime, with all cores of wt int in state P0. Surprisingly, the results are quite different from what we had expected: Idle periods do not show a transition of the corresponding core to a power-saving C-state and the associated reduction of the power rate. Figure 4 reports an analogous behavior for the (preconditioned) iterative solution stage on wt int (and similar results were also obtained for both stages on wt amd). A closer inspection of the runtime that leverages the taskparallelism in ILUPACK reveals the reason for these surprising results. Concretely, in the original implementation of ILUPACK runtime, upon encountering no tasks ready to be executed, “idle” threads simply perform a “busy-wait” (polling) on a condition variable, till a new task is available. This strategy thus prevents the operating system from promoting the associated cores into a power-saving C-state because the threads are not actually idle (but doing useless work). This performance-oriented decision is far from uncommon, being adopted in runtimes like OmpSs (SMPSs) [28] or libflame+SuperMatrix [17] as well. Furthermore, the same performance-oriented but power-oblivious behavior appears, for example, when a synchronous GPU kernel is invoked with the default operation mode of CUDA [24] (the CPU remains in an active polling, waiting for the GPU to finish), or with the polling mode of certain MPI implementations (e.g., MVAPICH [23]). As an alternative to the previous power-hungry strategy, we developed a power-aware version of the runtime underlying ILUPACK, which applies an “idlewait” (blocking) whenever a thread does not encounter a task ready for execution and, thus, becomes inactive. (Note that setting the necessary conditions for the operating system to promote the cores into a power-saving C-state is as much as we can do, since we cannot explicitly enforce the transition from the application code.) As in the original version of the runtime, upon completing the execution of a task, a thread updates the corresponding dependencies identifying those tasks, if any, that have become ready for execution. However, in the power-aware runtime, the thread also ensures that the number of active (non-blocked threads) is, at least, equal to the number of ready tasks, releasing blocked threads if needed. The effect of idle-wait on the power trace and use of the C-states of wt int is illustrated in Figure 5, for the calculation of the preconditioner, and Figure 6, for the iterative solution stage. Compared with the performance-oriented (but power-hungry) implementation of the runtime (see Figures 3 and 4), the new runtime effectively allows inactive cores to enter a power-saving C-state, thus yielding the sought-after power reduction. The pending question, however, is whether the adoption of the power-aware runtime comes with a performance penalty which may blur the energy benefits, as in most cases the key factor is energy instead of power. Table 3 compares the execution time, average power, and energy consumption of the two runtimes, showing that fortunately this is not the case for the computation of the preconditioner and iterative solution, on any of the two target platforms when operating in state P0. Consider for example platform wt amd: For a minimal increase in the total execution time, from 286.28 s to 287.91 s, we observe reductions in the (average) power from 240.17 W to 227.16 W for the preconditioner; and from 269.27 W to 230.80 W for the solver. The outcome is a decrease of the total energy from 75,163.74 J to 67,758.84 J (−10.88 %). The power reductions attained by the power-aware implementation with respect to the power-oblivious case are given in percentage in the columns labeled as “Experimental” of Table 4 (averaged for 10 repeated executions). Combined with the negligible impact of the runtime on the execution time, these power figures also justify similar energy savings.