# GPU offloading in Fortran

**URL:** <https://fortran-lang.discourse.group/t/gpu-offloading-in-fortran/9120>\
**Category:** Advocacy\
**Created:** [January 22, 2025, 9:10pm UTC](https://fortran-lang.discourse.group/t/gpu-offloading-in-fortran/9120 "2025-01-22T21:10:12Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![hkvzjal](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hkvzjal/32/3055_2.png) [@hkvzjal](https://fortran-lang.discourse.group/u/hkvzjal)\
**Post date:** [January 29, 2025, 11:41pm UTC](https://fortran-lang.discourse.group/t/gpu-offloading-in-fortran/9120/34 "2025-01-29T23:41:08Z")

</div>

> [@hkvzjal](#):
>
> I though there was an option to install the required additional dependencies

It turns out there is. Tried the following on a Ubuntu 22.04:

```auto
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install gcc-12 g++-12 gfortran-12 gcc-12-offload-nvptx  

```

And managed to offload using OpenMP.

At first I wanted to do it with gfortran 13 but there seems to be a bug in the packaging, as I got this error when compiling a code:

```auto
x86_64-linux-gnu-accel-nvptx-none-gcc-13: fatal error: cannot read spec file ‘libgomp.spec’: No such file or directory   
compilation terminated.

```

Which a search on google just tells me it is a missing component and that the issue seems to not have been solved so far [Bug #2036593 “Compilation error: absent libgomp.spec with gcc-13...” : Bugs : gcc-13 package : Ubuntu](https://bugs.launchpad.net/ubuntu/+source/gcc-13/+bug/2036593)

@jorgeg I tried compiling from source using the script you shared but I got another error

```auto
cc1plus: fatal error: gengtype-lex.cc: No such file or directory
compilation terminated.

```

I’ll keep this gcc-12 version for the moment.

---

_[View the full topic](https://fortran-lang.discourse.group/t/gpu-offloading-in-fortran/9120)._
