This is an old revision of the document!
Gnuplot is a free, command-driven, interactive, function and data plotting program. It can be downloaded at https://sourceforge.net/projects/gnuplot/. The official Gnuplot documentation can be found at http://gnuplot.sourceforge.net/documentation.html.
It was originally created to allow scientists and students to visualize mathematical functions and data interactively, but has grown to support many non-interactive uses such as web scripting. It is also used as a plotting engine by third-party applications such as Octave.
The command language of Gnuplot is case sensitive, i.e. commands and function names written in lowercase are not the same as those written in capitals. All command names may be abbreviated as long as the abbreviation is not ambiguous. Any number of commands may appear on a line, separated by semicolons (;). Strings may be set off by either single or double quotes, although there are some subtle differences. See syntax (p. 44) and quotes (p. 44) for more details in the Gnuplot documentation (http://gnuplot.sourceforge.net/docs_5.0/gnuplot.pdf).
Commands may extend over several input lines by ending each line but the last with a backslash (\). The backslash must be the last character on each line. The effect is as if the backslash and newline were not there. That is, no white space is implied, nor is a comment terminated.
For built-in help on any topic, type help followed by the name of the topic or help ? to get a menu of available topics.
average IOPS = 1 / (average latency in ms + average seek time in ms).
Let's calculate the Rotational Delay - RD for a 10K RPM drive:
10000/60 = 166 RPS
1/166 = 0.006 seconds per Rotation
6/2 = 3 MS
3 MS + 3 MS = 6 MS
6 MS + 2 MS = 8 MS
1000/8 = 125 IOPS
Add in your archive the operations and the result you obtained. (Screenshot, picture of calculations made by hand on paper)
Calculate the Rotational Delay, and then the IOPS for a 5400 RPM drive.
$ iostat -xdm
Use iostat with -p for specific device statistics:
$ iostat -xdm -p sda
Add in your archive screenshot or pictures of the operations and the result you obtained, also showing the output of iostat from which you took the values.
$ df -kh /dev/loop*
Debian/Ubuntu Linux install iotop $ sudo apt-get install iotop How to use iotop command $ sudo iotop OR $ iotop
Supported options by iotop command:
Options | Description | |
–version | show program’s version number and exit | |
-h, –help | show this help message and exit | |
-o, –only | only show processes or threads actually doing I/O | |
-b, –batch | non-interactive mode | |
-n NUM, –iter=NUM | number of iterations before ending [infinite] | |
-d SEC, –delay=SEC | delay between iterations [1 second] | |
-p PID, –pid=PID | processes/threads to monitor [all] | |
-u USER, –user=USER | users to monitor [all] | |
-P, –processes | only show processes, not all threads | |
-a, –accumulated | show accumulated I/O instead of bandwidth | |
-k, –kilobytes | use kilobytes instead of a human friendly unit | |
-t, –time | add a timestamp on each line (implies –batch) | |
-q, –quiet | suppress some lines of header (implies –batch) |
Provide a screenshot in which it shows the iotop with only the active processes and one of them being the running script. Then another screenshot after you succeeded to kill it.
Linux allows you to use part of your RAM as a block device, viewing it as a hard disk partition. The advantage of using a RAM disk is the extremely low latency (even when compared to SSDs). The disadvantage is that all contents will be lost after a reboot.
Before getting started, let's find out the file system that our root partition uses. Run the following command (T - print file system type, h - human readable):
$ df -Th
The result should look like this:
Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 1.1G 0 1.1G 0% /dev tmpfs tmpfs 214M 3.8M 210M 2% /run /dev/sda1 ext4 218G 4.1G 202G 2% / <- root partition tmpfs tmpfs 1.1G 252K 1.1G 1% /dev/shm tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs tmpfs 1.1G 0 1.1G 0% /sys/fs/cgroup /dev/sda2 ext4 923M 73M 787M 9% /boot /dev/sda4 ext4 266G 62M 253G 1% /home
From the results, we will assume in the following commands that the file system is ext4. If it's not your case, just replace with what you have:
$ sudo mkdir /mnt/ramdisk $ sudo mount -t tmpfs -o size=1G ext4 /mnt/ramdisk
tmpfs /mnt/ramdisk tmpfs rw,nodev,nosuid,size=1G 0 0
That's it. We just created a 1Gb tmpfs ramdisk with an ext4 file system and mounted it at /mnt/ramdisk. Use df again to check this yourself.
As we mentioned before, you can't get I/O statistics regarding tmpfs since it is not a real partition. One solution to this problem is using pv to monitor the progress of data transfer through a pipe. This is a valid approach only if we consider the disk I/O being the bottleneck.
Next, we will generate 512Mb of random data and place it in /mnt/ramdisk/file first and then in /home/student/file. The transfer is done using dd with 2048-byte blocks.
$ pv /dev/urandom | dd of=/mnt/ramdisk/rand bs=2048 count=$((512 * 1024 * 1024 / 2048)) $ pv /dev/urandom | dd of=/home/student/rand bs=2048 count=$((512 * 1024 * 1024 / 2048))
Look at the elapsed time and average transfer speed. What conclusion can you draw?
Put one screenshot with the tmpfs partition in df output and one screenshot of both pv commands and write your conclusion.
Clone the repository containing the tasks and change to this lab's task 04. Follow the instructions to install the dependencies and build the project from the README.md.
$ git clone https://github.com/cs-pub-ro/EP-labs.git $ cd EP-labs/lab_05/task_04
To run the project, simply run the binary generated by the build step. This will render a scene with a sphere. Follow the instructions in the terminal and progressively increase the number of vertices. Upon exiting the simulation with Esc, two .csv files will be created. You will use these measurements to generate plots.
Also pay close attention to your RAM!
Increase vertices until you have less than 10 FPS for good results.
We want to interpret the results recorded. In order to do this, we need to visually see them in a suggestive way. Plot the results in such a way that they are suggestive and easy to understand.
Explain the results you have plotted. Answer the following questions:
Go back to step b. and rerun the binary and make it run on your dedicated GPU. Redo the plot with the new measurements. You do not need to answer the questions again.
https://gist.github.com/abenson/a5264836c4e6bf22c8c8415bb616204a
If you use AMD, you can use the DRI_PRIME=1 environment variable.
Please take a minute to fill in the feedback form for this lab.