Skip to content

Commit

Permalink
Allow to purge caches for all queues in a list
Browse files Browse the repository at this point in the history
This may be used in a standard  VexCL way:
    vex::purge_kernel_caches(ctx);
  • Loading branch information
ddemidov committed Sep 13, 2013
1 parent 9342d0f commit 620217f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void local_context() {
BOOST_CHECK(x.size() == n);
BOOST_CHECK(x[0] == 0);

vex::purge_kernel_caches();
vex::purge_kernel_caches(ctx);
}

BOOST_AUTO_TEST_CASE(create_destroy)
Expand Down
6 changes: 6 additions & 0 deletions vexcl/operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2380,6 +2380,12 @@ void purge_kernel_caches(const cl::Context &context) {
detail::cache_register<>::erase(context());
}

/// Clears cached OpenCL kernels, allowing to release OpenCL contexts.
void purge_kernel_caches(const std::vector<cl::CommandQueue> &queue) {
for(auto q = queue.begin(); q != queue.end(); ++q)
detail::cache_register<>::erase( qctx(*q)() );
}

} // namespace vex;


Expand Down

0 comments on commit 620217f

Please sign in to comment.