Skip to content

Commit e12b1cd

Browse files
Copilotdzzz2001
andcommitted
Fix MPI synchronization issue in get_device_kpar
- Remove redundant probe_gpu_availability check that could cause MPI inconsistency - Function is only called when device=gpu is already confirmed - Add comment clarifying the function should only be called in GPU mode Co-authored-by: dzzz2001 <153698752+dzzz2001@users.noreply.github.com>
1 parent f4653cb commit e12b1cd

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

source/source_base/module_device/device.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,8 @@ std::string get_device_flag(const std::string &device,
244244
int get_device_kpar(const int& kpar, const int& bndpar)
245245
{
246246
#if __MPI && (__CUDA || __ROCM)
247-
// This function should only be called when GPU mode is active
248-
// We use probe_gpu_availability to ensure GPU is actually available
249-
if (!probe_gpu_availability()) {
250-
// If no GPU available, return kpar unchanged
251-
return kpar;
252-
}
253-
247+
// This function should only be called when device mode is GPU
248+
// The device decision has already been made by get_device_flag()
254249
int temp_nproc = 0;
255250
int new_kpar = kpar;
256251
MPI_Comm_size(MPI_COMM_WORLD, &temp_nproc);

0 commit comments

Comments
 (0)