Go to file
hassiy 6c49293312 fix README.md file 2023-12-25 12:32:51 +03:00
1 Initial commit 2023-12-25 10:33:58 +03:00
2 Initial commit 2023-12-25 10:33:58 +03:00
3 Initial commit 2023-12-25 10:33:58 +03:00
500f.zip Initial commit 2023-12-25 10:33:58 +03:00
LICENSE Initial commit 2023-12-25 10:33:58 +03:00
README.md fix README.md file 2023-12-25 12:32:51 +03:00
pp-lab.pdf Initial commit 2023-12-25 10:33:58 +03:00

README.md

parallel-programming

A collection of tasks for studying parallel programming

1. Setup a proxy (on university computers only):

On Ubuntu:
echo 'http_proxy="http://212.192.128.4:8080/"' | sudo tee -a /etc/profile
echo 'https_proxy="http://212.192.128.4:8080/"' | sudo tee -a /etc/profile

Reboot a virtual machine to apply changes:

systemctl reboot
On Fedora:
echo 'proxy=212.192.128.4:8080' | sudo tee -a /etc/dnf/dnf.conf
echo 'http_proxy="http://212.192.128.4:8080/"' | sudo tee -a /etc/profile
echo 'http_proxy="http://212.192.128.4:8080/"' | sudo tee -a /etc/profile

Reboot a virtual machine to apply changes:

systemctl reboot

2. Install a necessary dependencies:

On Ubuntu:
sudo apt install gcc g++ libomp-dev git
On Fedora:
sudo dnf install gcc gcc-c++ libgomp git

3. Clone the repository:

git clone https://git.disroot.org/hassiy/parallel-programming.git

4. Navigate to the project directory:

cd parallel-programming

5. Unzip the 500f.zip file:

unzip 500f.zip

6. Use "cd" and "ls" commands to navigate to the necessary variant:

In case to navigate to the 9th variant use command below:

cd ~/parallel-programming/2/fork/linux

7. Inspect README.md file before do something

less README.md
cp main.cpp main.bk.cpp

where "main.cpp" may be different filename (i.e. fork2.cpp)

use "ls" command to check a content of the current directory

9. Edit the code:

To get a count of an available (logical) threads use command below:

nproc

To get username enter command below:

whoami

or

echo $USER

Edit the code using one of "nano", "vi", "vim" text editor:

i.e. using nano:

nano main.cpp

or another .cpp filename. Use "ls" command to verify it

Inspect the comments

!Don't forget to change file paths to the proper values!

Save changes and exit

10. Compile a program:

g++ main.cpp

file "a.out" will appear in the current directory

"a.out" is a default binary name in gcc or g++ compilers

Use -o (or --output) option to change an executable (binary) filename:

g++ -o binary_name.exe main.cpp

If a program uses thread method use command bellow:

g++ -lpthread main.cpp

If a program uses openMP method use command bellow:

g++ -fopenmp main.cpp

11. Execute the binary:

./a.out

or another binary name that was entered after -o option

12. If result wasn't in stdout you need to read "result" file(s):

cat ~/parallel-programming/500f/result*