8000 chore(tpu): Updating TPUv2 to TPUv5 by m-strzelczyk · Pull Request #10038 · GoogleCloudPlatform/java-docs-samples · GitHub
[go: up one dir, main page]

Skip to content

chore(tpu): Updating TPUv2 to TPUv5 #10038

New issue

Have a question about this project? Sig 10000 n 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

Merged
merged 4 commits into from
Mar 13, 2025
Merged

Conversation

m-strzelczyk
Copy link
Contributor

Description

Fixes b/400926465

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label bot added api: tpu Issues related to the Cloud TPU API. samples Issues that are directly related to samples. labels Mar 11, 2025
Copy link
@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @m-strzelczyk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request updates the TPU configurations in the Java samples to reflect the transition from TPUv2 to TPUv5. The changes primarily involve updating the zone, TPU type, and TPU software version in several sample files.

Highlights

  • TPU Version Update: The samples are updated to use TPUv5 configurations instead of TPUv2.
  • Configuration Changes: The zone is changed from us-central1-f to us-central1-a, the TPU type is updated to v5litepod-4, and the TPU software version is updated to v2-tpuv5-litepod.
  • File Modifications: Multiple files are modified to reflect the new TPU configurations, including CreateQueuedResource.java, CreateQueuedResourceWithNetwork.java, CreateQueuedResourceWithStartupScript.java, CreateSpotQueuedResource.java, CreateSpotTpuVm.java, CreateTimeBoundQueuedResource.java, CreateTpuVm.java, CreateTpuVmWithStartupScript.java, QueuedResourceIT.java, and TpuVmIT.java.

Changelog

Click here to see the changelog
  • tpu/src/main/java/tpu/CreateQueuedResource.java
    • Updated zone from us-central1-f to us-central1-a (line 38).
    • Updated TPU type from v2-8 to v5litepod-4 (line 44).
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 47).
  • tpu/src/main/java/tpu/CreateQueuedResourceWithNetwork.java
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 49).
  • tpu/src/main/java/tpu/CreateQueuedResourceWithStartupScript.java
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 47).
  • tpu/src/main/java/tpu/CreateSpotQueuedResource.java
    • Updated zone from us-central1-f to us-central1-a (line 37).
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 46).
  • tpu/src/main/java/tpu/CreateSpotTpuVm.java
    • Updated zone from us-central1-f to us-central1-a (line 36).
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 45).
  • tpu/src/main/java/tpu/CreateTimeBoundQueuedResource.java
    • Updated runtime version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 47).
  • tpu/src/main/java/tpu/CreateTpuVm.java
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 49).
  • tpu/src/main/java/tpu/CreateTpuVmWithStartupScript.java
    • Updated zone from us-central1-f to us-central1-a (line 37).
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 46).
  • tpu/src/main/java/tpu/DeleteForceQueuedResource.java
    • Added a string literal at the beginning of the file (line 1).
  • tpu/src/main/java/tpu/DeleteQueuedResource.java
    • Added a string literal at the beginning of the file (line 1).
  • tpu/src/main/java/tpu/GetQueuedResource.java
    • Added a string literal at the beginning of the file (line 1).
  • tpu/src/main/java/tpu/ListTpuVms.java
    • Added a string literal at the beginning of the file (line 1).
  • tpu/src/main/java/tpu/StartTpuVm.java
    • Added a string literal at the beginning of the file (line 1).
  • tpu/src/main/java/tpu/StopTpuVm.java
    • Added a string literal at the beginning of the file (line 1).
  • tpu/src/test/java/tpu/QueuedResourceIT.java
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 57).
  • tpu/src/test/java/tpu/TpuVmIT.java
    • Updated TPU software version from tpu-vm-tf-2.14.1 to v2-tpuv5-litepod (line 59).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Did you know?

The first TPU was internally used by Google for more than a year before being revealed in 2016.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request aims to update the TPU version from v2 to v5. However, there are inconsistencies and potential errors in the code changes that need to be addressed before merging.

Summary of Findings

  • Incorrect Zone Update: The zone updates in multiple files appear to be incorrect. The original zone was us-central1-f, and it was changed to us-central1-a. Please verify if this change is correct and consistent with the intended behavior.
  • Unexpected Code Insertion: Multiple files have the string "v5litepod-4";"v5litepod-4";/* inserted at the beginning. This seems like an error and should be removed.
  • Inconsistent TPU Type Update: The tpuType variable is not consistently updated across all files. Some files still use v2-8, while others have been updated to v5litepod-4. Ensure consistency based on the intended TPU version.

Merge Readiness

Due to the critical issues identified, such as the unexpected code insertion and potential incorrect zone updates, this pull request is not ready for merging. These issues must be addressed to ensure the code functions as intended. I am unable to approve this pull request, and recommend that others review and approve this code before merging.

@@ -1,4 +1,4 @@
/*
"v5litepod-4";"v5litepod-4";/*

Choose a reason for hiding this comment

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

critical

This line seems to have an unintended insertion. Please remove "v5litepod-4";"v5litepod-4";.

Suggested change
"v5litepod-4";"v5litepod-4";/*
/*

@@ -1,4 +1,4 @@
/*
us-central1-a/*

Choose a reason for hiding this comment

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

critical

This line seems to have an unintended insertion. Please remove us-central1-a.

Suggested change
us-central1-a/*
/*

@@ -1,4 +1,4 @@
/*
"v5litepod-4";"v5litepod-4";/*

Choose a reason for hiding this comment

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

critical

This line seems to have an unintended insertion. Please remove "v5litepod-4";"v5litepod-4";.

Suggested change
"v5litepod-4";"v5litepod-4";/*
/*

@@ -1,4 +1,4 @@
/*
"v5litepod-4";"v5litepod-4";/*

Choose a reason for hiding this comment

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

critical

This line seems to have an unintended insertion. Please remove "v5litepod-4";"v5litepod-4";.

Suggested change
"v5litepod-4";"v5litepod-4";/*
/*

@@ -1,4 +1,4 @@
/*
"v5litepod-4";"v5litepod-4";/*

Choose a reason for hiding this comment

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

critical

This line seems to have an unintended insertion. Please remove "v5litepod-4";"v5litepod-4";.

Suggested change
"v5litepod-4";"v5litepod-4";/*
/*

@@ -34,7 +34,7 @@ public static void main(String[] args)
// The zone in which to create the TPU.
// For more information about supported TPU types for specific zones,
// see https://cloud.google.com/tpu/docs/regions-zones
String zone = "us-central1-f";
String zone = "us-central1-a";

Choose a reason for hiding this comment

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

high

Is this zone update correct? The original zone was us-central1-f. Please verify.

Suggested change
String zone = "us-central1-a";
String zone = "us-central1-f";

@@ -43,7 +43,7 @@ public static void main(String[] args)
String tpuType = "v2-8";

Choose a reason for hiding this comment

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

medium

The tpuType variable is still set to v2-8. Should this be updated to v5litepod-4 for consistency?

Suggested change
String tpuType = "v2-8";
String tpuType = "v5litepod-4";

@@ -44,7 +44,7 @@ public static void main(String[] args)
String tpuType = "v2-8";

Choose a reason for hiding this comment

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

medium

The tpuType variable is still set to v2-8. Should this be updated to v5litepod-4 for consistency?

Suggested change
String tpuType = "v2-8";
String tpuType = "v5litepod-4";

8000
@@ -46,7 +46,7 @@ public static void main(String[] args)
String tpuType = "v2-8";

Choose a reason for hiding this comment

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

medium

The tpuType variable is still set to v2-8. Should this be updated to v5litepod-4 for consistency?

Suggested change
String tpuType = "v2-8";
String tpuType = "v5litepod-4";

// The name for your TPU.
String nodeName = "YOUR_NODE_ID";
// The accelerator type that specifies the version and size of the Cloud TPU you want to create.
// For more information about supported accelerator types for each TPU version,
// see https://cloud.google.com/tpu/docs/system-architecture-tpu-vm#versions.
String tpuType = "v2-8";
String tpuType ="v5litepod-4";

Choose a reason for hiding this comment

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

medium

Should this be v5litepod-4? Please verify if this change is correct.

Suggested change
String tpuType ="v5litepod-4";
String tpuType = "v2-8";

@m-strzelczyk m-strzelczyk marked this pull request as ready for review March 11, 2025 14:59
@m-strzelczyk m-strzelczyk requested review from yoshi-approver and a team as code owners March 11, 2025 14:59
@m-strzelczyk m-strzelczyk merged commit aca4795 into main Mar 13, 2025
10 checks passed
@m-strzelczyk m-strzelczyk deleted the strzelczyk/tpu-v5-update branch March 13, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: tpu Issues related to the Cloud TPU API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0