[GitHub] [incubator-mxnet] DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage.
DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage. URL: https://github.com/apache/incubator-mxnet/pull/15449#discussion_r302772718 ## File path: src/common/cuda_utils.cc ## @@ -0,0 +1,108 @@ +/* + * 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 cuda_utils.cc + * \brief CUDA debugging utilities. + */ + +#include +#include "cuda_utils.h" + +#if MXNET_USE_CUDA == 1 + +namespace mxnet { +namespace common { +namespace cuda { + +// 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 1 +#endif + +// Dynamic init here will emit a warning if runtime and compile-time cuda lib versions mismatch. +// Also if the user has recompiled their source to a version no longer tested by upstream CI. +bool cuda_version_check_performed = []() { + // Don't bother with checks if there are no GPUs visible (e.g. with CUDA_VISIBLE_DEVICES="") + if (dmlc::GetEnv("MXNET_CUDA_VERSION_CHECKING", true) && Context::GetGPUCount() > 0) { +int linkedAgainstCudaVersion = 0; +CUDA_CALL(cudaRuntimeGetVersion()); +if (linkedAgainstCudaVersion != CUDA_VERSION) + LOG(WARNING) << "cuda library mismatch: linked-against version " << linkedAgainstCudaVersion Review comment: After studying the link supplied by @larroy (thanks!), I need to retract what I said above. Based on a new understanding, I have removed the runtime check of the cuda-runtime library version. The check is unnecessary since (per the link) the major.minor of the cuda runtime must match for the libmxnet.so lib to load. It was instructive for me to do a `ldd libmxnet.so`: ``` libcudart.so.9.2 => /usr/local/cuda/lib64/libcudart.so.9.2 (0x7f361cc64000) libcudnn.so.7 => /usr/lib/x86_64-linux-gnu/libcudnn.so.7 (0x7f35f9cdf000) libcuda.so.1 => /usr/lib/x86_64-linux-gnu/libcuda.so.1 (0x7f35f3703000) ``` Note the extra '.minor' number on libcudart.so. So while a compiled-against cudnn 7.2, might run against a cudnn 7.6, a compiled-against cuda 10.1 won't run against a cuda 10.2. Now, keep in mind we're talking about the cuda `runtime` library, so libcudart.so as set up by the toolkit install. Your experience on 10.1 vs. 10.2 @KellenSunderland was probably based on upgrading the driver to a higher version, while leaving the toolkit install the same. Let me know if the PR is now to your liking. I've left in the test of the cuda runtime version against the threshold MXNET_CI_OLDEST_CUDA_VERSION. The idea is that once we no longer test against a particular cuda version, then bugs will creep in with new PRs. We'd prefer users to not be on the front line of bug finding, so we should encourage them to upgrade. Back to your original question- there will be no warning for upgrading the driver to a newer version (e.g. 10.2) while leaving the toolkit at 10.1 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage.
DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage. URL: https://github.com/apache/incubator-mxnet/pull/15449#discussion_r302657800 ## File path: src/common/cuda_utils.cc ## @@ -0,0 +1,108 @@ +/* + * 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 cuda_utils.cc + * \brief CUDA debugging utilities. + */ + +#include +#include "cuda_utils.h" + +#if MXNET_USE_CUDA == 1 + +namespace mxnet { +namespace common { +namespace cuda { + +// 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 1 +#endif + +// Dynamic init here will emit a warning if runtime and compile-time cuda lib versions mismatch. +// Also if the user has recompiled their source to a version no longer tested by upstream CI. +bool cuda_version_check_performed = []() { + // Don't bother with checks if there are no GPUs visible (e.g. with CUDA_VISIBLE_DEVICES="") + if (dmlc::GetEnv("MXNET_CUDA_VERSION_CHECKING", true) && Context::GetGPUCount() > 0) { +int linkedAgainstCudaVersion = 0; +CUDA_CALL(cudaRuntimeGetVersion()); +if (linkedAgainstCudaVersion != CUDA_VERSION) + LOG(WARNING) << "cuda library mismatch: linked-against version " << linkedAgainstCudaVersion Review comment: So 'yes' there would be a warning if the user built against 10.1, but ran with 10.2. These warnings can be turned off with an environment variable setting MXNET_CUDA_VERSION_CHECKING=0. The idea behind the 'advisory' is that the user may want to rebuild to get the new functionality present in 10.2, or perhaps to avoid work-arounds for any issues of 10.1. It's probably more useful with the CUDNN version checks, where we have far more compile guards based on version minor numbers. Do you feel these warnings would be unwelcome to users? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage.
DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage. URL: https://github.com/apache/incubator-mxnet/pull/15449#discussion_r301844223 ## File path: src/common/cuda_utils.cc ## @@ -0,0 +1,116 @@ +/* + * 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 cuda_utils.cc + * \brief CUDA debugging utilities. + */ + +#include +#include "cuda_utils.h" + +#if MXNET_USE_CUDA == 1 + +namespace mxnet { +namespace common { +namespace cuda { + +// 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 1 +#endif + + +// Start-up check that the version of cuda compiled-against matches the linked-against version. +bool CudaVersionChecks() { + // Don't bother with checks if there are no GPUs visible (e.g. with CUDA_VISIBLE_DEVICES="") + if (dmlc::GetEnv("MXNET_CUDA_VERSION_CHECKING", true) && Context::GetGPUCount() > 0) { +int linkedAgainstCudaVersion = 0; +CUDA_CALL(cudaRuntimeGetVersion()); +if (linkedAgainstCudaVersion != CUDA_VERSION) + LOG(WARNING) << "cuda library mismatch: linked-against version " << linkedAgainstCudaVersion + << " != compiled-against version " << CUDA_VERSION << "." + << "Set MXNET_CUDA_VERSION_CHECKING=0 to quiet this warning."; +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_VERSION_CHECKING=0 to quiet this warning."; + } + return true; +} + +// Dynamic initialization here will emit a warning if runtime and compile-time versions mismatch. +// Also if the user has recompiled their source to a version no longer tested by upstream CI. +bool cuda_version_ok = CudaVersionChecks(); + +} // namespace cuda +} // namespace common +} // namespace mxnet + +#endif // MXNET_USE_CUDA + +#if MXNET_USE_CUDNN == 1 + +namespace mxnet { +namespace common { +namespace cudnn { + +// 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 + +// Start-up check that the version of cudnn compiled-against matches the linked-against version. +// Also if the user has recompiled their source to a version no longer tested by upstream CI. +bool CuDNNVersionChecks() { + // Don't bother with checks if there are no GPUs visible (e.g. with CUDA_VISIBLE_DEVICES="") + if (dmlc::GetEnv("MXNET_CUDNN_VERSION_CHECKING", true) && Context::GetGPUCount() > 0) { +size_t linkedAgainstCudnnVersion = cudnnGetVersion(); +if (linkedAgainstCudnnVersion != CUDNN_VERSION) + LOG(WARNING) << "cuDNN library mismatch: linked-against version " << linkedAgainstCudnnVersion + << " != compiled-against version " << CUDNN_VERSION << ". " + << "Set MXNET_CUDNN_VERSION_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 library version " + << CUDNN_VERSION << ", which is older than the oldest version tested by CI (" + << MXNET_CI_OLDEST_CUDNN_VERSION << "). " + << "Set MXNET_CUDNN_VERSION_CHECKING=0 to quiet this warning."; + } + return true; +} + +// Dynamic initialization here will emit a
[GitHub] [incubator-mxnet] DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage.
DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage. URL: https://github.com/apache/incubator-mxnet/pull/15449#discussion_r300207690 ## File path: src/common/cuda_utils.cc ## @@ -0,0 +1,116 @@ +/* + * 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 cuda_utils.cc + * \brief CUDA debugging utilities. + */ + +#include +#include "cuda_utils.h" + +#if MXNET_USE_CUDA == 1 + +namespace mxnet { +namespace common { +namespace cuda { + +// 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 1 +#endif + + +// Start-up check that the version of cuda compiled-against matches the linked-against version. +bool CudaVersionChecks() { + // Don't bother with checks if there are no GPUs visible (e.g. with CUDA_VISIBLE_DEVICES="") + if (dmlc::GetEnv("MXNET_CUDA_VERSION_CHECKING", true) && Context::GetGPUCount() > 0) { +int linkedAgainstCudaVersion = 0; +CUDA_CALL(cudaRuntimeGetVersion()); +if (linkedAgainstCudaVersion != CUDA_VERSION) + LOG(WARNING) << "cuda library mismatch: linked-against version " << linkedAgainstCudaVersion + << " != compiled-against version " << CUDA_VERSION << "." + << "Set MXNET_CUDA_VERSION_CHECKING=0 to quiet this warning."; +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_VERSION_CHECKING=0 to quiet this warning."; + } + return true; +} + +// Dynamic initialization here will emit a warning if runtime and compile-time versions mismatch. +// Also if the user has recompiled their source to a version no longer tested by upstream CI. +bool cuda_version_ok = CudaVersionChecks(); + +} // namespace cuda +} // namespace common +} // namespace mxnet + +#endif // MXNET_USE_CUDA + +#if MXNET_USE_CUDNN == 1 + +namespace mxnet { +namespace common { +namespace cudnn { + +// 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 + +// Start-up check that the version of cudnn compiled-against matches the linked-against version. +// Also if the user has recompiled their source to a version no longer tested by upstream CI. +bool CuDNNVersionChecks() { + // Don't bother with checks if there are no GPUs visible (e.g. with CUDA_VISIBLE_DEVICES="") + if (dmlc::GetEnv("MXNET_CUDNN_VERSION_CHECKING", true) && Context::GetGPUCount() > 0) { +size_t linkedAgainstCudnnVersion = cudnnGetVersion(); +if (linkedAgainstCudnnVersion != CUDNN_VERSION) + LOG(WARNING) << "cuDNN library mismatch: linked-against version " << linkedAgainstCudnnVersion + << " != compiled-against version " << CUDNN_VERSION << ". " + << "Set MXNET_CUDNN_VERSION_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 library version " + << CUDNN_VERSION << ", which is older than the oldest version tested by CI (" + << MXNET_CI_OLDEST_CUDNN_VERSION << "). " + << "Set MXNET_CUDNN_VERSION_CHECKING=0 to quiet this warning."; + } + return true; +} + +// Dynamic initialization here will emit a
[GitHub] [incubator-mxnet] DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage.
DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage. URL: https://github.com/apache/incubator-mxnet/pull/15449#discussion_r300163871 ## File path: src/common/cuda_utils.cc ## @@ -0,0 +1,114 @@ +/* + * 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 cuda_utils.cc + * \brief CUDA debugging utilities. + */ + +#include +#include "cuda_utils.h" + +#if MXNET_USE_CUDA == 1 + +namespace mxnet { +namespace common { +namespace cuda { + +// 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 1 +#endif + + +// Start-up check that the version of cuda compiled-against matches the linked-against version. +bool CudaVersionChecks() { + if (dmlc::GetEnv("MXNET_CUDA_VERSION_CHECKING", true)) { +int linkedAgainstCudaVersion = 0; +CUDA_CALL(cudaRuntimeGetVersion()); Review comment: My latest push has hopefully resolved this build problem. If there are no visible GPUs on the system (perhaps the user has set CUDA_VISIBLE_DEVICES=""), then the version checks are omitted. Without a visible GPU, there won't be any GPU contexts successfully created and any GPU library mismatch is irrelevant. So no warning messages should be emitted in this case. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage.
DickJC123 commented on a change in pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage. URL: https://github.com/apache/incubator-mxnet/pull/15449#discussion_r300163871 ## File path: src/common/cuda_utils.cc ## @@ -0,0 +1,114 @@ +/* + * 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 cuda_utils.cc + * \brief CUDA debugging utilities. + */ + +#include +#include "cuda_utils.h" + +#if MXNET_USE_CUDA == 1 + +namespace mxnet { +namespace common { +namespace cuda { + +// 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 1 +#endif + + +// Start-up check that the version of cuda compiled-against matches the linked-against version. +bool CudaVersionChecks() { + if (dmlc::GetEnv("MXNET_CUDA_VERSION_CHECKING", true)) { +int linkedAgainstCudaVersion = 0; +CUDA_CALL(cudaRuntimeGetVersion()); Review comment: My latest push has hopefully resolved this build problem. If there are no visible GPUs on the system (perhaps the user has set CUDA_VISIBLE_DEVICES=0), then the version checks are omitted. Without a visible GPU, there won't be any GPU contexts successfully created and any GPU library mismatch is irrelevant. So no warning messages should be emitted in this case. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services