matrixvector
所属分类:数据结构
开发工具:C/C++
文件大小:11KB
下载次数:0
上传日期:2018-12-04 19:29:48
上 传 者:
xxdfffs
说明: Matrix Vector Multiplications Problem
文件列表:
matrixvector (0, 2018-11-02)
matrixvector\Makefile (3566, 2018-11-02)
matrixvector\bin (0, 2018-11-02)
matrixvector\obj (0, 2018-11-02)
matrixvector\src (0, 2018-11-02)
matrixvector\src\matrix_vector.h (1575, 2018-11-02)
matrixvector\src\matrix_vector_driver.c (2147, 2018-11-02)
matrixvector\src\matrix_vector_openmp.c (2925, 2018-11-02)
matrixvector\src\matrix_vector_serial.c (2641, 2018-11-02)
matrixvector\src\matrix_vector_pthread.c (3476, 2018-11-02)
matrixvector\src\matrix_vector_tests.cpp (4088, 2018-11-02)
matrixvector\testdata (0, 2018-11-02)
matrixvector\testdata\vector1 (5, 2018-11-02)
matrixvector\testdata\vector3 (11, 2018-11-02)
matrixvector\testdata\matrix1x1 (6, 2018-11-02)
matrixvector\testdata\matrix2x3 (16, 2018-11-02)
# PA1 - Matrix-vector multiply (Serial,Pthreads,OpenMP)
* **Author**: *Matt Masarik*
* **Class**: *CS430 [Parallel Computing] Section 001*
## Overview
The matrix-vector product `Ax = y` is calculated where `A` is a 2D matrix
with dimensions `MxN`, `x` is a `Nx1` column vector, and the output vector
`y` has dimensions `Mx1`.
## Manifest
```
pa1/matrix_vec/
├── bin
├── Makefile
├── obj
├── README.md
├── src
│ ├── matrix_vector.h
│ ├── matrix_vector_driver.c
│ ├── matrix_vector_openmp.c
│ ├── matrix_vector_pthread.c
│ ├── matrix_vector_serial.c
│ └── matrix_vector_tests.cpp
└── testdata
├── matrix1x1
├── matrix2x3
├── vector1
└── vector3
```
## Build
Clone, init, and compile googletest and serial main and test drivers
```bash
git clone https://github.com/BoiseState/CS430-FA18-05
cd CS430-FA18-05
git submodule init
git submodule update
cd pa1/matrixvector
make # builds googletest
```
## Run Tests
```bash
make pthread # compiles drivers for pthreads: main and unittests
make openmp # compiles drivers for openmp: main and unittests
make test # run unit tests for: serial, pthread, openmp
```
### Run Main Executables
To run the main drivers vs. unit tests, the prototypes for each version:
matrix_vec-(serial, pthread, openmp) have the same form
```bash
./bin/matrix_vector_ "" ""
```
For example, pthread version, 2 threads, and two text files in the testdata/ directory
```bash
./bin/matrix_vector_pthread "testdata/matrix2x3" "testdata/vector3" 2
```
## Auxilary Make Targets
```bash
# Serial
serial # serial: build executable main driver
serial_test # build exe unittests driver
srund # run main driver
srunt # run tests (unittests) driver
sclean # clean .o and exe's
# Pthreads
pthread # pthread: build executable main driver
pthread_test # build exe unittests driver
prund # run main driver
prunt # run tests (unittests) driver
pclean # clean .o and exe's
# OpenMP
openmp # openmp: build executable main driver
openmp_test # build exe unittests driver
orund # run main driver
orunt # run tests (unittests) driver
oclean # clean .o and exe's
cleaner # Clean all .o .a and exe's, including googletest
```
## Closing Comments
All tests passed for each implementation: serial, pthread, openmp.
I followed the text's implementation of the pthread version using global variables for A, x, M, N. I'm
doing the Jacobi 2D OpenMP implementation too, if I have time after that, I will return to pass a struct into the pthread
callback function.
近期下载者:
相关文件:
收藏者: