Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Linking Fortran Objects with dpcpp objects

William_Jones
New Contributor I
939 Views

I am working on a mixed language program that involves Fortran and Data Parallel C++ code.  

When previously working on mixed language projects, I have followed the recommended procedure of linking all of the objects with ifort such that the Fortran runtimes are linked properly.  This is because of the long list of varying runtime libraries that are typically involved with Fortran linking.  When C++ code is involved this would involve linking the single, additional libstdc++ library with the ifort link command.

However, now with dpcpp under Linux, when I link with ifort (adding -lsycl and -lstdc++), the resulting executable fails to run, instead throwing a "cl::sycl::runtime_error".

If I instead link with dpcpp, providing -lifcore and .../compiler/lib/intel64_lin/for_main.o, the resulting executable runs as expected.

I have also tried linking with icpx and the resulting executable again throws "cl::sycl::runtime_error".

Is it possible to link a Data Parallel C++ executable, with dpcpp generated fat objects, using the ifort or ifx compilers to obtain a functional executable that runs on the device?

I can provide a reproducer if necessary, but thought I'd start by asking the question.

1 Solution
Barbara_P_Intel
Moderator
887 Views

I helped another user with a similar issue. The Fortran code does not offload. This worked for him:

+ dpcpp -c device.cpp

+ ifx -qopenmp -fsycl host.f90 device.o -lstdc++ -lOpenCL -lsycl


View solution in original post

5 Replies
Bahamas2021
Novice
911 Views
Hi
I'm interested in the topics you have ifind it excellent advanced thanks
Best wishes,
0 Kudos
jimdempseyatthecove
Honored Contributor III
900 Views

The OneAPI Fortran compiler is ifx. Try linking with the ifx compiler (you may also need to build your Fortran sources with ifx). Please report back on your success or failure in using ifx in lieu of ifort.

 

Jim Dempsey

0 Kudos
William_Jones
New Contributor I
890 Views

Thank you for the response, but as I implied in the original post, I have already tried ifx without success.  The results are the same as linking with ifort, it throws the exception.

0 Kudos
Barbara_P_Intel
Moderator
888 Views

I helped another user with a similar issue. The Fortran code does not offload. This worked for him:

+ dpcpp -c device.cpp

+ ifx -qopenmp -fsycl host.f90 device.o -lstdc++ -lOpenCL -lsycl


William_Jones
New Contributor I
872 Views

Thank you!  The "-qopenmp" and "-fsycl" command line options to ifx were what fixed it for me.  Thanks again!

0 Kudos
Reply