最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

windows下如何安裝OpenCL

 更新時(shí)間:2023年05月06日 11:46:08   作者:陽光開朗男孩  
這篇文章主要介紹了windows下如何安裝OpenCL,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

由于我的電腦是windows10,顯卡是集顯Intel® UHD Graphics 630。

下載Intel的SDK for OpenCL,下載地址https://software.intel.com/en-us/opencl-sdk/choose-download,也可以在我的資源里面直接下載

http://xiazai.jb51.net/202305/yuanma/intel_sdk_for_opencl_applications_283428.rar

運(yùn)行install.exe,安裝

運(yùn)行后,如果vs打開了需要關(guān)閉。

默認(rèn)安裝路徑在C:\Program Files (x86)\IntelSWTools,找到OpenCL安裝位置在C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL

配置環(huán)境變量,發(fā)現(xiàn)以及自動(dòng)配置到里面了

下載intel提供測試工具,下載地址:https://download.csdn.net/download/qq_36314864/87756581然后下載了直接運(yùn)行,打印如下表示安裝成功。

自己搭建一個(gè)OpenCL工程,創(chuàng)建一個(gè)C++控制臺工程

打開配置屬性,包含OpenCL的頭文件,即將C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\include

添加依賴項(xiàng),如果工程是x64,就在C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\lib\x64下面,如果x86就依賴x86下面的

拷貝下面測試代碼替換helloword

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cassert>
#include <CL/cl.h>
/*
 * 修改自官方示例intel_ocl_caps_basic_win,用于測試手工配置項(xiàng)目
*/
int main()
{
    using namespace std;
    const char* required_platform_subname = "Intel";
    //函數(shù)返回值,CL_SUCCESS表示成功
    cl_int err = CL_SUCCESS;
    // 判斷返回值是否正確的宏
#define CAPSBASIC_CHECK_ERRORS(ERR)        \
    if(ERR != CL_SUCCESS)                  \
    {                                      \
    cerr                                   \
    << "OpenCL error with code " << ERR    \
    << " happened in file " << __FILE__    \
    << " at line " << __LINE__             \
    << ". Exiting...\n";                   \
    exit(1);                               \
    }
    // 遍歷系統(tǒng)中所有OpenCL平臺
    cl_uint num_of_platforms = 0;
    // 得到平臺數(shù)目
    err = clGetPlatformIDs(0, 0, &num_of_platforms);
    CAPSBASIC_CHECK_ERRORS(err);
    cout << "Number of available platforms: " << num_of_platforms << endl;
    cl_platform_id* platforms = new cl_platform_id[num_of_platforms];
    // 得到所有平臺的ID
    err = clGetPlatformIDs(num_of_platforms, platforms, 0);
    CAPSBASIC_CHECK_ERRORS(err);
    //列出所有平臺
    cl_uint selected_platform_index = num_of_platforms;
    cout << "Platform names:\n";
    for (cl_uint i = 0; i < num_of_platforms; ++i)
    {
        size_t platform_name_length = 0;
        err = clGetPlatformInfo(
            platforms[i],
            CL_PLATFORM_NAME,
            0,
            0,
            &platform_name_length
        );
        CAPSBASIC_CHECK_ERRORS(err);
        // 調(diào)用兩次,第一次是得到名稱的長度
        char* platform_name = new char[platform_name_length];
        err = clGetPlatformInfo(
            platforms[i],
            CL_PLATFORM_NAME,
            platform_name_length,
            platform_name,
            NULL
        );
        CAPSBASIC_CHECK_ERRORS(err);
        cout << "    [" << i << "] " << platform_name;
        if (
            strstr(platform_name, required_platform_subname) &&
            selected_platform_index == num_of_platforms // have not selected yet
            )
        {
            cout << " [Selected]";
            selected_platform_index = i;
        }
        cout << endl;
        delete[] platform_name;
    }
    delete[] platforms;
    return 0;
}

到此這篇關(guān)于windows下如何安裝OpenCL的文章就介紹到這了,更多相關(guān)windows安裝OpenCL內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

重庆市| 邛崃市| 岑溪市| 旺苍县| 卓尼县| 桦川县| 麟游县| 长武县| 腾冲县| 县级市| 隆回县| 西平县| 繁昌县| 滕州市| 鄄城县| 桓台县| 秦皇岛市| 南平市| 突泉县| 丰台区| 阿拉善右旗| 铁岭市| 康马县| 万年县| 丰原市| 泰安市| 剑河县| 安阳市| 和静县| 肇州县| 英超| 余干县| 岗巴县| 唐海县| 肇东市| 兰考县| 华容县| 察雅县| 南木林县| 马鞍山市| 台湾省|