https://github.com/t4vexx/sockets
This project is an implementation of a simulation of the MPI_REDUCE algorithm using TCP/IP sockets in C. The main idea is to divide the sum of a set of numbers among different processes (called workers), which run in parallel, following a binary tree structure.
https://github.com/t4vexx/sockets
c make mpi-library multiprocessing parallel-computing shell-script
Last synced: 3 months ago
JSON representation
This project is an implementation of a simulation of the MPI_REDUCE algorithm using TCP/IP sockets in C. The main idea is to divide the sum of a set of numbers among different processes (called workers), which run in parallel, following a binary tree structure.
- Host: GitHub
- URL: https://github.com/t4vexx/sockets
- Owner: T4vexx
- Created: 2024-09-29T22:47:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-15T21:44:04.000Z (10 months ago)
- Last Synced: 2025-04-19T09:32:15.689Z (9 months ago)
- Topics: c, make, mpi-library, multiprocessing, parallel-computing, shell-script
- Language: C
- Homepage:
- Size: 22.5 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SOCKETS PROJECT - MPI_REDUCE() SIMULATOR
## DESCRIPTION
This project is an implementation of an MPI_REDUCE algorithm simulation using TCP/IP sockets in C. The main idea is to distribute the sum of a set of numbers across different processes (called workers) that execute in parallel, following a binary tree structure.
### Features
- Parallel Architecture: Uses a binary tree approach, where workers hierarchically perform value reduction until the final result is obtained.
- Socket Communication: Data transmission between processes is done via TCP/IP sockets, simulating point-to-point communication between workers and the manager.
- Scalability: The number of workers can be easily configured, allowing execution with different binary tree sizes for parallelism.
- Synchronization: Implements synchronization to ensure that workers operate in coordination and send data to the manager only after completing the reduction operation.
## CONFIGURATION
You must have GCC and build-essentials installed on your Linux system to run the process.
To clean executable files, run:
make clean
To build the project, run:
make build
To execute the project, run:
make exec
After executing the processes via make exec, wait for the manager to print the final result.

### Considerações
The worker initialization format is as follows:
```Bash
./worker
```
In the logic used to spawn worker processes, the exec_trabalho.sh script starts all workers with the value 10.
If you want to change the values used for summation, simply modify this logic:
for i in {0..7}
do
./worker $i 10 &
if [ $? -ne 0 ] then
echo "Erro ao iniciar o processo worker $i"
exit 1
fi
sleep 1
done
Thus, in the current logic, **the correct answer is 80.** 🚀