Questions & Posts from Piazza
We see that there are some questions and posts on piazza which contain useful info that we would like to share so we copy them here:
Q: Are we suppose to just use array.sort on the sorting part where we have to use Array.sort and print out the last k number of sorted part ?
A: You use Arrays.sort only for testing that your own solution is correct and to report how much time Array.sort takes (Include the time measurements in the report).
Q: P? hvilke n-verdier kan man forvente ? f? speedup > 1?
A: Du kan i hvert fall forvente det ved n = 100 mill , men sannsynligvis f?r man det ogs? ved n = 1 mill.
- Maria
-----
Jeg tok en kjapp sp?rrerunde i begynnelsen av gruppetimen i dag. De aller fleste f?r speedup > 1 mellom n=1M og n=10M. Det kommer ann p? hardware og andre faktorer.
- Magnus
Q: Number of Threads
in the live coding I see that you guys are using "Runtime.getRuntime().availableProcessors();" to determine
the number of threads that are supposed to be initialised to get the job done, if I understood the idea right it means it is the "Runtime.getRuntime().availableProcessors();" statement which determines the number of threads which implies that we don't have control over the number of threads we want to initialise, for example if we want to increase the number of threads so we can get the job done faster what can we do?
A: TL;DR - You are free to replace the statement in question with whatever integer you see fit.
"Runtime.getRuntime().availableProcessors();" returns the number of cores the operating system says it has available (not necessarily idle, but online and ready for work).
You are free to specify any reasonable number of threads, for example, 4x the number of available cores, or 1/2 of them or just hardcode it to 2, 3, 7, 8 or whatever. It's up to you!
However, if your computer has X cores, and the task your threads is executing doesn't have (a lot of) I/O wait, you'll actually get poorer performance if you increase the number of threads past X.
Why is this? You tell us in your reports!
PS: Computers can have a varied amount of cores. My desktop has 12, my laptop has 4, margir.ifi.uio.no has 64. Will your code survive on all of them? (Hint: Last year some submissions crashed due to not expecting a different number of cores than what was on the students computers).
Note: Seq baseline Oblig1
You should not use Arrays.sort() as the sequential baseline for your measurements in Oblig 1. Use the sequential version of the algorithm as the baseline.
Note: margir.ifi.uio.no - 64 core server for your testing pleasure
Hello,
Just a quick note about a server you might find interesting, and where you can test your code on a many-core cpu.
margir.ifi.uio.no - 64 cores, 128GB ram
You need to be inside the IFI net to log on. If you're at home, just ssh to login.ifi.uio.no and then on to margir. Your home directory is mounted in the same fashion as the rest of the machines at IFI.
To check if someone else's code is running, the command 'top' can be useful. If the server is busy, just come back in a little while, and try again. This also means that no-one should run experiments that take a long time (more than say, 15 minutes).
Enjoy!
Magnus
#pin