Skip to content

Commit 1b809fd

Browse files
authored
plan: check multiple devices in rank correctly for global transpose (#1429)
[ROCm/rocFFT commit: f899388]
1 parent 2a01c08 commit 1b809fd

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

projects/rocfft/library/src/include/plan.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,9 @@ struct rocfft_plan_description_t
172172
return fieldPtrs;
173173
}
174174

175-
// returns true if a field:
176-
// - has bricks across multiple ranks (i.e. MPI), and
177-
// - any rank has bricks on more than one device
178-
static bool multiple_ranks_devices(const rocfft_field_t& field);
175+
// returns true if a field has bricks such that any rank has
176+
// bricks on more than one device
177+
static bool multiple_devices_in_rank(const rocfft_field_t& field);
179178
};
180179

181180
struct rocfft_plan_t

projects/rocfft/library/src/plan.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void rocfft_plan_description_t::init_defaults(rocfft_transform_type transfo
196196
}
197197
}
198198

199-
bool rocfft_plan_description_t::multiple_ranks_devices(const rocfft_field_t& field)
199+
bool rocfft_plan_description_t::multiple_devices_in_rank(const rocfft_field_t& field)
200200
{
201201
// map ranks to a set of distinct devices
202202
std::map<int, std::set<int>> rank_devices;
@@ -208,10 +208,6 @@ bool rocfft_plan_description_t::multiple_ranks_devices(const rocfft_field_t& fie
208208
devices.insert(brick.location.device);
209209
}
210210

211-
// need to have multiple ranks to return true
212-
if(rank_devices.size() <= 1)
213-
return false;
214-
215211
// any rank needs to have multiple devices to return true
216212
for(const auto& rank_device : rank_devices)
217213
{
@@ -1924,8 +1920,8 @@ void rocfft_plan_t::GlobalTranspose(size_t elem_size,
19241920
// Fall back to point-to-point transfers if all-to-all is not
19251921
// possible.
19261922
std::string itemGroup = "transpose_" + std::to_string(transposeNumber);
1927-
if(rocfft_plan_description_t::multiple_ranks_devices(inField)
1928-
|| rocfft_plan_description_t::multiple_ranks_devices(outField))
1923+
if(rocfft_plan_description_t::multiple_devices_in_rank(inField)
1924+
|| rocfft_plan_description_t::multiple_devices_in_rank(outField))
19291925
GlobalTransposeP2P(
19301926
elem_size, inField, outField, input, output, inputAntecedents, outputItems, itemGroup);
19311927
else

0 commit comments

Comments
 (0)