#include "CudaMgr/CudaMgr.h"
#include "QueryEngine/NvidiaKernel.h"
#include "Shared/boost_stacktrace.hpp"
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include <boost/filesystem.hpp>
#include "Logger/Logger.h"
Go to the source code of this file.
std::string get_cuda_home |
( |
void |
| ) |
|
Definition at line 583 of file CudaMgr.cpp.
References LOG, and logger::WARNING.
584 static const char* CUDA_DEFAULT_PATH =
"/usr/local/cuda";
585 const char* env =
nullptr;
587 if (!(env = getenv(
"CUDA_HOME")) && !(env = getenv(
"CUDA_DIR"))) {
589 if (boost::filesystem::exists(boost::filesystem::path(CUDA_DEFAULT_PATH))) {
590 env = CUDA_DEFAULT_PATH;
594 if (env ==
nullptr) {
595 LOG(
WARNING) <<
"Could not find CUDA installation path: environment variables "
596 "CUDA_HOME or CUDA_DIR are not defined";
601 auto cuda_include_dir = env + std::string(
"/include");
602 auto cuda_h_file = cuda_include_dir +
"/cuda.h";
603 if (!boost::filesystem::exists(boost::filesystem::path(cuda_h_file))) {
604 LOG(
WARNING) <<
"cuda.h does not exist in `" << cuda_include_dir <<
"`. Discarding `"
605 << env <<
"` as CUDA installation path.";
609 return std::string(env);
std::string get_cuda_libdevice_dir |
( |
void |
| ) |
|
Definition at line 612 of file CudaMgr.cpp.
References LOG, and logger::WARNING.
Referenced by Executor::initialize_extension_module_sources().
613 static const char* CUDA_DEFAULT_PATH =
"/usr/local/cuda";
614 const char* env =
nullptr;
616 if (!(env = getenv(
"CUDA_HOME")) && !(env = getenv(
"CUDA_DIR"))) {
618 if (boost::filesystem::exists(boost::filesystem::path(CUDA_DEFAULT_PATH))) {
619 env = CUDA_DEFAULT_PATH;
623 if (env ==
nullptr) {
624 LOG(
WARNING) <<
"Could not find CUDA installation path: environment variables "
625 "CUDA_HOME or CUDA_DIR are not defined";
630 auto libdevice_dir = env + std::string(
"/nvvm/libdevice");
631 auto libdevice_bc_file = libdevice_dir +
"/libdevice.10.bc";
632 if (!boost::filesystem::exists(boost::filesystem::path(libdevice_bc_file))) {
633 LOG(
WARNING) <<
"`" << libdevice_bc_file <<
"` does not exist. Discarding `" << env
634 <<
"` as CUDA installation path with libdevice.";
638 return libdevice_dir;