Detecting object positions in image matrices is accomplished by utilizing a threshold average value -
The process involves implementing MPI for coordinating master and worker nodes across distributed processes, supporting multiprocessing. Additionally, threading is employed through OpenMP to enhance parallel execution. The system is further optimized with GPU support using CUDA for efficient object detection within the matrices.
- Unix
- gpu that supports cuda , or cuda emulater(i does not recommend you to go though that, it does not worth it)
- mpi libs
- omp libs
- cuda libs
- MPI libs:
sudo apt install mpich
sudo apt install libopenmpi-devsudo apt install libopenmpi-dev- OMP libs:
sudo apt install libomp-dev- CUDA libraries: Nividia Website
Avoid using WSL/2 or Docker when using multiple nodes, as MPI is not compatible with these platforms.
Define hosts in hosts.txt for running on multiple nodes. Retrieve host names using the command:
hostname
Ensure new lines in the hosts file are in LF (/n) format, not CRLF (/r/n). Avoid adding extra spaces.
Passwordless SSH protocol is essential for MPI. To facilitate MPI commands between computers, install and configure OpenSSH Server. Follow these steps:
Step 1:
- Install OpenSSH Server:
sudo apt-get install openssh-server
- Start SSH Server Service
sudo service ssh start
Step 2: Generate SSH Key Pairs and Exchange Public Keys: On each computer involved in MPI communication, generate SSH key pairs and exchange public keys between nodes. The keys will be associated with your current user.
ssh-keygen -t rsa
Enter the desired filename and password when prompted. Take note of the filepath and proceed to the next steps.
Ensure that the following files are present in the .ssh folder: filename.pub: Public key to be shared with other nodes. filename: Private key (do not expose).
Adjust Permissions if Necessary
- 700 - read, write, excute for owner only.
filepath - unix default is /root/.ssh (Interesting fact: In WSL2 it might appear as /root/.ssh ,but its actually in mnt/'disk'/Users/'user'/.ssh/)
chmod 700 <filepath>
Step 4: Copy Public Key to Other Nodes
ssh-copy-id -i ~/.ssh/<filename>.pub other_node_username@other_node_ip
Alternatively use default:
ssh-copy-id other_node_username@other_node_ip
Ensure the system environment has LD_LIBRARY_PATH and nessessary dependancies.
export PATH=$PATH:/path/to/mpi/bin
export PATH=$PATH:/path/to/openmpi/bin
export PATH=$PATH:/path/to/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<mpi_lib_directory>:<openmp_lib_directory>:<cuda_lib_directory> # one liner
Ensure the firewall allows SSH traffic on the desired port (default is 22).
sudo ufw allow 22
sudo ufw enable
sudo ufw status
The input file should follow this format, where each line represents a row in the file:
1.Matching value: This is a double value that represents the threshold for matching positions.
2.Number of matrices: This is an integer indicating the total number of matrices in the file.
For each matrix:
- Matrix ID: This is an integer representing the ID of the matrix.
- Number of matrix rows: This is an integer indicating the number of rows in the matrix.
- Number of matrix columns: This is an integer indicating the number of columns in the matrix.
- Matrix data: This line contains the matrix data itself, represented as a series of double values.
- Number of sub-matrices: This is an integer indicating the total number of sub-matrices in the file.
For each sub-matrix:
- Sub-matrix ID: This is an integer representing the ID of the sub-matrix.
- Number of sub-matrix rows: This is an integer indicating the number of rows in the sub-matrix.
- Number of sub-matrix columns: This is an integer indicating the number of columns in the sub-matrix.
- Sub-matrix data: This line contains the sub-matrix data itself, represented as a series of double values.
You can repeat the above steps for each matrix and sub-matrix in your input file, adding the corresponding data for each one.
Please note that the format assumes that the matrix and sub-matrix data are represented as a series of double values.


