Skip to content

Commit 56eaf0e

Browse files
authored
Fix ce 2.6 (#59977)
* Fix comments for PR #59644 (#59885) * update * update * Fix comments for PR #59644 (#59750) * tinyfix for PR #59644 * tinyfix * tinyfix * update * update
1 parent 5c100fb commit 56eaf0e

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

paddle/fluid/memory/allocation/allocator.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "paddle/fluid/platform/enforce.h"
2424
#include "paddle/fluid/platform/place.h"
2525
#include "paddle/phi/core/allocator.h"
26+
#include "paddle/phi/core/enforce.h"
2627
#include "paddle/phi/core/flags.h"
2728

2829
#ifdef PADDLE_WITH_NCCL
@@ -143,22 +144,22 @@ using DecoratedAllocationPtr =
143144

144145
template <typename T>
145146
static T&& FillValue(T&& allocation) {
146-
#if defined(PADDLE_WITH_NCCL)
147+
#if defined(PADDLE_WITH_CUDA)
147148
if (allocation != nullptr) {
148149
if (FLAGS_sync_after_alloc || FLAGS_alloc_fill_value >= 0) {
149-
cudaDeviceSynchronize();
150+
PADDLE_ENFORCE_GPU_SUCCESS(cudaDeviceSynchronize());
150151
if (FLAGS_alloc_fill_value >= 0) {
151152
VLOG(10) << "Set " << FLAGS_alloc_fill_value << " on "
152153
<< allocation->ptr() << " " << allocation->place() << " "
153154
<< allocation->size();
154155
if (platform::is_gpu_place(allocation->place())) {
155-
cudaMemset(
156-
allocation->ptr(), FLAGS_alloc_fill_value, allocation->size());
156+
PADDLE_ENFORCE_GPU_SUCCESS(cudaMemset(
157+
allocation->ptr(), FLAGS_alloc_fill_value, allocation->size()));
157158
} else {
158159
std::memset(
159160
allocation->ptr(), FLAGS_alloc_fill_value, allocation->size());
160161
}
161-
cudaDeviceSynchronize();
162+
PADDLE_ENFORCE_GPU_SUCCESS(cudaDeviceSynchronize());
162163
}
163164
}
164165
}

python/paddle/distributed/fleet/meta_parallel/pipeline_parallel.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,6 @@ def __init__(self, layers, hcg, strategy):
921921
self._virtual_pp_rank = 0
922922
self._reset_counter()
923923

924-
self._assign_vpp_info(self.model_chunks)
925-
926924
def _check_sanity(self):
927925
assert (
928926
framework.in_dynamic_mode()

python/paddle/distributed/fleet/utils/tensor_fusion_helper.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,15 @@ def scale_grads(self):
461461

462462
self._reset_params_checked_in()
463463

464+
@imperative_base.no_grad
465+
def scale_and_split_grads(self):
466+
assert self._task is not None, "Task is not initialized. "
467+
self._task.wait()
468+
scale_factor = 1.0 / self._comm_group.nranks
469+
self.grad_storage.scale_(scale_factor)
470+
471+
self._reset_params_checked_in()
472+
464473

465474
def obtain_storage(
466475
parameters,

0 commit comments

Comments
 (0)