From 2ec8e44cd6094f9d509da9cda871bd1def57b1f3 Mon Sep 17 00:00:00 2001 From: Victor Yu Date: Thu, 2 Apr 2020 16:46:26 -0700 Subject: [PATCH] Fix uninitialized memory in elpa2_trans_ev_band_to_full The old code crashes when calling an MPI_Allreduce. The reason is that part of the input array (t_tmp in this case) is not initialized. --- src/elpa2/elpa2_trans_ev_band_to_full_template.F90 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/elpa2/elpa2_trans_ev_band_to_full_template.F90 b/src/elpa2/elpa2_trans_ev_band_to_full_template.F90 index 5a4044aa..b86abd4d 100644 --- a/src/elpa2/elpa2_trans_ev_band_to_full_template.F90 +++ b/src/elpa2/elpa2_trans_ev_band_to_full_template.F90 @@ -299,6 +299,13 @@ hvm = 0.0_rck ! Must be set to 0 !!! hvb = 0.0_rck ! Safety only + tmp1 = 0.0_rck + tmp2 = 0.0_rck + tmat_complete = 0.0_rck + if (blocking_factor > 1) then + t_tmp = 0.0_rck ! Must be set to 0 !!! + t_tmp2 = 0.0_rck + endif l_cols = local_index(nqc, my_pcol, np_cols, nblk, -1) ! Local columns of q_mat do istep=1,((na-1)/nbw-1)/blocking_factor + 1 @@ -485,7 +492,7 @@ call cublas_PRECISION_TRMM('L', 'U', BLAS_TRANS_OR_CONJ, 'N', & n_cols, l_cols, ONE, tmat_dev, cwy_blocking, & tmp_dev, n_cols) - call cublas_PRECISION_GEMM('N', 'N', l_rows, l_cols, n_cols, & + call cublas_PRECISION_GEMM('N', 'N', l_rows, l_cols, n_cols, & -ONE, hvm_dev, max_local_rows, tmp_dev, n_cols, ONE, q_dev, ldq) call obj%timer%stop("cublas") else -- GitLab