Real-Time implementation of Fuzzy Type for power efficiency of Multi-Core System By Muhammad Ibrahim Asif Mustafa khan Shahzeb Tanveer Supervised by Engr

Real-Time implementation of Fuzzy Type for power efficiency of Multi-Core System

By
Muhammad Ibrahim
Asif Mustafa khan
Shahzeb Tanveer
Supervised by
Engr. Shehryar Najam
Department of Electrical Engineering
Riphah International University, Pakistan
Fall 2018
Riphah International University, Pakistan
Real-Time implementation of Fuzzy Type for power efficiency of Multi-Core System
A Thesis Presented to
Riphah International University, Pakistan
In partial fulfillment
Of the requirement for the degree of
B.S. Electrical Engineering
By
Muhammad Ibrahim
CMS#14040
Asif Mustafa khan
CMS#14354
Shahzeb Tanveer
CMS#13618
Fall 2018
Declaration
We, hereby declare that this project neither as a whole nor as a part there of has been copied out from any source. It is further declared that we have developed this project and the accompanied report entirely on the basis of our personal efforts made under the sincere guidance of our supervisor. No portion of the work presented in this report has been submitted in the support of any other degree or qualification of this or any other University or Institute of learning, if found we shall stand responsible.

Signature: ______________
Name: Muhammad Ibrahim
Signature: ______________
Name: Asif Mustafa khan
Signature: ______________
Name: Shahzeb Tanveer
Riphah International University, Pakistan
Fall 2018

Department of Electrical Engineering
Riphah International University, Pakistan
  
The project real- time implementation of fuzzy type for power efficiency
Of Multi-Core System presented by:
1 Muhammad ibrahim CMS#14040
2 Asif Mustafa khan CMS#14354
3 Shahzeb Tanveer CMS#13618
under the supervision of their project advisor and approved by the project examination committee, has been accepted by the Riphah International University, Pakistan, in partial fulfillment of the requirements for the four year degree of B.S. Electrical Engineering.  

(Engr. Shehryar Najam)
Designation, Project Advisor

(Dr. Sohail Khalid)
Associate professor& HOD
Department of Electrical Engineering
Dedication
This thesis work is dedicated to the institution named Riphah International University, Islamabad. We are grateful to be a part of this institution which has provided us a platform for showcasing our skills. This work is also dedicated to our parents because they have advised us to work hard throughout our university life.

Acknowledgement
We are very thankful that we have completed our graduate work at the university. There are many teachers to thank for their support in our success. We would first want to thank our advisor and supervisor, Engr. Shehryar Najam for giving us an opportunity and confidence to do this work. His throughout motivation and guidelines have helped us a lot during the management of our project.

Abstract
This report is about controlling the system architecture. We have used Linux operating system in order to measure and control components of the system architecture mainly those which affect power consumption when the processor is dealing with some load (process). In recent years computer engineers have made computers with better performance which are able to do the work more efficiently. By increasing performance our work is achieved efficiently but it has got few disadvantages i.e. when performance is increased the power consumption of source is also increased as a result our battery normally does not last for long. In this project, we put forward a few technologies that we can use to overcome these shortcomings. Our system will be able to work effectively without disturbing the throughput and also save power at the same time.

Table of Contents
Declaration ii
Certificate iii
Dedication iv
Acknowledgement v
Abstract vi
Table of Contents vii
List of Tables x
List of Figures xi
List of Abbreviations xii
TOC o “1-3” h z u 1INTRODUCTION………………………………………………………………….. PAGEREF _Toc504271641 h 1 1.1 Overview………………………………………………………………………1
1.2 Research Motivation………………………………………………………….2
1.3 Research Objectives……………………………………………….2
2 SYSTEM ARCHITECTURE…………………………………………….3
2.1 Definition…………………………………………………………..3
2.2 Main Components of System Architecture…………………………3
2.2.1 Central Processing Unit (CPU)……………………………….4
2.2.2 Main Memory………………………………………………..5
2.2.3 Secondary Memory………………………………………….5
2.2.4 Input Output Devices……………………………………….5
2.3 What are CPU Cores? ……………………………………………………………..5
2.4 Performance (Throughput)…………………………………………7
2.5 What is Operational Frequency? ………………………………………………7
3 FUZZY LOGIC THEORY………………………………………………..8
3.1 Fuzzy Logic………………………………………………………..8
3.2 Fuzzifier……………………………………………………………9
3.3 Fuzzy Based Interface………………………………………………9
3.4 Defuzzifier…………………………………………………………9, 10
4LITERATURE SURVEY……………………………………………….11
4.1 Fuzzy Logic Based Power-Efficient Real-Time Multi-Core System………..11
4.2 Selecting membership function in a Mamdani-type Fuzzy controller….12, 13
4.3 Dynamic Voltage & Frequency Scaling ………………………………14
4.4 Power Gating/Clock Gating……………………………………………14, 15
4.5 System and method for collecting and propagating computer benchmark data…15
4.6 Multi-core computer processor based on a dynamic core-level power
management for enhanced overall power efficiency …………………….15, 16
4.7 Adaptive real-time methodology for optimizing energy-efficient
computing …………………….. 16, 17
5 METHODOLOGY…………………………………………………………..18
5.1 Input Parameters………………………………………………………..18
5.1.1 Throughput………………………………………………………18
5.1.2 Energy/Power Consumption…………………………………….18, 19
5.1.3 Cores…………………………………………………………….19
5.1.4 Frequency (Clock rate)………………………………………….19
5.2 Targeted Techniques for Power Consumption………………………….19
5.2.1 Dynamic Voltage & Frequency Scaling (DVFS)……………….19, 20
5.2.1.1 PowerSave Governor………………………………………20, 21
5.2.1.2 Ondemand Governor………………………………………22
5.2.1.3 Conservative Governor…………………………………23
5.2.1.4 Performance Governor………………………………….24
5.2.2 Power Gating/Clock Gating………………………………………25, 26
5.3 Output Parameters……………………………………………………..26
5.3.1 Cores……………………………………………………………..26
5.3.2 Frequency (Clock rate)…………………………………………..27
5.4 Parameters affecting Power Dissipation………………………………27
5.5 List of Tools used in Linux……………………………………………27, 28
5.6 Fuzzy Controller………………………………………………………29, 30
6 REFRENCES……………………………………………………………….31, 32

