Sunday, November 27, 2011

Quarter II, Week 3: ScreenCasts, SmartNotes and Code, oh my!

Wow, this was an exceptionally short week. Calculus had a preTest and Test. preCalculus had a re-preTEST and a reTEST. The computing classes did some new stuff (see below) and then Wednesday was National BZFlag Day in honor of Thanksgiving!

AP Computer Science spent all week debugging C5X7 StringSorter.java using compareTo() and equals() methods from the String class.
C5X1 StringSorter.java





Computer Math finished Chapter 4 on Sequences and Series and started Lab 4!
CM 404 Infinite Series
https://clemix.clemson.edu:34567/home/pub/252

Calculus Research Lab started 4.11 about derivatives of inverse functions!

CRL 411 Differentiating Inverse Functions




HTH and I hope you enjoyed this week's notes!


Learning with Technology, 

Saturday, November 26, 2011

CIS(theta) 2011-2012 - Scaling the Cluster! - Meeting VI

The following is a summary of what we've accomplished so far with the 2011-2012 CIS(theta) team. Our new Shadowfax Cluster is coming along quite well. We have a nice base OS in the 64bit Ubuntu 11.04 Natty Narwhal Desktop on top of our AMD dualcore Athlons and gigE LAN. The Unity Desktop isn't that different from the Gnome Desktop we've been using these past few years on Fedora and Ubuntu. Natty is proving very user friendly and easy to maintain! This week we installed openMPI and we used flops.f to scale our cluster to 14 cores! Remember, we needed openSSH public keys so openMPI can scatter/gather cluster jobs without the overhead of logging into each node as needed. We created a user common to all cluster nodes called "jobs" in memory of Steve Jobs so the cluster user can simply log into one node and be logged into all nodes at once (you can actually ssh into each node as "jobs" without specifying a userid or passwd)!
InstantCluster Step 1: Infrastructure
Make sure your cores have enough ventilation. The room has to have powerful air conditioning too. These two factors may seem trivial but will become crucial when running the entire cluster for extended periods of time! Also, you need to have enough electrical power, preferably with the cabling out of the way, to run all cores simultaneously. Don't forget to do the same with all your Ethernet cabling. We have CAT6E cables to support our gigE Ethernet cards and switches. We are lucky that this step was taken care of for us already!

InstantCluster Step 2: Hardware
You need up to date Ethernet switches plus Ethernet cards and cores as well as plenty of RAM in each Linux box. As stated above, our gigE LAN and switches were already setup for us. Also, we have 64bit dual-core AMD Athlons and our HP boxes have 2GB of RAM. We are still waiting for our quad-core AMD Phenom upgrade!

InstantCluster Step 3: Firmware
We wasted way too much time two years ago (2009-2010 CIS(theta)) trying out all kinds of Linux distros looking for a good 64bit base for our cluster. Last year (2010-2011 CIS(theta)) we spent way too much time testing out different liveCD distros. Last year, we also downgraded from 64bit Ubuntu 10.04 Desktop edition to the 32bit version on our Linux partitions. 64bit gives us access to more RAM and a larger maxint, but was proving to be a pain to maintain. Just to name one problem, jre and flash were hard to install and update on FireFox. Two years ago, we tried Fedora, Rocks, Oscar, CentOS, Scientific Linux and, finally, Ubuntu. We've done this several times over the years using everything from Slakware and KNOPPIX to Fedora and Ubuntu! This year, 64bit Ubuntu has proven very easy to use and maintain, so I think we'll stick with it for the cluster!

InstantCluster Step 4: Software Stack I
On top of Ubuntu we need to add openSSH, public-key authentication (step 4) and openMPI (step 5). Then we have to scale the cluster (step 6). In steps 7-10, we can discuss several applications to scatter/gather over the cluster whether it be graphical (fractals, povray, blender, openGL, animations) or number crunching (C++ or python app for Mersenne Primes or Beal's Conjecture). So, what follows is a summary of what we did to get up to plublic-key authentication. This summary is based on the http://cs.calvin.edu/curriculum/cs/374/MPI/ link listed below. First, we installed openSSH-server from http://packages.ubuntu.com, then:
  1. If you have no .ssh directory in your home directory, ssh to some other machine in the lab; then Ctrl-d to close the connection, creating .ssh and some related files. 
  2. From your home directory, make .ssh secure by entering:
    chmod 700 .ssh
  3. Next, make .ssh your working directory by entering:
    cd .ssh
  4. To list/view the contents of the directory, enter:
    ls -a [we used ls -l]
  5. To generate your public and private keys, enter:
    ssh-keygen -t rsa
    The first prompt is for the name of the file in which your private key will be stored; press Enter to accept the default name (id_rsa).The next two prompts are for the password you want, and since we are trying to avoid entering passwords, just press Enter at both prompts, returning you to the system prompt.
  6. To compare the previous output of ls and see what new files have been created, enter:
    ls -a [we used ls -l]
    You should see id_rsa containing your private key, and id_rsa.pub containing your public key.
  7. To make your public key the only thing needed for you to ssh to a different machine, enter:
    cat id_rsa.pub >> authorized_keys
    [The Linux boxes on our LAN, soon to be cluster, have IPs ranging from 10.5.129.1 to 
    10.5.129.24 So, we copied each id_rsa.pub file to temp01-temp24 and uploaded these 
    files via ssh to the teacher station. Then we just ran cat tempnn >> authorized_keys 
    for each temp file to generate one master authorized_keys file for all nodes that we could 
    just download to each node's .ssh dir.]
  8. [optional] To make it so that only you can read or write the file containing your private key, enter:
    chmod 600 id_rsa [optional] To make it so that only you can read or write the file containing your authorized keys, enter: chmod 600 authorized_keys
InstantCluster Step 5: Software Stack II
We then installed openMPI (we had a lot less dependencies this year with Natty 11.04 64bit) and tested multi-core with flops. Testing the cluster as a whole will have to wait until the next meeting when we scale the cluster! We followed openMPI install instructions for Ubuntu from http://www.cs.ucsb.edu/~hnielsen/cs140/openmpi-install.html
These instructions say to use sudo and run run apt-get install openmpi-bin openmpi-doc libopenmpi-dev However, the way our firewall is setup at school, I can never update my apt-get sources files properly. So, I used http://packages.ubunutu.com and installed openmpi-bin, gfortran and libopenmpi-dev. That's it!
Then we used the following FORTRAN code to test multi-core. FORTRAN, really? I haven't used FORTRAN77 since 1979! ...believe it or don't!
We compiled flops.f on the Master Node (any node can be a master):
mpif77 -o flops flops.f
and tested openmpi and got just under 800 MFLOPS using 2 cores (one PC):
mpirun -np 2 flops
Next, we generated a "machines" file to tell mpirun where all the nodes (Master and Workers) are (2 PCs or nodes with 2 cores each for example):
mpirun -np 4 --hostfile machines flops
Every node has the same "machines" text file in /home/jobs listing all the IPs, one per line. Every node has the same "flops" executable file (or whatever your executable will be) in /home/jobs. Every node has the same "authorized_keys" text file with all 25 keys in /home/jobs/.ssh 
Note: last year we got about 900 MFLOPS per node. This year we still have 64bit AMD athlon dualcore processors. However, these are new PCs, so these athlons have slightly different specs. Also, last year we were running Maverick 10.04 32bit ... and ... these new PCs were supposed to be quadcores! We are still awaiting shipment.

InstantCluster Step 6: Scaling the cluster
Including myself, we only had 3 members attending this week. So, we added 3 new nodes. We had nodes 21-24 working well last time. Now we have nodes 19-25 for a total of 7 nodes, 14 cores and over 5 GFLOPS! We streamlined the process: 
(1) adduser jobs and login as jobs 
(2) goto http://packages.ubuntu.com and install openssh-server from the natty repository 
(3) create /home/jobs/.ssh dir and cd there 
(4) run ssh-keygen -t rsa 
(5) add new public keys to /home/jobs/.ssh/authenticated_keys to all nodes 
(6) add new IPs to /home/jobs/machines 
(7) goto http://packages.ubuntu.com and install openmpi-bin, gfortran and libopenmpi-dev 
(8) download flops.f to /home/jobs from ftpsite compile and run! 
The secret is setting up each node identically. That's it!
===================================================
What we are researching III 
(look at some clustering environments we've used in the past):
We used PVM PVMPOV in the 1990s.
Let's try out openMPI and Blender now!
http://www.blender.org
===================================================
What we are researching II 
(look what other people are doing with MPI):
MPI intro, nice!
Sample MPI code
http://www.cc.gatech.edu/projects/ihpcl/mpi.html
===================================================
What we are researching I 
(look what this school did in the 80s and 90s): 
Thomas Jefferson High courses
Thomas Jefferson High paper
Thomas Jefferson High ftp
Thomas Jefferson High teacher
http://www.tjhsst.edu/~rlatimer/
===================================================
Today's Topic:
CIS(theta) 2011-2012 - Scaling the Cluster! - Meeting VI
Today's Attendance:
CIS(theta) 2011-2012: GeorgeA, LucasE CIS(theta) 2010-2011: JoshG, RyanH
Today's Reading:
Chapter 3 Building Parallel Programs (BPP) using clusters and parallelJava
===================================================
Well, that's all folks, enjoy!

Friday, November 25, 2011

Where have you been all my life, Python?


I suppose that I've been spoiled having entered the world of python via SAGE (computer algebra systems, scientific computing, etc). As you can see in the video above, I've been using SAGE, http://www.sagemath.org and http://www.sagenb.org, in class for some time. I officially introduced SAGE to my high school last year in Computer Math, my introCS class. We use SAGE to run python studying Discrete Mathematics using Gary and Maria Litvin's text http://skylit.com/mathandpython.html which has proven very useful in class. This year I also started a new course entitled Calculus Research Lab using SAGE as a Computer Algebra system to investigate concepts in Calculus using free online Calculus texts in pdf: http://sage.math.washington.edu/home/wdj/teaching/calc1-sage/ and http://wdjoyner.com/teach/calc2-sage/hoffman-stein-calculus.pdf and http://sage.math.washington.edu/home/wdj/teaching/DiffyQ/des-book.pdf


I only just recently bothered to install IDLE and write source files such as turtleTester.py in Ubuntu. Apparently, the current Ubuntu liveCD ships with python 2.6 and turtle.py is part of it. All I added to the mix was IDLE and I was good to go! Also, I installed the visual module (vpython) and have been playing with that in IDLE as well. In the video above Kirby Urner, a long-time proponent of using python in the mathematics classroom, shows off some of his work especially in geometry, group theory and object orientation. Apparently, there's a lot of math you can do with plain vanilla python!

BTW, you have to take a look at Ron Reiter's awesome website http://www.learnpython.org which has lots of python tutorials including turtle code online! All I had to do to use the turtle and visual modules offline is as follows. Python 2.6 and turtle.py are already installed by default in Ubuntu. So, I ran "sudo apt-get install idle" to make python more user friendly. You don't need IDLE to run python source code, but it makes it very easy for the students. Then I got vpython from the Ubuntu Software Center and vpython needs "sudo apt-get install libgtkglextmm-x11-1.2-dev." VPython works fine in Ubuntu now, but I can't rotate the image with my mouse. I have to look into that a bit.


I'm looking forward to doing a final project with my Computer Math class this year involving python's turtle graphics module or VPython 3D modeling or TI83/89 BASIC programming. In this video we have Gregor Lingl, a math teacher from Austria, showing off his turtle.py graphics module which is now standard in python 2.6 and above. His turtle module is an object oriented implementation of the classic logo language in python, http://el.media.mit.edu/logo-foundation/logo/turtle.html and http://www.rupert.id.au/microworlds/index.php and http://www.cs.berkeley.edu/~bh/v1ch10/v1ch10.html. This file
http://www.slideshare.net/calcpage2011/seven-waystouseturtle-pycon2009 is the pdf that goes with Gregor's talk. Here's some documentation http://svn.python.org/projects/python/branches/release25-maint/Lib/lib-tk/turtle.py for the turtle module from the python website. This is the turtle module http://svn.python.org/projects/python/branches/release25-maint/Lib/lib-tk/turtle.py itself. Here's Gregor's textbook http://thepythongamebook.com/en:resources:people:lingl_gregor:start and http://ada.rg16.asn-wien.ac.at/~python/index.html using the turtle module. This is more documentation http://docs.python.org/library/turtle.html and here's Gregor's website http://xturtle.rg16.at Here's the "Think Python" http://greenteapress.com/thinkpython/html/index.html text by Allen B. Downey with a chapter on turtle graphics.


This clip from Showmedo has Erik Thompson, a physics teacher, showing off the visual module or vpython teaching some physics concepts! Here's more videos http://vpython.erikthompson.com from Erik's website. This is the documentation http://vpython.org from the vpython website.

Here's another Showmedo by J. Unpingco about Scientific Computing with python in SAGE.


Well, that's all folks!

Teaching with Technology, 

Saturday, November 19, 2011

Quarter II, Week 2: ScreenCasts, SmartNotes and Code, oh my!

This was a long week making up for last week with Veteran's day on Friday and my being sick on Thursday....

AP Calculus BC finished CH5 on Anti Derivatives and will have a test next week. We covered Riemann Sums, definite vs. indefinite integrals, Fundamental Theorem of Calculus Parts I & II as well as U-Substitution! 
BC 506 LRTE.p89








BC 507 MTSE.p89







BC 509 Indefinite Integrals









BC 510 U-Substitution

PreCalculus for Seniors finished CH5 on using Inverse Functions to solve equations analytically and graphically. We focused mostly on exponential and logarithmic functions. We had a test yesterday, but it didn't seem to go over well! Maybe we'll review some more on Monday and reTest on Tuesday before GameDay on Wednesday (Thursday is TurkeyDay).
PRE 506 Compound Interest








PRE 507 Exponential Growth and Decay Word Problems




AP Computer Science started CH5 about conditional statements and predicate methods! We started with C4X6, renaming it C5X0, which we said needed if statements, but really didn't! C5X1 was a rewrite of C4X13 using a predicate method to guard against square rooting the discriminant of the quadratic formula when its negative! C5X2 was about using if statements to parse String input. C5X3 used if statements to sort 3 doubles. What about Math.min(Math.min(num1,num2),num3)???

C5X0+C5X1 DataSet.java and QuadraticEquation.java

















C5X2 Card.java












C5X3 Sorter.java









Computer Math is finishing Chapter 4 on Sequences and Series. I'm looking ahead toward a final project this year involving python's turtle graphics module or VPython 3D modeling or TI83/89 BASIC programming.
Note: 
python 2.6 is already installed by default in Ubuntu
turtle.py is already installed by default in Ubuntu.
run apt-get install idle to use python
get vpython from the Ubuntu Software Center
vpython needs apt-get install libgtkglextmm-x11-1.2-dev


CM 404 Infinite Series
https://clemix.clemson.edu:34567/home/pub/251


CM 405 Iteration and While loops in Python 2.6



Calculus Research Lab continued Lab 4.10 (even exercises) so we have nothing new to post. Recall, I only post new material. I do not post review sheets, labs, quizzes, tests or solutions as these are graded materials.


XTRA CREDIT: 
Can you figure out what the frak the following file is for???



HTH and I hope you enjoyed this week's notes!


Learning with Technology, 

Monday, November 14, 2011

The Paperless Office: How's your 21st Century Classroom's workflow?


OK, I've got this down to a science! This year, I'm ScreenCasting from a Linux desktop with a real SmartBoard as needed and focusing on AP Computer Science with java. I hope you have been enjoying all the new recordings! However, I'm also using recordings from prior years for preCalculus and AP Calculus. Next year I hope to record Computer Math and Calculus Research Lab.



Typically, I start a Math unit on http://www.edmodo.com with an assignment sheet listing daily topics, homeworks, quizzes and tests for a whole chapter of the textbook. These assignment sheets usually span 2-4 school weeks. I link to the appropriate MP4 file from http://www.youtube.com/calcpage2009 to Edmodo daily and Blogspot weekly. I also link the current PDF from http://www.slideshare.net/calcpage2011 to Blogspot weekly. Note: I don't record, upload or link anything to do with review material, quizzes, tests or solutions. For example, today I linked to pre506.mp4 on Compounded Bank Interest from Youtube to Edmodo as shown above. I also uploaded pre506.pdf to Slideshare for future reference!



A Computer unit on Edmodo usually starts with uploading the current chapter as a PDF of our etext. Then I upload the exercises for that chapter. Finally, I give out hardcopies only of the curent lab assignment or test. Again, I link MP4s from http://www.youtube.com/calcpage2009 to Edmodo daily and to Blogspot weekly. I also link from http://pastebin.com/u/calcpage or SAGE to Blogspot weekly. For example, I recorded C5X0X1.mp4 today and uploaded it to Youtube and linked it to Edmodo as shown above. Further, I uploaded C5X0_DataSet.java and C5X1_QuadraticEquation.java to Pastebin for the weeekly blog.

preCalculus 506 Compounded Interest

View more documents from A Jorge Garcia
In my Math classes, everything I do at the SmartBoard, including what I say, is recorded in real time! I attach a wireless lapel mic to my SmartBoard PC and run http://screencast-o-matic.com in the background. Screencast-o-matic renders the recording as an MP4 file that I upload to YouTube. SmartNotebook files can be exported to PDF and I upload these files to Slideshare as shown above. Actually, I'm using Xournal on 64bit Ubuntu this year instead of SmartNotebook as there's only a 32bit version for Linux, but the result is the same (I only use SmartNotebook as a pen app anyway).



My Computing classes are a little more keyboard intensive. I still use the lapel mic to record what I say as I type. However, for these classes I'm stuck at my desktop in the back of the room. I use a Bluetooth Wacom Gaphire 6x8 tablet to write on the SmartBoard remotely if need be. TXT files I type for these classes get uploaded to Pastebin as shown above. I also upload new MP4s from Screencast-o-matic for these classes to YouTube.

https://clemix.clemson.edu:34567/home/pub/251

I link all these files to my blog weekly and to Edmodo daily for students that are absent or want to review old topics. However, I do not link files from pastebin or slideshare to Edmodo anymore. I find that doing so just clutters up the Edmodo page for each class (Edmodo looks and feels a lot like Facebook). The result is a huge number of links from the beginning of a unit to the end making it hard to find the first postings when needed. The files on pastebin and slideshare do get linked to my blog on a weekly basis so students have access to written class notes whether it be SmartNotes as PDFs or code as TXTs. BTW, code for Computer Math and Calculus Research Lab is linked from my account on a SAGE server as shown above (CM 4.4 Infinite Series).

Well, that's all folks!

Teaching with Technology, 

Friday, November 11, 2011

Quarter II, Week 1: ScreenCasts, SmartNotes and Code, oh my!

AP Calculus BC continued CH5 on Anti Derivatives. 
BC 505 Left, Right and Trap Riemann Sums!


PreCalculus for Seniors continued CH5 on using Inverse Functions to solve equations analytically and graphically. 
PRE 504 Log Rules


PRE 505 Solving Equations using Logs!


AP Computer Science finished Lab 4 so I have nothing new to post. Sorry, I don't post anything to do with Labs, Quizzes or Tests. I only record new material, so I don't post anything to do with Homework Assignments or Review Sheets either! 

Computer Math continued Chapter 4 on Sequences and Series. 
CM 403 Series
https://clemix.clemson.edu:34567/home/pub/246

Calculus Research Lab continued the odd exercises in 4.10 and  started Lab 4.10 (even exercises)!
CRL 410 Differentiation Rules
https://clemix.clemson.edu:34567/home/pub/234

This was a very short week as we had Veteran's Day on Friday and I got sick on Thursday....

HTH and I hope you enjoyed this week's notes!


Learning with Technology,