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

Run a Fortran program on GPU

eliopoulos
Novice
5,105 Views

eliopoulos_0-1755535963680.png

I have an Asrock intel arc a770 phantom gaming 16gb oc GPU and I try to run my Fortran program on it. When I build the solution, I get the above warnings and errors. Is there anything I can do to make it work?

0 Kudos
14 Replies
Ron_Green
Moderator
5,075 Views

Did you install the Arc GPU driver?  Our documentation on the prerequisite drivers is somewhat obscure, though necessary:
https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-windows/2025-2/install-intel-gpu-drivers.html

 

 

 

0 Kudos
eliopoulos
Novice
5,062 Views
0 Kudos
Mark_Lewy
Valued Contributor I
4,906 Views

It appears to me that you don't have the Intel oneAPI DPC++/C++ Compiler installed.
I think you need it to generate code to offload to a GPU.

It is a available as an option in the HPC Toolkit installer.

0 Kudos
eliopoulos
Novice
4,892 Views
0 Kudos
Mark_Lewy
Valued Contributor I
4,871 Views

I compiled this very simple program and it appears to be offloading, according to vtune:

program offload_test
    implicit none
    integer, parameter :: n = 1000000
    real, allocatable :: a(:), b(:), c(:)
    integer :: i

    allocate(a(n), b(n), c(n))

    ! Initialize arrays
    a = 1.0
    b = 2.0

    !$omp target teams distribute parallel do map(to: a, b) map(from: c)
    do i = 1, n
        c(i) = a(i) + b(i)
    end do

    print *, "First element of c: ", c(1)
    print *, "Last element of c: ", c(n)
end program offload_test

ifx 2025.2.0, VS 2022 LTSC 17.12.4

Options for a debug build:
/nologo /debug:full /Od /Qopenmp-targets:spir64 /Qopenmp /Qiopenmp /warn:interfaces /module:"x64\Debug\\" /object:"x64\Debug\\" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c

 

0 Kudos
eliopoulos
Novice
4,825 Views

Here is my program along with the input files (continued in the next post). To build the solution, you should set: /Qmkl, /integer-size:64 and /Qoverride-limits. Can you make it run on GPU?

0 Kudos
eliopoulos
Novice
4,823 Views

Here are the remaining input files.

0 Kudos
Mark_Lewy
Valued Contributor I
4,803 Views

It built fine for me, however I got this series of errors running it:

LEVEL_ZERO message: Error: module creation failed
LEVEL_ZERO message: Target build log:
LEVEL_ZERO message:   ''
LEVEL_ZERO message:   'error: Total size of kernel arguments exceeds limit! Total arguments size: 2088, limit: 2048'
LEVEL_ZERO message:   'in kernel: 'MAIN__''
LEVEL_ZERO message:   'error: backend compiler failed build.'
LEVEL_ZERO message:   ''
LEVEL_ZERO message:   'error: Total size of kernel arguments exceeds limit! Total arguments size: 2088, limit: 2048'
LEVEL_ZERO message:   'in kernel: 'MAIN__''
LEVEL_ZERO message:   'error: backend compiler failed build.'
"PluginInterface" error: Failure to load binary image 0000027CEBD6A990 on device 0: Error in buildModules -1
omptarget error: Failed to load image Failed to load binary 0000027CEBD6A990
omptarget fatal error 0: Failed to load images on device '0'

I haven't offloaded before, but I suspect your loop is too complex to be offloaded to my Intel GPU.  Someone else may be able to provide other suggestions to fix this.

As you for your inability to compile your program, I suggest you confirm that you have all the HPC toolkit components installed and if that looks ok, try repairing your installation.

0 Kudos
Ron_Green
Moderator
4,793 Views

GPUs have fixed memory size - in this example the data is too large.  Keep it simple, first get 100 element arrays to work then curb your data to fit the GPU.  

 

test that the driver is installed and working.  From a Intel Fortran Command Prompt window, run this command to make sure the driver is responding

 

sycl-ls 

 

 

0 Kudos
eliopoulos
Novice
4,785 Views

eliopoulos_0-1755621381972.png

I think the driver responds.

0 Kudos
Ron_Green
Moderator
4,771 Views

compile and run from the Intel Fortran command prompt before moving to VS.  After downsizing the data sizes, run Mark's example to make sure core functionality is working.  And get rid of all the unnecessary /check and /warn options, traceback, etc.  Keep the compiler options to the simple qopenmp* options 

Get something simple working before throwing the question of Life the Universe and Everything to the GPU

0 Kudos
eliopoulos
Novice
4,738 Views

eliopoulos_0-1755624404053.png

Mark's example works. Is there anything wrong with my setup?

0 Kudos
Ron_Green
Moderator
4,599 Views

There is an online document for OpenMP for C++ and Fortran https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/2025-1/c-c-or-fortran-with-openmp-offload-programming.html

 

I would recommend:
set LIBOMPTARGET_PLUGIN_PROFILE=T

When set, and you run your application, it will print the information for each offload kernel.  This is a way to verify that offload is actually occurring. 

Ron_Green_1-1755629270702.png

 

Also there are ENV vars to control output of debug info if something goes wrong in the offload

 

Ron_Green_0-1755629240441.png

 

eliopoulos
Novice
3,733 Views

I still cannot compile and run my program on my Intel GPU. Is there anyone who can?

0 Kudos
Reply