Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Can I use MKL routines when running on GPU?

eliopoulos
Novice
2,077 Views

I want to enable my Intel iris xe graphics GPU to run a Fortran program which includes MKL routines. Is this possible? I have created and attached a simple reproducer. When I build the solution, I get:

 

Rebuild started at 01:30...
1>------ Rebuild All started: Project: z2 (IFX), Configuration: Release x64 ------
Deleting intermediate files and output files for project 'z2', configuration 'Release|x64'.
Compiling with Intel® Fortran Compiler 2024.0.2 [Intel(R) 64]...
z2.for
ifx: warning #10148: option '/size-llp64' not supported
ifx: warning #10148: option '/size-llp64' not supported
Linking...
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
13292354.o : warning LNK4078: multiple '__CLANG_OFFLOAD_BUNDLE__openmp-s' sections found with different attributes (40500040)
Embedding manifest...

Build log written to "file://C:/Work/Work/2023%20OPENZDM/Fortran%20folder/z2/z2/x64/Release/BuildLog.htm"
z2 - 0 error(s), 3 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild completed at 01:30 and took 01.366 seconds ==========

 

and when I run the program:

 

Libomptarget error: Unable to generate entries table for device id 0.
Libomptarget error: Failed to init globals on device 0
Libomptarget error: Run with
Libomptarget error: LIBOMPTARGET_DEBUG=1 to display basic debug information.
Libomptarget error: LIBOMPTARGET_DEBUG=2 to display calls to the compute runtime.
Libomptarget error: LIBOMPTARGET_INFO=4 to dump host-target pointer mappings.
Libomptarget error: Source location information not present. Compile with -g or -gline-tables-only.
Libomptarget fatal error 1: failure of target construct while offloading is mandatory.

 

Is there anything I can do to solve this issue?

0 Kudos
1 Solution
Mahan
Moderator
1,910 Views

If you use the following for compilation, does it help?

ifx /Qiopenmp /Qopenmp-targets:spir64 -fsycl mkl_sycl.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib OpenCL.lib


View solution in original post

0 Kudos
6 Replies
eliopoulos
Novice
2,001 Views

Can anyone tell me if it works on better Intel GPU?

0 Kudos
Mahan
Moderator
1,943 Views

Hi

Could you please set these environment variables and run the application through command line

set OMP_TARGET_OFFLOAD=MANDATORY 

set LIBOMPTARGET_PLUGIN=LEVEL_ZERO 

set LIBOMPTARGET_DEVICETYPE=GPU


0 Kudos
eliopoulos
Novice
1,924 Views

It does not work. It produces the same errors:

 

C:\Work\Work\2023 OPENZDM\Fortran folder\z2\z2\x64\Release>set OMP_TARGET_OFFLOAD=MANDATORY

C:\Work\Work\2023 OPENZDM\Fortran folder\z2\z2\x64\Release>set LIBOMPTARGET_PLUGIN=LEVEL_ZERO

C:\Work\Work\2023 OPENZDM\Fortran folder\z2\z2\x64\Release>set LIBOMPTARGET_DEVICETYPE=GPU

C:\Work\Work\2023 OPENZDM\Fortran folder\z2\z2\x64\Release>ifx /Qopenmp-targets:spir64 /Qopenmp /Qiopenmp /Qmkl z2.for
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

ifx: warning #10148: option '/size-llp64' not supported
ifx: warning #10148: option '/size-llp64' not supported

C:\Work\Work\2023 OPENZDM\Fortran folder\z2\z2\x64\Release>z2
Libomptarget error: Unable to generate entries table for device id 0.
Libomptarget error: Failed to init globals on device 0
Libomptarget error: Run with
Libomptarget error: LIBOMPTARGET_DEBUG=1 to display basic debug information.
Libomptarget error: LIBOMPTARGET_DEBUG=2 to display calls to the compute runtime.
Libomptarget error: LIBOMPTARGET_INFO=4 to dump host-target pointer mappings.
Libomptarget error: Source location information not present. Compile with -g or -gline-tables-only.
Libomptarget fatal error 1: failure of target construct while offloading is mandatory

0 Kudos
Mahan
Moderator
1,911 Views

If you use the following for compilation, does it help?

ifx /Qiopenmp /Qopenmp-targets:spir64 -fsycl mkl_sycl.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib OpenCL.lib


0 Kudos
eliopoulos
Novice
1,898 Views
0 Kudos
Mahan
Moderator
1,895 Views

Thanks for letting me know.

Also remember to set those environment variables.


0 Kudos
Reply