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

Use atomic<int64_t> instead of atomic_int64_t. The later is available in GCC7, but not GCC5 #528

Closed
wants to merge 2 commits into from

Conversation

aaronenyeshi
Copy link
Member

Summary: Since PyTorch CI builds for GCC5, we need to use std::atomicstd::int64_t for iterationCount, because atomic_int64_t is not available until after GCC5.

Reviewed By: briancoutinho

Differential Revision: D34190739

Pulled By: aaronenyeshi

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D34190739

aaronenyeshi and others added 2 commits February 15, 2022 08:41
…++14.

Summary:
std::shared_mutex is not available in C++14, and shows an error when incorporated into PyTorch CI. This patch replaces it with shared_timed_mutex, which is available, and is shared_mutex in GCC5.0.

To use std::shared_mutex, we must use C++17.

Differential Revision: D34190117

fbshipit-source-id: dab9bc72f5df9f050814e5e30ab73450b5995961
… in GCC7, but not GCC5 (pytorch#528)

Summary:
Pull Request resolved: pytorch#528

Since PyTorch CI builds for GCC5, we need to use std::atomic<std::int64_t> for iterationCount, because atomic_int64_t is not available until after GCC5.

Test Plan:
This fixes PyTorch CI error:
https://app.circleci.com/pipelines/github/pytorch/pytorch/450702/workflows/e2f30e30-26d5-410d-8334-a2d6919d74de/jobs/16978938
```
In file included from ../third_party/kineto/libkineto/src/ActivityProfilerController.cpp:3:0:
../third_party/kineto/libkineto/src/ActivityProfilerController.h:79:8: error: ‘atomic_int64_t’ in namespace ‘std’ does not name a type
   std::atomic_int64_t iterationCount_{-1};
        ^
../third_party/kineto/libkineto/src/ActivityProfilerController.cpp: In member function ‘void libkineto::ActivityProfilerController::step()’:
../third_party/kineto/libkineto/src/ActivityProfilerController.cpp:137:27: error: ‘iterationCount_’ was not declared in this scope
   int64_t currentIter = ++iterationCount_;
                           ^
../third_party/kineto/libkineto/src/ActivityProfilerController.cpp: In member function ‘void libkineto::ActivityProfilerController::scheduleTrace(const libkineto::Config&)’:
../third_party/kineto/libkineto/src/ActivityProfilerController.cpp:185:44: error: ‘iterationCount_’ was not declared in this scope
   if (config.hasProfileStartIteration() && iterationCount_ < 0) {
                                            ^
```

Reviewed By: briancoutinho

Differential Revision: D34190739

Pulled By: aaronenyeshi

fbshipit-source-id: 6797ed39084a518d210a27cae2e6030cf8625c99
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D34190739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants