Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

SCEN – PMP Science, Engineering and Mathematics

Introduction to Scientific Computing (35 credit)

Assignment details

Assessment

components

Marks available

Component

weighting

Learning outcomes

A1 – Assignment

report (1500 words)

100 %

20 %

1, 2, 5, 9–12

In order to pass the module, students must achieve a minimum of 50 % in all summative assess- ments.  Resit and reattempt opportunities are available for all summative assessment.  Progres- sion will be based on the achievement of the agreed progression grade.

Learning outcomes being assessed

Knowledge and understanding

1  recognise the limitations of computers when required to undertake large volumes of com- plex computations

2  explain the common features of imperative procedural and object-orientated high-level pro- gramming languages used in science, engineering, and mathematics

Subject-specific

5  identify how the architecture of modern computers, the IEEE-754 standard, and the choice of compiled or interpreted programming languages can affect the performance of algorithms used to compute approximations using series and iterative methods

Key skills and employability skill

9  use  numbers in appropriate engineering and scientific formats when solving numerical problems

10  communicate effectively in writing using appropriate vocabulary and academic standards   11  employ appropriate computer skills to produce technical documents to appropriatescienti-

fic/engineering academic standards (e.g., IEEE standards, LaTeX Typesetting) 12  develop a range of effective interpersonal and problem-solving skills

Assignment task

Assignment

Computing the value of π : investigating the limitations of modern computing hardware and software

Description

In this assignment, you are required to carry out research and practical activities to investigate the features and limitations of modern computing hardware and software when used to carry out multiple computations.  The research will involve investigating modern computing architec- ture, features and terminology; the practical activities will involve creating C and Python code to implement an algorithm to compute the value of π in order to test the performance of different machines and the different programming languages. You will then be required to communicate your findings in the form of a technical report using LaTeX in Overleaf following the template provided and general IEEE standards. It is expected that this assignment will be carried out over the last four weeks of term and you will be expected to organise your workshop and personal study time to complete your work within that period.

Tasks and guidance

It is expected that you will carry out the following general activities to complete your assignment. Further guidance on writing the technical report is provided in the Structure and content section on pages 6–8.

1. Introduction

Write a brief introduction in your report to set the context and state the aims of your assign- ment. Try to write three clear stages in your introduction, moving from general context, to specific topic, to specific aims.

2. Hardware

Before choosing a computer to carry out any computations, it is important to be able to analyse and understand key features of the machine hardware which could impact on per- formance of any computational algorithm.  For this task, you are required to analyse how CPU characteristics and floating-point (FP) formats can impact the performance of a ma- chine.

(a)  Use the open-source diagramming software diagrams.net to create a block diagram showing the general architecture of modern CPUs. Write paragraphs to explain each key part, referring to your diagram.  As a minimum.  your diagram and paragraphs should explain the following:

i. the concepts of socket, core and thread in relation to modern computer CPUs;

ii. the concept of simultaneous multithreading (SMT), how this is implemented in a modern CPU (such as Intel HT technology), and the performance benefits of SMT

iii.  a  real example of a  modern CPU, detailing the  key features,  such as cores,

threads, and key capabilities such as SMT and FP (floating-point) processing.

(b) Appendix A shows the system information of a computer which may be used to run the software to compute the value of π , along with console output after running Linux commands to probe the details of the CPU in the system. Write paragraphs summar- ising the key features of CPU in this system in terms of the concepts described in the previous task, such as CPU frequency, number of cores, number of threads and CPU features.

(c)  Using  suitable examples,  explain how numbers are stored in single-precision and double-precision IEEE-754 floating-point (FP) format.   Explain at least one advant- age and disadvantage of using both a float and a double type of numerical variable when writing C programs.

(d)  For higher grading opportunities, compare the CPU and FP capabilities of the sugges- ted machine shown in Appendix Awith the CPU in the server in the computer science lab, or an alternative computer in consultation with your tutor; you would be expected to run the required Linux commands on the machines to identify the capabilities of each machine.

3. Software

Now that we have chosen a computer to carry out the computations, we next need to choose a suitable algorithm to compute the value of π , along with a suitable high-level programming language to implement the algorithm.

(a) Write paragraphs to explain some of the fundamental features of the following pro- gramming languages. Your explanation should include whether each language is im- perative or object-orientated, and whether it is compiled or interpreted.

i.  C

ii.  Python

iii.  C++

