0% found this document useful (0 votes)
49 views8 pages

Configureation PC

The document provides a comprehensive guide for setting up a computer configuration suitable for simulations, focusing on installing a stable Linux operating system and necessary software. It outlines steps for creating a bootable USB, configuring the system, and installing CUDA for GPU computing. The guide emphasizes the importance of a stable environment and offers troubleshooting tips for graphics card issues during installation.

Uploaded by

ridzuan365713
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views8 pages

Configureation PC

The document provides a comprehensive guide for setting up a computer configuration suitable for simulations, focusing on installing a stable Linux operating system and necessary software. It outlines steps for creating a bootable USB, configuring the system, and installing CUDA for GPU computing. The guide emphasizes the importance of a stable environment and offers troubleshooting tips for graphics card issues during installation.

Uploaded by

ridzuan365713
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer configuration for Dummies - (from scratch)

I. Sticco∗ and F. Cornes†


Departamento de Fı́sica, Facultad de Ciencias Exactas y Naturales, Universidad de Buenos Aires,
Pabellón I, Ciudad Universitaria, 1428 Buenos Aires, Argentina.

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...

PACS numbers: DuMMy, [Link]

I. THE BASIC CONFIGURATION dmesg | grep scsi -A 3

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).

Once you logged in, switch to super user mode (root)


in order to edit the resources list, update the packages,
2. Partition manager and install sudo and grant sudo rights to the user. Type:
su and enter the root password. Then type
When you are asked for the partition configuration,
select the guided partition procedure. You may choose nano /etc/apt/[Link]
one partition for the installation and another partition
and add at the end of each line contrib non-free. For
for swap. Usually swap size is twice the RAM size. Also,
example, for any line similar to
choose the EXT4 file system.
deb [Link] stable main

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.

The last step is to choose a boot loader. Just accept


the default Grub boot loader. C. Step 3: special software (or firmware)

If you had problems with the graphics card, now is


time to solve it definitely. We assume that your system
B. Step 2: boot into the new installation includes an Nvidia graphic card and that you may want
to use it in the future for parallel computing (i.e. CUDA
Recall that at this stage you can access your computer compatible).
through a SSH service. Thus, after booting into the new
3

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 +-------------------------------+----------------------+----------------------+

additional actions. These actions require a system re- +-----------------------------------------------------------------------------+


| Processes: GPU Memory |
boot before installing the CUDA toolkit and the samples. | GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
Please, do not get annoyed because of this report.
We experienced more annoying messages in our first A last check on the health of the CUDA driver can be
try! Thus, it is very important to receive the above done by writing
report. If your report includes additional messages
like “missing recommended library” or “driver not cat /proc/driver/nvidia/version
selected” or the annoying “***WARNING: Incomplete
installation!”, it means that something is going (re- and you should get the following nice report
ally) wrong, and you should step back to find the failure. NVRM version: NVIDIA UNIX x86_64
Kernel Module 387.26
Type sudo reboot and after login type Thu Nov 2 [Link] PDT 2017
GCC version: gcc version 6.3.0 20170516
sudo /sbin/init 3 (Debian 6.3.0-18)
sudo ./cuda_9.1.85_387.26_linux.run
So, the CUDA driver seems to be correctly installed.
However, a couple of examples needs to be run, in order
and repeat the previous steps. The installation should to relax after this (somehow) stressing installation. Type
now be successful. The report, however, still remind you the lowing commands (from /home/me/mydir) in order to
to include the corresponding paths. The paths are nec- compile the examples bundled in the CUDA package.
essary for locating files along the system directory struc-
ture. Just open the .bashrc file located in you home cd NVIDIA_CUDA-9.1_Samples
directory (i.e. /home/me) and add the following lines at make
the end of the file
and wait.... until all the examples are compiled. Notice
export CUDA_HOME=/usr/local/cuda-9.1 that we did not install the graphical desktop environ-
export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64 ment (see Section I A 3), and consequently, it will not be
export PATH=/usr/local/cuda-9.1/bin possible to execute those examples requiring a graphi-
cal environment. Furthermore, some warning messages
save and exit. You may also type into the terminal the might appear during the examples compilation due to
command source /home/me/.bashrc for the changes missing graphical libraries.
to take place. You are done! After the compilation procedure is finished, proceed by
changing directory
6

