代写 parallel software Introduction

Introduction
1. In brief, Task focuses on designing, developing and testing a new program such that it is able to:
• Validate/invalidate the two data files related to configuration and task allocations. • Validate/invalidate allocations that are described in the allocations file.
• Compute and display the amount of energy consumed by each allocation.
• Display each allocation.
You will be provided with valid input data files, and invalid input files. These files and their format descriptions can be found in the ZIP file
Objectives
The main objectives for Task are:
1. Design and develop a new program to work with the two input data files. Their formats are described in the following sections:
• Task Allocation file format (.tan)
• Configuration file format (.csv)
2. Design and develop many unit tests.
3. Code to conventions and standards.
Testing Requirements – Unit Tests
Your software solution for Assessment Task 1 requires testing. You must design and develop several unit tests for the following functionality.
1. Computing the runtime of a task allocated to an N GHz processor.
2. Computing the energy consumed by a task allocated to an N GHz processor.
3. Computing the runtime of an allocation.
4. Computing the energy consumed by an allocation.
5. Validating an allocation.
6. Validating the configuration file.
7. Validating the allocations file.
Task Allocations file format (.tan)
Your software solution for Assessment Task 1 must use data from a task allocation text file (see “Test1.tan” as an example).
1. Lines containing zero or more white spaces only are allowed.
2. Lines containing a comment or data are permitted to commence with 0 or more white spaces.
Page 1 of 6

3. A line containing a comment is allowed. The symbol // will indicate the start of a comment, the end of line will represent the end of a comment. Some valid comment lines are as follows.
// This is valid.
// Creation date: 31/12/2019
// Leading white spaces are valid too.
Mixing data and a comment on one line is not allowed. For example, the following line is invalid:
TASKS,5 // There are 5 tasks.
4. There will be a line containing the file name of a configuration file. It commences with the keyword CONFIGURATION, followed by a comma, and ends with the filename that is delimited by double quotes. Two examples are below: the first is an absolute file name, the second is a relative file name.
CONFIGURATION,”C:\\temp\config.csv”
CONFIGURATION,”.\..\config.csv”
5. There will be a line containing the number of program tasks. It commences with the keyword TASKS, followed by a comma, and ends with this number. For example, the following indicates a program of 5 tasks.
TASKS,5
6. There will be a line containing the number of processors. It commences with the keyword PROCESSORS, followed by a comma, and ends with this number. For example, the following indicates 3 processors on which tasks will be allocated.
PROCESSORS,3
7. There will be a line containing the number of allocations. It commences with the keyword ALLOCATIONS, followed by a comma, and ends with this number. For example, the following indicates 8 allocations. These 8 allocations are specified in the TAN file and described below.
ALLOCATIONS,8
8. There will be a section of data for each allocation. In general, each allocation commences an allocation ID which is followed by a table representing the allocation of 0 or more tasks to each processor.
For each allocation, there will be several lines of data. The first line commences with the keyword ALLOCATION-ID, followed by a comma, and ends with an ID number.
Following this line are several lines to specify the allocation, one line per processor. Each of these lines contain comma separated 1s and 0s such as 1,0,1,0,0 where values on the mth line represents an allocation of 0 or more tasks to the mth processor.
• 1 in the nth position of the mth line indicates the nth task is assigned to the mth processor.
• 0 in the nth position of the mth line indicates the nth task is not assigned to the mth processor.
The following data represents one allocation.
ALLOCATION-ID,3
Page 2 of 6

1,0,0,1,0
0,1,1,0,0
0,0,0,0,1
Based on the above example allocation, there are 5 tasks and 3 processors.
• Processor 1 has been allocated tasks 1 and 4.
• Processor 2 has been allocated tasks 2 and 3.
• Processor 3 has been allocated task 5. Configuration file format (.csv)
Your software solution for Assessment Task 1 must use data from a CSV file containing configuration data, an example can be seen in “Test1.csv”.
1. Lines containing zero or more white spaces only are allowed.
2. Lines containing a comment or data are permitted to commence with 0 or more white spaces.
3. A line containing a comment is allowed. The symbol // will indicate the start of a comment, the end of line will represent the end of a comment. Some valid comment lines are as follows.
// This is valid.
// Creation date: 31/12/2019
// Leading white spaces are valid too.
Mixing data and a comment on one line is not allowed. For example, the following two lines are invalid.
PROGRAM-TASKS,5 // There are 5 tasks. PROGRAM-PROCESSORS,3 // There are 3 processors.
4. There will be a line containing the name of a log file. It commences with the keyword DEFAULT-LOGFILE, followed by a comma, and ends with the filename that is delimited by double quotes.
This can be an absolute or a relative file name. For example:
DEFAULT-LOGFILE,”AT1-log.txt”
5. There will be a section of minimum and maximum limits for the number of tasks, the number of processors, and the processor frequencies.
Each line in this section commences with a keyword, following by a comma, a minimum value, another comma, and ends with a maximum value. For example:
LIMITS-TASKS,1,500
LIMITS-PROCESSORS,1,1000 LIMITS-PROCESSOR-FREQUENCIES,0,10
This means that we cannot have a program partitioned into more than 500 tasks, we cannot use more than 1000 processors, and we cannot use a processor that has a frequency of more than 10 GHz.
Page 3 of 6

