-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
polish high frequency enforce error message #12591
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,25 +100,25 @@ size_t GpuMinChunkSize() { | |
|
||
size_t GpuMaxChunkSize() { | ||
size_t total = 0; | ||
size_t available = 0; | ||
size_t available_memory = 0; | ||
|
||
GpuMemoryUsage(&available, &total); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The older version is better than the new version. Since this function is GpuMaxChunkSize, using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks |
||
VLOG(10) << "GPU Usage " << available / 1024 / 1024 << "M/" | ||
GpuMemoryUsage(&available_memory, &total); | ||
VLOG(10) << "GPU Usage " << available_memory / 1024 / 1024 << "M/" | ||
<< total / 1024 / 1024 << "M"; | ||
size_t reserving = static_cast<size_t>(0.05 * total); | ||
// If available less than minimum chunk size, no usable memory exists. | ||
available = | ||
std::min(std::max(available, GpuMinChunkSize()) - GpuMinChunkSize(), | ||
total - reserving); | ||
available_memory = std::min( | ||
std::max(available_memory, GpuMinChunkSize()) - GpuMinChunkSize(), | ||
total - reserving); | ||
|
||
// Reserving the rest memory for page tables, etc. | ||
|
||
size_t allocating = static_cast<size_t>(FLAGS_fraction_of_gpu_memory_to_use * | ||
(total - reserving)); | ||
size_t allocating_memory = static_cast<size_t>( | ||
FLAGS_fraction_of_gpu_memory_to_use * (total - reserving)); | ||
|
||
PADDLE_ENFORCE_LE(allocating, available); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can write an extra message here if you think PADDLE_ENFORCE_LE is not good. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks |
||
PADDLE_ENFORCE_LE(allocating_memory, available_memory); | ||
|
||
return allocating; | ||
return allocating_memory; | ||
} | ||
|
||
void GpuMemcpyAsync(void *dst, const void *src, size_t count, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data check failed.
-->Enforce failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks