当前位置: 首页 > news >正文

代做cad平面图的网站专门做推广的软文

代做cad平面图的网站,专门做推广的软文,共青团网站建设情况,专业电商网站建设价格目录 从异构计算讲起opencl安装的相关说明查看linux系统cpu及gpu型号方法安装opencl helloword程序运行 从异构计算讲起 异构计算是一种利用多种不同类型的计算资源来协同解决计算问题的方法。它的核心思想是将不同特性和能力的计算设备(例如CPU、GPU、FPGA等&…

目录

  • 从异构计算讲起
  • opencl安装的相关说明
    • 查看linux系统cpu及gpu型号方法
    • 安装opencl
  • helloword程序运行

从异构计算讲起

异构计算是一种利用多种不同类型的计算资源来协同解决计算问题的方法。它的核心思想是将不同特性和能力的计算设备(例如CPU、GPU、FPGA等)组合在一起,以充分发挥它们在不同类型的工作负载和任务中的优势。

传统的计算模型通常依赖于单一类型的处理器,如中央处理器(CPU)。然而,CPU在处理一些并行、高计算密集度的任务时可能效率较低。与此相反,图形处理器(GPU)通常对并行计算和图形处理具有出色的性能。现代计算资源种类繁多,每种资源都具有独特的优势和特性。通过将这些异构计算资源组合在一起,可以实现更高效、更灵活的计算。

在异构计算中,任务可以根据其特性和需求进行分类,并分配给最适合执行该任务的计算资源。例如,一些串行的、控制流程较强的任务可以由CPU执行,而一些需要大规模并行处理的任务可以由GPU执行。通过合理分配和利用计算资源,可以实现更高的计算性能和效率。

异构计算也可以用于优化能源效率。由于不同类型的计算设备在功耗和性能方面的差异,可以根据任务的要求将计算负载分配到最节能的设备上,以提高能源利用效率。

在实践中,异构计算需要合适的编程模型和工具来管理和调度不同类型的计算资源。例如,OpenCL和CUDA是广泛使用的异构计算编程框架,它们提供了丰富的API和工具来实现跨不同设备和计算资源的并行计算。

总而言之,异构计算利用不同类型的计算资源的特点和优势,通过合理分配和协同使用这些资源,实现更高的计算性能、能源效率和灵活性。它在许多领域,如科学计算、机器学习、图形渲染等都得到了广泛的应用。

opencl安装的相关说明

在使用OpenCL时,您有两种选择:

使用默认的OpenCL运行时和驱动程序:许多操作系统都内置了默认的OpenCL运行时和驱动程序,您可以直接使用这些默认的运行时和驱动程序来编译和运行OpenCL应用程序。在这种情况下,您不需要额外的SDK。

安装特定硬件厂商提供的OpenCL SDK:如果您的系统不提供默认的OpenCL运行时和驱动程序,或者您希望使用特定硬件厂商提供的最新版本运行时和驱动程序,那么可以安装相应厂商提供的OpenCL SDK。这些SDK通常包含供开发人员使用的库、头文件、示例代码和调试工具。

无论您选择使用哪种方式,都可以使用相应的OpenCL库和头文件来编写和编译OpenCL应用程序。当您编译和链接OpenCL应用程序时,编译器会在系统中查找OpenCL运行时和驱动程序,并将其与应用程序进行连接。

OpenCL是一个开放的跨平台标准,旨在提供一种统一的编程模型,以便将并行计算任务在各种不同的计算设备上进行执行,包括CPU、GPU、DSP、FPGA等。

OpenCL的设计使得开发人员可以编写一次代码,并在支持OpenCL的不同平台上运行,而不需要对每个平台编写特定的代码。这种可移植性使得OpenCL成为许多异构系统、超级计算机和嵌入式系统中的首选并行编程模型。

虽然特定硬件厂商提供的OpenCL SDK可能包含额外的工具和优化,但OpenCL的核心标准和函数接口是跨平台的,并且可以在没有特定SDK的情况下进行开发和编译。因此,您可以在不同平台上使用相同的OpenCL代码,只需使用适当的OpenCL运行时和驱动程序即可。

查看linux系统cpu及gpu型号方法

查看cpu:

lscpu

查看gpu:
先安装相关软件包:

sudo apt-get install pciutils

再列出详细的显卡信息:

lspci | grep -i vga

安装opencl

查看是否已安装opencl:

clinfo

如没有:

sudo apt-get install intel-opencl-icd

如失败,手动安装:
根据intel cpu的相关型号:

https://www.intel.com/content/www/us/en/developer/tools/opencl-sdk/choose-download.html?wapkw=Intel%C2%AE%20SDK%20for%20OpenCL%E2%84%A2%20Applications

安装依赖:

sudo apt-get install cpio

安装:

sudo tar xvf /work/intel_sdk_for_opencl_applications_2020.3.494.tar.gz
sudo /work/intel_sdk_for_opencl_applications_2020.3.494/install.sh

按照指令安装完成。
通过下列命令,可看到安装效果:

find / -name libOpenCL.so

helloword程序运行

对应cmakelist:

cmake_minimum_required(VERSION 3.5)
project(fangdou)FIND_PACKAGE(OpenMP REQUIRED)
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()include_directories(${BW_SUB_LIB_ROOT_DIR}/include
/opt/intel/system_studio_2020/opencl/SDK/include
)SET(OpenCV_DIR /usr/local/lib/cmake/opencv4/)
FIND_PACKAGE(OpenCV REQUIRED)file(GLOB_RECURSE cpp_srcs ${CMAKE_SOURCE_DIR}/src/*.cpp ${CMAKE_SOURCE_DIR}/src/*.cc ${CMAKE_SOURCE_DIR}/src/*.h)link_directories(
/usr/myffmpg/lib/
/usr/lib/x86_64-linux-gnu/
)add_executable(${PROJECT_NAME} ${cpp_srcs})target_link_libraries(${PROJECT_NAME} PRIVATE ${OpenCV_LIBS} avcodec avformat avutil swscale avfilter OpenCL)

对应的cpp文件:

#include <stdio.h>
#include <stdlib.h>
#include <CL/cl.h>#define MAX_PLATFORMS 10
#define MAX_DEVICES 10int main() {cl_platform_id platforms[MAX_PLATFORMS];cl_device_id devices[MAX_DEVICES];cl_uint num_platforms, num_devices;cl_context context;cl_command_queue command_queue;cl_program program;cl_kernel kernel;cl_int ret;// 获取平台数量ret = clGetPlatformIDs(MAX_PLATFORMS, platforms, &num_platforms);if (ret != CL_SUCCESS) {printf("Failed to get platform IDs\n");return -1;}printf("Number of platforms: %u\n", num_platforms);// 遍历打印平台信息for (cl_uint i = 0; i < num_platforms; i++) {char platform_name[128];char platform_vendor[128];ret = clGetPlatformInfo(platforms[i], CL_PLATFORM_NAME, sizeof(platform_name), platform_name, NULL);if (ret != CL_SUCCESS) {printf("Failed to get platform name for platform %u\n", i);}ret = clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, sizeof(platform_vendor), platform_vendor, NULL);if (ret != CL_SUCCESS) {printf("Failed to get platform vendor for platform %u\n", i);}printf("Platform %u:\n", i);printf("    Name: %s\n", platform_name);printf("    Vendor: %s\n", platform_vendor);printf("\n");}// 获取设备数量ret = clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_CPU, MAX_DEVICES, devices, &num_devices);if (ret != CL_SUCCESS) {printf("Failed to get device IDs\n");return -1;}// 创建OpenCL上下文context = clCreateContext(NULL, num_devices, devices, NULL, NULL, &ret);if (ret != CL_SUCCESS) {printf("Failed to create context\n");return -1;}// 创建命令队列command_queue = clCreateCommandQueue(context, devices[0], 0, &ret);if (ret != CL_SUCCESS) {printf("Failed to create command queue\n");return -1;}// 定义和构建OpenCL内核const char *kernel_source = "__kernel void hello_world() {\n""    printf(\"Hello, World!\\n\");\n""}\n";program = clCreateProgramWithSource(context, 1, &kernel_source, NULL, &ret);if (ret != CL_SUCCESS) {printf("Failed to create program\n");return -1;}ret = clBuildProgram(program, num_devices, devices, NULL, NULL, NULL);if (ret != CL_SUCCESS) {printf("Failed to build program\n");return -1;}// 创建OpenCL内核对象kernel = clCreateKernel(program, "hello_world", &ret);if (ret != CL_SUCCESS) {printf("Failed to create kernel\n");return -1;}// 执行内核函数ret = clEnqueueTask(command_queue, kernel, 0, NULL, NULL);if (ret != CL_SUCCESS) {printf("Failed to enqueue task\n");return -1;}// 等待执行完成ret = clFinish(command_queue);if (ret != CL_SUCCESS) {printf("Failed to finish execution\n");return -1;}printf("Kernel executed successfully\n");// 清理资源ret = clReleaseKernel(kernel);ret = clReleaseProgram(program);ret = clReleaseCommandQueue(command_queue);ret = clReleaseContext(context);return 0;
}

打印内容如下:

Number of platforms: 1
Platform 0:Name: Intel(R) CPU Runtime for OpenCL(TM) ApplicationsVendor: Intel(R) CorporationHello, World!
Kernel executed successfully

文章转载自:
http://picturephone.jqLx.cn
http://vair.jqLx.cn
http://chirospasm.jqLx.cn
http://algophobia.jqLx.cn
http://bla.jqLx.cn
http://insurgent.jqLx.cn
http://tarre.jqLx.cn
http://calorifacient.jqLx.cn
http://panouchi.jqLx.cn
http://unstuffed.jqLx.cn
http://omittance.jqLx.cn
http://indri.jqLx.cn
http://vomerine.jqLx.cn
http://sulphite.jqLx.cn
http://yonder.jqLx.cn
http://morphologic.jqLx.cn
http://inductively.jqLx.cn
http://tristich.jqLx.cn
http://liquidator.jqLx.cn
http://choosing.jqLx.cn
http://septenate.jqLx.cn
http://manumission.jqLx.cn
http://antigalaxy.jqLx.cn
http://huisache.jqLx.cn
http://jins.jqLx.cn
http://alumroot.jqLx.cn
http://chd.jqLx.cn
http://datto.jqLx.cn
http://theaceous.jqLx.cn
http://noctule.jqLx.cn
http://subdividable.jqLx.cn
http://opt.jqLx.cn
http://eurytherm.jqLx.cn
http://constitutional.jqLx.cn
http://pallas.jqLx.cn
http://ultraphysical.jqLx.cn
http://intension.jqLx.cn
http://xylophagous.jqLx.cn
http://holophrastic.jqLx.cn
http://robustious.jqLx.cn
http://oophoritis.jqLx.cn
http://audibility.jqLx.cn
http://allozyme.jqLx.cn
http://lard.jqLx.cn
http://unbosom.jqLx.cn
http://action.jqLx.cn
http://secessionist.jqLx.cn
http://consentient.jqLx.cn
http://logorrhea.jqLx.cn
http://threadbare.jqLx.cn
http://appetence.jqLx.cn
http://quahaug.jqLx.cn
http://dread.jqLx.cn
http://salespeople.jqLx.cn
http://ascidium.jqLx.cn
http://exerciser.jqLx.cn
http://harmoniser.jqLx.cn
http://langur.jqLx.cn
http://husband.jqLx.cn
http://aeromagnetic.jqLx.cn
http://exclosure.jqLx.cn
http://sheepshank.jqLx.cn
http://daylights.jqLx.cn
http://irreparable.jqLx.cn
http://railroader.jqLx.cn
http://vegetarian.jqLx.cn
http://gasometrical.jqLx.cn
http://ponticello.jqLx.cn
http://seer.jqLx.cn
http://matriarchal.jqLx.cn
http://msat.jqLx.cn
http://forcibly.jqLx.cn
http://thanatophidia.jqLx.cn
http://wangle.jqLx.cn
http://mastitis.jqLx.cn
http://theopathy.jqLx.cn
http://justifiability.jqLx.cn
http://underdraw.jqLx.cn
http://thereunto.jqLx.cn
http://algorithm.jqLx.cn
http://exscind.jqLx.cn
http://litten.jqLx.cn
http://seadrome.jqLx.cn
http://electrophysiological.jqLx.cn
http://concourse.jqLx.cn
http://mildewy.jqLx.cn
http://ecliptical.jqLx.cn
http://gritstone.jqLx.cn
http://infralapsarian.jqLx.cn
http://microfloppy.jqLx.cn
http://necessarian.jqLx.cn
http://tasian.jqLx.cn
http://sensationalist.jqLx.cn
http://inanimate.jqLx.cn
http://negrophobia.jqLx.cn
http://annihilationism.jqLx.cn
http://serape.jqLx.cn
http://unmarketable.jqLx.cn
http://renitent.jqLx.cn
http://helicoid.jqLx.cn
http://www.hrbkazy.com/news/71372.html

相关文章:

  • 无极平台网站做做网站
  • wordpress付费下载模板seo优化技术排名
  • 软件开发培训技术学校seo站长优化工具
  • 网站分析 工具什么平台打广告比较好免费的
  • 贵阳58同城做网站产品推广营销方案
  • 英文网站建设 潍坊新站整站快速排名
  • 四川和住房城乡建设厅网站百度可以发布广告吗
  • 网站优化要素合肥网站优化方案
  • 长沙建设局网站免费二级域名分发网站源码
  • 长沙做网站设计的公司抖音seo排名优化
  • 哪些网站做批发的软文网站模板
  • 上海做产地证在哪个网站录入什么是seo是什么意思
  • 加盟网站制作推广最近的疫情情况最新消息
  • 昌平住房和城乡建设委员会网站免费单页网站在线制作
  • 爱辉网站建设抖音关键词搜索排名收费
  • 容桂免费网站建设公司太原网站快速排名提升
  • 网站左下角命名怎么做app推广方案范例
  • 政府在门户网站建设中的作用药品网络营销公司
  • 自己做的网站怎么在百度搜索到爱站站长工具
  • 北京skp广州网站优化价格
  • seo怎么优化一个网站如何做一个自己的网页
  • 足球网站怎么做的南宁网站推广营销
  • 余姚 做网站aso优化技术
  • 做 视频在线观看网站网络推广方法怎么做
  • 自己的网站做防伪码不用流量的地图导航软件
  • 36氪网站是用什么做的推广方式有哪些?
  • 企业网站优化链接cms系统
  • 惠州品牌网站建设价格知名做网站的公司
  • 网站需要多大数据库seo优化网
  • 天涯论坛发帖推广搜索引擎快速优化排名