(b)  Explain at least two key advantages and disadvantages of using both C and Python to implement an infinite series algorithm to compute the value of π .

4. Implementation in code

Now we have compared different programming languages, the next step is to implement different algorithms in C and Python, and compare how quickly each algorithm can compute the value of π to a specified number of digits using our chosen hardware.

(a) Write C programs to compute the value of π using the following algorithms. Start with the basic then move to the more advanced algorithm.  For each algorithm, create and test a suitable C program and determine how many iterations are required to compute π to at least 5 digits.   For an initial test, start by specifying a stopping criterion of εs = 0.01 % and examining how many iterations are required and how many decimal digits starting from the most significant digit (left) are stable when compared with the previous approximation.  If required, try making εs = 0.01 % smaller to see if 5 stable significant digits can be achieved.

i. basic: the Gregory-Leibniz series (1)

(1)

ii. intermediate: compare with the Nilakantha infinite series (2)

(2)

iii. advanced: then compare with one of Ramanujan’s series formulae (3) or a more recent, purely iterative algorithm such as the Gauss–Legendre iterative algorithm.

(3)

The grading for this task will depend on how many of the algorithms you can fully implement and test in the duration of this assignment, as well as the quality of your code with reference to the following key indicators.

Follow the overall code structure demonstrated by the templates used in class.

•  Use a consistent style throughout such as when aligning curly braces {} and naming variables:  the Allman style for  braces is recommended (always put a brace on its own line and indent code within the braces to an appropriate level), and snake case is recommended for all variables and function names.

Use appropriate comments throughout, as demonstrated in class.

•  Name all program files following the same convention as when naming this re- port, which should include your student ID, and show the file name and date as comments at the top of the code.

•  Ensure your code produces suitable console output using appropriate formatting for all numerical values.

(b)  Make sure your code files included in the Appendix using the correct listings format. Also include any console output from testing your code. You will need to demonstrate that your code works on the computer science lab server via the X2Go connection, and provide copies of your code files in your private channel in the module Team on Teams.

(c)  Document your code in your report by creating a flow diagram and writing paragraphs to describe each main block of your code in relation to your flow diagram. You do not need to describe every line of code, just the overall structure and approach used to implement your flow diagram. Use the LaTeX cross-referencing features to refer to the relevant appendices.

(d)  For higher grading opportunities, you should also be able to show both C and Python programs for computing the value of π .

5. Results and discussion

Once you have created working programs to compute the value of π , it is important to present your results clearly and accurately, and validate them using manual calculations. Furthermore, after comparing the performance of your algorithms and code, the final step is to identify what factors of the hardware and software could affect the performance of code.

(a) Using equations (1), (2) and (3), manually calculate the first few terms of each series using a scientific calculator set to scientific notation to 6 significant figures.

(b)  Create a suitable table to show your manual calculations alongside the results from your code using the LaTeX template code provided, making use of the \num{} and \SI{}{} commands where required to show numbers in an appropriate format.

(c)  For higher grading opportunities, you should also be able to create a table to compare the performance of each algorithm, with a suitable paragraph to describe the overall results.

(d) Write at least one paragraph to suggest at least two possible factors relating to the software used to compute π (i.e. the programming language and code) which could affect the performance of your computational code.  You should be able to refer back to concepts already covered in Tasks 3 and 4.

(e) Write at least one paragraph to describe at least two possible factors relating to the hardware used to compute π which could affect the performance of your computational code. You should be able to refer back to concepts already covered in Task 2.

6. Conclusion

Write a suitable conclusion for your work. Try to write three clear stages in your conclusion, in reverse order to the stages in the introduction.

Structure and content of the project report

The project report should be typeset using the LaTeX template provided in Overleaf. The word count should be 1500 words. The following is a list of the required sections with required word counts and guidance on the content of each section.  Use the features in Overleaf to determine your word count for each of your sections, and include the section word count in the section title.

Try to stick to the word count for each section as closely as possible: the word limit is designed to stop you from adding too much irrelevant detail; your grade for each section will be affected if your are significantly under or over the specified word count.

Do not enumerated lists e.g.   1  (a)  in your  report:  just  use  clear sections, subsections and paragraphs. Make sure your paragraphs have a clear, appropriate topic sentence and are of an appropriate length - not too short and not too long.  In Overleaf, just leave a blank line between paragraphs: the spacing will be automatic.

