Question: The first homework focuses on Python fundamentals and Amdahl s law, which include: 1 . ( a ) Define a list with 2 0 elements
The first homework focuses on Python fundamentals and Amdahls law, which include:
a Define a list with elements and assign the elements with random integers
between sort the list and print the result. After sorting the list, calculate the
sum of the elements at even locations ie a a a a a
b Calculate the mean, median, standard deviation of the list. Also, calculate the based
logarithm values of the list elements. Hint: use functions in modules statistics and math.
Using Python, define a list with elements and assign the elements with random
integers between Then complete the following tasks: define a function
myfunc which take one argument and check if the argument is prime, if yes, return
True, otherwise, return False; apply the builtin map function to the list and use the
based logarithm function of the math module to calculate the value of each element
in the list, apply the builtin filter function the list and use the myfunc function to filter
the prime numbers; redo part but instead of calling the function, in the filter
function, write a lambda expression to implement the same functionality.
a Given a program, its total running time is t using a single processor ie running
the program serially If of the program ie of t can be executed parallelly,
according to Amdahls law, what will be the speedup if running the program parallelly
on a computer with processors or CPU cores If unlimited processors are available
in the computer, what is the maximum speedup?
b What is superlinear speedup? Under what conditions will it happen?
c Given a program which searches the target data in a sequence of data, assume
i without knowing the location of the target data, the CPU will examine the data one
by one; ii the whole program can be executed parallelly and the program will stop
immediately once the target data is found; and iii the programs running time except
data searching can be ignored, please calculate:
If the target data is the rd in the sequence, what is the speedup gained by
running the program using CPUs over running the program using CPU.
Note: by default, the data will be equally dispatched to the CPUs ie CPU
processes data ; CPU processes data etc.
If the target data is the th in the sequence, what is the speedup by running the
programing using CPUs?
If the target data is the th in the sequence, what is the speedup by running the
programing using CPUs?
Turn in source code in py file. Add your name, student ID and HW number at the
beginning as comments. For problem please turn in the electronicscanned
copy of your calculation.
Due: Friday, September
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
