This commit is contained in:
2026-03-30 16:25:35 +02:00
parent 01b96ef523
commit 4ad11eb64d
2 changed files with 21 additions and 10 deletions

View File

@@ -9,26 +9,26 @@ draft: false
---
1. On all computers
```
```bash
sudo apt install openssh-client
sudo apt install openssh-server
sudo apt install openmpi-bin libopenmpi-dev
```
2. Disable firewall
```
```bash
sudo ufw status
sudo ufw disable
```
3. Try connecting master to every slave ( you will need password )
```
```bash
ssh user@ipslave1
ssh user@ipslave2
```
4. On master generate a key and put it on the slaves
```
```bash
ssh-keygen -t rsa
ssh-copy-id user@ipslave1
@@ -36,25 +36,25 @@ ssh-copy-id user@ipslave2
```
5. Try connecting master to every slave ( you will not need password )
```
```bash
ssh user@ipslave1
ssh user@ipslave2
```
6. Compile program
```
```bash
mpicc main.c -o main
mpic++ main.cpp -o main
```
7. Copy main in to /tmp folder for easy same location ( program needs to be in the same path on all computers )
```
```bash
cp /path/to/main /tmp/mympiprogram/
```
8. Copy program to all computers
- Could use NFS server for auto copy
```
```bash
scp <source> <destination>
scp /tmp/mympiprogram/main user@ipslave1:/tmp/mympiprogram/main
scp /tmp/mympiprogram/main user@ipslave2:/tmp/mympiprogram/main
@@ -65,12 +65,12 @@ scp /tmp/mympiprogram/main user@ipslave2:/tmp/mympiprogram/main
- `num < c1 + c2 + c3`
- c1 is number of processes that can run on the computer
- num is number of processes that are needed for the program
```
```bash
mpirun -np <num> --host 127.0.0.1:<c1>,ipslave1:<c2>,ipslave2<c3> /tmp/mympiprogram/main
```
10. Enable firewall
```
```bash
sudo ufw status
sudo ufw enable
```