Intel® High Level Design
Support for Intel® High Level Synthesis Compiler, DSP Builder, OneAPI for Intel® FPGAs, Intel® FPGA SDK for OpenCL™
Announcements
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
649 Discussions

Matrix_mul in FPGA Only warning coming up

Laxmis
Beginner
1,413 Views

Trying to run matrix_mul in fpga.  Followed same procedure mentioned in Vector add, made build_fpga_hw.sh and run_fpga_hw.sh  and then

qsub -l nodes=1:fpga_compile:ppn=2 -d . build_fpga_hw.sh

qsub -l nodes=1:fpga_runtime:arria10:ppn=2 -d . run_fpga_hw.sh

 

This warning came up..

 

:: WARNING: setvars.sh has already been run. Skipping re-execution.
To force a re-execution of setvars.sh, use the '--force' option.
Using '--force' can result in excessive use of your environment variables.

usage: source setvars.sh [--force] [--config=file] [--help] [...]
--force Force setvars.sh to re-run, doing so may overload environment.
--config=file Customize env vars using a setvars.sh configuration file.
--help Display this help message and exit.
... Additional args are passed to individual env/vars.sh scripts
and should follow this script's arguments.

Some POSIX shells do not accept command-line options. In that case, you can pass
command-line options via the SETVARS_ARGS environment variable. For example:

$ SETVARS_ARGS="ia32 --config=config.txt" ; export SETVARS_ARGS
$ . path/to/setvars.sh

The SETVARS_ARGS environment variable is cleared on exiting setvars.sh.

 

Can anyone please tell me where i am going wrong and what should be done..?

thanks for any help..

0 Kudos
14 Replies
RemyaP_Intel
Moderator
1,390 Views

Hi,


Thank you for posting in Intel Communities.

Could you please let us know which DevCloud you are using. Is it DevCloud for Edge/FPGA/OneAPI ?


Thanks,

Remya


0 Kudos
Laxmis
Beginner
1,389 Views

It is Devcloud for OneAPI

0 Kudos
RemyaP_Intel
Moderator
1,350 Views

Hi,


Could you please share with us a sample reproducer and the script files for build_fpga_hw.sh and run_fpga_hw.sh


Also, please confirm whether you are taking the sample from the repo: https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/DPC%2B%2B/DenseLinearAlgebra.

And note that all the samples given here are not designed for FPGA hardware. You can see under the pre-requisites>hardware section in the README file to know that.


Regards,

Remya Premdas


0 Kudos
Laxmis
Beginner
1,328 Views
#!/bin/bash
source /opt/intel/inteloneapi/setvars.sh
make run_hw -f Makefile.fpga
#!/bin/bash
source /opt/intel/inteloneapi/setvars.sh
make hw -f Makefile.fpga

These were used..

Yes.. Samples were taken from the mentioned link.. I understand all samples are not for FPGA hardware. So what should be done to run these atleast in Fpga emulator. I tried running with build_fpga_emu.sh and run_fpga_emu.sh as following

#!/bin/bash
source /opt/intel/inteloneapi/setvars.sh
make fpga_emu -f Makefile.fpga

 

#!/bin/bash
source /opt/intel/inteloneapi/setvars.sh
make run_emu -f Makefile.fpga

Still nothing is happening.. I think i am missing something.. I need to know what all should be done for any program to run on Fpga in devcloud..

 

0 Kudos
RemyaP_Intel
Moderator
1,290 Views

Hi,

 

Please follow the below steps to run matrix_mul in the FPGA emulator(in oneAPI DevCloud).

 

Step 1: Under matrix_multiplication folder:

 

  • Create build_fpga_emu.sh
    #!/bin/bash
    
    #PBS -l nodes=1:fpga_compile:ppn=2
    #PBS -d .
    
    source /opt/intel/oneapi/setvars.sh > /dev/null 2>&1
    
    echo
    echo start: $(date "+%y/%m/%d %H:%M:%S.%3N")
    echo
    
    make fpga_emu -f Makefile.fpga
    
    echo
    echo stop: $(date "+%y/%m/%d %H:%M:%S.%3N")
    echo
  • Create run_fpga_emu.sh.

 

#!/bin/bash

#PBS -l nodes=1:fpga_compile:ppn=2
#PBS -d .

source /opt/intel/oneapi/setvars.sh > /dev/null 2>&1

echo
echo start: $(date "+%y/%m/%d %H:%M:%S.%3N")
echo

make run_emu -f Makefile.fpga

echo
echo end: $(date "+%y/%m/%d %H:%M:%S.%3N")
echo

 

 

  • Create Makefile.fpga and paste the contents as below:

 

CXX := dpcpp
CXXFLAGS = -O2 -g -std=c++17

SRC := src/matrix_mul_dpcpp.cpp

.PHONY: fpga_emu run_emu  clean

fpga_emu: matrix_mul_dpcpp.fpga_emu
report: matrix_mul_dpcpp.a

matrix_mul_dpcpp.fpga_emu: $(SRC)
        $(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -DFPGA_EMULATOR=1

a.o: $(SRC)
        $(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1

run_emu: matrix_mul_dpcpp.fpga_emu
         ./matrix_mul_dpcpp.fpga_emu

dev.o: $(SRC)
        $(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1

clean:
        rm -rf *.o *.d *.out *.mon *.emu *.aocr *.aoco *.prj *.fpga_emu *.fpga_emu matrix_mul_dpcpp.fpga *.a

 

 

Step 2: Navigate to the src folder in matrix_mul

Step 3: Edit the matrix_mul_dpcpp.cpp file as below:

 

  • Add in the header : 

 

#include <sycl/ext/intel/fpga_extensions.hpp>

 

 

  • Add the below under main() :

 

#if FPGA_EMULATOR
  // DPC++ extension: FPGA emulator selector on systems without FPGA card.
  ext::intel::fpga_emulator_selector d_selector;
#elif FPGA
  // DPC++ extension: FPGA selector on systems with FPGA card.
  ext::intel::fpga_selector d_selector;
#else
  // The default device selector will select the most performant device.
  default_selector d_selector;
#endif

 

 

After editing and creating the above files run the below commands:

 

qsub -l nodes=1:fpga_compile:ppn=2 -d . build_fpga_emu.sh

 

 

RemyaP_Intel_0-1666937235518.png

 

 

qsub -l nodes=1:fpga_compile:ppn=2 -d . run_fpga_emu.sh

 

 

RemyaP_Intel_2-1666937432177.png

 

The result will be generated. Please try and let us know if you need any clarifications.

 

If this resolves your issue, make sure to accept this as a solution. This would help others with similar issues. Thank you!

 

 

Regards,

Remya Premdas

 

0 Kudos
Laxmis
Beginner
1,281 Views

Tried all these steps

Included Makefile.fpga

Laxmis_3-1666952203053.png

 

I think Fpga is not getting detected. FPGA_Emulator and FPGA are in red color when .cpp file is edited.

Laxmis_0-1666951454048.png

So after build

Laxmis_1-1666951582108.png

and after run nothing is happening

Laxmis_2-1666951795393.png

No output.. No error..

Is there anything else to do initially before all these steps..?

0 Kudos
RemyaP_Intel
Moderator
1,279 Views

Hi,

 

Sharing the screenshot of the matrix_mul_dpcpp.cpp file, where you need to make the changes.

RemyaP_Intel_0-1667033153134.png

Are you saying about the highlighted part in the code? If yes, the red highlight shouldn't be a problem.

Make sure the spaces and tabs are given correctly in all the files.

 

If issue still exist, please send a screenshot/content of the error files.

 

Regards,

Remya Premdas

 

 

0 Kudos
Laxmis
Beginner
1,277 Views

Hi,

Can you please send the screenshot of matrix_mul_dpcpp.cpp you mentioned as I am not able to see any image.

 

Regards

 

0 Kudos
RemyaP_Intel
Moderator
1,256 Views

Hi,

 

I am attaching the screenshot and files. Please check and let us know if you are able to do the execution.

 

RemyaP_Intel_0-1667193860842.png

 

 

Regards,

Remya Premdas

 

0 Kudos
Laxmis
Beginner
1,249 Views

Hi,

Thanks a lot! It worked.. I guess some issue was there inside my Makefile.fpga it is working in Fpga emulator now. 

What change should I do to work in Fpga hardware?

I tried generating run_fpga_hw.sh and build_fpga_hw.sh.. and then tried building.  But the warning that I earlier mentioned still persist. So changes should be done in Makefile.fpga ?

0 Kudos
RemyaP_Intel
Moderator
1,194 Views

Hi,


We are working on this internally with the team. We will get back to you.


Regards,

Remya Premdas


0 Kudos
BoonBengT_Intel
Moderator
1,142 Views

Hi @Laxmis,


Thank you for posting in Intel community forum and hope all is well.

If I understand the situation correctly, you are trying to vector add example to compile and run the Matrix Multiply Sample.

Seems that you have successfully run the emulator with some changes on the MakeFile.

As mention previously the Matrix Multiply are not design for FPGA, hence running in hardware would defeat the purposes of understand oneapi on FPGA.


Hence would recommend to follow the similar project below to use the cmake to generate the make which will allow emulation and also hardware execute.

- https://github.com/oneapi-src/oneAPI-samples/tree/488e174e2d2b3ed7584e3f604553df4dcd347238/DirectProgramming/DPC%2B%2BFPGA/ReferenceDesigns/qrd

Hope that clarify.


Best Wishes

BB


0 Kudos
BoonBengT_Intel
Moderator
1,116 Views

Hi @Laxmis,


Greetings, just checking in to see if there is any further doubts in regards to this matter.

Hope we have clarify your doubts.


Best Wishes

BB


0 Kudos
Kenny_Tan
Moderator
1,085 Views

As we do not receive any response from you on the previous answer that we have provided. Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.



0 Kudos
Reply