Skip to content
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

pd: skip certain UT and fix paddle ver in in test_cuda.yml #4439

Merged

Conversation

HydrogenSulfate
Copy link
Contributor

@HydrogenSulfate HydrogenSulfate commented Nov 28, 2024

In two unit tests under pd/, paddle.jit.save is called, which leads to occasional cuda error 709. Before resolving this issue, temporarily mark these two unittests to be skipped(pd/test_dp_show.py and pd/test_multikask).
image
image

image

Meanwhile, the version of paddlepaddle-gpu in test_cuda.yml has been fixed.

@njzjz

Summary by CodeRabbit

  • Bug Fixes

    • Updated test classes to skip execution due to unresolved CUDA errors.
  • Tests

    • Introduced a new test class for multitask models.
    • Added assertions to validate multitask model configurations.
    • Retained cleanup methods in test classes to manage generated files.

… in jit.save; fix the paddlepaddle-gpu version in test_cuda.yml
Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

📝 Walkthrough

Walkthrough

The pull request introduces several updates to the workflow configuration for testing CUDA, specifically in the .github/workflows/test_cuda.yml file. It refines job conditions, updates the PaddlePaddle installation command, and maintains the structure of the workflow. Additionally, new test classes for multitask models are introduced in the test files, with some tests temporarily disabled due to unresolved CUDA errors. The overall structure of the tests is preserved while ensuring proper cleanup after execution.

Changes

File Path Change Summary
.github/workflows/test_cuda.yml Updated workflow triggers, concurrency settings, job conditions, and PaddlePaddle installation command.
source/tests/pd/test_dp_show.py Added TestMultiTaskModel class with setup, checkpoint, and teardown methods; existing tests marked to skip.
source/tests/pd/test_multitask.py Added skip decorators to MultiTaskTrainTest and TestMultiTaskSeA classes to prevent execution until CUDA error is resolved.

Possibly related PRs

  • ci: bump TF to 2.18, PT to 2.5 #4228: The changes in this PR also involve updates to the .github/workflows/test_cuda.yml file, specifically modifying the CUDA version and installation commands, which are directly related to the main PR's updates in the same file.
  • ci: install GPU JAX in GPU CI #4293: This PR updates the .github/workflows/test_cuda.yml file to enhance the CUDA testing environment by adding JAX installation, which is relevant to the main PR's focus on CUDA workflow modifications.

Suggested labels

Python

Suggested reviewers

  • wanghan-iapcm

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (2)
source/tests/pd/test_dp_show.py (2)

32-33: Enhance skip message with issue tracking reference.

While the skip message clearly indicates the CUDA error 709 issue, it would be helpful to add a reference to the tracking issue for future maintainers.

-@unittest.skip("Skip until solving cuda error 709 in jit.save")
+@unittest.skip("Skip until solving cuda error 709 in jit.save (see issue #XXXX)")

Also applies to: 105-106


Line range hint 107-204: Consider adding error test case for invalid model branch.

The TestMultiTaskModel thoroughly tests the happy path but could benefit from additional error handling tests, similar to test_checkpoint_error in TestSingleTaskModel.

Consider adding a test case like:

def test_invalid_model_branch(self):
    INPUT = "model.ckpt.pd"
    ATTRIBUTES = "model-branch type-map descriptor fitting-net"
    with self.assertRaisesRegex(RuntimeError, "Invalid model branch"):
        run_dp(f"dp --pd show {INPUT} {ATTRIBUTES} --model-branch invalid_branch")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 037cf3f and 6bda4b6.

📒 Files selected for processing (3)
  • .github/workflows/test_cuda.yml (1 hunks)
  • source/tests/pd/test_dp_show.py (2 hunks)
  • source/tests/pd/test_multitask.py (2 hunks)
🔇 Additional comments (5)
.github/workflows/test_cuda.yml (3)

Line range hint 19-20: Verify CUDA version compatibility across dependencies

The workflow uses CUDA 12.6.2 base image but installs packages with different CUDA versions:

  • PaddlePaddle: CUDA 12.3
  • TensorFlow: 2.18.0rc2
  • PyTorch: 2.5.0
  • JAX: CUDA 12

This version mix might lead to compatibility issues. Consider:

  1. Aligning CUDA versions across all dependencies
  2. Documenting why specific versions are required
  3. Adding explicit tests to verify CUDA compatibility

Let's check for potential CUDA conflicts:

Also applies to: 54-54

🧰 Tools
🪛 actionlint (1.7.4)

51-51: shellcheck reported issue in this script: SC2155:warning:1:8: Declare and assign separately to avoid masking return values

(shellcheck)


51-51: shellcheck reported issue in this script: SC2155:warning:2:8: Declare and assign separately to avoid masking return values