List of figures
Figure 2-1: Computer architecture…………………………………………………………….4
Figure 22: Cores of multi-cored processor……………………………………………..……6
Figure 3 SEQ Figure * ARABIC s 1 1: Fuzzy Logic……………………………………………………………………..….8
Figure 4-1: Completeness of a fuzzy controller………………………………………….…13
Figure 5-1: To monitor CPU speed in real time, run during PowerSave governor….20
Figure 5-2: To monitor CPU speed in real time, run during Ondemand governor……21
Figure 5-3: To monitor CPU speed in real time, run during Conservative governor…22
Figure 5-4: To monitor CPU speed in real time, run during Performance governor…22
Figure 5-5: Turning off CPU4…………………………………………………………..……23
Figure 5-6: Turning off CPU4 & CPU3……………………………………………………24
Figure 5-7: Fuzzy Controller…………………………………………………………..……27
Figure 5-8: Rules implemented in the inference block of the controller……………….28, 29
Figure 5-9: Mamdani type fuzzy controller……………………………………………….30
Figure 5.10: Triangular memberships…………………………………………………….30
Figure 5-11: Result after applying fuzzy logic to the system…………………………..31

List of tables
Table 1-2: Rule base inference …………………………………………………………28, 29

List of abbreviations
DVFS Dynamic Voltage Frequency Scaling
MATLAB Matrix Laboratory
CPU Central Processing Unit
CMP Chip Multiprocessor
FLC Fuzzy Logic Controller
I/O Input Output
Chapter One
1 Introduction1.1 Overview
This chapter will provide you the brief introduction of our project along with the techniques that we will be using to design our FYP. In the present era the need for computers and smart phones with better performance and improved throughput has increased remarkably. Computer has become very important and very common. As the demand for computers is increasing rapidly, computer engineers are designing processors with better performance and power efficiency. The power efficiency of modern embedded and real-time systems is increasingly important. This is achieved by increasing the number of cores, operational frequency and cache size. Increasing the cores means the number of transistors is also increased whereas when the number of transistors is increased the power consumption and heat dissipation is also increased.

So, engineers need to keep in mind that they not only need to increase the performance of the multi-core processors system but also make it power efficient. In order to control the power consumption and heat dissipation of current computing devices, ideal approach is to efficiently utilize available resources. Therefore, there exists need of smart processors that can use energy efficiently without disturbing the throughput. Now the techniques we have used in this regard are:
?Dynamic Voltage and Frequency Scaling (DVFS)
?Power Gating/Clock Gating
As the cores work in parallel throughput can be divided by implementing some conditions, for setting these conditions we have used fuzzy logic in our project by using MATLAB. With the help of fuzzy logic we have designed a system that will be smart enough to utilize resources efficiently without disturbing the throughput and conserve power.
With the advantage of fuzzy logic we are able to control;
? The Cores of the processors
? Throughput
? Operational Frequency
? Power Consumption
In this project we have worked on Linux. This operating system is flexible as we can control the computer architecture through software. Unlike other operating systems in Linux we’re able to manually adjust and measure different parameters of the computer architecture such as cores and operational frequency etc.

1.2 Research Motivation
In recent years computer engineers have made computers with better performance that are able to do the work more efficiently. By increasing the performance our work is achieved efficiently but it has got few disadvantages i.e. when performance is increased the power consumption of source is also increased; due to increased number of transistors and cores as a result our battery life decreases and heat dissipation. This problem has motivated us to troubleshoot these types of issues. In this report we have proposed few techniques with the help of which we can overcome these disadvantages and our system will be able to work efficiently without disturbing the throughput and also save power at the same time.

