https://github.com/aabduvak/matrix-calculator
Just assignment from Parallel Computing lecture
https://github.com/aabduvak/matrix-calculator
multithreading parallel-computing
Last synced: 3 months ago
JSON representation
Just assignment from Parallel Computing lecture
- Host: GitHub
- URL: https://github.com/aabduvak/matrix-calculator
- Owner: aabduvak
- License: gpl-3.0
- Created: 2022-11-29T15:40:39.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-16T20:56:52.000Z (over 2 years ago)
- Last Synced: 2025-01-08T10:11:59.853Z (5 months ago)
- Topics: multithreading, parallel-computing
- Language: C
- Homepage:
- Size: 5.98 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
👨🏻💻 Matrix Calculator
Just assignment from Parallel Computing lecture 🫥
![]()
## Rules:
1. All matrixes must be square: [7][7], [4][4] or [2][2]
2. Bigger matrix must be first argument
3. Content of matrix must be numeric value## Functions ##
Only the following functions are used in this project:
| Function | Description | Function | Description |
|----------|-------------|----------|-------------|
| atoi | convert ascii to integer | pthread_create | create a new thread |
| printf | format and print data | pthread_mutex_unlock | releases the mutex object |
| calloc | allocate dynamic memory | pthread_join | join with a terminated thread |
| free | free dynamic memory | pthread_mutex_init | initialise the mutex |
| write | write to a file descriptor | pthread_mutex_destroy | destroy the mutex object |
| usleep | suspend execution for microsecond intervals | pthread_mutex_lock | lock the mutex object |## Starting ##
Clone this project and change directory
```bash
git clone https://github.com/aabduvak/matrix-calculator && cd matrix-calculator
```
To compile the program you may use **Makefile**
if your linux os doesn't have **make** package just run setup.sh```bash
bash setup.sh
```After installation of all packages you may use make command to compile the project
```bash
make
```
To run program
```bash
./matrix data/m1.mx data/m0.mx
```
or just use **Makefile** with default params
```bash
make run
```
Some usefull commands:
```bash
# To remove objects
make clean# To remove objects and executable
make fclean# To check data races
make test# To check memory leaks
make leaks
```## Links ##
- [pthreads Tutorial](https://randu.org/tutorials/threads/)
- [Playlist about C Threads](https://www.youtube.com/watch?v=d9s_d28yJq0&list=PLfqABt5AS4FmuQf70psXrsMLEDQXNkLq2)
- [pthreads Short Introduction](https://www.youtube.com/watch?v=d9s_d28yJq0)
- [How to pass arguments to threads](https://www.youtube.com/watch?v=HDohXvS6UIk)
- [What are detached threads?](https://www.youtube.com/watch?v=-i8Kzuwr4T4)
- [An Application of Pthreads and Mutexes](http://files.kipr.org/gcer/2009/proceedings/Myers_ApplicationPthreads.pdf)
- [Multithreading part 1](https://www.youtube.com/watch?v=GNw3RXr-VJk)
- [Multithreading part 2](https://www.youtube.com/watch?v=sDLQWivf1-I)---
[](https://www.buymeacoffee.com/aabduvak)