Intel® High Level Design
Support for Intel® High Level Synthesis Compiler, DSP Builder, OneAPI for Intel® FPGAs, Intel® FPGA SDK for OpenCL™
663 Discussions

How to modify makefile by calling FPGA and GPU?

HYB
Beginner
977 Views

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.

 

0 Kudos
2 Replies
AnilErinch_A_Intel
944 Views

Hi ,

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

Thanks and Regards

Anil


0 Kudos
HYB
Beginner
938 Views

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

0 Kudos
Reply