Skip to content

The resultant of two matrices, formed by calculating dot-product of respective components is called matrix multiplication.

License

Notifications You must be signed in to change notification settings

cudaf/matrix-multiplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The resultant of two matrices, formed by calculating dot-product of respective components is called matrix multiplication.

testHost():
Testing matrix multiplication on the CPU.
A = X . Y
X: 1024 x 1024
Y: 1024 x 1024
testSimple():
Testing simple matrix multiplication on the GPU.
This is the standard CPU algorithm adapted to use
GPU blocks amd threads.
testTiled():
Testing tiled matrix multiplication on the GPU.
Each thread-block computes the resultant of a small
square sub-matrix by fetching parts of input matrices
and storing partial results in the resultant sub-matrix.
This is repeated for all sub-matrices until full
matrix multiplication is calculated.
$ nvcc -std=c++17 -Xcompiler -O3 main.cu
$ ./a.out

# CPU matrix multiplication ...
# Execution time: 3880.0 ms
# Matrix element sum: 2.9528e+20
#
# GPU matrix multiplication, simple ...
# Execution time: 7.3 ms
# Matrix element sum: 2.9528e+20
# Result doesnt match exactly!
#
# GPU matrix multiplication, tiled ...
# Execution time: 4.3 ms
# Matrix element sum: 2.9528e+20
# Result doesnt match exactly!

See main.cu for code.



References

About

The resultant of two matrices, formed by calculating dot-product of respective components is called matrix multiplication.

Topics

Resources

License

Stars

Watchers

Forks

Languages