1.3 Research objectives
The performance of the system mostly depends on the system architecture i.e. the number of cores as well as the number of transistors on chip. In order to make our system efficient we have used techniques of power gating, and DVFS (DYNAMIC VOLTAGE FREQUENCY SCALING). We have been able to scale the frequency of our system via Linux operating system by using Linux tool for frequency scaling whereas with power gating technique we have been able to control the numbers of cores to be turned on or off as well as it allows us to do our work with less number of cores and save power.
Chapter Two
2 SYSTEM ARCHITECTURE
In computer engineering all the rules and the methods that describe the functionality and implementation of a computer system represent the computer architecture of a system. Computer architecture also involves micro-architecture design, logic design and its particular implementations 1.
2.1 Definition
The purpose is to design a computer that is able to perform work efficiently while keeping the power consumption in check. For this, many things are to be considered which includes instruction set design, Functional organization, Logic design and its implementation. By implementation we mean that it involves the integrated circuit design, packaging, power and cooling whereas optimization of the design requires familiarity with the Compilers, OS to logic design and packaging.
The most basic division between computer systems is the ‘software’ and ‘hardware’. Hardware is often described as the physical parts of the computer that you can actually touch with your hands although that is not recommended especially when the power is turned on whereas software includes all the instructions of a computer. There’s a main program called system software i.e. Windows 8, Windows 10 etc. also known as the operating system which controls the interaction between the software and hardware components. On the other hand application software is software like the photo shop, internet explorer or MS office tools etc.

2.2 Main components of system architecture
The main components include
Central Processing Unit (CPU)
Main Memory
Secondary storage
Input and output devices
2.2.1 Central Processing Unit (CPU)
The Central processing unit (CPU) is like the brain of a computer. The CPU is a microchip that receives and decodes the instruction from the memory. Within a CPU are specialized units, one is the ‘Arithmetic logic unit’ this part performs operations with numbers. The control unit manages the instructions and time of CPU clock whereas memory unit contains the volatile memory of the system.

Figure 2-1: computer architecture
There are also lots of different small wires carrying information in a CPU. These particular wires turn on and off in a steady rate termed as clock rate of the system. Faster the CPU clock the more instructions can be processed at that time. In modern CPU’s clock rate is in millions and billions of hertz. Due to this CPU can perform big tasks very quickly. The CPU fits into what’s known as a motherboard. The motherboard allows all the components of a computer to connect to each other. The Central Processing Unit is manufactured by different companies like
Intel
AMD
ARM etc.

2.2.2 Main memory
The main memory can be imagined as a sequence of cells that are empty or contain instructions or data. Main memory holds the instructions that are to be processed. The main memory is volatile that means whatever information is stored here will be lost without constant flow of electricity. Volatile memory needs constant flow of electricity to store information so main memory is only used for instructions in active use. Main memory is also known as RAM (Random Access Memory). RAM lies on the motherboard as well. Random access memory contains all the data that needs to be processed by the CPU. RAM contains list of addresses and in each address lies piece of data. The CPU normally requests and process each bit of data from RAM in order one after another. When computers start a process its sends request message to the RAM. The RAM address contains series of 1’s and 0’s. They represent the on and off wires. Ram does not do anything until the CPU requests or turns on the enabled set wire.

2.2.3 Secondary storage
This storage is non-volatile, as SRAM is only used for instructions in active use since it needs constant flow of electricity to store information but in this type of storage data is stored in permanent device which is the secondary storage i.e. hard drive, flash drive, DVD, CD etc.
2.2.4 Input and output devices
All those devices through which we send or enter (input) data into the computer are known as the ‘Input devices’ i.e. keyboard and mouse etc. whereas all those devices which displays output of the system are termed to be output devices like the monitor and printer.
2.3 What are CPU cores?
Cores play essential role in computation process of a system. Computer these days come with different type of cores i.e. cores can be dual core, multi-core and quad core etc. A “quad core” processor means that it has four printouts of the same circuitry so in a quad core there are four copies of the transistors on chip. With four cores a processor can execute four times as many instructions at a time then it will have on one core.

Figure 22: Cores of multi-cored processor
If there are more cores on a processor that means they will perform work efficiently by dividing the load but at the same time require more energy. As more energy will be consumed by the processor so battery timing will also be affected and reduced with respect to load on the cores. In this project we have managed to control the number of cores we want to run considering specific applications. For instance if system is doing a small process i.e. it’s having less burden of load there is no need for all the cores to be turned on if it can be achieved by single or two core so in this case as the two cores are idle so what happens is that it conserves power for us where as the process is also performed efficiently. We have been able to control the cores by implementing fuzzy logic which is further explained in detail in chapter 3.
2.4 Performance (Throughput)
Throughput or performance is the efficiency rate of a processor to perform work or we can say it’s the measure of how many units of information a system can process in a given amount of time. That means if our system is dealing with big load throughput will also be high, similarly if our system is dealing with less amount of load throughput will be low. Therefore we can say that throughput is directly proportional to amount of load on a system. In our project throughput is the input for the fuzzy logic system on the basis of which the system decides the number of cores to be turned on and the operational frequency to be set. In Linux throughput of a system is measured by “Perf tool”.

2.5 What is Operational Frequency?
Operational frequency is nothing but the clock rate of the processor. CPU operates on this specific frequency and this helps to indicate the speed of our process. It is measured in cps (clocks per second). Operational frequency comes in different ranges with respect to processors, in our system (Intel i5-4210U) the frequency range is from 1.7GHz to 2.7GHz.It can be controlled manually in Linux operating system using CPU indicator freq_tool. In this project we have controlled the operational frequency of our system as well via fuzzy logic as it affects the power consumption.
Chapter Three
FUZZY LOGIC Theory
In this section we are going to overview the “Fuzzy Controller” involved in our project which we made on MATLAB. Apart from other techniques that were used in this project our main emphasis was on fuzzy logic. 3.1 Fuzzy LogicFuzzy theory was proposed by Lotfi A. Zadeh in 1965. Fuzzy set theory has been adapted from the classical set theory. Fuzzy logic is not very precise and unclear but still helps to manipulate results by improving imprecision, but the theory itself remains precise. That’s why it is used to design different kinds of control systems. It’s sort of a combination of human expert knowledge based on certain sensory measurements and mathematical model of physical laws. One has to think in a fuzzy way in order to work on fuzzy logic. Fuzzy logic has three main parts which can be seen in figure 3.1.

Figure 3 SEQ Figure * ARABIC s 1 1: Fuzzy Logic
3.2 Fuzzifier
In this part of fuzzy logic; set of crisp input is accumulated first and then changed into fuzzy sets on the basis of their membership functions. This is the first step of fuzzy logic and it is termed as fuzzification. We can say that Fuzzifier simply maps the input into fuzzy set.
3.3 Fuzzy based inference
After fuzzification of the inputs, an inference is made which depends on the set of rules empowered by the user. This is an important part to design and being able to control the fuzzy controller. In this section certain rules are applied onto the fuzzy set which act as input for the controller and after applying these rules controller is able to gives us the output. Whereas each output comes after sets of rules are applied to it in fuzzy based inference.
3.4 Defuzzifier
When the fuzzy based inference applies set of rules onto the input, the fuzzy output set in then sent to the Defuzzifier where the Defuzzifier simply changes the output to a crisp output (value).

Before we further explain fuzzy logic, fuzzy logic can be explained by a simple example. Let’s say if we want to change the numbers of cores automatically keeping different processing workloads in mind. For this purpose human knowledge is used to design a system that will be smart enough to do so. Now for the task above we simply create few rules in order to smoothly change the numbers of cores and imply them onto the system in the following manner;
IF load is Minimum, Then numbers of cores will be Low.

IF load is Normal, Then numbers of cores will be Medium.

IF load is Maximum, Then numbers of cores will be High.

Fuzzy controller has paid a key role in our project. Reason why it’s so famous is that fuzzy logic can be useful in designing a control system. In this project our goal in fuzzy logic was to design a fuzzy controller using;
? Membership functions for controlling numbers of cores, operational frequency with respect to the performance and power consumption by the system.

? Create Rules for fuzzy based inference.

?The centroid method for computation (defuzzification of the controlled effort).
Chapter Four
4 LITERATURE SURVEYDuring this project we looked over different literature surveys that were related to our project i.e. “Fuzzy Logic Based Power-Efficient Real-Time Multi-Core System”, “Selecting the membership functions in a Mamdani-Type Fuzzy controller” different techniques such as “Dynamic Voltage Frequency Scaling”, and “Power Gating/Clock Gating” These literature surveys helped us a great deal in solving and understanding the project.

4.1 Fuzzy Logic Based Power-Efficient Real-Time Multi-Core System
The first literature we studied was related to Fuzzy Logic Based Power-Efficient Real-Time Multi-Core System written by Jameel Ahmed, Mohammed Yakoob Siyal, Shaheryar Najam, Zohaib Najam .20171.

The book which we studied was “Fuzzy Logic Based Power-Efficient Real-Time Multi-Core System”. In this book we came to know about the basic concept of the Fuzzy Logic system theory and how this system can be used for “Power Efficient Real-Time Multi-Core System”. Fuzzy logic is an approach to computing based on “degrees of truth” rather than the usual “true or false” (1 or 0) Boolean logic on which the modern computer is based. 
The idea of fuzzy logic was first advanced by Dr. Lotfi Zadeh of the University of California at Berkeley in the 1960s. Dr. Zadeh was working on the problem of computer understanding of natural language. Natural language (like most other activities in life and indeed the universe) is not easily translated into the absolute terms of 0 and 1. (Whether everything is ultimately describable in binary terms is a logical question worth pursuing, but in practice much data we might want to feed a computer is in some state in between and so, frequently, are the results of computing.) It may help to see fuzzy logic as the way reasoning really works and binary or Boolean logic is simply a special case of it.

We also studied about Fuzzy Logic based multi-core power efficient architecture. How any multi-core system can be power efficient and what are the Fuzzy rules and algorithms which make the system capable enough to consume less power, these all things have been studied by us in detail. We designed a sample of Fuzzy type by taking some inputs such as frequency, cores, throughput & power consumption. We also added some rules in the inferences block of Fuzzy logic system by using MATLAB which gave us the desired outputs in the form of new cores, new frequency & new power consumption.
A multi-core processor is a single computing component with two or more independent processing units called cores, which read and execute program instructions. The instructions are ordinary CPU instructions (such as add, move data, and branch) but the single processor can run multiple instructions on separate cores at the same time, increasing overall speed for programs amenable to parallel computing. Manufacturers typically integrate the cores onto a single integrated circuit die (known as a chip multiprocessor or CMP) or onto multiple dies in a single chip package.
The demand of high processing multi-core systems is increasing day by day, engineers are pursuing this demand from the very beginning. In doing so number of transistors on the chip have been increased that enable fast processing of the system but in return consuming more power, causing heat dissipation which is not a favorable sign for any multi-core system. This will not only damage the hardware but also reduce the battery life of any computing device, especially in handheld computing devices. So we controlled that extra power consumption by using fuzzy logic system.