(shellcheck)


51-51: shellcheck reported issue in this script: SC2102:info:4:61: Ranges can only match single chars (mentioned due to duplicates)

(shellcheck)


54-54: Consider using a stable PaddlePaddle release instead of nightly build

The current installation uses a nightly development build (dev20241126) which may introduce instability in the CI pipeline. While this might temporarily fix the CUDA error 709, it's generally recommended to use stable releases in CI environments.

Consider either:

  1. Using the latest stable release with CUDA 12.3 support
  2. If the nightly build is necessary, document why it's required and add a reminder to update it to a stable version once available

Let's verify if there are stable versions available:

✅ Verification successful

Let me try another verification approach to understand the context better:


Using development build is justified due to CUDA error 709

Based on the search results, using the nightly build appears to be a deliberate choice to address the CUDA error 709 that's affecting multiple tests. The codebase shows:

  • Multiple test files are skipped with the comment "Skip until solving cuda error 709 in jit.save"
  • The project requires PaddlePaddle >= 3.0.0b1 as seen in backend/find_paddle.py
  • No stable CUDA 12.3 versions are currently available

Since this is a known issue being actively worked on, and the development build is specifically chosen to address the CUDA error 709, the current approach is appropriate for now.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for stable PaddlePaddle versions with CUDA 12.3 support
curl -s "https://www.paddlepaddle.org.cn/whl/linux/gpu-cuda-12.3/flagged" | grep -o 'paddlepaddle_gpu-[0-9.]*-cp311-cp311-linux_x86_64.whl' || echo "No stable versions found"

Length of output: 198


Script:

#!/bin/bash
# Check the repository for any documentation or comments about PaddlePaddle version requirements
rg -i "paddlepaddle" -g "!*.whl" -g "!*.pyc" -g "!*.log" -A 3 -B 3

# Also check if there are any issues or PRs mentioning CUDA error 709
rg -i "cuda.*709|error.*709" -g "!*.whl" -g "!*.pyc" -g "!*.log" -A 2 -B 2

Length of output: 4375


Line range hint 65-69: Consider optimizing test environment for CUDA stability

Given the CUDA error 709 issues mentioned in the PR objectives, consider these environment optimizations:

  1. Add memory management settings:
    env:
      NUM_WORKERS: 0
      CUDA_VISIBLE_DEVICES: 0
      XLA_PYTHON_CLIENT_PREALLOCATE: false
  • CUDA_LAUNCH_BLOCKING: 1
  • PYTORCH_CUDA_ALLOC_CONF: max_split_size_mb:512
2. Add error logging to capture CUDA-specific issues



Let's check current CUDA memory management settings:

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 actionlint (1.7.4)</summary>

51-51: shellcheck reported issue in this script: SC2155:warning:1:8: Declare and assign separately to avoid masking return values

(shellcheck)

---

51-51: shellcheck reported issue in this script: SC2155:warning:2:8: Declare and assign separately to avoid masking return values

(shellcheck)

---

51-51: shellcheck reported issue in this script: SC2102:info:4:61: Ranges can only match single chars (mentioned due to duplicates)

(shellcheck)

</details>

</details>

</details>
<details>
<summary>source/tests/pd/test_dp_show.py (1)</summary>

Line range hint `34-104`: **LGTM! Well-structured test implementation.**

The TestSingleTaskModel implementation follows testing best practices with:
- Proper setup and teardown
- Comprehensive attribute verification
- Good error handling for invalid cases

</details>
<details>
<summary>source/tests/pd/test_multitask.py (1)</summary>

Line range hint `43-185`: **Verify the scope of CUDA error 709 impact.**

Let's verify if this CUDA error affects other test files and if there are any potential workarounds.

</details>

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

source/tests/pd/test_dp_show.py Show resolved Hide resolved
source/tests/pd/test_multitask.py Show resolved Hide resolved
source/tests/pd/test_multitask.py Show resolved Hide resolved
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.75%. Comparing base (037cf3f) to head (6bda4b6).
Report is 1 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #4439      +/-   ##
==========================================
- Coverage   83.27%   82.75%   -0.52%     
==========================================
  Files         667      667              
  Lines       61446    61446              
  Branches     3486     3486              
==========================================
- Hits        51167    50851     -316     
- Misses       9151     9469     +318     
+ Partials     1128     1126       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@njzjz njzjz added this pull request to the merge queue Nov 28, 2024
Merged via the queue into deepmodeling:devel with commit f7e4cdf Nov 28, 2024
60 checks passed
@HydrogenSulfate HydrogenSulfate deleted the skip_UT_and_fix_paddle_ver branch November 28, 2024 06:09
@HydrogenSulfate HydrogenSulfate mentioned this pull request Dec 9, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants