• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ accelerator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GpuAccView1ToGpuAccView2

	bool GpuAccView1ToGpuAccView2()
	{
		accelerator_view cpu_av1 = cpu_acc.get_default_view();
		accelerator_view stg_arr_av1 = gpu_acc.get_default_view();

		accelerator_view cpu_av2 = cpu_acc.get_default_view();
		accelerator_view stg_arr_av2 = gpu_acc.create_view();

		return CopyAndVerifyFromStagingArrayToStagingArray<DATA_TYPE, RANK>(cpu_av1, stg_arr_av1, cpu_av2, stg_arr_av2);
	}
开发者ID:8l,项目名称:kalmar,代码行数:10,代码来源:test.cpp


示例2: StagingArrayToStagingArrayTests

	StagingArrayToStagingArrayTests()
	{
		cpu_acc = accelerator(accelerator::cpu_accelerator);
		gpu_acc = require_device_for<DATA_TYPE>();
		
		if(gpu_acc.get_supports_cpu_shared_memory())
		{
			WLog() << "Accelerator " << gpu_acc.get_description() << " supports zero copy" << std::endl;
			
			// Set the default cpu access type for this accelerator
			gpu_acc.set_default_cpu_access_type(DEF_ACCESS_TYPE);
		}
	}
开发者ID:8l,项目名称:kalmar,代码行数:13,代码来源:test.cpp


示例3: test10

runall_result test10(accelerator& device)
{
	array<int, 1> arr1(64, device.get_default_view(), ACCESS_TYPE);
	array<int, 2> arr2(64, 64, device.get_default_view(), ACCESS_TYPE);
	array<int, 3> arr3(64, 64, 64, device.get_default_view(), ACCESS_TYPE);
	
	runall_result res;
	
	res &= REPORT_RESULT(VerifyCpuAccessType(arr1, ACCESS_TYPE));
	res &= REPORT_RESULT(VerifyCpuAccessType(arr2, ACCESS_TYPE));
	res &= REPORT_RESULT(VerifyCpuAccessType(arr3, ACCESS_TYPE));
	
	return res;
}
开发者ID:MindCodeTech,项目名称:CPPAMPDemos,代码行数:14,代码来源:test.cpp


示例4: Gpu1AccViewToGpu2AccView

	runall_result Gpu1AccViewToGpu2AccView()
	{
		accelerator_view gpu_av1 = gpu_acc1.get_default_view();
		accelerator_view gpu_av2 = gpu_acc2.get_default_view();
		
		runall_result res;
		
		for(auto a_t_tuple : access_types_vec)
		{
			print_access_type_tuple(a_t_tuple);
			res &= CopyAndVerifyFromArrayToNonContiguousArrayView<DATA_TYPE, RANK>(gpu_av1, gpu_av2, std::get<0>(a_t_tuple), std::get<1>(a_t_tuple), std::get<0>(a_t_tuple));
		}

		return res;
	}
开发者ID:8l,项目名称:kalmar,代码行数:15,代码来源:test.cpp


示例5: CpuAccViewToGpuAccView

	runall_result CpuAccViewToGpuAccView()
	{
		accelerator_view cpu_av = cpu_acc.get_default_view();
		accelerator_view gpu_av = gpu_acc.get_default_view();
		
		runall_result res;
		
		for(auto a_t_tuple : access_types_vec)
		{
			print_access_type_tuple(a_t_tuple);
			res &= CopyAndVerifyFromNonContigArrayViewConstToArray<DATA_TYPE, RANK>(cpu_av, gpu_av, std::get<0>(a_t_tuple), std::get<1>(a_t_tuple));
		}
		
		return res;
	}
开发者ID:8l,项目名称:kalmar,代码行数:15,代码来源:test.cpp


示例6: test9

runall_result test9(accelerator& device)
{
	extent<2> arr_extent = CreateRandomExtent<2>(64);        
    array<float, 2> arr(arr_extent, device.get_default_view(), ACCESS_TYPE);
	
	return REPORT_RESULT(VerifyCpuAccessType(arr, ACCESS_TYPE));
}
开发者ID:MindCodeTech,项目名称:CPPAMPDemos,代码行数:7,代码来源:test.cpp


示例7: test12

runall_result test12(accelerator& device)
{
	extent<2> arr_extent = CreateRandomExtent<2>(64);  
	std::vector<int> cont(arr_extent.size(), 10);
	array<int, 2> arr(arr_extent, cont.begin(), cont.end(), device.get_default_view(), ACCESS_TYPE);
	
	return REPORT_RESULT(VerifyCpuAccessType(arr, ACCESS_TYPE));
}
开发者ID:MindCodeTech,项目名称:CPPAMPDemos,代码行数:8,代码来源:test.cpp


示例8: test14

runall_result test14(accelerator& device)
{
	std::vector<int> cont1(64, 10);
	array<int, 1> arr1(64, cont1.begin(), cont1.end(), device.get_default_view(), ACCESS_TYPE);
	
	std::vector<int> cont2(64 * 64, 10);
	array<int, 2> arr2(64, 64, cont2.begin(), cont2.end(), device.get_default_view(), ACCESS_TYPE);
	
	std::vector<int> cont3(64 * 64 * 64, 10);
	array<int, 3> arr3(64, 64, 64, cont3.begin(), cont3.end(), device.get_default_view(), ACCESS_TYPE);
	
	runall_result res;
	
	res &= REPORT_RESULT(VerifyCpuAccessType(arr1, ACCESS_TYPE));
	res &= REPORT_RESULT(VerifyCpuAccessType(arr2, ACCESS_TYPE));
	res &= REPORT_RESULT(VerifyCpuAccessType(arr3, ACCESS_TYPE));
	
	return res;
}
开发者ID:MindCodeTech,项目名称:CPPAMPDemos,代码行数:19,代码来源:test.cpp


示例9: test8

runall_result test8(accelerator& device)
{
	extent<2> arr_extent = CreateRandomExtent<2>(64);  
	
	array_view<int , 2> arr_v(arr_extent);
	array_view<const int, 2> arr_v_c(arr_v);	
	array<int, 2> arr(arr_v_c, device.get_default_view(), ACCESS_TYPE);
	
	return REPORT_RESULT(VerifyCpuAccessType(arr, ACCESS_TYPE));
}
开发者ID:MindCodeTech,项目名称:CPPAMPDemos,代码行数:10,代码来源:test.cpp


示例10: StagingArrayToArrayTests

	StagingArrayToArrayTests()
	{
		cpu_acc = accelerator(accelerator::cpu_accelerator);
		gpu_acc1 = require_device_for<DATA_TYPE>();
		gpu_acc2 = require_device_for<DATA_TYPE>(gpu_acc1);
		
		if(gpu_acc1.get_supports_cpu_shared_memory())
		{
			WLog() << "Accelerator " << gpu_acc1.get_description() << " supports zero copy" << std::endl;
			
			// Set the default cpu access type for this accelerator
			gpu_acc1.set_default_cpu_access_type(DEF_ACCESS_TYPE1);
						
			access_types_vec.push_back(std::make_tuple(access_type_none));
			access_types_vec.push_back(std::make_tuple(access_type_read));
			access_types_vec.push_back(std::make_tuple(access_type_write));
			access_types_vec.push_back(std::make_tuple(access_type_read_write));
		}
		else
		{
			access_types_vec.push_back(std::make_tuple(access_type_auto));
		}
		
		if(gpu_acc2.get_supports_cpu_shared_memory())
		{
			WLog() << "Accelerator " << gpu_acc2.get_description() << " supports zero copy" << std::endl;
			
			// Set the default cpu access type for this accelerator
			gpu_acc2.set_default_cpu_access_type(DEF_ACCESS_TYPE2);
		}
	}
开发者ID:8l,项目名称:kalmar,代码行数:31,代码来源:test.cpp


示例11: setDefaultAccelerator

 /**
 ********************************************************************************
 * @fn setDefaultAccelerator
 * @brief Set a default accelerator
 *******************************************************************************/
 int setDefaultAccelerator()
 {
     std::vector<accelerator> allAccl = accelerator::get_all();
     /**************************************************************************
     * if deviceID is not set, the default accelerator is AMD Readon           *
     **************************************************************************/
     if(!enableDeviceId)
     {
         for (unsigned i = 0; i < allAccl.size(); ++i)
         {
             if (allAccl[i].get_description().find(L"AMD Radeon") != std::wstring::npos ||
                     allAccl[i].get_description().find(L"ATI Radeon") != std::wstring::npos )
             {
                 deviceAccl = allAccl[i];
                 break;
             }
         }
     }
     else
     {
         deviceAccl = allAccl[deviceId];
     }
     accelerator::set_default(deviceAccl.device_path);
     std::wcout << L"Selected accelerator : " << deviceAccl.get_description()
                << std::endl;
     if (deviceAccl == accelerator(accelerator::direct3d_ref))
     {
         std::cout << "WARNING!! Running on very slow emulator!" << std::endl;
     }
     if(deviceAccl == accelerator(accelerator::cpu_accelerator))
     {
         std::cout << "There is no need to run on single CPU !"<<std::endl;
         return SDK_FAILURE;
     }
     return SDK_SUCCESS;
 }
开发者ID:KacperGr,项目名称:Techniki-multimedialne,代码行数:41,代码来源:AMPUtil.hpp


示例12: test_accelerator_view

bool test_accelerator_view(const accelerator_view& av, const accelerator& acc)
{
	return av.get_accelerator() == acc
		&& av.get_is_debug() == acc.get_is_debug()
		&& av.get_version() == acc.get_version();
}
开发者ID:pathscale,项目名称:amp-testsuite,代码行数:6,代码来源:test.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ actor类代码示例发布时间:2022-05-31
下一篇:
C++ acc_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap