Forum Discussion

HYB's avatar
HYB
Icon for New Contributor rankNew Contributor
5 years ago

How to modify makefile by calling FPGA and GPU?

Using the example "vector-add" given by the cloud platform, I simply added "queue q1(default_selector, exception_handler);", to get an FPGA and a GPU at the same time using" queue q(d_selector, exception_handler);
queue q1(default_selector, exception_handler);", what commands should be used when compiling? Here is my Makefile.fpga, with the output error information.

"dpcpp -O2 -g -std=c++17 src/vector-add-buffers.cpp -o vector-add-buffers.fpga_emu

Makefile.fpga:19: recipe for target 'vector-add-buffers.fpga_emu' failed ".

So how do I modify makefile. Command in FPGA?Please understand the friends give some advice.

2 Replies

  • AnilErinch_A_Intel's avatar
    AnilErinch_A_Intel
    Icon for Frequent Contributor rankFrequent Contributor

    Hi ,

    Can you share the complete source file and make file which you have changed.

    Thanks and Regards

    Anil


    • HYB's avatar
      HYB
      Icon for New Contributor rankNew Contributor

      vector-add-buffers.cpp

      #include <CL/sycl.hpp>

      #include <array>

      #include <iostream>

      #if FPGA || FPGA_EMULATOR

      #include <CL/sycl/INTEL/fpga_extensions.hpp>

      #endif

      using namespace sycl;

      // Create an exception handler for asynchronous SYCL exceptions

      static auto exception_handler = [](sycl::exception_list e_list) {

      for (std::exception_ptr const &e : e_list) {

      try {

      std::rethrow_exception(e);

      }

      catch (std::exception const &e) {

      #if _DEBUG

      std::cout << "Failure" << std::endl;

      #endif

      std::terminate();

      }

      }

      };

      int main() {

      try {

      queue q1(INTEL::fpga_selector, exception_handler);

      queue q2(default_selector, exception_handler);

      // Print out the device information used for the kernel code.

      std::cout << "Running on device1: "

      << q1.get_device().get_info<info::device::name>() << "\n";

      std::cout << "Running on device2: "

      << q2.get_device().get_info<info::device::name>() << "\n";

      } catch (exception const &e) {

      std::cout << "An exception is caught for vector add.\n";

      std::terminate();

      }

      return 0;

      }

      Makefile.fpga

      CXX := dpcpp

      CXXFLAGS = -O2 -g -std=c++17

      SRC := src/vector-add-buffers.cpp

      .PHONY: fpga_emu run_emu fpga_emu_usm run_emu_usm clean

      fpga_emu: vector-add-buffers.fpga_emu

      hw: vector-add-buffers.fpga

      report: vector-add-buffers_report.a

      vector-add-buffers.fpga_emu: $(SRC)

      $(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -DFPGA_EMULATOR=1

      a.o: $(SRC)

      $(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1

      vector-add-buffers.fpga: a.o

      $(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -Xshardware

      run_emu: vector-add-buffers.fpga_emu

      ./vector-add-buffers.fpga_emu

      clean:

      rm -rf *.o *.d *.out *.mon *.emu *.aocr *.aoco *.prj *.fpga_emu *.fpga_emu_buffers vector-add-buffers.fpga vector-add-usm.fpga *.a