thinkoco / c5soc_opencl

DE1SOC DE10-NANO DE10-Standard OpenCL hardware that support VGA and desktop. And Some applications such as usb camera YUYV to RGB , Sobel and so on.
Apache License 2.0
90 stars 39 forks source link

Open cl environment #26

Open 18521613 opened 3 years ago

18521613 commented 3 years ago

Hi @thinkoco Could you tell me how can create De1-SoC linux image with OpenCL driver and initopencl.sh file? I have spent a lot of time looking for any documents about it but i couldn't find anything! Thanks you!

thinkoco commented 3 years ago

Hi,

A: 1.You can downlaod the c5soc_opencl_lxde_fpga_reconfigurable_20201027.img

  1. do as follows,and choose de1-soc in step 2 https://github.com/thinkoco/c5soc_opencl#run-default-opencl-application

Now, the sdcard is for de1-Soc with de1-Soc sharedonly-vga BSP

B: For building your own sdcard,here are some guides.

https://github.com/thinkoco/c5soc_opencl/blob/master/documents/LinuxAndDrivers.md#how-to-update-opencl-driver

https://github.com/thinkoco/c5soc_opencl/blob/master/documents/HowToBuildSDImage.md

Sent from my iPhone

On Mar 18, 2021, at 15:11, 18521613 @.***> wrote:

 Hi @thinkoco Could you tell me how can create De1-SoC linux image with OpenCL driver and initopencl.sh file? I have spent a lot of time looking for any documents about it but i couldn't find anything! Thanks you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

18521613 commented 3 years ago

hi @thinkoco, I want to build my sdcard so i have tried to do your B option with socfpga-opencl_4.1.22 branch on your git. But when i use _cp configopencl .config , the system informs that no file such a config_opencl or .config file. I have clicked on show hidden file but there is no file named config_opencl or .config

thinkoco commented 3 years ago

@18521613 Hi, the socfpga-3.18 is a stable branch for opencl. Also, linux 4.9 and 4.19 has been tested with modified opencl driver.Here are some guides. https://github.com/thinkoco/c5soc_opencl_rte/blob/master/documents/How_to_do.md

18521613 commented 3 years ago

@thinkoco I'm following your guides: https://github.com/thinkoco/c5soc_opencl_rte/blob/master/documents/How_to_do.md with linux 4.9. But when I'd used command make zImage, i got this error image

thinkoco commented 3 years ago

hi @18521613 have you check out the socfpga-4.9.78-aoc barnch ?

git clone --depth 3 --branch socfpga-4.9.78-aocl https://github.com/thinkoco/linux-socfpga.git
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export LOADADDR=0x8000
make c5socl_defconfig
make zImage -j4
make modules
make socfpga_cyclone5_de10_nano.dtb
18521613 commented 3 years ago

hi @18521613 have you check out the socfpga-4.9.78-aoc barnch ?

git clone --depth 3 --branch socfpga-4.9.78-aocl https://github.com/thinkoco/linux-socfpga.git
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export LOADADDR=0x8000
make c5socl_defconfig
make zImage -j4
make modules
make socfpga_cyclone5_de10_nano.dtb

Yes, the last picture i sent to you that is socfpga-4.9.78-aocl branch and when i used make zImage -j4 i got the same error. And i have a question that do i have to do Update linux kernel part in your guide: https://github.com/thinkoco/c5soc_opencl_rte/blob/master/documents/How_to_do.md with socfpga-4.9.78-aocl branch And one more when i try with linux 4.19 i also got this error: image

thinkoco commented 3 years ago

@18521613 for linux 4.9, no need to update files after checkout the socfpga-4.9.78-aocl branch

git clone --depth 3 --branch socfpga-4.9.78-aocl https://github.com/thinkoco/linux-socfpga.git
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export LOADADDR=0x8000
make c5socl_defconfig
make zImage -j4
make modules
make socfpga_cyclone5_de10_nano.dtb

for linux 4.19, update the driver files , makefile and kconfig

18521613 commented 3 years ago

Hi @thinkoco, I have built my sd card image with opencl driver successfully. But when i try to execute hello_world example of BSP(Board Support Package) for Altera SDK OpenCL 18.1 from terasic (http://download.terasic.com/downloads/cd-rom/de1-soc/linux_BSP/OPENCL18.1/DE1-SoC_OpenCL_BSP.zip) i got this error: image Do you know the way to solve this error? Thanks you!

thinkoco commented 3 years ago

@18521613 maybe, the sdcard is unpluged when data copying. just fix it by fsck

tungdt113 commented 3 years ago

@18521613 maybe, the sdcard is unpluged when data copying. just fix it by fsck

Thanks for your help, I have solved that issue. But i got another issue :(. I have run init_opencl_18.1_4.19.sh but when i try to execute hello_world.aocx the system inform that Couldn't open /dev/ac10 device! Did you load the driver? image

And when i run ls /dev there is no ac10 here! Do you know anything about this? image

Thank you!

thinkoco commented 3 years ago

@tungdt113 Hi, the opencl driver should be rebuild when running with a new zImage.

  1. dowload the runtime enviroment files here. https://github.com/thinkoco/c5soc_opencl_rte/blob/master/linux-4.19.x/opencl_rte/aocl-rte-18.1.0-625.arm32.4.19.tar.xz
  2. here is the guide for buiding opencl driver
    export ARCH=arm
    export CROSS_COMPILE=arm-linux-gnueabihf-
    cd  xxxxxx/aocl-rte-18.1.0-625.arm32.4.19/board/c5soc/arm32/driver
    make KDIR=xxxxxx/linux-socfpga
18521613 commented 3 years ago

Hi @thinkoco, I have built opencl driver and copy it to /home/root in partiotion 2 of sdcard, but it not working..

thinkoco commented 3 years ago

Hi @18521613 you may change the path in the init_opencl_18.1_4.19 .sh for your case , or copy it to $AOCL_BOARD_PACKAGE_ROOT/arm32/driver/

#!/bin/bash
export INTELFPGAOCLSDKROOT=/root/aocl-rte-18.1.0-625.arm32.4.19
export AOCL_BOARD_PACKAGE_ROOT=$INTELFPGAOCLSDKROOT/board/c5soc
export PATH=$INTELFPGAOCLSDKROOT/bin:$PATH
export LD_LIBRARY_PATH=$INTELFPGAOCLSDKROOT/host/arm32/lib:$AOCL_BOARD_PACKAGE_ROOT/arm32/lib:$LD_LIBRARY_PATH
insmod $AOCL_BOARD_PACKAGE_ROOT/arm32/driver/aclsoc_drv.ko
#export CL_CONTEXT_COMPILER_MODE_INTELFPGA=3
tungdt113 commented 3 years ago

Hi @thinkoco, i have tried to build OpenCL driver like this guide: https://github.com/thinkoco/c5soc_opencl/blob/master/documents/LinuxAndDrivers.md. I have downloaded Intel FPGA Runtime Environment for OpenCL Linux Cyclone V SoC TGZ 17.1 on Altera Download Website. And I build it for kernel 3.18 like your image: _c5soc_opencl_lxde_fpga_reconfigurable20201027.img. But when I try to test my OpenCL driver on your image. I got this error like this: image P/s: I've download kernel3.18 in your git: https://github.com/thinkoco/linux-socfpga/tree/socfpga-3.18

18521613 commented 3 years ago

@thinkoco I'm following your guides: https://github.com/thinkoco/c5soc_opencl_rte/blob/master/documents/How_to_do.md with linux 4.9. But when I'd used command make zImage, i got this error image

Hi @thinkoc, I have built another image with linuxs-socfpga 4.9.78-ltsi so my zImage doesn't change fpga bridges name for aclsoc driver. I hope you could help me solve this error. Thank you!!

thinkoco commented 3 years ago

@18521613
the error occurs when using gcc 5.0 and above, it has been fixed. you can checkout the lastest code on branch socfpga-4.9.78-aocl

tungdt113 commented 3 years ago

@thinkoco i have a question that if i can use socfpga_cyclone5_de1soc.dts from socfpga-3.18 branch to build socfpga_cyclone5_de1soc.dtb for socfpga-4.9.78-aocl ??

tungdt113 commented 3 years ago

@18521613 the error occurs when using gcc 5.0 and above, it has been fixed. you can checkout the lastest code on branch socfpga-4.9.78-aocl

@thinkoco, I've rebuild with your update, it builds successfully. But when i boot this zImage with socfpga.dtb for de1soc that i take from your image: c5soc_opencl_lxde_fpga_reconfigurable_20201027.img. It seemly don't add /dev/fpga0 char driver and file operations. And i saw you change something in c5soc_opencl_rte/blob/master/socfpga-4.9.78-ltsi/include/linux/fpga/fpga-mgr.h, but i did'n see any change infpga-mgr.h of socfpga-4.9.78-aocl branch image And there are some warnings when i build zImage with your update. Is there anything problem with this?? image

thinkoco commented 2 years ago

@tungdt113 yes, it’s here