OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CudaMgr.h File Reference
#include <cstdlib>
#include <mutex>
#include <string>
#include <vector>
#include "Logger/Logger.h"
#include "Shared/DeviceGroup.h"
#include "Shared/nocuda.h"
+ Include dependency graph for CudaMgr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CudaMgr_Namespace::DeviceProperties
 
class  CudaMgr_Namespace::CudaMgr
 

Namespaces

 CudaMgr_Namespace
 

Enumerations

enum  CudaMgr_Namespace::NvidiaDeviceArch {
  CudaMgr_Namespace::NvidiaDeviceArch::Kepler, CudaMgr_Namespace::NvidiaDeviceArch::Maxwell, CudaMgr_Namespace::NvidiaDeviceArch::Pascal, CudaMgr_Namespace::NvidiaDeviceArch::Volta,
  CudaMgr_Namespace::NvidiaDeviceArch::Turing, CudaMgr_Namespace::NvidiaDeviceArch::Ampere
}
 

Functions

std::string get_cuda_home (void)
 

Function Documentation

std::string get_cuda_home ( void  )

Definition at line 404 of file CudaMgr.cpp.

References LOG, and logger::WARNING.

404  {
405  static const char* CUDA_DEFAULT_PATH = "/usr/local/cuda";
406  const char* env = nullptr;
407 
408  if (!(env = getenv("CUDA_HOME")) && !(env = getenv("CUDA_DIR"))) {
409  // check if the default CUDA directory exists: /usr/local/cuda
410  if (boost::filesystem::exists(boost::filesystem::path(CUDA_DEFAULT_PATH))) {
411  env = CUDA_DEFAULT_PATH;
412  }
413  }
414 
415  if (env == nullptr) {
416  LOG(WARNING) << "Could not find CUDA installation path: environment variables "
417  "CUDA_HOME or CUDA_DIR are not defined";
418  return "";
419  }
420 
421  // check if the CUDA directory is sensible:
422  auto cuda_include_dir = env + std::string("/include");
423  auto cuda_h_file = cuda_include_dir + "/cuda.h";
424  if (!boost::filesystem::exists(boost::filesystem::path(cuda_h_file))) {
425  LOG(WARNING) << "cuda.h does not exist in `" << cuda_include_dir << "`. Discarding `"
426  << env << "` as CUDA installation path.";
427  return "";
428  }
429 
430  return std::string(env);
431 }
#define LOG(tag)
Definition: Logger.h:203