Skip to content

Commit 4c023e7

Browse files
committed
mpi for torque
1 parent b781fe0 commit 4c023e7

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

source/module_hamilt_general/module_xc/xc_functional_libxc_vxc.cpp

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,25 +1128,11 @@ std::tuple<double,double,ModuleBase::matrix> XC_Functional_Libxc::v_xc_libxc( /
11281128
mx,my,mz,V_MC
11291129
);
11301130
#ifdef _OPENMP
1131-
#pragma omp parallel
1132-
{
1133-
std::vector<double> local_torque(3 * nrxx, 0.0);
1134-
#pragma omp for schedule(static, 1024) nowait
1135-
for (int ir = 0; ir < 3 * nrxx; ++ir) {
1136-
local_torque[ir] = torque_tmp[ir];
1137-
}
1138-
#pragma omp critical
1139-
{
1140-
for (int ir = 0; ir < 3 * nrxx; ++ir) {
1141-
torque[ir] += local_torque[ir];
1142-
}
1143-
}
1144-
} // end parallel
1145-
#else
1131+
#pragma omp parallel for schedule(static, 1024)
1132+
#endif
11461133
for (int ir = 0; ir < 3 * nrxx; ++ir) {
11471134
torque[ir] += torque_tmp[ir];
11481135
}
1149-
#endif
11501136
}
11511137
#ifdef _OPENMP
11521138
#pragma omp parallel for schedule(static, 1024) reduction(+:etxc) reduction(+:vtxc)
@@ -1415,9 +1401,6 @@ for (size_t i = 0; i < size; ++i) {
14151401
//Parallel_Reduce::reduce_pool(vtxc_col);
14161402
#endif
14171403
if(PARAM.inp.xc_torque){
1418-
#ifdef __MPI
1419-
Parallel_Reduce::reduce_pool(torque);
1420-
#endif
14211404
NCLibxc::print_torque(torque);
14221405
}
14231406

tools/SIAB/SimulatedAnnealing/source/src_parallel/parallel_reduce.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ void Parallel_Reduce::reduce_int_pool(int &object)
1919
}
2020

2121

22-
void Parallel_Reduce::reduce_double_vector_pool(std::vector<double>& vec)
23-
{
24-
#ifdef __MPI
25-
MPI_Allreduce(MPI_IN_PLACE, vec.data(), static_cast<int>(vec.size()), MPI_DOUBLE, MPI_SUM, POOL_WORLD);
26-
#endif
27-
}
2822

2923

3024
void Parallel_Reduce::reduce_double_all(double &object)

tools/SIAB/SimulatedAnnealing/source/src_parallel/parallel_reduce.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Parallel_Reduce
1313
void reduce_int_all(int &object);
1414
void reduce_int_pool(int &object);
1515

16-
void reduce_double_vector_pool(std::vector<double>& vec);
16+
1717

1818
// reduce double in all process
1919
void reduce_double_all(double &object);

0 commit comments

Comments
 (0)