6. There will be a section containing data related to the parallel program. Each line in this section commences with a keyword, following by a comma, and ends with a value. For example:
PROGRAM-MAXIMUM-DURATION,3
PROGRAM-TASKS,5
PROGRAM-PROCESSORS,3
This means that the parallel program must complete within 3 seconds. It must be partitioned into 5 tasks. Each task must be allocated to one of the 3 processors.
7. There will be a line indicating the frequency of a reference processor. The runtime of a task is based on executing that task on a processor running at that frequency. This line commences with the keyword RUNTIME-REFERENCE-FREQUENCY, following by a comma, and ends with a frequency value (in GHz). For example:
RUNTIME-REFERENCE-FREQUENCY,2
8. There will be a section containing tasks runtimes. This section commences with a line containing a header which is followed by several lines, one line per task.
The header line contains two keywords TASK-ID,RUNTIME separated by a comma.
Following this header are several lines, each containing a task ID and a runtime value. For example:
1,1
2,1
3,2
4,1
5,3
This means that:
• tasks 1, 2 and 4 have a runtime of 1 second
• task 3 has a runtime of 2 seconds
• task 5 has a runtime of 3 seconds.
9. There will be a section containing processor frequencies. This section commences with a line containing a header which is followed by several lines, one line per processor.
The header line contains two keywords PROCESSOR-ID,FREQUENCY that are separated by a comma.
Following this header are several lines, each containing a processor ID and a frequency value. For example:
1,1.7
2,2.3
3,2.9
This means that:
• processor 1 runs at a frequency of 1.7 GHz
• processor 2 runs at a frequency of 2.3 GHz
• processor 3 runs at a frequency of 2.9 GHz
Page 4 of 6

10. There will be a section containing coefficients of a quadratic formula. This section commences with a line containing a header which is followed by several lines, one line per coefficient.
The header line contains two keywords COEFFICIENT-ID,VALUE that are separated by a comma.
Following this header are three lines, each containing a coefficient ID and value. For example:
0,25
1,-25
2,10
This means that:
• the 0th coefficient has a value of 25
• the 1st coefficient has a value of -25
• the 2nd coefficient has a value of 10
In secondary school, it is common to see quadratics written as a function of x such as y(x)=3×2 +5x–4
The general form of a quadratic is as follows where c2, c1 and c0 are just numbers. y(x) = c2x2 + c1x1 + c0x0
which can be written as the following as x1 = x and x0 = 1. y(x)=c2x2 +c1x+c0
Based on the above coefficient values, the following quadratic computes the energy consumed per second by a processor based on its frequency (f) and coefficients. 10f2 – 25f + 25
This means that a task that runs for 2.5 seconds on a 3.3 GHz processor will consume the following amount of energy.
(10*3.32 – 25*3.3 + 25) * 2.5
= (10*3.32 – 25*3.3 + 25) * 2.5
= (108.9 – 82.5 + 25) * 2.5
= 51.4 * 2.5
= 128.5
Validating files and allocation
1. Your software solution for Assessment Task 1 must be able to validate both text input data files (tan and csv).
Page 5 of 6

Invalid aspects of these files are available via the GUI.
2. Your software solution for Assessment Task 1 must be able to validate allocations too, but only if both input data files are valid. Consequently, it is possible to have perfectly valid input files, but an allocation is invalid.
For example, an allocation is invalid if the accumulated runtime of tasks exceeds the overall program runtime.
As another example, the following allocation is invalid because task 1 has been allocated to two processors.
1,1,0,0,0
0,0,1,1,0
1,0,0,0,1
Invalid aspects of an allocation should also be available via the GUI.
Displaying an allocation and the amount of energy consumed
1. Whether or not the input files and allocations are valid, the existing program attempts to display valid or invalid allocations on the GUI. For example, the invalid allocation in the above section could still be displayed.
2. The existing program computes and displays the amount of energy consumed by a valid allocation on the GUI. However, an appropriate message is displayed for an invalid allocation.
Data files
To help you design and develop your unit tests and software, you will be provided with several pairs of CSV and TAN files based on the above formats. These file can be found in the ZIP file called Assessment Task 1 Files.zip. The validities of each file and the associated allocations are presented in the following table.
Page 6 of 6