/** @brief Convenience function for setting devices for a context */ inline void setup_context(long i, viennacl::ocl::device const & device) { std::vector<cl_device_id> device_id_array(1); device_id_array[0] = device.id(); viennacl::ocl::backend<>::setup_context(i, device_id_array); }
bool invalid_base(viennacl::ocl::device const & dev, size_t lmem_used) const{ //Query profile informations std::pair<size_t, size_t> workgroup_size = local_work_size(); //Query device informations size_t lmem_available = viennacl::ocl::info<CL_DEVICE_LOCAL_MEM_SIZE>(dev.id()); size_t max_workgroup_size = viennacl::ocl::info<CL_DEVICE_MAX_WORK_GROUP_SIZE>(dev.id()); std::vector<size_t> max_work_item_sizes = viennacl::ocl::info<CL_DEVICE_MAX_WORK_ITEM_SIZES>(dev.id()); bool invalid_work_group_sizes = workgroup_size.first*workgroup_size.second > max_workgroup_size; // uses too much resources invalid_work_group_sizes = invalid_work_group_sizes || workgroup_size.first > max_work_item_sizes[0]; if(max_work_item_sizes.size()>1) invalid_work_group_sizes = invalid_work_group_sizes || workgroup_size.second > max_work_item_sizes[1]; return invalid_work_group_sizes || lmem_used>lmem_available; }