How to use Arria10 and Intel OpenCL
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[ASAP Top]]
Written by Noda.
(2017/10/19追記)~
AOCL環境をv16.1からv17.0に変更しようとして躓いている。~
hostであるneutrinoの環境はv17.0にした。~
Ariia10のRTEもv17.0にしたけど、$aocl diagnoseしたらカーネ...
SDカードイメージをv17.0に変更する必要があるらしい。~
やりかたわかんにゃい~
\\\\
OpenClで高位合成したい人間のためのメモ。
これでとりあえず足し算くらいはできる。~
host codeぐちゃぐちゃな気がしますがとりあえず動くので許し...
回路の最適化については触れていないので、詳しく知りたい方...
This is a simple guide for implementing on Arria 10 SoC u...
If you want to optimize your code, please read the follow...
https://www.altera.com/en_US/pdfs/literature/hb/opencl-sd...
https://www.altera.com/en_US/pdfs/literature/hb/opencl-sd...
*Introduction [#jbfa5e69]
Arria 10 SoC is a system on chip with ARM CPU and FPGA pr...
The strength of the Arria10 is that a hard macro (DSP) fo...
OpenCl is a framework for performing parallel computation...
In the environment we use host code and kernel code. The ...
And, Board Support Package (BSP) is provided for each boa...
*How to develop [#s255b310]
**Preparation for implementation [#d85bd23e]
The sample addition code is placed in the following direc...
/home/asap2/noda/arria_test
There are two directories "add" and "common". The additio...
The host code is in "host/src/main.cpp", and the kernel c...
This code sums up randomly generated 100 elements. In ord...
Also, we will ssh and scp to Arria 10 later, but before t...
**Emulation [#ed68a223]
Before implementing the circuit in the FPGA, we debug on ...
First, after ssh to neutrino, copy "~noda/.bash_profile" ...
Now that PATH has passed, you try to emulate. There is a ...
There are various compile options. Check references for d...
The result of execution is as follows.~
bash-4.1$ ./emu_go
aoc: Environment checks are completed successfully.
You are now compiling the full flow!!
aoc: Selected target board a10soc_2ddr
aoc: Running OpenCL parser....
aoc: OpenCL parser completed successfully.
aoc: Compiling for Emulation ....
aoc: Emulator Compilation completed successfully.
Emulator flow is successful.
To execute emulated kernel, invoke host with
env CL_CONTEXT_EMULATOR_DEVICE_ALTERA=1 <host_program>
For multi device emulations replace the 1 with the numb...
Initializing OpenCL
Platform: Altera SDK for OpenCL
Using 1 device(s)
EmulatorDevice : Emulated Device
Using AOCX: add.aocx
Arria 10 SoC
Turn_around_Time: 0.712237 ms
Kernel time (device 0)(getStartEndTime): 0.619050 ms
Output: 93.649620
Reference: 93.649620
Verification: PASS
You can check the flow of calculation on the CPU. You mus...
Although we can confirm that the calculation is done norm...
We can also check FPGA resource usage. Execute "emu_resou...
bash-4.1$ cd device/
bash-4.1$ ./emu_resource
aoc: Environment checks are completed successfully.
aoc: Selected target board a10soc_2ddr
aoc: Running OpenCL parser....
aoc: OpenCL parser completed successfully.
aoc: Compiling....
aoc: Linking with IP library ...
+-------------------------------------------------------...
; Estimated Resource Usage Summary ...
+----------------------------------------+--------------...
; Resource + Usage ...
+----------------------------------------+--------------...
; Logic utilization ; 2% ...
; ALUTs ; 1% ...
; Dedicated logic registers ; 1% ...
; Memory blocks ; 3% ...
; DSP blocks ; 0% ...
+----------------------------------------+--------------...
aoc: First stage compilation completed successfully.
aoc: To compile this project, run "aoc add.aoco"
The float operation automatically uses the DSP. In the ta...
We confirmed that the addition of sample code worked prop...
**Compile kernel code[#o59c0c75]
First, execute the shell code "aocl_shell" and launch the...
So, run the shell "aocx_go" and you can compile the kerne...
This is very time-consuming. Even in this sample code, it...
And now, We have compiled kernel code(aocx file) in the d...
We will compile the host code later in ARM on Arria 10. T...
bash-4.1$ ./aocx_go
aoc: Environment checks are completed successfully.
You are now compiling the full flow!!
aoc: Selected target board a10soc_2ddr
aoc: Running OpenCL parser....
aoc: OpenCL parser completed successfully.
aoc: Compiling....
aoc: Linking with IP library ...
+-------------------------------------------------------...
; Estimated Resource Usage Summary ...
+----------------------------------------+--------------...
; Resource + Usage ...
+----------------------------------------+--------------...
; Logic utilization ; 2% ...
; ALUTs ; 1% ...
; Dedicated logic registers ; 1% ...
; Memory blocks ; 3% ...
; DSP blocks ; 0% ...
+----------------------------------------+--------------...
aoc: First stage compilation completed successfully.
aoc: Hardware generation completed successfully.
When compilation starts, the directory "to_a10soc" specif...
**Transfer aocx file and host code to Arria 10 [#tadba939]
After compiling the kernel code, transfer the generated a...
./to_a10soc/go_scp
**Compile the host code on Arria 10 [#qebbd5d8]
Ssh to Arria 10.~
ssh root@131.113.69.239
Currently, everyone is Superuser, so you have to be caref...
Before compiling, execute the following spells on arria10...
source ~/init_opencl.sh
After that, you move to the transfer destination director...
If you prepared your own directory, copy "~/test/Makefile...
Finally, make the "main.cpp" and compile it. The executio...
root@Arria10_linaro:~/test/test_add# make clean
root@Arria10_linaro:~/test/test_add# make all
../common/src/AOCLUtils/opencl.cpp: In function ‘void* a...
../common/src/AOCLUtils/opencl.cpp:55:49: warning: ignor...
posix_memalign (&result, AOCL_ALIGNMENT, size);
^
../common/src/AOCLUtils/opencl.cpp: In function ‘bool ao...
../common/src/AOCLUtils/opencl.cpp:278:14: warning: igno...
chdir(path);
^
Then, a directory "bin" is created. Inside there is a "ho...
Finally move "aocx file" to directory "bin" and execute "...
root@Arria10_linaro:~/test/test_add# ./bin/host
Initializing OpenCL
Platform: Altera SDK for OpenCL
Using 1 device(s)
a10soc_2ddrArria 10 SoC Development Kit
Using AOCX: add.aocx
Reprogramming device with handle 1
Arria 10 SoC
Turn_around_Time: 1.022762 ms
Kernel time (device 0)(getStartEndTime): 0.107940 ms
Output: 93.649620
Reference: 93.649620
Verification: PASS
Congrats! Now we are the king of addition! ! !~
**Others (GUI Profiler) [#z7817398]
When compiling the kernel code with the "--profile" optio...
Note that adding "--profile" option will degrade performa...
bash-4.1$ ./go_mon
Enter passphrase for key '/home/hlab/hoge/.ssh/id_rsa':
profile.mon 100% 97 ...
bash-4.1$ aocl report profile.mon add.aocx &
もう力尽きたので後はまたこんどにゃん。
Please add your knowledge to this wiki!!!
|||
終了行:
[[ASAP Top]]
Written by Noda.
(2017/10/19追記)~
AOCL環境をv16.1からv17.0に変更しようとして躓いている。~
hostであるneutrinoの環境はv17.0にした。~
Ariia10のRTEもv17.0にしたけど、$aocl diagnoseしたらカーネ...
SDカードイメージをv17.0に変更する必要があるらしい。~
やりかたわかんにゃい~
\\\\
OpenClで高位合成したい人間のためのメモ。
これでとりあえず足し算くらいはできる。~
host codeぐちゃぐちゃな気がしますがとりあえず動くので許し...
回路の最適化については触れていないので、詳しく知りたい方...
This is a simple guide for implementing on Arria 10 SoC u...
If you want to optimize your code, please read the follow...
https://www.altera.com/en_US/pdfs/literature/hb/opencl-sd...
https://www.altera.com/en_US/pdfs/literature/hb/opencl-sd...
*Introduction [#jbfa5e69]
Arria 10 SoC is a system on chip with ARM CPU and FPGA pr...
The strength of the Arria10 is that a hard macro (DSP) fo...
OpenCl is a framework for performing parallel computation...
In the environment we use host code and kernel code. The ...
And, Board Support Package (BSP) is provided for each boa...
*How to develop [#s255b310]
**Preparation for implementation [#d85bd23e]
The sample addition code is placed in the following direc...
/home/asap2/noda/arria_test
There are two directories "add" and "common". The additio...
The host code is in "host/src/main.cpp", and the kernel c...
This code sums up randomly generated 100 elements. In ord...
Also, we will ssh and scp to Arria 10 later, but before t...
**Emulation [#ed68a223]
Before implementing the circuit in the FPGA, we debug on ...
First, after ssh to neutrino, copy "~noda/.bash_profile" ...
Now that PATH has passed, you try to emulate. There is a ...
There are various compile options. Check references for d...
The result of execution is as follows.~
bash-4.1$ ./emu_go
aoc: Environment checks are completed successfully.
You are now compiling the full flow!!
aoc: Selected target board a10soc_2ddr
aoc: Running OpenCL parser....
aoc: OpenCL parser completed successfully.
aoc: Compiling for Emulation ....
aoc: Emulator Compilation completed successfully.
Emulator flow is successful.
To execute emulated kernel, invoke host with
env CL_CONTEXT_EMULATOR_DEVICE_ALTERA=1 <host_program>
For multi device emulations replace the 1 with the numb...
Initializing OpenCL
Platform: Altera SDK for OpenCL
Using 1 device(s)
EmulatorDevice : Emulated Device
Using AOCX: add.aocx
Arria 10 SoC
Turn_around_Time: 0.712237 ms
Kernel time (device 0)(getStartEndTime): 0.619050 ms
Output: 93.649620
Reference: 93.649620
Verification: PASS
You can check the flow of calculation on the CPU. You mus...
Although we can confirm that the calculation is done norm...
We can also check FPGA resource usage. Execute "emu_resou...
bash-4.1$ cd device/
bash-4.1$ ./emu_resource
aoc: Environment checks are completed successfully.
aoc: Selected target board a10soc_2ddr
aoc: Running OpenCL parser....
aoc: OpenCL parser completed successfully.
aoc: Compiling....
aoc: Linking with IP library ...
+-------------------------------------------------------...
; Estimated Resource Usage Summary ...
+----------------------------------------+--------------...
; Resource + Usage ...
+----------------------------------------+--------------...
; Logic utilization ; 2% ...
; ALUTs ; 1% ...
; Dedicated logic registers ; 1% ...
; Memory blocks ; 3% ...
; DSP blocks ; 0% ...
+----------------------------------------+--------------...
aoc: First stage compilation completed successfully.
aoc: To compile this project, run "aoc add.aoco"
The float operation automatically uses the DSP. In the ta...
We confirmed that the addition of sample code worked prop...
**Compile kernel code[#o59c0c75]
First, execute the shell code "aocl_shell" and launch the...
So, run the shell "aocx_go" and you can compile the kerne...
This is very time-consuming. Even in this sample code, it...
And now, We have compiled kernel code(aocx file) in the d...
We will compile the host code later in ARM on Arria 10. T...
bash-4.1$ ./aocx_go
aoc: Environment checks are completed successfully.
You are now compiling the full flow!!
aoc: Selected target board a10soc_2ddr
aoc: Running OpenCL parser....
aoc: OpenCL parser completed successfully.
aoc: Compiling....
aoc: Linking with IP library ...
+-------------------------------------------------------...
; Estimated Resource Usage Summary ...
+----------------------------------------+--------------...
; Resource + Usage ...
+----------------------------------------+--------------...
; Logic utilization ; 2% ...
; ALUTs ; 1% ...
; Dedicated logic registers ; 1% ...
; Memory blocks ; 3% ...
; DSP blocks ; 0% ...
+----------------------------------------+--------------...
aoc: First stage compilation completed successfully.
aoc: Hardware generation completed successfully.
When compilation starts, the directory "to_a10soc" specif...
**Transfer aocx file and host code to Arria 10 [#tadba939]
After compiling the kernel code, transfer the generated a...
./to_a10soc/go_scp
**Compile the host code on Arria 10 [#qebbd5d8]
Ssh to Arria 10.~
ssh root@131.113.69.239
Currently, everyone is Superuser, so you have to be caref...
Before compiling, execute the following spells on arria10...
source ~/init_opencl.sh
After that, you move to the transfer destination director...
If you prepared your own directory, copy "~/test/Makefile...
Finally, make the "main.cpp" and compile it. The executio...
root@Arria10_linaro:~/test/test_add# make clean
root@Arria10_linaro:~/test/test_add# make all
../common/src/AOCLUtils/opencl.cpp: In function ‘void* a...
../common/src/AOCLUtils/opencl.cpp:55:49: warning: ignor...
posix_memalign (&result, AOCL_ALIGNMENT, size);
^
../common/src/AOCLUtils/opencl.cpp: In function ‘bool ao...
../common/src/AOCLUtils/opencl.cpp:278:14: warning: igno...
chdir(path);
^
Then, a directory "bin" is created. Inside there is a "ho...
Finally move "aocx file" to directory "bin" and execute "...
root@Arria10_linaro:~/test/test_add# ./bin/host
Initializing OpenCL
Platform: Altera SDK for OpenCL
Using 1 device(s)
a10soc_2ddrArria 10 SoC Development Kit
Using AOCX: add.aocx
Reprogramming device with handle 1
Arria 10 SoC
Turn_around_Time: 1.022762 ms
Kernel time (device 0)(getStartEndTime): 0.107940 ms
Output: 93.649620
Reference: 93.649620
Verification: PASS
Congrats! Now we are the king of addition! ! !~
**Others (GUI Profiler) [#z7817398]
When compiling the kernel code with the "--profile" optio...
Note that adding "--profile" option will degrade performa...
bash-4.1$ ./go_mon
Enter passphrase for key '/home/hlab/hoge/.ssh/id_rsa':
profile.mon 100% 97 ...
bash-4.1$ aocl report profile.mon add.aocx &
もう力尽きたので後はまたこんどにゃん。
Please add your knowledge to this wiki!!!
|||
ページ名: