CS4414: Examples from lecture 1

Some people asked to see the code for the little demo I ran.  No problem but as of today very people people would be able to actually understand any of the code, or run it. Still, you asked, so here it is:

wc++.tar --  This is Sagar's code.  It wants two arguments: the path to the Linux source files, and the number of threads to run.  You need to use "taskset" to tell it which cores it can use (for example, taskset 0xFF ....)

WordCount.java  --  This is Lucy's Java code.  It wants one argument: the path to the Linux source files.

WordCount.py  --  Lucy's Python version.  Same thing: run it with the path the Linux source files.

 

ken-wc.tar -- This is my version; it was definitely fastest, but Sagar considers my C++ coding style to be pretty messy.  And he's right!  I learned C long before C++ and I find it hard to really get fully into sync with C++, even though the language is unquestionably a better one, which is why Sagar is the actual person teaching C++.  Learn it his way, not my way.  But having said this, if you want to run it, compile with "compile.sh" and then it runs like the others, except that before the directory name you specify -nx to tell it to use x cores, -p to tell it to do a parallel word-count merge, -bx to tell it how many file system blocks to read at a time, -s to silence the output (if you don't want to see the output), and you also need taskset.  So: "time taskset 0xFF ./fast-wc -n4 -b2 -p -s ../linux-5.8-rc7".  This particular run would be silent, 2 blocks at a time (1024 bytes), parallel merge, 4 cores. 

 

Linux command:

time find linux*  -type f \( -name '*.c' -o -name '*.h' \) -exec cat {} \; |  tr -c '[A-Za-z0-9_ \012]' ' ' | tr -s '[ ]' '\012' | sort | uniq -c | sort -r -n > words &

These programs all expect to be in a directory one level "below" the home directory, and in my tests, I put the source files for linux in a folder linux-5.8-rc7 in the home directory.  So to run them, you would also need the source files... download those from linux-5.8-rc7.