4.2 Selecting membership function in a Mamdani-type Fuzzy controller
In this literature we studied was regarding selecting the membership function in a Mamdani-type fuzzy controller 2, written by;
DEE-POLITECNICO DI BARI from Italy [email protected]
LAFORIA-IBP from France [email protected]
Whenever we’re designing a fuzzy controller, selecting the right type of membership function is a great problem initially. This paper somehow helped us great deal in this regard. The performance of a fuzzy controller depends on different factors such as;
Membership functions
Overlapping of the function
Completeness level
Sensitivity
Convergence of control
Apart from these factors the designer must also choose the type of fuzzification (single-ton or non-singleton), functional forms of a membership function i.e. linear, Gaussian, sigmoid etc., the parameters of membership functions (fixed or tuned), the conjunction operator (t-norm, t-conorm) and the type of defuzzification. All these parameters define the richness of a controller. As defining membership is very delicate point in designing a fuzzy controller, therefore only restriction that a membership function has to satisfy is that its values has to be normalize i.e. they must be in 0,1 range.

Moreover this paper leads us to work on a Mamdani-type fuzzy controller as this type of fuzzy controller can have infinite number of membership functions. It’s also necessary to keep completeness level 2 in all of these membership functions whereas overlapping is considered to be good for better completeness of the membership functions. One other point to keep in mind is that decreasing completeness may result in inefficient results and control.

Figure 4-1: Completeness of a fuzzy controller
4.3 Dynamic Voltage Frequency ScalingThis literature is about the optimization of energy and power consumption which is an important goal for an efficient system. A method of adjusting the design based on Fuzzy control dynamic voltage is written by Zhang Feng, Chen ji-Cheng.2015 6.
Dynamic voltage and frequency scaling (DVFS) is the adjustment of power and speed settings on a computing device’s various processors, controller chips and peripheral devices to optimize resource allotment for tasks and maximize power saving when those resources are not needed. This technique has been used greatly for smart phones in order to control power consumption and also for the cooling purpose of the handheld devices. A fuzzy control based on dynamic voltage regulator design method characterized by the
use of Fuzzy logic in having uncertain information processing features to achieve customer satisfaction, while maintaining as much as possible to reduce the frequency and voltage to control power consumption.

4.4 Power Gating / Clock Gating
This literature is about the dynamic and idle power reduction sequence using recombinant clock and power gating written by Sin S. Tan, Srikanth T. Srinivasan, Sivakumar Radhakrishnan, Stephan J. Jordan, Lili Pao Looi .2011 8.
Clock gating is a popular technique used in many synchronous circuits for reducing dynamic power dissipation. Clock gating saves power by adding more logic to a circuit to prune the clock tree. Pruning the clock disables portions of the circuitry so that the flip-flops in them do not have to switch states. Switching states consumes power. When not being switched, the switching power consumption goes to zero, and only leakage currents are incurred. Power consumption is quickly becoming a major issue for computing device manufacturers. For example, high energy costs and /or environmental concerns require lower power consumption. Also, from a practical perspective, reduction in power consumption may allow for use of a computing device in more settings, e.g. due to lighter source components (e.g. batteries or power supplies) and/or reduction in heat generation. The power gating technique is used in integrated circuits design to reduce power consumption, by shutting off the current to blocks of the circuit that are not in use. This paper helped us a lot while practicing these techniques.

4.5 System and method for collecting and propagating computer benchmark data
This literature is about System and method for collecting and propagating computer benchmark data, written by Tristan G. RINEHART, Mar 31, 2011 7.

In computing, a benchmark is the act of running a computer program, group of programs, or other operations in order to evaluate the relative performance of an object, usually by running some standard tests and experimenting with it. The term “benchmark” is also mainly used for the well-designed benchmark program itself.

Benchmarking is often associated with evaluating the performance characteristics of a computer’s hardware, such as CPU floating-point performance, but in some cases the technology is also applicable to software. For example, software benchmarks run against a compiler or database management system. Benchmarking provides a way to compare the performance of various subsystems in different chip/system architectures.

This patent has proved to be productive for us, it has facilitated us with computer-implemented method for processing benchmark data. The user downloads and runs the client software from the host server, and the host server performs a benchmark test on the computer and calculates its score. The benchmark data is then returned to the host server where it matches the appropriate product record and displayed to the user. Advantageously, the product record and benchmark data are for a specific computer system, configuration or component being benchmarked, and useful related data is added to the product record.

4.6 Multi-core computer processor based on a dynamic core-level power management for enhanced overall power efficiency
This literature is about dynamic core-level power management for multi-core computer processor, written by Paula Petrica, Adam M. Izraelevitz, David H. Albonesi, Christine A. Shoemaker; July 7, 2015 8.

It provides a method and system for managing power in a processor having multiple cores. In one implementation, the microarchitecture of a general-purpose processor core may include configurable channels (via horizontal slices of pipes) that can be powered on and off independently of each other within the core. Managing power in a processor having multiple cores, wherein each core includes different partitioned power regions and each power region is partitioned into multiple lanes with each lane including processor components, comprising:
Controlling power to the processor by independently turning on or off electrical power to the lanes, respectively, by turning on or off electrical power to components within each lane.

