目录
一、注册Intel® DevCloud for oneAPI
一、注册Intel® DevCloud for oneAPI
访问链接:https://devcloud.intel.com/oneapi/
点击Get Free Access按照提示创建账户
填写信息后等待邮箱验证
接收到祝贺邮件表示账户成功创建
创建完成一般页面会自动跳转到 Intel® Developer Cloud Intel® DevCloud主页或起步页面 Overview | Intel® DevCloud。
等待邮件验证,接到以下邮件后重新访问Get Started | Intel® DevCloud
点击Get Started
点击Launch JupyterLab*
等待后成功登录
二、完成实验模块1
1、运行示例文件
依次点击右边目录oneAPI_Essentials/01_oneAPI_Intro/oneAPI_Intro.ipynb
运行程序:
运行结果:
三、编写并编译hello.cpp
1、创建os_exp文件夹
2、在terminal中输入touch hello.cpp 创建cpp文件
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World!"<<endl;
return 0;
}
3、在终端中输入命令 g++ hello.cpp -o hello 编译
4、输入 ./hello 运行
5、运行结果:
四、设备选择
方式1:默认设备选择
#include<iostream>
#include<sycl/sycl.hpp>
using namespace sycl;
int main(){
queue Q;
std::cout<<"Selected device:"<<
Q.get_device().get_info<info::device::name>()<<"\n";
return 0;
}
运行结果:
方式2: 使用cpu_selector
#include<iostream>
#include<sycl/sycl.hpp>
using namespace sycl;
int main(){
queue Q{ sycl::cpu_selector_v };
std::cout<<"Selected device:"<<
Q.get_device().get_info<info::device::name>()<<"\n";
std::cout<<" -> Device vendor:"<<
Q.get_device().get_info<info::device::vendor>()<<"\n";
return 0;
}
运行结果:
五、GEMM示例
无访问权限