File tree Expand file tree Collapse file tree 2 files changed +14
-17
lines changed Expand file tree Collapse file tree 2 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 88
99#include " DeviceUtil.h"
1010
11- #include < mutex>
12-
1311namespace KINETO_NAMESPACE {
1412
15- bool amdGpuAvailable = false ;
16- bool cudaGpuAvailable = false ;
17-
1813bool isAMDGpuAvailable () {
1914#ifdef HAS_ROCTRACER
20- static std::once_flag once;
21- std::call_once (once, [] {
15+ static bool amdGpuAvailable = [] {
2216 // determine AMD GPU availability on the system
2317 hipError_t error;
2418 int deviceCount;
2519 error = hipGetDeviceCount (&deviceCount);
26- amdGpuAvailable = (error == hipSuccess && deviceCount > 0 );
27- });
28- #endif
20+ return (error == hipSuccess && deviceCount > 0 );
21+ }();
2922 return amdGpuAvailable;
23+ #else
24+ return false ;
25+ #endif
3026}
3127
3228bool isCUDAGpuAvailable () {
3329#ifdef HAS_CUPTI
34- static std::once_flag once;
35- std::call_once (once, [] {
30+ static bool cudaGpuAvailable = [] {
3631 // determine CUDA GPU availability on the system
3732 cudaError_t error;
3833 int deviceCount;
3934 error = cudaGetDeviceCount (&deviceCount);
40- cudaGpuAvailable = (error == cudaSuccess && deviceCount > 0 );
41- });
42- #endif
35+ return (error == cudaSuccess && deviceCount > 0 );
36+ }();
4337 return cudaGpuAvailable;
38+ #else
39+ return false ;
40+ #endif
4441}
4542
4643bool isGpuAvailable () {
Original file line number Diff line number Diff line change @@ -316,8 +316,8 @@ class EventProfilerTest : public ::testing::Test {
316316 loggers_,
317317 onDemandLoggers_);
318318
319- for (int i = 0 ; i < kEventGroupCount ; i++ ) {
320- eventGroups_[i] = &eventGroups_[i] ;
319+ for (auto & eventGroup : eventGroups_ ) {
320+ eventGroup = &eventGroup ;
321321 }
322322 for (int i = 0 ; i < kGroupSetCount ; i++) {
323323 // Default size to 1 but can be changed by test
You can’t perform that action at this time.
0 commit comments