OmniSciDB  a667adc9c8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CudaMgr.cpp File Reference
#include "CudaMgr/CudaMgr.h"
#include "QueryEngine/NvidiaKernel.h"
#include "Shared/boost_stacktrace.hpp"
#include <algorithm>
#include <cassert>
#include <iostream>
#include <stdexcept>
#include "Logger/Logger.h"
+ Include dependency graph for CudaMgr.cpp:

Go to the source code of this file.

Namespaces

 CudaMgr_Namespace
 

Functions

std::string CudaMgr_Namespace::errorMessage (CUresult const status)
 
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.

Referenced by UdfCompiler::compileToGpuByteCode().

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  if (env == nullptr) {
415  LOG(WARNING) << "Could not find CUDA installation path: environment variables "
416  "CUDA_HOME or CUDA_DIR are not defined";
417  return "";
418  }
419 
420  // check if the CUDA directory is sensible:
421  auto cuda_include_dir = env + std::string("/include");
422  auto cuda_h_file = cuda_include_dir + "/cuda.h";
423  if (!boost::filesystem::exists(boost::filesystem::path(cuda_h_file))) {
424  LOG(WARNING) << "cuda.h does not exist in `" << cuda_include_dir << "`. Discarding `"
425  << env << "` as CUDA installation path.";
426  return "";
427  }
428 
429  return std::string(env);
430 }
#define LOG(tag)
Definition: Logger.h:188

+ Here is the caller graph for this function: