Configureation PC
Configureation PC
G.A. Frank‡
Universidad Tecnológica Nacional, Facultad Regional Buenos Aires,
Av. Medrano 951, 1179 Buenos Aires, Argentina.
(Dated: February 1, 2018)
This article is intended as a starting point in the art of simulation. We will try to make it easy...
This is the very first step in computing simulation. This should inform you the device name for your
Here is a piece of advice: start with a simple, easy to USB. Alternatively, type lsblk for a shorter (and more
configure, multi-core computer. The minimum require- friendly) device name. For example,you may get sdf1
ment for making possible a computer simulation are for this last instruction. This means that your device
name is /dev/sdf (omit the number “1” in the device
(1) A stable operating system. name).
(2) An internet connection. You are now able to copy the linux image into your
(3) The specific software for your hardware. pendrive. Just type
sudo dd if=[Link]
A. Step 1: install the Linux distro of=/dev/sdf bs=4M; sync
where the line has been broken for space reasons only
Since you will only want to drop simulation jobs (do no break the line instructions in your terminal). The
into the box and get back the results, neither nice sudo command allows you to copy the image avoiding
environment nor strange software will be needed. any “permission denied” message. Of course, you will be
What you actually need is a stable operating system and asked for your personal password. The dd command is
a way for managing it through a terminal (in situ or not). a low level instruction for copying data block by block.
The bs=4M switch fixes the block size to 4MBytes. The
Download a small image of the operating system. For sync command dispatches the data out to the /dev/sdf
example, go to device.
[Link]
You are now ready for the linux installation! But,
and download any suitable image for your computer. If before the installation, make sure that the network
you do not know which is one is the correct image for your administrator has already provided you a working
computer, just try the x86_64 compatible image. Most connection. Just ask him!
systems are compatible with this architecture. Thus,
choose Unplug your pendrive and plug it into the computer
where the linux distro will be installed. Turn on the
[Link] computer and access the Bios at startup by pressing
either the F1, F2, F12, Del or Esc key (it depends on the
In order to install this image in your (new) computer, manufacturer settings). Change the BIOS boot order so
you will have to make a bootable USB-stick (or pendrive). the USB device option is listed first. Then, restart your
Get a pendrive with at least 300MB available and plug computer.
it into the USB port. Then, find out the device name for
this port by typing into a terminal window
1. No graphical installation
∗ ignaciosticco@[Link]
† fercornes@[Link] Do not choose the Graphical Install, just the sim-
‡ [Link]@[Link] ple Install option. Since this computer will be used for
2
computer simulations only, no graphical environments installation, you may enter the user login and password
will be needed. This will save hard disk space and avoid chosen previously) in situ or from a distant keyboard.
more complicated configurations.
Warning: if you have an Nvidia card, or any other
After you enter the installer, select the right options graphic card that needs a special driver, Debian will
for the language and regional settings. The installer will hang after (re)booting. You may surpass the hang up by
download all the needed packages through the internet pressing the “e” key at the Grub screen and typing at
connection. Allow the installer to configure the network the end of the line beginning with “linux”: nomodeset.
with DHCP automatically. Do not configure any proxy That will solve the problem, but not persistently (see
if not needed (just leave it as blank). below).
replace it by
3. Software selection
deb [Link] stable main
The Software selection menu is a very impor- contrib non-free
tant step during the configuration. Unselect the
Graphical desktop environment option since no (the line breaking has been done for space reasons only).
graphical environment will be used on this machine
(although you will be allowed to configure it at any time This will allow the installation of non-GNU software.
later). Select the SSH server and the Standard utilities. After you finish, save and exit (ctrl+o + ctrl+x). Then
The menu should look something like this before you type
continue.
apt-get update
apt-get install sudo
[ ] Graphical desktop environment
usermod -a -G sudo <username>
[ ] Web server
[ ] Print server where <username> means the username to which you
[ ] DNS server want to grant sudo access. Logout and Log into your user
[ ] File server (yes, logout and login, because otherwise the changes will
[ ] Mail server not take effect!) and run the following commands
[ ] SQL data base
[*] SSH server sudo apt-get update
[ ] Laptop sudo apt-get upgrade
[*] Standard system utilities
After the upgrade is complete, restart the system by
If you get a dialogue box asking if services can be typing sudo reboot.
restarted automatically during upgrade, choose yes.
In order to install the Nvidia CUDA package (that is, that no Nvidia software has been installed yet, and
the CUDA driver, CUDA toolkit and CUDA samples), it therefore, we assume that a “fresh” installation is
is necessary to include the following packages into your required.
system
Warning: very important! If you suspect that previous
firmware-linux: binary firmware for various Nvidia software was installed before (say, any previous
drivers in the Linux kernel installation that failed, or whatever), make sure that no
pieces of Nvidia software are still present.
llvm: the low-level virtual machine package li-
braries and tools that make it easy to build com- We further recommend to (strictly) follow the corre-
pilers, optimizers, just-in-time code generators, and sponding steps, but do not proceed to the next one if
many other compiler-related programs. you did not succeed in the current one. Nvidia software
clang: a front-end for the llvm compiler. may be somehow tricky on “not-supported” Linux
distributions (see below).
build-essential: necessary to create Debian
packages.
gcc-multilib: the GNU C compiler with multilib A. Before the installation
support, that is, with support for the non-default
multilib architecture(s).
Suppose for a while that you can not remember the
install linux-headers: allows pieces of source graphic card model in our system. Just type lspci into
code (say, the “headers”) to be available for other the terminal, and you will get the following line (or sim-
packages. ilar) among others
The installation of these packages is straight forward. 01:00.0 VGA compatible controller:
Type: su and enter the root password. Then type NVIDIA Corporation GM204
[GeForce GTX 980] (rev a1)
apt install llvm
apt install clang (the line breaking corresponds to space reasons only).
apt install firmware-linux This means that a Nvidia GeForce GTX 980 is available,
apt install build-essential but it says nothing if it is currently in use. You may
apt install gcc-multilib further type
apt install linux-headers-$(uname -r)
apt build-dep linux lspci -k | grep -EA3 ’VGA|3D|Display’
where the $(uname -r) is a command substitution and the more verbose report will appear as follows
for the current kernel version. The last command
(build-dep) re-builds the dependencies for linux. 01:00.0
Thus, these seven commands sets a “friendly” environ- VGA compatible controller:
NVIDIA Corporation GM204 [GeForce GTX 980] (rev a1)
ment for the installation for the CUDA package.
Subsystem: [Link]. Corp. GM204 [GeForce GTX 980]
Kernel driver in use: nouveau
Kernel modules: nouveau, nvidia_drm, nvidia
D. Step 3: configure the computer to restart The report confirms that GeForce GTX 980 is avail-
automatically
able, although Nouveau is currently the driver in use.
This is right, since Nouveau is the default driver shipping
Open your computer’s BIOS and look for the Power with Debian. The Nvidia people, however, may not feel
Settings menu. Change the AC Power Recovery (or really comfortable with Nouveau playing around. Thus,
similar) setting to On. If this setting is not available, switch the computer mode to runlevel 3 (you are
it means that your computer is not capable to restart probably running the system to runlevel 5) in order to
automatically after a power off. turn off the current “display manager”. In other words,
you will somehow switch to “text mode” only. Type into
the terminal: sudo /sbin/init 3
II. CUDA INSTALLATION You are right in the way to install the CUDA package.
But before proceeding, it’s time to make a few “just in
It is time to improve the computing capabilities case” actions. These are “recommended” actions from
through the GPU (Graphic Processing Unit)! Recall Nvidia and other people. ¡They seem to be the result of
4
many try-and-failure experiences! Warning: Perhaps, at this stage, you might be operat-
ing the system from a remote terminal (via ssh). If this
First, install some extra packages. Do not worry if the case, you can download the runfile as follows
some of them were previously installed because in that
wget [Link]
case they will be passed over.
cuda/9.1/Prod/local_installers/
sudo apt-get install freeglut3-dev build-essential cuda_9.1.85_387.26_linux
libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx
(the line breaking corresponds to space reasons only).
libglu1-mesa libglu1-mesa-dev
The above url location can be obtained by right-clicking
Second, check if this card is CUDA capable at http:// on the download button and selecting the “save link”
[Link]/cuda-gpus. The current card option.
should be listed as CUDA capable (you may click on the
listed name for more information). Type the following commands to change the name of
the file and the corresponding executable permissions
Third, verify (once more!) the current Linux version, mv cuda_9.1.85_387.26_linux
the gcc version, and the current headers and develop- cuda_9.1.85_387.26_linux.run
ment packages. Although this is quite boring, take a few chmod +x cuda_9.1.85_387.26_linux.run
minutes to ensure that you are in the right way. Type
the following commands (the line breaking corresponds to space reasons only).
You may now execute the file
uname -m && cat /etc/*release
gcc --version sudo ./cuda_9.1.85_387.26_linux.run
uname -r The text-based installer will first show a looooong dis-
claimer (press the space key to continue). Then you will
The first command will return the several lines, but have to answer some questions, as follows
the important ones are
----------------------------------------
x86_64 Do you accept the previously read EULA?
PRETTY_NAME="Debian GNU/Linux 9 (stretch)" accept/decline/quit: accept
meaning that we are running a 64-bits system (Debian 9, You are attempting to install on an unsupported
in this case). The second command will return configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: y
gcc (Debian 6.3.0-18) 6.3.0 20170516
Install NVIDIA Accelerated Graphics Driver
that is, the version 6.3.0 for gcc. The third command for Linux-x86_64 387.26?
will return something like 4.9.0-4-amd64 (the version (y)es/(n)o/(q)uit: y
of the kernel headers).
Do you want to install the OpenGL libraries?
(y)es/(n)o/(q)uit [ default is yes ]: y
Well, the pre-installation is actually complete! Good
job till now! Do you want to run nvidia-xconfig?
This will update the system X configuration file
so that the NVIDIA X driver is used....
(y)es/(n)o/(q)uit [ default is no ]: y
B. The installation
Install the CUDA 9.1 Toolkit?
You have now enough information for the installation. (y)es/(n)o/(q)uit: y
Download the corresponding CUDA package from
Enter Toolkit Location
[Link] [ default is /usr/local/cuda-9.1 ]:
and choose the Linux option, the x86_64 architecture Do you want to install a symbolic link
(since you have already verified in Section II A that this at /usr/local/cuda?
is the right one), the Ubuntu distribution (since it is (y)es/(n)o/(q)uit: y
based on Debian), the 16.04 version (since it is currently Install the CUDA 9.1 Samples?
an LTS version, but most important, you will find at (y)es/(n)o/(q)uit: y
/etc/debian_version that the Ubuntu 16.04 (xenial)
is based on Debian (stretch)), and the runfile installer Enter CUDA Samples Location
type. [ default is /home/me ]: /home/me/mydir
----------------------------------------
5
Notice that we accepted all the options. This seems to C. Testing CUDA
be safe enough! After proceeding, the installer reports
the following We now proceed with a few tests (suggested by the
Nvidia people). First, reboot your system (that is,
Installing the NVIDIA display driver... sudo reboot). After login (as user), type into the ter-
A system reboot is required to continue installation. minal nvcc -V. This is the CUDA compiler and you are
Please reboot then run the installer again.
requesting some kind of proof that it is alive :). You
An attmept has been made to disable Nouveau.
If this message persists after reboot, please see
should receive
the display driver log file at nvcc: NVIDIA (R) Cuda compiler driver
/var/log/[Link] for more information. Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_[Link]_CDT_2017
=========== Cuda compilation tools, release 9.1, V9.1.85
= Summary =
=========== meaning that the compiler is in good health.
Driver: Reboot required to continue As a second check, type nvidia-smi to make sure that
Toolkit: Installation skipped
the CUDA driver is communicating correctly with the
Samples: Installation skipped
system. If a similar report as the one below appears, it
To uninstall the NVIDIA Driver,run nvidia-uninstall means that you are in the right way
Wed Jan 31 [Link] 2018
+-----------------------------------------------------------------------------+
Logfile is /tmp/cuda_install_1134.log | NVIDIA-SMI 387.26 Driver Version: 387.26 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
This report looks surprisingly neat :) . It says that | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
our attempt to disable Nouveau was not completely effec- |
| 0%
0 GeForce GTX 980
40C P0
Off | 0000[Link].0 Off |
37W / 185W | 0MiB / 4036MiB | 0%
N/A |
Default |
tive, and thus, the installer had to further proceed with +-------------------------------+----------------------+----------------------+
The configuration file is empty till now. Open the file i=1
(with a text editor like gedit) and include the following while [ $i -lt $# ]
information do
message+=${args[i]}
account default message+=" "
host [Link] i=$[i+1]
port 587 done
from mycluster@[Link]
tls on if [[ $1 != @* ]]; then
tls_starttls on subject="Subject: "
tls_certcheck off subject+="${message}"
auth on echo -e "${subject}" |
user mycluster@[Link] /home/you/msmtp-1.6.3/src/msmtp "${args[0]}"
password xxxxxx fi
The above instruction is a pipe, that is, echo passes B. Re-booting notifications
the "Subject: hello" to msmtp. The | character
chains both instructions. Thus, msmtp knows that the We now want to allow the computer to notify when-
string hello is the subject needed to complete the mail ever a re-booting occurred (due to power off-on, an
to mymail@[Link]. administrator re-booting, etc.). We assume that a bash
file notify already exists, similar to the notification file
shown in Section III A 3. We further assume that the file
is located in
3. Step 3: automate it
/home/me/notify
This last step makes the use of msmtp more comfort-
able, although it is not really necessary. You can create (make sure that the chmod -x permissions are set).
a bash file with the following content Then type
#!/bin/bash
crontab -e
args=("$@")
A text file will appear on screen. Just add at the end
if (($# > 1)); then of the file the following
8
@reboot sleep 60 && /home/me/ the following tasks after reboot (or restart, or power on,
notify me@[Link] rebooted as you like)
(caution: the line has been broken into two lines for 1. sleep 60 (in order to wait enough time until the
space reasons only) computer is completely ready)
2. use the script notify to send an email to
Save and exit (if the text editor is nano, just press me@[Link] with the word “rebooted”
ctrl-o and ctrl-x)
That is all!!! You can test it by typing sudo reboot
This line tells de program cron (the piece of software or power off/power on the computer. Enjoy!
in Debian 9 that controls the tasks schedule) to make