cd /home/me/software/ III. FINE TUNING OUR SYSTEM


NVIDIA_CUDA-9.1_Samples/bin/
x86_64/linux/release A. e-mail notifications

run the text mode example ./deviceQuery. You should


receive something like msmtp is a small program that communicates via
the SMTP protocol to the Gmail server. Install this
---------------------------------------- program in order to receive e-mail notifications from
./deviceQuery Starting... your system. Follow the instructions outlined in Trick
for email notifications.
CUDA Device Query (Runtime API) version
(CUDART static linking)

Detected 1 CUDA Capable device(s) 1. Step 1: install msmtp


Device 0: "GeForce GTX 980"
CUDA Driver Version / You may download the latest version msmtp from
Runtime Version 9.1 / 9.1
... [Link]
...
You will get something like [Link].
Don’t worry because it is a small file.
deviceQuery, CUDA Driver = CUDART,
CUDA Driver Version = 9.1, CUDA Runtime Drop the file into your home directory in the cluster.
Version = 9.1, NumDevs = 1 You will probably need a ssh connection. Use the com-
Result = PASS mand scp to copy the file into the cluster. From now on
---------------------------------------- we will assume that your home directory is /home/you
and that the expression $HOME is an alias for your home
These are the relevant pieces of the report. The final
directory (technically, $HOME is an environment variable).
result is PASS, so the example, ran successfully. Also, try
the example ./bandwidthTest. The report should read
To copy the file into the cluster, type from the terminal
----------------------------------------
[CUDA Bandwidth Test] - Starting... scp ./[Link] you@cluster:/home/you
Running on...
where you is your username and cluster is the name
Device 0: GeForce GTX 980 of the cluster (obvious). After that, log into your user
Quick Mode directory in the cluster (say, ssh you@cluster) and
uncompress the source file. For example,
Host to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s) tar -xf [Link]
33554432 12873.2
You will notice that a new directory has been create
Device to Host Bandwidth, 1 Device(s) called msmtp-x.x.x. It contains all the source files for
PINNED Memory Transfers building the binaries. Now follow the steps
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 12469.6 cd msmtp-x.x.x
./configure --prefix=$HOME
Device to Device Bandwidth, 1 Device(s) make install
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s) The --prefix option ensures that everything will be
33554432 163707.9 inside the limits of the /home/you directory.
Result = PASS
The installation is almost done! You only need to cre-
NOTE: The CUDA Samples are not meant ate a configuration file. Do this by with any text editor
for performance measurements. Results may (such a gedit). Your configuration file should have the
vary when GPU Boost is enabled. name .msmtprc (the dot is mandatory to “hide” the file)
---------------------------------------- and it should be located in /home/you (or $HOME as you
wish). For security reasons, you better assign only user
You get another PASS result. So, congratulations, you read/write permission to the file. Type
are done! Enjoy!.
chmod 600 $HOME/.msmtprc
7

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

Save and exit. The xxxxxx is our secret password. fi


The account mycluster@[Link] is your recently
created mail account for the cluster. (caution: the line starting with echo has been broken
into two lines for space reasons only)
Configuration is finished, congratulations!
The args variable contains the all the arguments
passed to the bash file. The first argument is args[0]
and corresponds to the mail address where the message
2. Step 2: test it should be delivered. The rest of the arguments are
collected into a single string (called message) by the
The installation process is over. You can make a simple while loop. Finally, subject joins the word Subject to
test to ensure that everything is working fine. Type the the message.
following and see if a new mail appears in the inbox of
webmail This bash file is really useful, since we only need to
type the address and the message. For example, if the
echo "Subject: hello" | msmtp mymail@[Link] bash file name is myfile, then the instruction

where mymail@[Link] is assumed to be your myfile mymail@[Link] My first message


personal account (not the recently opened account
mycluster@gmail). Thus, if you now check your will deliver the mail with the message My first message.
personal account, you will find an incoming mail from
mycluster@gmail with the subject hello. The body of Enjoy!
the mail should be empty.

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

You might also like