예제 #1
0
// returns the program cache for the context
inline boost::shared_ptr<program_cache> get_program_cache(const context &context)
{
    typedef lru_cache<cl_context, boost::shared_ptr<program_cache> > cache_map;

    static cache_map caches(8);

    boost::shared_ptr<program_cache> cache = caches.get(context.get());
    if(!cache){
        cache = boost::make_shared<program_cache>(64);

        caches.insert(context.get(), cache);
    }

    return cache;
}