Skip to content

Commit

Permalink
Fix comments for PR #59644 (#59750)
Browse files Browse the repository at this point in the history
* tinyfix for PR #59644

* tinyfix

* tinyfix

* update
  • Loading branch information
wentaoyu authored Dec 11, 2023
1 parent e5fbff4 commit a763716
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions paddle/fluid/memory/allocation/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/place.h"
#include "paddle/phi/core/allocator.h"
#include "paddle/phi/core/enforce.h"
#include "paddle/phi/core/flags.h"

#ifdef PADDLE_WITH_NCCL
Expand Down Expand Up @@ -143,22 +144,22 @@ using DecoratedAllocationPtr =

template <typename T>
static T&& FillValue(T&& allocation) {
#if defined(PADDLE_WITH_NCCL)
#if defined(PADDLE_WITH_CUDA)
if (allocation != nullptr) {
if (FLAGS_sync_after_alloc || FLAGS_alloc_fill_value >= 0) {
cudaDeviceSynchronize();
PADDLE_ENFORCE_GPU_SUCCESS(cudaDeviceSynchronize());
if (FLAGS_alloc_fill_value >= 0) {
VLOG(10) << "Set " << FLAGS_alloc_fill_value << " on "
<< allocation->ptr() << " " << allocation->place() << " "
<< allocation->size();
if (platform::is_gpu_place(allocation->place())) {
cudaMemset(
allocation->ptr(), FLAGS_alloc_fill_value, allocation->size());
PADDLE_ENFORCE_GPU_SUCCESS(cudaMemset(
allocation->ptr(), FLAGS_alloc_fill_value, allocation->size()));
} else {
std::memset(
allocation->ptr(), FLAGS_alloc_fill_value, allocation->size());
}
cudaDeviceSynchronize();
PADDLE_ENFORCE_GPU_SUCCESS(cudaDeviceSynchronize());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ def __init__(self, layers, hcg, strategy):
self._virtual_pp_rank = 0
self._reset_counter()

self._assign_vpp_info(self.model_chunks)
self._check_sanity()

def _check_sanity(self):
assert (
Expand Down

0 comments on commit a763716

Please sign in to comment.