Skip to content

Commit 758c6e2

Browse files
JYMiracle305kilinchange
authored andcommitted
fix: resolve the Progress_group and Device subclasses cannot call the base destructor
1 parent 49d937b commit 758c6e2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

infini_train/include/device.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class DeviceManager;
2525

2626
class Device {
2727
public:
28+
virtual ~Device() = default;
29+
2830
DeviceType Type() const;
2931
int8_t Index() const;
3032

@@ -57,7 +59,7 @@ class CpuDevice : public Device {
5759
#ifdef USE_CUDA
5860
class CudaDevice : public Device {
5961
public:
60-
~CudaDevice();
62+
~CudaDevice() override;
6163

6264
void SetDevice() const override;
6365
void Synchronize() const override;

infini_train/include/nn/parallel/process_group.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ namespace infini_train::nn::parallel {
3030

3131
class ProcessGroup {
3232
public:
33+
virtual ~ProcessGroup() = default;
34+
3335
virtual int GetGroupRank(int global_rank) const;
3436

3537
// Asynchronous communication APIs (Compute / Communication stream decoupled)
@@ -90,7 +92,7 @@ class ProcessGroupNCCL final : public ProcessGroup {
9092
public:
9193
explicit ProcessGroupNCCL(const std::string &process_group_name, const std::vector<int> &device_indices);
9294

93-
~ProcessGroupNCCL();
95+
~ProcessGroupNCCL() override;
9496

9597
// Asynchronous communication APIs (Compute / Communication stream decoupled)
9698
std::shared_ptr<Work> AllReduce(const std::shared_ptr<Tensor> &tensor, function::ReduceOpType reduce_op,

0 commit comments

Comments
 (0)