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

tools/ut: add a parallel parameter #8186

Merged
merged 6 commits into from
May 23, 2024
Merged

Conversation

HuSharp
Copy link
Member

@HuSharp HuSharp commented May 17, 2024

What problem does this PR solve?

can execute

./bin/pd-ut run --race tests --parallel 100

Issue Number: Ref #7969

What is changed and how does it work?

add parallel parameter

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

Release note

None.

Copy link
Contributor

ti-chi-bot bot commented May 17, 2024

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • nolouch

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label May 17, 2024
@ti-chi-bot ti-chi-bot bot requested review from lhy1024 and rleungx May 17, 2024 01:29
@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 17, 2024
@HuSharp HuSharp changed the title tools/ut: add parallel parameter tools/ut: add a parallel parameter May 17, 2024
Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.32%. Comparing base (0056569) to head (3c5957c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8186      +/-   ##
==========================================
- Coverage   77.35%   77.32%   -0.04%     
==========================================
  Files         471      471              
  Lines       61436    61436              
==========================================
- Hits        47522    47503      -19     
- Misses      10347    10360      +13     
- Partials     3567     3573       +6     
Flag Coverage Δ
unittests 77.32% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Signed-off-by: husharp <[email protected]>
@HuSharp HuSharp mentioned this pull request May 20, 2024
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 22, 2024
@@ -694,7 +701,8 @@ func buildTestBinaryMulti(pkgs []string) error {
packages = append(packages, path.Join(modulePath, pkg))
}

p := strconv.Itoa(buildParallel)
// We use 2 * parallel for `go build` to make it faster.
Copy link
Member

@okJiang okJiang May 22, 2024

Choose a reason for hiding this comment

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

One question, why do we choose 2 * parallel to execute go build? not 1.5 or 3.

Copy link
Member Author

@HuSharp HuSharp May 22, 2024

Choose a reason for hiding this comment

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

background:

When building the test binaries, by default it is the number of cores(pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies):

-p n
the number of programs, such as build commands or
test binaries, that can be run in parallel.
The default is GOMAXPROCS, normally the number of CPUs available.

When running the 'building binaries stage' of make ut, the CPU usage is not high with the default value. So I think it's a better idea to increase the parallelism.

why do we choose 2 * parallel to execute go build? not 1.5 or 3.

Choice 2 wasn't much thought or testing, and I think 2 is fine for the time being :) Or do you have any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

Or do you have any ideas?

I have no idea about that. I thought 2 had any special meaning before

parallel = runtime.GOMAXPROCS(0)
} else {
var err error
parallel, err = strconv.Atoi(parallelStr)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need check if the parallel<=runtime.GOMAXPROCS(0)

Copy link
Member Author

@HuSharp HuSharp May 22, 2024

Choose a reason for hiding this comment

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

There is no need, we can support parallel greater than procs. It depends on the user.

Copy link
Member

@okJiang okJiang May 22, 2024

Choose a reason for hiding this comment

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

I think it's better to set a maximum value. For example, 1000. I just said it casually

what do you think

Copy link
Member Author

Choose a reason for hiding this comment

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

make sense, and add a hint when parallel was set greater than procs :)
f42fc5e#diff-d1de7e6511458d33a769c0c501ec0ea45494dd9d2e830dc315e8fe623eb34b76R132

Signed-off-by: husharp <[email protected]>
@HuSharp HuSharp requested a review from okJiang May 22, 2024 09:14
Copy link
Contributor

ti-chi-bot bot commented May 22, 2024

@okJiang: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@HuSharp HuSharp added the require-LGT1 Indicates that the PR requires an LGTM. label May 23, 2024
@HuSharp
Copy link
Member Author

HuSharp commented May 23, 2024

/merge

Copy link
Contributor

ti-chi-bot bot commented May 23, 2024

@HuSharp: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

Copy link
Contributor

ti-chi-bot bot commented May 23, 2024

This pull request has been accepted and is ready to merge.

Commit hash: 3c5957c

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label May 23, 2024
@ti-chi-bot ti-chi-bot bot merged commit 0f3e1f9 into tikv:master May 23, 2024
19 checks passed
@HuSharp HuSharp deleted the add_parallel branch May 23, 2024 02:10
okJiang pushed a commit to okJiang/pd that referenced this pull request May 23, 2024
ref tikv#7969

add parallel parameter

Signed-off-by: husharp <[email protected]>
Signed-off-by: okJiang <[email protected]>
okJiang pushed a commit to okJiang/pd that referenced this pull request May 23, 2024
ref tikv#7969

add parallel parameter

Signed-off-by: husharp <[email protected]>
Signed-off-by: okJiang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. require-LGT1 Indicates that the PR requires an LGTM. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants