当前位置: 首页>>代码示例>>C++>>正文


C++ context::get方法代码示例

本文整理汇总了C++中context::get方法的典型用法代码示例。如果您正苦于以下问题:C++ context::get方法的具体用法?C++ context::get怎么用?C++ context::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在context的用法示例。


在下文中一共展示了context::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: caches

// 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;
}
开发者ID:EdKeith,项目名称:compute,代码行数:16,代码来源:program_cache.hpp

示例2:

    /// Returns the global program cache for \p context.
    ///
    /// This global cache is used internally by Boost.Compute to store compiled
    /// program objects used by its algorithms. All Boost.Compute programs are
    /// stored with a cache key beginning with \c "__boost". User programs
    /// should avoid using the same prefix in order to prevent collisions.
    static boost::shared_ptr<program_cache> get_global_cache(const context &context)
    {
        typedef detail::lru_cache<cl_context, boost::shared_ptr<program_cache> > cache_map;

        BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(cache_map, caches, (8));

        boost::optional<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;
    }
开发者ID:erik-thon,项目名称:extra-libs,代码行数:21,代码来源:program_cache.hpp

示例3: link

    /// Links the programs in \p programs with \p options in \p context.
    ///
    /// \opencl_version_warning{1,2}
    ///
    /// \see_opencl_ref{clLinkProgram}
    static program link(const std::vector<program> &programs,
                        const context &context,
                        const std::string &options = std::string())
    {
        const char *options_string = 0;

        if(!options.empty()){
            options_string = options.c_str();
        }

        cl_int ret;
        cl_program program_ = clLinkProgram(
            context.get(),
            0,
            0,
            options_string,
            static_cast<uint_>(programs.size()),
            reinterpret_cast<const cl_program*>(&programs[0]),
            0,
            0,
            &ret
        );

        if(!program_){
            BOOST_THROW_EXCEPTION(opencl_error(ret));
        }

        return program(program_, false);
    }
开发者ID:2bbb,项目名称:compute,代码行数:34,代码来源:program.hpp

示例4: catch

		shared_buffer::shared_buffer(context& compute_context, cl_mem_flags flags, size_t size, const void* data, GLenum usage) : buffer{size, data, usage} {
			try {
				shared_buffer_ = std::make_unique<cl::BufferGL>(compute_context.get(), flags, id_, nullptr);
			} catch (const cl::Error& error) {
				utils::log(utils::log_level::fatal) << error.what() << "(" << error.err() << ")" << std::endl;
			}
		}
开发者ID:Berling,项目名称:bachelor_arbeit,代码行数:7,代码来源:shared_buffer.cpp

示例5: ctx

/** Chooses a device based on the provided device selector in the given context.
 */
queue::queue(const context& syclContext, const device& syclDevice,
             info::queue_profiling profilingFlag,
             const async_handler& asyncHandler)
    : ctx(syclContext.get(), asyncHandler),
      dev(syclDevice),
      command_q(create_queue(profilingFlag)),
      command_group(this) {
  command_q.release_one();
}
开发者ID:ProGTX,项目名称:sycl-gtx,代码行数:11,代码来源:queue.cpp

示例6: ptr

inline svm_ptr<T> svm_alloc(const context &context,
                            size_t size,
                            cl_svm_mem_flags flags = CL_MEM_READ_WRITE,
                            unsigned int alignment = 0)
{
    svm_ptr<T> ptr(clSVMAlloc(context.get(), flags, size * sizeof(T), alignment));
    if(!ptr.get()){
        BOOST_THROW_EXCEPTION(opencl_error(CL_MEM_OBJECT_ALLOCATION_FAILURE));
    }
    return ptr;
}
开发者ID:AuroraSyN,项目名称:compute,代码行数:11,代码来源:svm.hpp

示例7: got

std::vector<msg_on_chan> get_all_msg_on_chan(context const&pb)
{
    std::vector<msg_on_chan> result;
    for (;;) {
        msg_on_chan got(pb.get(), pb.get_channel());
        if (got.message().empty() && got.channel().empty()) {
            break;
        }
        result.emplace_back(got);
    }
    return result;
}
开发者ID:ramshenai,项目名称:c-core,代码行数:12,代码来源:pubnub_fntest.cpp

示例8: create_with_il

    /// Creates a new program with \p il_binary (SPIR-V binary)
    /// of \p il_size size in \p context.
    ///
    /// \opencl_version_warning{2,1}
    ///
    /// \see_opencl21_ref{clCreateProgramWithIL}
    static program create_with_il(const void * il_binary,
                                  const size_t il_size,
                                  const context &context)
    {
        cl_int error = 0;

        cl_program program_ = clCreateProgramWithIL(
            context.get(), il_binary, il_size, &error
        );

        if(!program_){
            BOOST_THROW_EXCEPTION(opencl_error(error));
        }

        return program(program_, false);
    }
开发者ID:ASMlover,项目名称:study,代码行数:22,代码来源:program.hpp

示例9: create_with_builtin_kernels

    /// Creates a new program with the built-in kernels listed in
    /// \p kernel_names for \p devices in \p context.
    ///
    /// \opencl_version_warning{1,2}
    ///
    /// \see_opencl_ref{clCreateProgramWithBuiltInKernels}
    static program create_with_builtin_kernels(const context &context,
                                               const std::vector<device> &devices,
                                               const std::string &kernel_names)
    {
        cl_int error = 0;

        cl_program program_ = clCreateProgramWithBuiltInKernels(
            context.get(),
            static_cast<uint_>(devices.size()),
            reinterpret_cast<const cl_device_id *>(&devices[0]),
            kernel_names.c_str(),
            &error
        );

        if(!program_){
            BOOST_THROW_EXCEPTION(opencl_error(error));
        }

        return program(program_, false);
    }
开发者ID:2bbb,项目名称:compute,代码行数:26,代码来源:program.hpp

示例10: operator

 bool operator()(const context &a, const context &b) const {
     return a.get() < b.get();
 }
开发者ID:ddemidov,项目名称:vexcl,代码行数:3,代码来源:context.hpp

示例11: svm_free

inline void svm_free(const context &context, svm_ptr<T> ptr)
{
    clSVMFree(context.get(), ptr.get());
}
开发者ID:AbhinavJain13,项目名称:turicreate,代码行数:4,代码来源:svm.hpp

示例12: got_message_on_channel

 /// Returns whether the given message was received on the given
 /// channel on the context
 inline bool got_message_on_channel(context const &pb, msg_on_chan expected) {
     pubnub::msg_on_chan got(pb.get(), pb.get_channel());
     return got == expected;
 }
开发者ID:evanbeard,项目名称:c-core,代码行数:6,代码来源:pubnub_fntest.hpp


注:本文中的context::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。