CSE3100编程语言 辅导、 写作c/c++,Java

” CSE3100编程语言 辅导、 写作c/c++,JavaFinal Project CSE3100 Due 2020-12-07 20:00Final ProjectThis project starts Friday Dec 4 at 8AM and ends Monday Dec 7 at 8PM. It should not take anywherethis long to complete it. The ample padding is to deflect issues that may occur with MIMIR. I encourageyou to take into account the fact that MIMIR is open during business hours on weekdays. You are unlikelyto get assistance from them over the week-end. So please, plan accordingly.You may use your notes, textbook, PDF of textbooks and laptop to access Mimir. You cannot useStackOverflow, Chegg, or any other online sources. Plagiarism checks are in full force. Cheating on theproject will be severely punished (it will lead to an immediate F).Each question is evaluated with several test scripts that exercise dierent capabilities of your program.Therefore you can earn partial credit on a question by only passing some of those tests. Also note thateach question come with some base including a Makefile. We urge you to test in your environmentand not simply submit to Mimir as this increases the load on their servers. Once again, we emphasizethat gdb and valgrind are extremely useful tools that you should not neglect.There are a handful of questions on this test. Read the description carefully and attentively beforediving into the code. I wish to emphasize that hard coding answers to test scripts will not earn youany points. You need to write the code that solves the problem.I have Spoken. – KuillQ1. We shall multiply 20 pointsFor this question, head into the folder Q1. It contains a Makefile and minimal starter code. Your taskis to write a program that reads and multiply matrices. Your program takes, on the command line, 3arguments denoting the names of files containing two matrices and the number of processes you areexpected to use to carry out your task. For instance, running1 ./matrix m1.txt m2.txt 2Will execute the matrix Multiplication on the matrices in the files m1.txt and m2.txt and use two subprocesses to carry out this task.Matrix RefresherRemember that a matrix is a n by m 2D array with n rows and m columns. For instance,A multi-process approachGiven two matrices A and B, where A has n rows, to speed up the task with k processes, it is natural toslice the first matrix into k bands, in which each band contains (approximately)rows. (If n does not divides equally into k, spread the r remaining rows over the first r bands. Forinstance, with n=10 and k=4, 10/4=2 with a remainder of 2 and therefore we would have 4 bands with[3,3,2,2] rows each. Then each child process is tasked with computing his part of the product for therows entrusted to it. In this example, the first worker would multiply the first 3 rows of the first matrixby the second to obtain the first 3 rows of the result while the second worker would work on the next 3rows of the first matrix and multiply them by the second to obtain the second block of three rows ofthe result.This division of labor technique splits the work as evenly as possible among the k workers involvedand leaves the multiplication algorithms essentially untouched.Putting it togetherYour program must read the two input matrices, compute the product with k sub processes (as specifiedon the command line) and print the resulting matrix on its standard output (in row major mode), onerow of the matrix per line of output (do not output the size of the result, only its content). Your codeCSE3100 2Final Project CSE3100 Due 2020-12-07 20:00should be able to handle arbitrarily sized matrices and should experience a speedup once we use morethan one process.You are free to use the Communication technology of your choice to answer this question (thoughsome are easier than others for this purpose). Recall that you should not be using threads.Q2. Its the ship that made the Kessel run in less than twelve parsecs. 40 pointsFor this question, head into the folder Q2. Your task is to compute a histogram for a function f of atext (sequence of bytes) as quickly as possible. Interestingly, your grade is a function of how fast yourcode is going to be. I suggest compiling with the optimization flags turned on (i.e., -O3). Naturally, youshould expect to use the best algorithms and technique you know as well as threads to get to whereyou want to be.Consider that a text is a sequence of n bytes [t0, t1, …, tn 1], then your task is to compute a histogramh over the sequence of n-1 pairs [f(t0t1)f(t1t2), …, f(tn2tn1)] where the function f is modularexponentiation and is defined asf(a, b) = ab mod 256To make your task easier, we provide a C function for modular exponentiation:1 long modPow(long base,long exp,long m) {2 if (m == 1) return 0;3 long c = 1;4 for (long ep=0;ep = exp – 1;ep++)5 c = (c * base) % m;6 return c;7 }Observe how all the values in [f(t0, t1)f(t1, t2), …, f(tn2, tn1)] belong in the interval (0..255) andyou can therefore compute the histogram of this sequence, i.e., the number of occurrences of eachvalue in the range 0..255.i 0..255 : hi = |{k 0..n 2 : i =ttk+1k mod 256}|ImplementationIt might be wise to first Obtain a sequential implementation. If you create a program seqHisto, thenexecuting the command1 ./seqHisto file.txtCSE3100 3Final Project CSE3100 Due 2020-12-07 20:00on a file containing the four bytes [a,b,c,d] would produce the histogramConveying that the values 0,81 and 193 appeared once while all the other values (252 of them) areabsent.Note how the four bytes array is an array of 4 characters, i.e., it could be defined in C by the statement:1 char t[4] = {a,b,c,d};Since its length is 4, it yields 3 windows, i.e., [(a,b), (b,c), (c,d)] and thus,using modPow one obtains the three values [193,0,81]. Indeed, the ASCII code of [a,b,c,d] are, in decimal, [97,98,99,100] and therefore one computes[9798 mod 256, 9899 mod 256, 99100 mod 256]which is equal to [193,0,81].Once you have a correct version of the program, the fun begins. Your task is to pull all the stops tomake your submission as fast as possible. Your graded submission will be named histo and take twoarguments. First the Name of a file to read and second, an upper bound on the maximum number ofthreads you can use. For instance, doing1 ./histo file.txt 10would invoke histo on a file named file.txt and can use up to 10 threads. Note that you can prefixyour command with the keyword time to measure the runtime of your executable. Namely,1 time ./histo file.txt 10outputs the runtime of the command.We provide one test file (E.coli) in your handout to test with.Your submission will be compared against several implementation that are increasingly better at thisgame. Keep in mind that you will be tested on large files (megabytes).CSE3100 4Final Project CSE3100 Due 2020-12-07 20:00Q3. Stayin alive, stayin alive. Ah, ha, ha, ha, stayin alive, stayin alive 40 pointsPreliminariesFor this question, head into the folder named Q3. John Conway invented a fun 0-player game knownas the Game of Life. You should first head to httpss://playgameoflife.com and play with the web-basedsoware to see what can be done. The game of life is played on a nxm board which you can makeinfinite by wrapping around in both directions, turning it into a donut (thoroid). The board evolvesthrough generations. At each generation, each cell present on the board will see its state change basedon its own current value and the value of its neighbors (the 8 cells surrounding it)..The Figure above shown in gray the 8 cells surrounding cell (i, j). The update rule for cell (i, j) issimply: (i, j) is ALIVE in generation k. Then the status of cell (i, j) in generation k+1 depends on thenumber of neighbors that are alive in generation k. 0,1 living Neighbors: (i, j) is dead in generation k+1 2,3 living neighbors: (i, j) survives and is alive in generation k+1 4,5,6,7,8 living neighbors: Its too crowded. Cell (i, j) is dead in generation k+1. (i, j) is DEAD in generation k. Then life may sprout in (i, j) at generation k+1 if there are exactly3 live neighbors of (i, j) at generation k.To produce interesting behavior one can start with an initial board containing a specific pattern. Forinstance, a provided text file data.txt contains a glider pattern. You will find in your git repository asequential implementation of the game of Life that runs the simulation starting from a n m boardstored in a text file whose name is given in argument. The C implementation is straightforward andanimates the Computation on the terminal. At the end, it saves the final board to a text file namedfinal.txtCSE3100 5Final Project CSE3100 Due 2020-12-07 20:00Your taskSince you receive the sequential implementation, you should first study it to make sure you understandhow it works. Once this is done, you can turn your attention to your task.Your are to implement a multi-threaded version lifeMT that takes on its command line the name of afile holding a starting board, the number of generations to simulate and the number of threads to useto speed up the simulation.For instance, doing1 time ./liveMT board.txt 10000 4runs the simulation on the board.txt for 10000 iterations using 4 threads and spits out the final board ina file named final.txt. As you might expect, to speed up the simulation, you should no longer drawnthe board aer each generation and only produce the final result.You are to be judged on correctness and performance. You should have the correct board at the end ofthe game and if you use multiple threads, you should see shorter computation times. You are free todevise a strategy for decomposing the work amongst the participating threads. Lets observe thoughthat the board is a 2D matrix that is nxm in size and that using the same banding trick as in Q1 mightprove handy.Nonetheless, the Necessity to handle all generations adds a level of complexity over what you alreadymastered in Q1.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导