Binding: now releasing profiles in clblasTeardown()

This commit is contained in:
Philippe Tillet
2015-08-25 19:34:23 -04:00
parent 7b77d5ae4b
commit cf2d88a0a2
4 changed files with 19 additions and 3 deletions

View File

@@ -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<value_type> const & profile);
private:

View File

@@ -127,11 +127,15 @@ std::list<Context const *> backend::contexts::cache_;
void backend::platforms(std::vector<Platform> & 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<Platform> & platforms)
ocl::check(dispatch::dispatch::clGetPlatformIDs(0, NULL, &nplatforms));
std::vector<cl_platform_id> 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())

View File

@@ -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<driver::CommandQueue, profiles::map_type> profiles::cache_;
///////////////////

View File

@@ -14,6 +14,7 @@ extern "C"
void clblasTeardown()
{
isaac::profiles::release();
isaac::driver::backend::release();
}