MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / fillupMatrix

Function fillupMatrix

cpp/4_CUDA_Libraries/batchCUBLAS/batchCUBLAS.cpp:105–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103template <typename T_ELEM> void fillupMatrix(T_ELEM *A, int lda, int rows, int cols, int seed = 0);
104
105template <typename T_ELEM> void fillupMatrix(T_ELEM *A, int lda, int rows, int cols, int seed)
106{
107 for (int j = 0; j < cols; j++) {
108 for (int i = 0; i < rows; i++) {
109 A[i + lda * j] = cuGet<T_ELEM>(((double)(((lda * i + j + seed) % 253) + 1)) / 256.0,
110 ((double)((((cols * i + j) + 123 + seed) % 253) + 1)) / 256.0);
111 }
112 }
113}
114/* Explicit instantiation */
115template void fillupMatrix<float>(float *A, int lda, int rows, int cols, int seed);
116template void fillupMatrix<double>(double *A, int lda, int rows, int cols, int seed);

Callers 1

test_gemm_loopFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_gemm_loopFunction · 0.68