Created
September 2, 2017 22:05
-
-
Save sbugrov/a7844d30686b76d619ac6ca4d5c3f97c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__global__ void kMartixByMatrixElementwise(const float *m1, const float *m2, float *output) { | |
/* Computes the product of two arrays (elementwise multiplication). | |
Inputs: | |
m1: array | |
m2: array | |
output: array,the results of the multiplication are to be stored here | |
*/ | |
const int id = blockIdx.x * blockDim.x + threadIdx.x; | |
output[id] = m1[id] * m2[id]; | |
} | |
__device__ float* dMartixByMatrixElementwise(const float *m1, const float *m2, float *output, const int width, const int height){ | |
kMartixByMatrixElementwise <<< width, height >>> ( m1, m2, output ); | |
cudaDeviceSynchronize(); | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment