1. Homepage
  2. Coding
  3. Concurrent Programming Coursework 2024 - Prefix Scan Algorithm in C/MPI

Concurrent Programming Coursework 2024 - Prefix Scan Algorithm in C/MPI

Get in Touch with Our Experts
Concurrent ProgrammingCPrefix ScanMPI

Concurrent Programming Coursework 2024 Assignment Writing Service

Summary: You are required to implement the parallel prefix scan algorithm in c/mpi: Assignment Writing Service

Specification: Assignment Writing Service

To have keyboard input of the number, n, of elements in the sequence
Process 0 will generate n random integers and broadcast these to the other processes as appropriate Process 0 prints the input and output sequences onto the screen. Assignment Writing Service

Note: use of MPI_Scan is explicitly forbidden. Assignment Writing Service

Methodology: Assignment Writing Service

There will be an in-class discussion of the algorithm in which we shall work together to identify the key issues and details of the algorithm – be prepared to ask questions in that session. Assignment Writing Service

Deliverables: Assignment Writing Service

  1. 1)  A single source file prefix.c that can be compiled under MSYS2 using mpicc. This source file will contain all necessary c/mpi code. Codes provided for other frameworks (e.g. implemented using Microsoft Visual Studio with MPI are NOT ACCEPTABLE and will be awarded a mark of 0) Assignment Writing Service

    Your code must be properly documented to permit an experienced coder, who is unfamiliar with the prefix scan algorithm to understand and be able to modify or upgrade it. Assignment Writing Service

  2. 2)  A very brief pdf report highlighting any significant code features to which you wish to draw attention and the results of your testing to convince the client of correct functionality and any comments on the limitations and scope for upgrade of the code. Assignment Writing Service

Submission is only accepted via the assessment link on the Moodle page. Assignment Writing Service

Marks and feedback will be provided within 15 working days of the submission deadline and each student will receive their completed copy of the marking rubric posted on Moodle. Further feedback can subsequently be requested by email. Assignment Writing Service

Plagiarism: Students will naturally discuss the assignment between themselves, however each student’s submission must be wholly their own work. It is easier than you might think to spot both students sharing code and the use of third-party code downloaded from the internet etc. The full force of the University’s academic misconduct regulations will be invoked for any infringements. Assignment Writing Service

The Prefix Scan Algorithm Assignment Writing Service

Definition: Given a sequence, a, of input values (𝑎􏰀, 𝑎􏰁, 𝑎􏰂, 𝑎􏰃, 𝑎􏰄 ... 𝑎􏰅􏰆􏰁)
the output sequence, b, is defined as (𝑏􏰀, 𝑏􏰁, 𝑏􏰂, 𝑏􏰃, 𝑏􏰄 ... 𝑏􏰅􏰆􏰁) where 𝑏􏰇 = ∑􏰇􏰈􏰉􏰀 𝑎􏰈 Assignment Writing Service

We note that 𝑏􏰇 = 𝑏􏰇􏰆􏰁 + 𝑎􏰇
Example: a= (1,2,3,4,5,6,7,8) then b= (1,3,6,10,15,21,28,36) Assignment Writing Service

A simple serial C implementation of this algorithm might be Assignment Writing Service

void prefix_scan(int n, int a[], int b[]){ b[0]=a[0]; Assignment Writing Service

for(int i=1;i<n;++i) b[i]=b[i-1]+a[i]; Assignment Writing Service

} Assignment Writing Service

Parallel Prefix Scan Algorithm Assignment Writing Service

Initialise b with a 12345678 Assignment Writing Service

Up Phase Assignment Writing Service

Note those elements in cells of index 2, 4, 6 ,8 ...,i.e. spaced by steps of 2
Each such cell’s value is replaced by the sum of the current value and the value in the cell 1 place before it. All other cells keep Assignment Writing Service

the same value Assignment Writing Service

􏰊􏰊􏰊􏰊 Assignment Writing Service

1
Note those elements in cells of index 4, 8, 12 ,16 ...,i.e. spaced by steps of 4 Assignment Writing Service

Each such cell’s value is replaced by the sum of the current value and the value in the cell 2 places before it. All other cells keep the same value Assignment Writing Service

1 Assignment Writing Service

􏰊􏰊 Assignment Writing Service

133
Note those elements in cells of index 4, 8, 12 ,16 ...,i.e. spaced by steps of 8 Assignment Writing Service

Each such cell’s value is replaced by the sum of the current value and the value in the cell 4 places before it. All other cells keep the same value Assignment Writing Service

133 Assignment Writing Service

􏰊 Assignment Writing Service

1 3 3 10 5 11 7 36 This is continued until, as just reached in this example, there are no further changes. Assignment Writing Service

Assignment Writing Service

Note those elements in cells of index 4, 8, 12 ,16 ... i.e. spaced by steps of 4 (i.e. one less than the highest reached in the up phase) Assignment Writing Service

Each such cell’s value contributes to a sum of the current value and the value in the cell 2 places after it. All other cells keep the same value Assignment Writing Service

133 Assignment Writing Service

􏰊 Assignment Writing Service

1 3 3 10 5 21 7 36 Note those elements in cells of index 2, 4, 6 ,8 ...,i.e. spaced by steps of 2 Assignment Writing Service

Each such cell’s value is contributes to a sum of the current value and the value in the cell 1 places after it. All other cells keep the same value Assignment Writing Service

1 Assignment Writing Service

􏰊􏰊􏰊 Assignment Writing Service

13 36 We could compress this into the following to succinctly show the evolution to the final result. Assignment Writing Service

1 Noting cells spaced by steps of 2 Noting cells spaced by steps of 4 Noting cells spaced by steps of 8 Assignment Writing Service

Noting cells spaced by steps of 8 Assignment Writing Service

Noting cells spaced by steps of 4 1 Noting cells spaced by steps of 2 Assignment Writing Service

13 36 Assignment Writing Service

Outlined dells are the noted ones per round and shaded cells are those whose value has changed
A different example illustrates the need to
pad with zeros the total number of elements to a power of 2 Assignment Writing Service

311 0 0 Assignment Writing Service

12 0 0 4 Assignment Writing Service

57 Assignment Writing Service

57 57 57 Assignment Writing Service

3 10 57 Assignment Writing Service

3 10 57 Assignment Writing Service

联系辅导老师!
私密保护
WeChat 微信
Concurrent Programming代写,C代写,Prefix Scan代写,MPI代写,Concurrent Programming代编,C代编,Prefix Scan代编,MPI代编,Concurrent Programming代考,C代考,Prefix Scan代考,MPI代考,Concurrent Programming代做,C代做,Prefix Scan代做,MPI代做,Concurrent Programminghelp,Chelp,Prefix Scanhelp,MPIhelp,Concurrent Programming作业代写,C作业代写,Prefix Scan作业代写,MPI作业代写,Concurrent Programming编程代写,C编程代写,Prefix Scan编程代写,MPI编程代写,Concurrent Programming作业答案,C作业答案,Prefix Scan作业答案,MPI作业答案,