Browse Source

fix(build): remove ununsed functions when cuda disabled

GitOrigin-RevId: 03f50683f6
release-1.10
Megvii Engine Team 3 years ago
parent
commit
64a8aaaf42
1 changed files with 8 additions and 9 deletions
  1. +8
    -9
      src/core/impl/utils/cuda_helper.cpp

+ 8
- 9
src/core/impl/utils/cuda_helper.cpp View File

@@ -7,8 +7,6 @@
#include <sstream> #include <sstream>
#include <string> #include <string>


using namespace mgb;

#ifdef WIN32 #ifdef WIN32
#include <io.h> #include <io.h>
#include <windows.h> #include <windows.h>
@@ -17,6 +15,8 @@ using namespace mgb;
#include <unistd.h> #include <unistd.h>
#endif #endif


#if MGB_CUDA

namespace { namespace {


#ifndef PATH_MAX #ifndef PATH_MAX
@@ -51,11 +51,6 @@ void* dlerror() {
return const_cast<char*>(errmsg); return const_cast<char*>(errmsg);
} }


void* dlsym(void* handle, char* name) {
FARPROC symbol = GetProcAddress((HMODULE)handle, name);
return reinterpret_cast<void*>(symbol);
}

int check_file_exist(const char* path, int mode) { int check_file_exist(const char* path, int mode) {
return _access(path, mode); return _access(path, mode);
} }
@@ -121,7 +116,6 @@ std::string get_nvcc_root_path() {
} // namespace } // namespace


std::vector<std::string> mgb::get_cuda_include_path() { std::vector<std::string> mgb::get_cuda_include_path() {
#if MGB_CUDA
std::vector<std::string> paths; std::vector<std::string> paths;
// 1. use CUDA_BIN_PATH // 1. use CUDA_BIN_PATH
auto cuda_path = getenv("CUDA_BIN_PATH"); auto cuda_path = getenv("CUDA_BIN_PATH");
@@ -163,7 +157,12 @@ std::vector<std::string> mgb::get_cuda_include_path() {
"2. add nvcc path in PATH " "2. add nvcc path in PATH "
"3. add libcudart.so path in LD_LIBRARY_PATH"); "3. add libcudart.so path in LD_LIBRARY_PATH");
return paths; return paths;
}

#else #else

std::vector<std::string> mgb::get_cuda_include_path() {
mgb_throw(MegBrainError, "cuda disabled at compile time"); mgb_throw(MegBrainError, "cuda disabled at compile time");
#endif
} }

#endif

Loading…
Cancel
Save