Please edit this file in text editor and submit to Quercus. You will earn up to 19% of the course mark for the whole exam, quiz and written problem(s) have equal weight. Your name and student number: ................ PHYD57. Midterm exam 1 Mar 2022 - Problems Outline a well commented C(++)/Fortran program. Use as many comment lines as you please, but do explain each line that does something. Small mistakes in syntax will not be counted against you. Random photon path Write in C(++) or Fortran program that simulates a random walk in 3-D of a photon inside a star. The photon starts at the origin of (x,y,z) system and each coordinate changes from -1 cm to +1 cm in each of N = 1024**3 (about 1 billion) steps. To provide the random numbers in the [-1,+1] range with a physically plausible probability distribution, a separate fast procedure called Rnd(tab) is available. That is, if tab is a 1-D float/real array of length 3N, then calling the procedure as "Rnd(tab);" in C, or in Fortran "call Rnd(tab)", you will quickly fill the whole array with random numbers. The program needs to be multithreaded via OpenMP (omp) to make simultaneous use of 16 available CPU threads. Make sure that you construct 1 continuous path, not 16 different paths in your code, and that the code is parallel not serial, yet if run with 1 thread only would return the same results. The final trajectory should be contained in 3 float/real arrays of length N, called x, y, and z. PHYD57. Midterm Exam 2022. QUIZ Edit this text file. Leave only one, Y[es] or N[o], then sign and submit this test in this file. Statements may be tricky, so read carefully. A single word or number may be incorrect. Any "[N]" answer MUST have at least one wrong word or number highlighted by enclosing them in << >> brackets. Please disregard typos. Symbol % stands for command-line prompt, symbol ^ is a power operation, e.g. 3^2 = 9. To make up for unintended ambiguity of the questions, 2 points will be added to your result. Good luck! [Y N] Antikythera Mechanism was the first known digital+analog portable computer of times of lunar and solar eclipses, positions of planets, olympiads etc. [Y N] IP packets sent over Internet contain detailed information such as the so-called MAC addresses, allowing unique identification of the sending equipment. [Y N] Numpy is faster than straight Python because it is multi-threaded and pre-compiled in other languages [Y N] icpc is a GNU compiler able to traslate C, C++, Fortran and Python programs [Y N] OpenMP language assumes shared memory access, that is all the threads it creates must have access to the same operational memory (RAM). [Y N] In 1944, Atanassov and Berry computer was built by British engineers for use in ballistic calculations of artillery shell motion in air. It also solved linear algebra equations. It used thousands of vacuum tubes. [Y N] Break-in attempts to Linux can be blocked by removing or changing /var/log/secure file [Y N] Simpson's integration method is 4th order [Y N] Assembly program is a series of low-level processor instructions, e.g. using registers [Y N] A 4-Byte integer can represent all numbers from 0 to 2^{32} inclusive [Y N] Scanning momory allocated to a 3-d array in Fortran from start to end, the first index of the array changes fastest and the last index most slowly. [Y N] option -openmp of Intel compiler makes sure OpenMP is de-activated (ignored) [Y N] In the same number of clock cycles a CPU can perform 30 aritmetic operations or fetch a randomly positioned number from RAM; thus fetching blocks of RAM into cache [Y N] Density of transistors on an integrated circuit has just reached 1 MT/mm^2 (1 million transistors per mm^2). [Y N] Double semicolon in the C loop: for (i,j,k=0;;) {(...)} is a syntax error [Y N] IBM computers in 1960s were mostly leased at high cost to wealthy businesses and universities. In the 1970s, Digital Equipment Corp (DEC) disrupted that model by selling a 100x cheaper minis: PDP-7 to PDP-11. [Y N] Java is a relatively new language, created for parallel computing of a scientific problems. [Y N] Operating system Unix was created at AT&T Bell Labs on PDP-series minicomputers [Y N] Currently, the single-thread performance of processors grows by a factor of 2 in about 2 years. [Y N] In Linux, a wave (tilde) means home directory of user; .. means parent of the current directory [Y N] %hostname in Linux prints the name of host computer; %ssh does secure file transfer [Y N] Command %rm /home/user/output*2.dat removes files in /home/user, such that any single character can be in place of "*". [Y N] Intel corp. produced a microprocessor called 8086 in late 70's. It was a 16-bit CPU. Later processors had compatible instruction sets, called x86_, for instance x86_64 is a family of 64-bit processors by Intel and AMD.) [Y N] Debian, Linux, Fedora, Red Hat etc. are flavors (versions) of Unix OS [Y N] OpenMP has directives for making variables private, i.e. creating copies of variables that are only known to a given thread of the program. [Y N] Single precision floating point number is 8 Bytes long, and has 6 to 7 accurate decimal places [Y N] If you parallelize a loop by OpenMP directive, the threads remain alive and usable after the loop ends. A separate directive needs to be issued to collapse the fork of multiple threads to a single thread. [Y N] Charles Babbage obtained in early 19th century a grant to build "Differential Engine" to compute astronomical & math tables. The project was mostly successful but it was not a general calculator that could do */+- operations. [Y] I have signed the front page of exam with my name and student number. \end{document}