Do not write your report in a word processor such as Microsoft Word and then try to copy/paste into Overleaf: this will result in errors. Just type directly into Overleaf. Your tutor can provide extra support with using Overleaf/LaTeX.

1. Introduction (150)

Writing the introduction is good practice for your academic writing skills.  Keep the intro- duction brief. Try to follow a standard three-stage structure: general context; specific topic; specific aims of the assignment. You can get some ideas from the Description part of this assessment brief.

2. Hardware (300)

This is quite a technical task, requiring research.  Try to use appropriate sources as dis- cussed in class.  Remember to add your sources to the references. bib file and use the \cite{} command within your paragraphs.

Guidance for each sub-task:

(a)  Remember to draw the diagram yourself using the software discussed in class. Make sure each part of your diagram is labelled so that you can refer to them in your writing. Write clear paragraphs; do not use bullet points or enumerated lists. Use the correct \begin{figure}..\end{figure} environment to include a PNG or JPG of your dia- gram, and refer to it using Figure  \ref{fig:label}, making sure that your figure has a unique cross-referencing label.  Refer to manufacturer data or data sheets for up-to-date information wherever possible.

(b) Write clear paragraphs and make sure to refer back to the concepts/parts on your diagram.

(c)  If you struggle showing the floating-point values in binary using LaTeX, you can write neatly on paper (as we did in class) and show scan of your paper as a figure.

(d)  Discuss with your tutor the best method for obtaining CPU information using Linux commands. For the server, your tutor will have to give you access to the main server using a special login.

3. Software (300)

This is a shorter task that the other tasks, and you should not spend as much time on this task as the others. You should be able to complete this task with little research, using topics discussed in class and your own knowledge and experience.

Guidance for each sub-task:

(a)  Make sure to follow the task: keep your descriptions limited to the key areas identified in the task. This is standard information, but make sure to write in your own words: do not copy and paste directly from internet-based sources.

(b) This is where you can show whether you understand how the choice of programming language can affect the performance of an algorithm. Think about the topics covered in class.

4. Implementation in code (300)

This is the main programming task. The programming activities should be carried out in the workshop sessions (second lesson of the week) using the computer science server and workstations.

Guidance for each sub-task:

(a)  Everyone should be able to complete the C code to implement the basic algorithm. Get that one working first before moving on to the intermediate and advanced algorithms. Remember to use the standard C file structure we used in class.

(b) Your tutor will track your progress in developing your code in the workshop sessions: you can only achieve a pass or higher grade if you can show the stages in the devel- opment of your code and that it works.

(c)  Stick to the word count for the documentation.  Present your flow diagram as a figure, and your code and console output as appropriate listings in an appendix, as demon- strated in class.

(d)  For higher grading, show how you have translated your C code into Python; in your documentation, briefly explain the key differences between your C and Python code. You may make use of the Python NumPy package, which is installed on the computer science server.

5. Results and discussion (300)

This task is where you can demonstrate a good understanding of the limitations of com- puters, in terms of both hardware and software, when required to undertake many complex computations.

Guidance:

(a) You just need to show the results of your manual calculations:  you do not need to show photos or scans of handwritten calculations. You can include scans of manual calculations in an appendix if you wish.

(b)  Use the \begin{table}..\end{table} environment to create the table, as demon- strated in class, and refer to it using cross-referencing in your main paragraphs.  Re- member to use the \num{} command to show all numbers correctly.

(c) When comparing each algorithm, focus on the number of iterations required to reach the desired level of accuracy.

(d) This is were you can demonstrate your understanding by linking back to features dis- cussed in the hardware and software tasks of the assignment.

6. Conclusion (150)

Writing the conclusion is good practice for your academic writing skills. Keep it brief: try to follow the standard three-stage structure used in your introduction but in reverse. At the end of your conclusion, you could make some recommendations for future studies, experiments or work.

7. References

This section will be produced automatically by the LaTeX document in the appropriate IEEE style if you use the \cite{} command within your report and accompanying entries in your references. bib file. Try to cite relevant textbooks and articles to support your work. You are more likely to use internet sources for this assignment, as it refer to technology which is always changing at a fast pace. Try to evaluate the credibility of your sources before using them, as discussed in class.

8. Appendices (with code listings)

This section will be produced automatically by the LaTeX document if you upload your code file to your Overleaf project and use the correct \lstinputlisting command to include your code file.  Make sure you have an appropriate title for each appendix section, and an appropriate caption for each code listing or console output listing.  Follow the guidance provided in class.