2018-04-15 OpenCL 简介

OpenCL

什么是 OpenCL?
OpenCL 是由 Khronos Group 集团于 2008 年开发的并行编程开放标准。这一标准允许您利用异构系统中的不同架构,开发可以在 GPU 或 CPU 上并行运行的应用程序。
换而言之,OpenCL 使得计算某任务时运用所有 CPU 核心或 GPU 的庞大运算能力成为了可能,并由此缩短了程序的执行时间。因此处理大工作量和资源消耗大的计算等相关任务时,使用 OpenCL 非常有利。
举个例子,说到 MQL5,处理某个按多交易品种和时间框架对历史数据执行复杂且冗长分析特定脚本时,绩效增益极其可观 (要注意的是,打算采用并行执行的 MQL5 程序,应利用 OpenCL API 以特殊方式编写)。

System Verilog数字系统设计    
BSP file description    
    https://www.altera.com/documentation/bba1475671648402.html

Inserting custom system verilog into OpenCL toolflow - Google Search
Integrating OpenCL .cl files with RTL   
how to interact between OpenCL and RTL

Intel FPGA SDK for OpenCL Programming Guide

https://www.altera.com/documentation/mwh1391807965224.html#mwh1391807939093

Altera opencl example
https://www.altera.com/products/design-software/embedded-software-developers/opencl/developer-zone.html#design-examples 
example1.tgz    

example1

aoc -v -I device/lib1 -L device -l double_lib.aoclib device/example1.cl --report

--cbi_hpc_v1
aoc device/example1.cl -o bin/example1.aocx -I device/lib1 -L device -l device/double_lib.aoclib --board cbi_hpc_v1 --report
--cbi_hpc_v1 emulator
aoc -march=emulator device/example1.cl -o bin/example1.aocx -I device/lib1 -L device -l device/double_lib.aoclib --board cbi_hpc_v1 --report

Altera opencl

12.1.2 Packaging an OpenCL Helper Function File for an OpenCL Library

Before creating an OpenCL library file, package each OpenCL source file with helper
functions into a .aoco file. Unlike RTL modules, you do not need to create an XML
specification file.
In general, you do not need to create a library to share helper functions written in
OpenCL. You can distribute a helper function in source form (for example,
<shared_file>.cl) and then insert the line #include "<shared_file>.cl" in
the OpenCL kernel source code.

To package an OpenCL source file into a .aoco file, invoke the following command: 

    aoc -c -shared <OpenCL_source_file_name>.cl -o <OpenCL_object_file_name>.aoco
    
    where the -shared offline compiler command option instructs the compiler to
    create a .aoco file that is suitable for inclusion into an OpenCL library

12.1.3 Packaging an RTL Component for an OpenCL Library

Before creating an OpenCL library file, package each RTL component into a .aoco file.
Hardware generation is not necessary for the creation of a .aoco file. Compile the
OpenCL source file using the -c Intel FPGA SDK for OpenCL Offline Compiler
command option.

To package an RTL component into a .aoco file, invoke the following command:

    aoc -c <RTL component description file name>.xml -o <RTL object file name>.aoco

12.1.5 Packaging Multiple Object Files into a Library File

After creating the .aoco files that you want to include into an OpenCL library,
package them into a library file by invoking the Intel FPGA SDK for OpenCL library
utility command option.

• To package multiple object files into a single library file, invoke the following command: 
    
    aocl library create -o <library file name>.aoclib <object file 1>.aoco [<object file 2>.aoco ... <object file N>.aoco]

12.1.6 Specifying an OpenCL Library when Compiling an OpenCL Kernel

    aoc -l <library_file_name>.aoclib [-L <library directory>] <kernel file name>.cl
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容