This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Bypass cuda/cudnn checks if no driver. #15551
Merged
ptrendx
merged 3 commits into
apache:master
from
DickJC123:no_cuda_cudnn_version_checks_without_driver
Jul 17, 2019
Merged
Changes from all commits
Commits
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 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,95 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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. | ||
*/ | ||
|
||
/*! | ||
* Copyright (c) 2019 by Contributors | ||
* \file base.cc | ||
* \brief Implementation of base declarations, e.g. context | ||
*/ | ||
#include <mxnet/base.h> | ||
|
||
namespace mxnet { | ||
|
||
#define UNUSED(x) (void)(x) | ||
|
||
#if MXNET_USE_CUDA == 1 | ||
// The oldest version of cuda used in upstream MXNet CI testing, both for unix and windows. | ||
// Users that have rebuilt MXNet against older versions will we advised with a warning to upgrade | ||
// their systems to match the CI level. Minimally, users should rerun the CI locally. | ||
#if defined(_MSC_VER) | ||
#define MXNET_CI_OLDEST_CUDA_VERSION 9020 | ||
#else | ||
#define MXNET_CI_OLDEST_CUDA_VERSION 10000 | ||
#endif | ||
|
||
void Context::CudaLibChecks() { | ||
// One-time init here will emit a warning if no gpus or gpu driver is seen. | ||
// Also if the user has recompiled their source to a version no longer tested by upstream CI. | ||
static bool cuda_lib_checks_performed = []() { | ||
if (dmlc::GetEnv("MXNET_CUDA_LIB_CHECKING", true)) { | ||
if (!GPUDriverPresent()) | ||
LOG(WARNING) << "Please install cuda driver for GPU use. No cuda driver detected."; | ||
else if (GetGPUCount() == 0) | ||
LOG(WARNING) << "GPU context requested, but no GPUs found."; | ||
else if (CUDA_VERSION < MXNET_CI_OLDEST_CUDA_VERSION) | ||
LOG(WARNING) << "Upgrade advisory: this mxnet has been built against cuda library version " | ||
<< CUDA_VERSION << ", which is older than the oldest version tested by CI (" | ||
<< MXNET_CI_OLDEST_CUDA_VERSION << "). " | ||
<< "Set MXNET_CUDA_LIB_CHECKING=0 to quiet this warning."; | ||
} | ||
return true; | ||
}(); | ||
UNUSED(cuda_lib_checks_performed); | ||
} | ||
#endif // MXNET_USE_CUDA | ||
|
||
#if MXNET_USE_CUDNN == 1 | ||
// The oldest version of CUDNN used in upstream MXNet CI testing, both for unix and windows. | ||
// Users that have rebuilt MXNet against older versions will we advised with a warning to upgrade | ||
// their systems to match the CI level. Minimally, users should rerun the CI locally. | ||
#if defined(_MSC_VER) | ||
#define MXNET_CI_OLDEST_CUDNN_VERSION 7600 | ||
#else | ||
#define MXNET_CI_OLDEST_CUDNN_VERSION 7600 | ||
#endif | ||
|
||
void Context::CuDNNLibChecks() { | ||
// One-time init here will emit a warning if runtime and compile-time cudnn lib versions mismatch. | ||
// Also if the user has recompiled their source to a version no longer tested by upstream CI. | ||
static bool cudnn_lib_checks_performed = []() { | ||
// Don't bother with checks if there are no GPUs visible (e.g. with CUDA_VISIBLE_DEVICES="") | ||
if (dmlc::GetEnv("MXNET_CUDNN_LIB_CHECKING", true) && GetGPUCount() > 0) { | ||
size_t linkedAgainstCudnnVersion = cudnnGetVersion(); | ||
if (linkedAgainstCudnnVersion != CUDNN_VERSION) | ||
LOG(WARNING) << "cuDNN lib mismatch: linked-against version " << linkedAgainstCudnnVersion | ||
<< " != compiled-against version " << CUDNN_VERSION << ". " | ||
<< "Set MXNET_CUDNN_LIB_CHECKING=0 to quiet this warning."; | ||
if (CUDNN_VERSION < MXNET_CI_OLDEST_CUDNN_VERSION) | ||
LOG(WARNING) << "Upgrade advisory: this mxnet has been built against cuDNN lib version " | ||
<< CUDNN_VERSION << ", which is older than the oldest version tested by CI (" | ||
<< MXNET_CI_OLDEST_CUDNN_VERSION << "). " | ||
<< "Set MXNET_CUDNN_LIB_CHECKING=0 to quiet this warning."; | ||
} | ||
return true; | ||
}(); | ||
UNUSED(cudnn_lib_checks_performed); | ||
} | ||
#endif // MXNET_USE_CUDNN | ||
|
||
} // namespace mxnet |
This file was deleted.
Oops, something went wrong.
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.
😀