Write a program that multiplies two matrices of 32-bit floating point numbers on a GPU. Given matrix \(A\) of dimensions \(M \times N\) and matrix \(B\) of dimensions \(N \times K\), compute the product matrix \(C = A \times B\), which will have dimensions \(M \times K\). All matrices are stored in row-major format.
solve function signature must remain unchangedC
Input:
Matrix \(A\) (\(2 \times 2\)):
\[
\begin{bmatrix}
1.0 & 2.0 \\
3.0 & 4.0
\end{bmatrix}
\]
Matrix \(B\) (\(2 \times 2\)):
\[
\begin{bmatrix}
5.0 & 6.0 \\
7.0 & 8.0
\end{bmatrix}
\]
Output:
Matrix \(C\) (\(2 \times 2\)):
\[
\begin{bmatrix}
19.0 & 22.0 \\
43.0 & 50.0
\end{bmatrix}
\]
Input:
Matrix \(A\) (\(1 \times 3\)):
\[
\begin{bmatrix}
1.0 & 2.0 & 3.0
\end{bmatrix}
\]
Matrix \(B\) (\(3 \times 1\)):
\[
\begin{bmatrix}
4.0 \\
5.0 \\
6.0
\end{bmatrix}
\]
Output:
Matrix \(C\) (\(1 \times 1\)):
\[
\begin{bmatrix}
32.0
\end{bmatrix}
\]
M, N, K ≤ 8192M = 8192, N = 6144, K = 4096