So, by switching the instructions on and off, we can gate the multi-core processor in order to enhance the overall power efficiency.

4.7 Adaptive real-time methodology for optimizing energy-efficient computing
This literature is about adaptive real-time optimization of energy-saving scheming, written by Chung-Hsing Hsu Wu-chun Feng, July 19, 2007.

This patent has provided us the information that how effectively a computing device can be made power efficient. Dynamic Voltage and frequency Scaling (DVFS) is an effective way to reduce energy and power consumption in micro-processor units. Current implementations of DVFS suffer from inaccurate modeling of power requirements and usage, and from inaccurate characterization of the relationships between the applicable variables. A system and method is proposed that adjusts CPU frequency and Voltage based on run-time calculations of the workload processing time, as well as a calculation of performance sensitivity with respect to CPU frequency.
The system and method are processor independent, and can be applied to either an entire system as a unit, or individually to each process running on a system. Dynamic voltage and frequency scaling (DVFS) is widely recognized as an effective way to reduce high power consumption in microprocessors (CPUs). Examples of DVFS mechanisms include powerNow! (AMD) and Speed Step (Intel). DVFS exports several frequency-voltage settings and each CPU runs at a particular setting at any given time. The many settings provide various power-performance tradeoffs: the faster a CPU runs, the more power it consumes; conversely, the slower a CPU runs, the less power it consumes. DVFS allows a CPU to switch between different frequency-Voltage settings at run time under the control of software.

Chapter 5
5 METHODOLOGY
In this portion we are going to overview and discuss different methods and procedures that are involved in this project.

5.1 Input parameters
In this section we are going to have a look at our input parameters for the project i.e. throughput, frequency, cores & Power consumption (by the system). All of these are explained below;
5.1.1 Throughput
Throughput or performance is the efficiency rate of a processor to perform work or we can say it’s the measure of how many units of information a system can process in a given amount of time. That means if our system is dealing with large load, throughput will also be high, similarly if our system is dealing with less amount of load throughput will be low. In our project throughput is the input for the fuzzy logic system on the basis of which the system decides the number of cores to be turned on and the operational frequency to be set.

5.1.2 Energy/Power consumption
The power consumed by the central processing unit due to solving different system operations is termed as power dissipation or power consumption i.e. energy released in the form of heat. Cooling fans are used to overcome this heat effect in order to cool down the computer components, keeping them in a permissible operating temperature limit. There are different types of power dissipation like static power dissipation and dynamic power dissipation. In Static power dissipation power is consumed while there is no circuit activity whereas in dynamic power the power is consumed when the inputs are active. Activity whereas in dynamic power the power is consumed when the inputs are active.

Power consumption of the system can be analyzed with “Power state” tool. This tool enables us to measure the real-time power consumption of battery by the system. After this we wrote a code that checks the power consumption by the battery of the processor by some regular intervals of time and also obtains certain “average power” of the system. After analyzing these results this code has been compiled in Fuzzylite library. The fuzzy controller takes the power consumption in feedback via Powerstate tool. The code written in C++ initiates itself by compiling the code in Fuzzylite automatically as a result; affects the output of our system by selecting the cores and the operational frequency to be set.

5.1.3 Cores
With regard to computer processors, the core is a processing unit that receives instructions and performs calculations or actions based on those instructions. A set of instructions can allow a software program to perform a particular function. In our system (Intel i5-4210U) numbers of cores are two. In our project current numbers of cores which are bearing the workload are the input for Fuzzy controller.

5.1.4 Frequency (Clock rate)
Operational frequency is nothing but the clock rate of the processor. CPU operates on this specific frequency and this helps to indicate the speed of our process. It is measured in cps (clocks per second). Operational frequency comes in different ranges with respect to processors, in our system (Intel i5-4210U) the frequency range is from 1.7GHz to 2.7GHz.It can be controlled manually in Linux operating system using CPU indicator freq_tool. In this project we have controlled the operational frequency of our system as well via fuzzy logic as it affects the power consumption.

5.2 Targeted Techniques for Power Consumption
DVFS(Dynamic voltage and frequency scaling)
Power Gating/Clock Gating
5.2.1 DVFS (Dynamic Voltage and Frequency Scaling)
Dynamic voltage and frequency scaling (DVFS) typically adapts CPU power consumption by modifying a processor’s operating frequency (and the associated voltage).
Typical DVFS approaches include using default strategies such as running at the lowest or the highest frequency, or reacting to the CPU’s run-time load to reduce or increase frequency based on the CPU usage. Energy efficiency is of increasing importance in a number of use cases ranging from battery operated devices to data centers striving to lower energy costs. DVFS (Dynamic Voltage and Frequency Scaling) is a fundamental control mechanism in processors that enables a trade-off between performance and energy. Typical DVFS approaches fall into two categories: schemes that employ specific frequencies for default policies (e.g., power save vs performance governors in Linux) or schemes that observe the CPU execution and dynamically react to CPU load changes (e.g., the on-demand governor). In our project we have used frequency scaling benchmark by using different frequency scaling governors which are as follow;
Powersave
Ondemand
Conservative
Performance
We have analyzed the frequency scaling by observing the temperature and workload of the CPUs or cores. The outputs of all governors for frequency scaling are as follow:
5.2.1.1 powersave governor
Powersave governor run the CPU at the minimum frequency. It has been shown in figure below;
Figure 5-1 Activating Powersave Governor ; to monitor CPU speed in real time
5.2.1.2 Ondemand Governor
This governor uses CPU load as a CPU frequency selection metric. In order to estimate the current CPU load, it measures the time elapsed between consecutive invocations of its worker routine and computes the fraction of that time in which the given CPU was not idle. It scales the frequency dynamically according to current load. Jumps to the highest frequency and then possibly back off as the idle time increases. The activation command and effect of implementing Ondemand governor on CPU frequency has been shown below:

Figure 5-2 To monitor CPU speed in real time, run during Ondemand governor.

5.2.1.3 Conservative Governor
This governor uses CPU load as a CPU frequency selection metric. It estimates the CPU load in the same way as the Ondemand governor described above, but the CPU frequency selection algorithm implemented by it is different. Namely, it avoids changing the frequency significantly over short time intervals which may not be suitable for systems with limited power supply capacity (e.g. battery-powered). To achieve that, it changes the frequency in relatively small steps, one step at a time, up or down – depending on whether or not a (configurable) threshold has been exceeded by the estimated CPU load.
The activation command and the respective effects on CPU frequency has been shown in the following figure.

Figure 5-3 To monitor CPU speed in real time, run during Conservative governor.

5.2.1.4 Performance Governor
It runs the CPU at the maximum frequency. The activation command and the respective effects on CPU temperature and frequency has been shown in the following figure.

Figure 5-4 To monitor CPU speed in real time, run during Performance governor.

5.2.2 Power Gating/Clock Gating
Power Gating/Clock Gating is a popular technique used in many synchronous circuits to reduce dynamic power consumption. Clock gating saves power by trimming the clock tree by adding more logic to the circuit, so the design must include these enable conditions to use clock gating and benefit from it. In our project we have gated the cores of our system by using Echo_ Utility. With the help of the echo tool, we can choose which core to open or close. The relevant activation commands and results has been shown in the figures given below.

Figure 5-5 Turning off CPU4

Figure 5-6 Turning off CPU4 ; CPU3
5.3 Output Parameters
In this section we are going to have a look at our output parameters for the project i.e. Frequency ; Cores (by the system), which are discussed below:
5.3.1 Cores
Cores play an important role in the computation process of the system and they also have major impact on the battery consumption. We can measure the process of our system performed by the cores in Linux operating system via echo tool. We are also able to control these cores in the same tool. After getting the inputs in feedback of the system fuzzy controller decides the number of cores to be turned on i.e. if load will be less fuzzy controller enable’s only two cores rather than four of them which results in power consumption.

5.3.2 Frequency (clock rate)
Frequency means the clock rate of the processor. CPU operates on this specific frequency and this helps to indicate the speed of our process. The clock frequency also affects the battery consumption. The frequency of the system can be measured as well as controlled in Linux operating system with CPU_freq tool. We have controlled the frequency with respect to inputs via CPU_freq tool which is implemented on the system by the code written in C++ in Fuzzylite.

5.4 Parameters affecting power dissipation
Electrical energy that’s being consumed by the CPU processor.
Due to switching devices that are present within the CPU, like the “transistors”.

This energy this lost in form of heat as well of the impedance of the electronic circuit.

5.5 List of tools used in Linux
The first step of the project was to install Linux based Ubuntu 14.04. Linux is an operating system that comes with a lot of flexibility as the user is empowered to manually control many features of the system unlike other operating systems. This OS is primarily composed of C and assembly language. It supports dozens of programming languages. Linux is slightly different operating system when compared to others, in this OS terminal plays important role as everything is achieved by typing a specific command for it. Even if one has to download something he has to type the command for it in terminal and the system itself connects to Linux utility and downloads the required package for the user. Similarly if you have to run any process for that also you have to type a command in the terminal. Linux is partial towards power performance. We have downloaded different tools of Linux that helped us achieve the aim of our project. These tools are mentioned below:
Indicator_CPUfreq: Indicates the running frequency of the processor.

Echo_Utility: With the help of echo utility we’re able to choose whether which core we want to turn on or turn off.

Perf_Tool: Perf tool lets us know about the performance of our system.

Fuzzylight_library C++: The fuzzy controller that we have made to control cores and operational frequency with respect to power and performance is composed in Matlab. Then after it’s generated in form of a C++ code and finally implemented into Linux after compiling it into fuzzy light library C++.

CPU_freq-Userspace/Scaling available-governor: This governor lets us decide the frequency of the processor on our own choice.

Synaptic: With the help of this tool we’re able to download any package we want by typing a command for that package in the terminal.

CPU_Power-set-governor Userspace: Due to this tool we can see the power state of a running process/application in that specific time.

Powerstate: Powerstate tool enables us to check the overall power consumption of the system in some regular interval of time.

