Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
718 Discussions

Using a C++ like g++ to compile SYCL host code?

Björne2
Novice
451 Views

I would like to compile SYCL host code with g++ and SYCL device code with icpx. Reason being that g++ integrates better with my existing workflow. I compile some C++ code that only uses the host API as follows:

icpx -fsycl hostcode.cpp -o hostcode

What would the equivalent g++ invocation be?

g++ hostcode.cpp -I/some/path -L/some/path -fblah ... -o hostcode

Some sources claim that this workflow should be possible, though they don't specify how to do it with g++: https://github.com/intel/llvm/issues/12457 https://github.com/intel/llvm/blob/sycl/sycl/doc/FAQ.md#q-how-are-dpc-compilation-phases-different-from-those-of-a-usual-c-compiler-can-i-customize-this-flow-for-my-applications

0 Kudos
2 Replies
Alex_Y_Intel
Moderator
302 Views

Since this is an Intel dpcpp/c++ compiler forum, we focus on investigating issues related to icx, but I'll leave your question here so others might be able to contribute their thoughts. 

Björne2
Novice
248 Views
I actually made it work with g++ and it wasn't so complicated. I just needed to compile with the right include paths and link with the right libraries. However, I could only create programs that only use the host api. What I would like is to use g++ for c++, another tool for compiling the kernels, and a third tool for linking them together.

Tbh, having icpx doing "everything" doesn't work well for me since I'm targeting FPGAs and synthesizing takes hours. I don't want to wait hours when I just change the host code.
0 Kudos
Reply