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

windows下如何安裝OpenCL

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

由于我的電腦是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

運行install.exe,安裝

運行后,如果vs打開了需要關閉。

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

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

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

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

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

添加依賴項,如果工程是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,用于測試手工配置項目
*/
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;
}

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

相關文章

最新評論

高台县| 大名县| 云安县| 临高县| 巴林左旗| 汤阴县| 宁德市| 定西市| 浦江县| 江阴市| 汾阳市| 泰来县| 防城港市| 武强县| 平利县| 天镇县| 崇文区| 施秉县| 保康县| 开江县| 建瓯市| 阿克| 瑞金市| 南阳市| 明水县| 岚皋县| 尤溪县| 会宁县| 米泉市| 富宁县| 揭阳市| 长丰县| 福贡县| 邢台县| 永康市| 丰都县| 苗栗市| 阳西县| 山东省| 东莞市| 陕西省|