diff --git a/include/isaac/profiles/profiles.h b/include/isaac/profiles/profiles.h index 0fb731ac5..50f0911b3 100644 --- a/include/isaac/profiles/profiles.h +++ b/include/isaac/profiles/profiles.h @@ -51,6 +51,7 @@ private: static void import(std::string const & fname, driver::CommandQueue const & queue); static map_type & init(driver::CommandQueue const & queue); public: + static void release(); static map_type & get(driver::CommandQueue const & queue); static void set(driver::CommandQueue const & queue, expression_type operation, numeric_type dtype, std::shared_ptr const & profile); private: diff --git a/lib/driver/backend.cpp b/lib/driver/backend.cpp index 3c0aa5775..3ab87202c 100644 --- a/lib/driver/backend.cpp +++ b/lib/driver/backend.cpp @@ -127,11 +127,15 @@ std::list backend::contexts::cache_; void backend::platforms(std::vector & platforms) { + bool has_cuda = false; + //if cuda is here if(dispatch::cuinit()) { - if(dispatch::nvrtcinit()) + if(dispatch::nvrtcinit()){ platforms.push_back(Platform(CUDA)); + has_cuda = true; + } else throw std::runtime_error("ISAAC: Unable to find NVRTC. Make sure you are using CUDA >= 7.0"); } @@ -143,8 +147,12 @@ void backend::platforms(std::vector & platforms) ocl::check(dispatch::dispatch::clGetPlatformIDs(0, NULL, &nplatforms)); std::vector clplatforms(nplatforms); ocl::check(dispatch::dispatch::clGetPlatformIDs(nplatforms, clplatforms.data(), NULL)); - for(cl_platform_id p: clplatforms) - platforms.push_back(Platform(p)); + for(cl_platform_id p: clplatforms){ + Platform tmp(p); + if(tmp.name().find("CUDA")!=std::string::npos && has_cuda) + continue; + platforms.push_back(tmp); + } } if(platforms.empty()) diff --git a/lib/profiles/profiles.cpp b/lib/profiles/profiles.cpp index 3008ed500..10bab1edc 100644 --- a/lib/profiles/profiles.cpp +++ b/lib/profiles/profiles.cpp @@ -253,6 +253,12 @@ void profiles::set(driver::CommandQueue const & queue, expression_type operation cache_[queue][std::make_pair(operation,dtype)] = profile; } +void profiles::release() +{ + cache_.clear(); +} + + std::map profiles::cache_; /////////////////// diff --git a/lib/wrap/clBLAS.cpp b/lib/wrap/clBLAS.cpp index 5bf275d7b..5d8ee8309 100644 --- a/lib/wrap/clBLAS.cpp +++ b/lib/wrap/clBLAS.cpp @@ -14,6 +14,7 @@ extern "C" void clblasTeardown() { + isaac::profiles::release(); isaac::driver::backend::release(); }