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

Linking Fortran Objects with dpcpp objects

William_Jones
New Contributor I
363 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
311 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
335 Views
Hi
I'm interested in the topics you have ifind it excellent advanced thanks
Best wishes,
jimdempseyatthecove
Black Belt
324 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

William_Jones
New Contributor I
314 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.

Barbara_P_Intel
Moderator
312 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
296 Views

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

Reply