Skip to content
Open
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
15 changes: 8 additions & 7 deletions source/source_io/module_parameter/read_input_item_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,20 @@ void ReadInput::item_system()
para.input.kpar = 1;
}
#endif
// GPU + PW: validate kpar against total processors
// Moved from base_device::information::get_device_kpar()
#if defined(__CUDA) || defined(__ROCM)
if (para.input.device == "gpu" && para.input.basis_type == "pw")
// PW: auto-reduce kpar when there are not enough processes.
// Only downgrade (NPROC < kpar*bndpar), never upgrade,
// because kpar must not exceed the number of k-points.
if (para.input.basis_type == "pw")
{
if (GlobalV::NPROC != para.input.kpar * para.input.bndpar)
if (GlobalV::NPROC < para.input.kpar * para.input.bndpar)
{
para.input.kpar = GlobalV::NPROC / para.input.bndpar;
if (para.input.kpar < 1) para.input.kpar = 1;
ModuleBase::WARNING("ReadInput",
"kpar is not compatible with the number of processors, auto set kpar value.");
"kpar exceeds the number of processors, auto-reducing kpar to "
+ std::to_string(para.input.kpar) + ".");
}
}
#endif
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.basis_type == "lcao" && para.input.kpar > 1)
Expand Down
Loading