From 01789304f030a496a8288c492079c196c6725ef0 Mon Sep 17 00:00:00 2001 From: Rutwik Choughule Date: Mon, 1 Nov 2021 13:22:44 +0530 Subject: [PATCH] update sample bf16TensorCoreGemm to add explicit casting --- Samples/bf16TensorCoreGemm/bf16TensorCoreGemm.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Samples/bf16TensorCoreGemm/bf16TensorCoreGemm.cu b/Samples/bf16TensorCoreGemm/bf16TensorCoreGemm.cu index 0287adbf..86143a5d 100644 --- a/Samples/bf16TensorCoreGemm/bf16TensorCoreGemm.cu +++ b/Samples/bf16TensorCoreGemm/bf16TensorCoreGemm.cu @@ -184,13 +184,13 @@ __host__ void init_host_matrices(__nv_bfloat16 *a, __nv_bfloat16 *b, float *c) { for (int i = 0; i < M_GLOBAL; i++) { for (int j = 0; j < K_GLOBAL; j++) { - a[i*K_GLOBAL+j] = (__nv_bfloat16)(rand() % 3); + a[i*K_GLOBAL+j] = (__nv_bfloat16)(float)(rand() % 3); } } for (int i = 0; i < N_GLOBAL; i++) { for (int j = 0; j < K_GLOBAL; j++) { - b[i*K_GLOBAL+j] = (__nv_bfloat16)(rand() % 3); + b[i*K_GLOBAL+j] = (__nv_bfloat16)(float)(rand() % 3); } }