Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions source/source_base/parallel_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ void Parallel_Reduce::reduce_all<int>(int& object)
return;
}

template <>
void Parallel_Reduce::reduce_all<long long>(long long& object)
{
#ifdef __MPI
MPI_Allreduce(MPI_IN_PLACE, &object, 1, MPI_LONG_LONG, MPI_SUM, MPI_COMM_WORLD);
#endif
return;
}

void Parallel_Reduce::reduce_int_diag(int& object)
{
#ifdef __MPI
Expand Down Expand Up @@ -48,6 +57,15 @@ void Parallel_Reduce::reduce_all<int>(int* object, const int n)
return;
}

template <>
void Parallel_Reduce::reduce_all<long long>(long long* object, const int n)
{
#ifdef __MPI
MPI_Allreduce(MPI_IN_PLACE, object, n, MPI_LONG_LONG, MPI_SUM, MPI_COMM_WORLD);
#endif
return;
}

void Parallel_Reduce::reduce_int_grid(int* object, const int n)
{
#ifdef __MPI
Expand Down
2 changes: 1 addition & 1 deletion source/source_io/single_R_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void ModuleIO::output_single_R(std::ofstream& ofs,
const bool& reduce)
{
T* line = nullptr;
std::vector<int> indptr;
std::vector<long long> indptr;
indptr.reserve(PARAM.globalv.nlocal + 1);
indptr.push_back(0);

Expand Down
2 changes: 1 addition & 1 deletion source/source_io/write_HS_sparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ void ModuleIO::save_sparse(
ModuleBase::timer::tick("ModuleIO", "save_sparse");

int total_R_num = all_R_coor.size();
std::vector<int> nonzero_num(total_R_num, 0);
std::vector<long long> nonzero_num(total_R_num, 0);
int count = 0;
for (auto& R_coor: all_R_coor) {
auto iter = smat.find(R_coor);
Expand Down
Loading