Archive | July, 2015

microservice

30 Jul

Three levels of practices that help learning: retrieval practice, teaching, re-creating

21 Jul

Copied from Scientific American, August 2015:

Retrieval practice does not use testing as a tool of assessment. Rather it treats tests as occasions for learning, which makes sense only once we recognize that we have misunderstood the nature of testing. We think of tests as kind of dipstick that we insert into a student’s head, an indicator that tells us how high the level of knowledge has risen in there — when in fact, every time a student calls up knowledge from memory, that memory changes. Its mental representation becomes stronger, more stable and more accessible.

Why would this be? It makes sense considering that we could not possibly remember everything we encounter, says Jefferey Karpicke, a professor of cognitive psychology at Purdue University. Given that our memory is necessarily selective, the usefulness of a fact or idea — as demonstrated by how often we have had reason to recall it — makes a sound basis for selection. “Our minds are sensitive to the likelihood that we’ll need knowledge at a future time, and if we retrieve a piece of information now, there’s a good chance we’ll need it again,” Karpicke explains. “The process of retrieving a memory alters that memory in anticipation of demands we may encounter in future.”

Comment:
“retrieval practice” is simple, to use it wisely, teachers should design test that needs to retrieval the most important things. In elemental/high school, I hated test questions in history class that ask me to give exact date of a not-that-important event. I would give score D to all history teachers who do such things in class.

We all know that the best way to know something is to teach it. This is a much higher level memory practice than the simple retrieval practice. To teach something, you actually need to organize the knowledge and present it in a way that is easy to follow. It is no wondering teaching something is much more effective than retrieval practice.

An even higher level of practice is “re-creating”, e.g to try to prove a math lemma/law before you see the proof in textbook, to ask yourself why we need the concept after we read the definition of a math concept, to try to put your foot in the shoes’s of whoever created the concepts/theories — how would you solve the problem if you were him/her/them.

Update: after search online, I think this article from Time Magazine worth reading: The Protégé Effect

Run CUDA on Ubuntu 14.04 (Desktop)

19 Jul

What is CUDA?

Modern video card on desktop/laptop can be used for general parallel computing. CUDA is such a platform developed by Nivida. On my laptop, the Nvidia card has 96 CUDA cores. A desktop Nvidia card can easily have 1000 CUDA cores. For the purpose of simplicity, you can think of one CUDA core as one CPU core when doing some parallel math computations.

Setup CUDA 7 on Ubuntu 14.04 (Desktop)

My laptop has two video cards: one is intel HD, the other is Nvidia 5200M. Ubuntu uses the Intel card for GUI, Nvidia card is not activated. After quite a few search & try, I setup CUDA on my laptop. Below is the steps that works for me.

Hardware: Thinkpad T430s two video cards: Intel & Nvidia NVS 5200M
OS: Ubuntu 14.04 (Desktop)

  • Remove all Nvidia default driver in Ubuntu
  • Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nvidiafb
blacklist nouveau
blacklist rivafb
blacklist rivatv
blacklist vga16fb
options nouveau modeset=0

Regenerate the kernel initramfs: sudo update-initramfs -u

  • Remove all other Nvidia packages:
    sudo apt-get purge nvidia*
  • Search all packages related to nouveau: dpkg –get-selections | grep -v deinstall|grep -i nouveau, you might have to sudo apt-get purge xserver-xorg-video-nouveau-lts-vivid
  • Sometime you must run sudo update-initramfs -u so the initramfs can be purged of nouveau
  • Download CUDA 7 toolkit here, and then reboot Ubuntu to a text/console mode (basically hold shift key and then edit with ‘e’ and continue boot with ctrl-x. For detail help, see this), and then run the downloaded file:
$ sudo sh cuda__version__linux.run
  • When prompt, install Nvidia driver
  • When prompt, remember NOT to install OpenGL driver: I mistakenly installed OpenGL and got blank GUI when reboot.
  • Install CUDA toolkit & examples & reboot
  • verify your installation:
$ cd
$ cd 1_Utilities/deviceQuery
$ make
$ ./deviceQuery
./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "NVS 5200M"
CUDA Driver Version / Runtime Version 7.0 / 7.0
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 1024 MBytes (1073479680 bytes)
( 2) Multiprocessors, ( 48) CUDA Cores/MP: 96 CUDA Cores
GPU Max Clock rate: 1250 MHz (1.25 GHz)

What does not work

The nvidia-346 and nvidia-340 drivers in ppa:xorg-edgers/ppa do NOT work.

What if cuda does not work after laptop wake up from sleep

put following 2 lines in your /etc/rc.local

/usr/bin/nvidia-smi -pm ENABLED
/usr/bin/nvidia-smi -c EXCLUSIVE_PROCESS