-
Notifications
You must be signed in to change notification settings - Fork 232
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
Allow checkpoint and restore on non-deterministic expressions in GpuFilter and GpuProject #9287
Merged
firestarman
merged 6 commits into
NVIDIA:branch-23.10
from
firestarman:retry-non-deterministic
Sep 28, 2023
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b24ef39
Allow checkpoint and restore on non-deterministic expressions
firestarman b583da2
Disable Retryable support for UDF
firestarman 1f9b649
some fixes
firestarman ddf0da2
Add tests
firestarman 9c4136b
A format fix
firestarman 2f76d2b
Address comments and add more tests
firestarman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.nvidia.spark; | ||
|
||
/** | ||
* An interface that can be used by Retry framework of RAPIDS Plugin to handle the GPU OOMs. | ||
* | ||
* GPU memory is a limited resource, so OOM can happen if too many tasks run in parallel. | ||
* Retry framework is introduced to improve the stability by retrying the work when it | ||
* meets OOMs. The overall process of Retry framework is similar as the below. | ||
* ``` | ||
* Retryable retryable | ||
* retryable.checkpoint() | ||
* boolean hasOOM = false | ||
* do { | ||
* try { | ||
* runWorkOnGpu(retryable) // May lead to GPU OOM | ||
* hasOOM = false | ||
* } catch (OOMError oom) { | ||
* hasOOM = true | ||
* tryToReleaseSomeGpuMemoryFromLowPriorityTasks() | ||
* retryable.restore() | ||
* } | ||
* } while(hasOOM) | ||
* ``` | ||
* In a retry, "checkpoint" will be called first and only once, which is used to save the | ||
* state for later loops. When OOM happens, "restore" will be called to restore the | ||
* state that saved by "checkpoint". After that, it will try the same work again. And | ||
* the whole process runs on Spark executors. | ||
* | ||
* Retry framework expects the "runWorkOnGpu" always outputs the same result when running | ||
* it multiple times in a retry. So if "runWorkOnGpu" is non-deterministic, it can not be | ||
* used by Retry framework. | ||
* The "Retryable" is designed for this kind of cases. By implementing this interface, | ||
* "runWorkOnGpu" can become deterministic inside a retry process, making it usable for | ||
* Retry framework to improve the stability. | ||
*/ | ||
public interface Retryable { | ||
revans2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/** | ||
* Save the state, so it can be restored in case of an OOM Retry. | ||
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. nit: can we drop the OOM here?
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. sure, done |
||
* This is called inside a Spark task context on executors. | ||
*/ | ||
void checkpoint(); | ||
|
||
/** | ||
* Restore the state that was saved by calling to "checkpoint". | ||
* This is called inside a Spark task context on executors. | ||
*/ | ||
void restore(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think this is too much detail for an end user. Could we adjust it a bit? Perhaps something more like.
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.
sure, done