-
Notifications
You must be signed in to change notification settings - Fork 6k
Profiler refine and add CUDA runtime api tracer #15301
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
225d331
refine profiler && add runtime tracer
cjld fc6dc7d
test=develop
cjld 41c82ca
test=develop
cjld e9a625f
test=develop
cjld 98a7543
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
cjld a84497c
test=develop
cjld c431b6a
test=develop
cjld e069fab
test=develop
cjld 31be7bf
test=develop
cjld d17f79e
test=develop
cjld bb49a5b
fix bug && test=develop
cjld c2cb082
add thread id map && test=develop
cjld 18f9158
test=develop
cjld eeb2aa7
testing
cjld 5510f31
bug fix
cjld b59cd77
Merge branch 'profiler_refine_tmp' into profiler_refine
cjld fbd3122
remove cuda event && refine code && test=develop
cjld 29c461f
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
cjld dda480c
test=develop
cjld fa15b9f
test=develop
cjld 6188131
test=develop
cjld 02158db
fix windows temp file && test=develop
cjld a1ca223
test=develop
cjld 58dea48
fix windows bug && test=develop
cjld e46c6b9
fix start up issue && test=develop
cjld b00bee2
code polish && test=develop
cjld 058bcd8
remove unused code && test=develop
cjld f0c9f10
add some cupti cbid && test=develop
cjld f878edf
add FLAGS_multiple_of_cupti_buffer_size && test=develop
cjld 3f29bb8
fix compile error && test=develop
cjld 12ecf7d
add keyword && test=develop
cjld 03a7de2
fix && test=develop
cjld 4f39900
code polish && test=develop
cjld 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 hidden or 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 hidden or 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 hidden or 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,50 @@ | ||
| /* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. | ||
|
|
||
| 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. */ | ||
|
|
||
| #include "paddle/fluid/platform/profiler.h" | ||
|
|
||
| #include <cuda.h> | ||
|
|
||
| namespace paddle { | ||
| namespace platform { | ||
|
|
||
| __global__ void DummyKernel(int *a) { a[0] = 0; } | ||
|
|
||
| static void ForEachDevice(std::function<void(int)> func) { | ||
| auto original_device = GetCurrentDeviceId(); | ||
| int count = GetCUDADeviceCount(); | ||
| for (int i = 0; i < count; i++) { | ||
| SetDeviceId(i); | ||
| func(i); | ||
| } | ||
| SetDeviceId(original_device); | ||
| } | ||
|
|
||
| void DummyKernelAndEvent() { | ||
| for (int i = 0; i < 5; i++) { | ||
| ForEachDevice([](int d) { | ||
| CUDADeviceContext *dev_ctx = new CUDADeviceContext(CUDAPlace(d)); | ||
| Mark("_cuda_startup_"); | ||
| int *ptr; | ||
| PADDLE_ENFORCE(cudaMalloc(&ptr, sizeof(int))); | ||
| DummyKernel<<<1, 1, 0, dev_ctx->stream()>>>(ptr); | ||
| dev_ctx->Wait(); | ||
| PADDLE_ENFORCE(cudaFree(ptr)); | ||
| delete dev_ctx; | ||
|
Contributor
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.
Contributor
Author
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. freed by cudaFree. |
||
| }); | ||
| } | ||
| } | ||
|
|
||
| } // namespace platform | ||
| } // namespace paddle | ||
This file contains hidden or 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
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.
It seems that
BuildVaris not used in this PR.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.
mistake, removed.