Skip to content

Commit 91f62f6

Browse files
committed
Add reduce for dot ops used in bpcg
1 parent 6114817 commit 91f62f6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/module_hsolver/kernels/math_kernel_op.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct line_minimize_with_block_op<T, base_device::DEVICE_CPU>
2424
Real theta = 0.0, cos_theta = 0.0, sin_theta = 0.0;
2525
auto A = reinterpret_cast<const Real*>(grad_out + band_idx * n_basis_max);
2626
Real norm = BlasConnector::dot(2 * n_basis, A, 1, A, 1);
27+
Parallel_Reduce::reduce_pool(norm);
2728
norm = 1.0 / sqrt(norm);
2829
for (int basis_idx = 0; basis_idx < n_basis; basis_idx++)
2930
{
@@ -71,6 +72,7 @@ struct calc_grad_with_block_op<T, base_device::DEVICE_CPU>
7172
T grad_1 = {0.0, 0.0};
7273
auto A = reinterpret_cast<const Real*>(psi_out + band_idx * n_basis_max);
7374
Real norm = BlasConnector::dot(2 * n_basis, A, 1, A, 1);
75+
Parallel_Reduce::reduce_pool(norm);
7476
norm = 1.0 / sqrt(norm);
7577
for (int basis_idx = 0; basis_idx < n_basis; basis_idx++)
7678
{

0 commit comments

Comments
 (0)