#include <cstdlib>
#include <mutex>
#include <string>
#include <vector>
#include "Logger/Logger.h"
#include "Shared/DeviceGroup.h"
#include "Shared/nocuda.h"
Go to the source code of this file.
std::string get_cuda_home |
( |
void |
| ) |
|
Definition at line 465 of file CudaMgr.cpp.
References LOG, and logger::WARNING.
Referenced by Executor::initialize_extension_module_sources().
466 static const char* CUDA_DEFAULT_PATH =
"/usr/local/cuda";
467 const char* env =
nullptr;
469 if (!(env = getenv(
"CUDA_HOME")) && !(env = getenv(
"CUDA_DIR"))) {
471 if (boost::filesystem::exists(boost::filesystem::path(CUDA_DEFAULT_PATH))) {
472 env = CUDA_DEFAULT_PATH;
476 if (env ==
nullptr) {
477 LOG(
WARNING) <<
"Could not find CUDA installation path: environment variables "
478 "CUDA_HOME or CUDA_DIR are not defined";
483 auto cuda_include_dir = env + std::string(
"/include");
484 auto cuda_h_file = cuda_include_dir +
"/cuda.h";
485 if (!boost::filesystem::exists(boost::filesystem::path(cuda_h_file))) {
486 LOG(
WARNING) <<
"cuda.h does not exist in `" << cuda_include_dir <<
"`. Discarding `"
487 << env <<
"` as CUDA installation path.";
491 return std::string(env);