5.6 Fuzzy Controller
Without implementing fuzzy logic we would not have been able to achieve our aim in the project. After downloading different packages of Linux our next main emphasis was on designing a fuzzy controller. As mentioned above fuzzy controller has played key role in our project by letting us control the different important parameters of our project such as cores, energy, throughput and energy. In fuzzy controller we set few conditions which are implemented on the output of the system with respect to the inputs. Fuzzy controller is designed in Matlab. Fuzzy actually has two types
Mamdani type fuzzy controller
Sugeno type fuzzy controller
In Sugeno type fuzzy controller the output is linear and it’s obtained by implementing some mathematical function where as in Mamdani type fuzzy controller fuzzy is implemented on the input which gives us the required output. In this project we have worked on Mamdani type fuzzy controller because in this type of fuzzy controller we can have several outputs for several inputs. Fuzzy logic has three main parts fuzzification, defuzzification and inference as shown in figure 5.7.

Figure 5-7 Fuzzy controller
The first thing to in fuzzy controller is to define the memberships and different variable that are to be controlled. So we selected two inputs and two outputs for our project. Then we had to choose the limits defining membership for every input and output whereas membership also has several types i.e. Gaussian, rectangular, triangular and bell shaped, we choose to work on triangular membership. After defining variables and memberships the next thing to do was to create rule based inference (Shown in the table, figure 5.8)
Moreover the fuzzy controller of our project can be seen in figure 5-9, the membership selection for the input and the outputs is shown in figure 5.10 whereas the results of the system after creating the rule based can be observed in figure 5.11.
Table 1-1: Rule base inference
S.No Power Throughput Cores Frequency New cores New frequency
1 L L L L 2 H M H H 3 H H H H 4 L M L M 5 L H M M 6 M L M M 7 M L M H 8 M H M M 9 M M M M 10 M H M M 11 H L H H 12 H M H H 13 H H M H 14 H L H H 15 H M H M 16 H M H H 17 H M M H 18 H H H H 19 L M M L 20 L L M L 21 L H M L 22 L M M M 23 L H M H 24 H L H H 25 H L M M
Figure 5-8: Rules implemented in the inference block of the controller

Figure 5-9: Mamdani type fuzzy controller

Figure 5.10: Triangular memberships
Following figure shows the result of our fuzzy controller after defining the memberships, variables and the rule base inference we can check our output for different types of inputs. The rule base of our project can be seen in figure 5-11

Figure 5-11: Result after applying fuzzy logic to the system
3. References1 Jameel Ahmed, Mohammed Yakoob Siyal, Shaheryar Najam, Zohaib Najam. Fuzzy Logic Based Power-Efficient Real-Time Multi-Core System. SpringerBriefs in Applied Sciences and Technology. 2017.

2 P.J. King and E.H. Mamdani, “The application of fuzzy control systems to industrial processes”. Proc. Workshop on discrete systems and fuzzy reasoning, Queen Mary College, London 1976.

3 Avadh Patel, Furat Afram, Shunfei Chen, and Kanad Ghose, Dept. of Computer Science, State University of New York at Binghamton.{Apatel, fafram1, schen, ghose}@cs.binghamton.edu.

4 A method of adjusting the design based on fuzzy control dynamic voltage, Zhang Feng, Chen ji-Cheng, Oct 14, 2015
5 Dynamic and idle power reduction sequence using recombinant clock and power gating, Sin S. Tan, Srikanth T. Srinivasan, Sivakumar Radhakrishnan, Stephan J. Jordan, Lili Pao Looi, Dec 1, 2011.

6 System and method for collecting and propagating computer benchmark data, Tristan G. RINEHART, Mar 31, 2011.

7 Multi-core computer processor based on a dynamic core-level power management for enhanced overall. July 7, 2015
8 Power efficiency, Paula Petrica, Adam M. Izraelevitz, David H. Albonesi, Christine A. Shoemaker. July 7, 2015.

9 Adaptive real-time methodology for optimizing energy-efficient computing, Chung-Hsing Hsu, Los Alamos, NM (US); Wu-Chun Feng, Blacksburg, VA (US), July, 19 2007.

10 Static and Dynamic Frequency Scaling on Multicore CPUs, Wenlei Bao, Changwan Hong, Sudheer Chunduri, Sriram Krishnamoorthy, Louis-Noel Pouchet,
Fabrice Rastello, and P. Sadayappan, 2016.

11 D. Rajan, R. Zuck, and C. Poellabauer, “WorkloadAware Dual–Speed Dynamic Voltage Scaling,” Proc. of 12th IEEE Int’l Conf. on Embedded and Real-Time Computing Systems and Applications, Aug. 2006, pp.251-256.
12 S. Saewong and R. R. Rajkumar, “Practical voltageScaling for Fixed-Priority RT-Systems,” Proc. of the 9th IEEE Real-Time and Embedded Technology and Applications Symp., 2003, p.106.

13 Wu, V. J. Reddi, Y. Wu, J. Lee, D. Connors, D. Brooks, M. Martonisi, and D. W. Clark, “A Dynamic Compilation Framework for Controlling Microprocessors.

14 P.J. King and E.H. Mamdani, “The application of fuzzy control systems to industrial processes”. Proc. Workshop on discrete systems and fuzzy reasoning, Queen Mary College, London 1976.

15 R.M. Tong, “An assessment of a fuzzy control algorithm for a non-linear multi-variable system” Proc. Workshop on discrete systems and fuzzy reasoning, Queen Mary College, London 1976.

16 A. Rutherford and G.C. Bloore, “The Implementation of fuzzy algorithm for control”, control system centre report no. 279, UMIST, Manchester. To appear in Proc. IEEE.