aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor/cuda/cuda_diagnostics.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/stream_executor/cuda/cuda_diagnostics.cc')
-rw-r--r--tensorflow/stream_executor/cuda/cuda_diagnostics.cc90
1 files changed, 4 insertions, 86 deletions
diff --git a/tensorflow/stream_executor/cuda/cuda_diagnostics.cc b/tensorflow/stream_executor/cuda/cuda_diagnostics.cc
index 46e5deed84..10f6d21d54 100644
--- a/tensorflow/stream_executor/cuda/cuda_diagnostics.cc
+++ b/tensorflow/stream_executor/cuda/cuda_diagnostics.cc
@@ -24,17 +24,12 @@ limitations under the License.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef __APPLE__
-#include <IOKit/kext/KextManager.h>
-#include <mach-o/dyld.h>
-#else
#if !defined(PLATFORM_WINDOWS)
#include <link.h>
#include <sys/sysmacros.h>
#include <unistd.h>
#endif
#include <sys/stat.h>
-#endif
#include <algorithm>
#include <memory>
#include <vector>
@@ -54,9 +49,7 @@ limitations under the License.
namespace stream_executor {
namespace cuda {
-#ifdef __APPLE__
-static const CFStringRef kDriverKextIdentifier = CFSTR("com.nvidia.CUDA");
-#elif !defined(PLATFORM_WINDOWS)
+#if !defined(PLATFORM_WINDOWS)
static const char *kDriverVersionPath = "/proc/driver/nvidia/version";
#endif
@@ -121,26 +114,7 @@ string Diagnostician::GetDevNodePath(int dev_node_ordinal) {
}
void Diagnostician::LogDiagnosticInformation() {
-#ifdef __APPLE__
- CFStringRef kext_ids[1];
- kext_ids[0] = kDriverKextIdentifier;
- CFArrayRef kext_id_query = CFArrayCreate(nullptr, (const void**)kext_ids, 1, &kCFTypeArrayCallBacks);
- CFDictionaryRef kext_infos = KextManagerCopyLoadedKextInfo(kext_id_query, nullptr);
- CFRelease(kext_id_query);
-
- CFDictionaryRef cuda_driver_info = nullptr;
- if (CFDictionaryGetValueIfPresent(kext_infos, kDriverKextIdentifier, (const void**)&cuda_driver_info)) {
- bool started = CFBooleanGetValue((CFBooleanRef)CFDictionaryGetValue(cuda_driver_info, CFSTR("OSBundleStarted")));
- if (!started) {
- LOG(INFO) << "kernel driver is installed, but does not appear to be running on this host "
- << "(" << port::Hostname() << ")";
- }
- } else {
- LOG(INFO) << "kernel driver does not appear to be installed on this host "
- << "(" << port::Hostname() << ")";
- }
- CFRelease(kext_infos);
-#elif !defined(PLATFORM_WINDOWS)
+#if !defined(PLATFORM_WINDOWS)
if (access(kDriverVersionPath, F_OK) != 0) {
LOG(INFO) << "kernel driver does not appear to be running on this host "
<< "(" << port::Hostname() << "): "
@@ -194,8 +168,7 @@ void Diagnostician::LogDiagnosticInformation() {
<< DriverVersionStatusToString(kernel_version);
#endif
- // OS X kernel driver does not report version accurately
-#if !defined(__APPLE__) && !defined(PLATFORM_WINDOWS)
+#if !defined(PLATFORM_WINDOWS)
if (kernel_version.ok() && dso_version.ok()) {
WarnOnDsoKernelMismatch(dso_version, kernel_version);
}
@@ -209,29 +182,6 @@ port::StatusOr<DriverVersion> Diagnostician::FindDsoVersion() {
port::error::NOT_FOUND,
"was unable to find libcuda.so DSO loaded into this program"));
-#if defined(__APPLE__)
- // OSX CUDA libraries have names like: libcuda_310.41.15_mercury.dylib
- const string prefix("libcuda_");
- const string suffix("_mercury.dylib");
- for (uint32_t image_index = 0; image_index < _dyld_image_count(); ++image_index) {
- const string path(_dyld_get_image_name(image_index));
- const size_t suffix_pos = path.rfind(suffix);
- const size_t prefix_pos = path.rfind(prefix, suffix_pos);
- if (prefix_pos == string::npos ||
- suffix_pos == string::npos) {
- // no match
- continue;
- }
- const size_t start = prefix_pos + prefix.size();
- if (start >= suffix_pos) {
- // version not included
- continue;
- }
- const size_t length = suffix_pos - start;
- const string version = path.substr(start, length);
- result = StringToDriverVersion(version);
- }
-#else
#if !defined(PLATFORM_WINDOWS) && !defined(ANDROID_TEGRA)
// Callback used when iterating through DSOs. Looks for the driver-interfacing
// DSO and yields its version number into the callback data, when found.
@@ -265,7 +215,6 @@ port::StatusOr<DriverVersion> Diagnostician::FindDsoVersion() {
dl_iterate_phdr(iterate_phdr, &result);
#endif
-#endif
return result;
}
@@ -310,38 +259,7 @@ void Diagnostician::WarnOnDsoKernelMismatch(
port::StatusOr<DriverVersion> Diagnostician::FindKernelDriverVersion() {
-#if defined(__APPLE__)
- CFStringRef kext_ids[1];
- kext_ids[0] = kDriverKextIdentifier;
- CFArrayRef kext_id_query = CFArrayCreate(nullptr, (const void**)kext_ids, 1, &kCFTypeArrayCallBacks);
- CFDictionaryRef kext_infos = KextManagerCopyLoadedKextInfo(kext_id_query, nullptr);
- CFRelease(kext_id_query);
-
- CFDictionaryRef cuda_driver_info = nullptr;
- if (CFDictionaryGetValueIfPresent(kext_infos, kDriverKextIdentifier, (const void**)&cuda_driver_info)) {
- // NOTE: OSX CUDA driver does not currently store the same driver version
- // in kCFBundleVersionKey as is returned by cuDriverGetVersion
- CFRelease(kext_infos);
- const CFStringRef str = (CFStringRef)CFDictionaryGetValue(
- cuda_driver_info, kCFBundleVersionKey);
- const char *version = CFStringGetCStringPtr(str, kCFStringEncodingUTF8);
-
- // version can be NULL in which case treat it as empty string
- // see
- // https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFStrings/Articles/AccessingContents.html#//apple_ref/doc/uid/20001184-100980-TPXREF112
- if (version == NULL) {
- return StringToDriverVersion("");
- }
- return StringToDriverVersion(version);
- }
- CFRelease(kext_infos);
- auto status = port::Status(
- port::error::INTERNAL,
- port::StrCat(
- "failed to read driver bundle version: ",
- CFStringGetCStringPtr(kDriverKextIdentifier, kCFStringEncodingUTF8)));
- return status;
-#elif defined(PLATFORM_WINDOWS)
+#if defined(PLATFORM_WINDOWS)
auto status =
port::Status(port::error::UNIMPLEMENTED,
"kernel reported driver version not implemented on Windows");