-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide more CUDA diagnostic information
* CUDA_VISIBLE_DEVICES can cause cuInit to fail, print it * Mention verbose logging * Clarify the error in the DSO search - not finding it is not necessarily bad * Add a basic test to make sure the diagnostic log at least doesn't crash PiperOrigin-RevId: 701961794
- Loading branch information
1 parent
ebd7920
commit 28fe451
Showing
3 changed files
with
146 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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 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 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,49 @@ | ||
/* Copyright 2024 The OpenXLA Authors. | ||
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 "xla/stream_executor/cuda/cuda_diagnostics.h" | ||
|
||
#include <gtest/gtest.h> | ||
#include "absl/debugging/leak_check.h" | ||
#include "absl/log/check.h" | ||
#include "absl/log/globals.h" | ||
#include "xla/stream_executor/platform.h" | ||
#include "xla/stream_executor/platform_manager.h" | ||
#include "tsl/platform/statusor.h" | ||
#include "tsl/platform/test.h" | ||
|
||
namespace stream_executor::gpu { | ||
namespace { | ||
|
||
void EnsureCudaIsInitialized() { | ||
// Platform is intentionally leaked. | ||
// See the comment in platform_manager.h. | ||
absl::LeakCheckDisabler disabler; | ||
|
||
TF_ASSERT_OK_AND_ASSIGN(stream_executor::Platform * platform, | ||
PlatformManager::PlatformWithName("CUDA")); | ||
CHECK_GT(platform->VisibleDeviceCount(), 0); | ||
} | ||
|
||
TEST(CudaDiagnosticsTest, DiagnosticRuns) { | ||
// Initialize the platform - this is not code under test, it only ensures that | ||
// we have a working CUDA setup. | ||
EnsureCudaIsInitialized(); | ||
|
||
cuda::Diagnostician::LogDiagnosticInformation(); | ||
} | ||
|
||
} // namespace | ||
} // namespace stream_executor::gpu |