提交 40085acb 编写于 作者: M Megvii Engine Team 提交者: huangxinda

fix(mgb): remove unnecessary cudnn8 warning

GitOrigin-RevId: 04cf1bfca93273953941a2f5904dc31b5f56cc4e
上级 54a4d70e
/**
* \file dnn/include/megdnn/common.h
* MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
*
* Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once
#if MGB_ENABLE_GETENV
#define MGB_GETENV ::std::getenv
#else
#define MGB_GETENV(_name) static_cast<char*>(nullptr)
#endif
#ifdef WIN32
#define unsetenv(_name) _putenv_s(_name, "");
#define setenv(name,value,overwrite) _putenv_s(name,value)
#endif
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
......@@ -16,6 +16,7 @@
#include "src/cuda/handle.h"
#include "src/cuda/utils.h"
#include "src/cuda/api_cache.h"
#include "megdnn/common.h"
#include <cuda.h>
#include <cstring>
......@@ -59,10 +60,12 @@ HandleImpl::HandleImpl(megcoreComputingHandle_t comp_handle):
"cuda library version is too low to run cublasLt");
#endif
#if CUDNN_VERSION >= 8000
megdnn_log_warn(R"(
Cudnn8 will jit ptx code with cache. You can set
CUDA_CACHE_MAXSIZE and CUDA_CACHE_PATH environment var to avoid repeat jit(very slow).
For example `export CUDA_CACHE_MAXSIZE=2147483647` and `export CUDA_CACHE_PATH=/data/.cuda_cache`)");
if (!MGB_GETENV("CUDA_CACHE_PATH")) {
megdnn_log_warn(R"(
Cudnn8 will jit ptx code with cache. You can set
CUDA_CACHE_MAXSIZE and CUDA_CACHE_PATH environment var to avoid repeat jit(very slow).
For example `export CUDA_CACHE_MAXSIZE=2147483647` and `export CUDA_CACHE_PATH=/data/.cuda_cache`)");
}
#endif
cudnn_check(cudnnCreate(&m_cudnn_handle));
cublas_check(cublasCreate(&m_cublas_handle));
......
......@@ -13,6 +13,7 @@
#include "megbrain_build_config.h"
#include "megdnn/basic_types.h"
#include "megdnn/common.h"
#include <memory>
#include <string>
......@@ -199,17 +200,6 @@ void __log__(LogLevel level, const char *file, const char *func, int line,
/* ================ misc ================ */
#if MGB_ENABLE_GETENV
#define MGB_GETENV ::std::getenv
#else
#define MGB_GETENV(_name) static_cast<char*>(nullptr)
#endif
#ifdef WIN32
#define unsetenv(_name) _putenv_s(_name, "");
#define setenv(name,value,overwrite) _putenv_s(name,value)
#endif
// use some macro tricks to get lock guard with unique variable name
#define MGB_TOKENPASTE(x, y) x ## y
#define MGB_TOKENPASTE2(x, y) MGB_TOKENPASTE(x, y)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册