# GPUFORT: source-to-source translation from Fortran+OpenACC and CUDA Fortran

**URL:** <https://fortran-lang.discourse.group/t/gpufort-source-to-source-translation-from-fortran-openacc-and-cuda-fortran/1957>\
**Category:** Uncategorized\
**Created:** [September 29, 2021, 1:08pm UTC](https://fortran-lang.discourse.group/t/gpufort-source-to-source-translation-from-fortran-openacc-and-cuda-fortran/1957 "2021-09-29T13:08:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [September 29, 2021, 1:08pm UTC](https://fortran-lang.discourse.group/t/gpufort-source-to-source-translation-from-fortran-openacc-and-cuda-fortran/1957/1 "2021-09-29T13:08:23Z")

</div>

This looks interesting but is above my head.

#### [GPUFORT](https://github.com/ROCmSoftwarePlatform/gpufort)

This project develops a source to source translation tool that is able to convert:

1. Fortran+OpenACC and CUDA Fortran → Fortran + OpenMP 4.5+
2. Fortran+OpenACC and CUDA Fortran → Fortran + [GCC/AOMP OpenACC/MP runtime calls] + HIP C++

The result of the first translation process, can be compiled with [AOMP](https://github.com/ROCm-Developer-Tools/aomp), which has a Fortran frontend. The result of the second translation process can be compiled with hipfort or a combination of hipcc and gfortran. Note that a OpenACC runtime is only necessary for translating OpenACC code.

…

#### Limitations

- GPUFORT is not a compiler (yet)

GPUFORT is not intended to be a compiler. It’s main purpose is to be a translator that allows an experienced user to fix and tune the outcomes of the translation process. However, we believe GPUFORT can develop into an early-outlining compiler if enough effort is put into the project. Given that all code and especially the grammar is written in python3, GPUFORT can be developed at a quick pace.

- GPUFORT does a bad job in analyzing what code parts can be offloaded and which ones not
- GPUFORT does a bad job in reorganizing loops and assignments in order to maximize the available parallelism

While both would be possible as the translator works with a tree structure, we simply have not started to implement much in this direction yet.

- GPUFORT does not implement the full OpenACC standard (yet)

GPUFORT was developed to translate a number of HPC apps to code formats that are well supported by AMD’s ROCm ecosystem. The development of GPUFORT is steered by the requirements of these applications.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [September 29, 2021, 3:45pm UTC](https://fortran-lang.discourse.group/t/gpufort-source-to-source-translation-from-fortran-openacc-and-cuda-fortran/1957/2 "2021-09-29T15:45:26Z")

</div>

Yes. I started in Python as well with LFortran, but it’s really hard to make the parser (as well as the rest of the compiler) performing well. But as a prototype Python worked exceptionally well.

---

<div class="post-metadata">

**Author:** ![shahmoradi](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahmoradi/32/3151_2.png) [@shahmoradi](https://fortran-lang.discourse.group/u/shahmoradi)\
**Post date:** [October 9, 2021, 8:00pm UTC](https://fortran-lang.discourse.group/t/gpufort-source-to-source-translation-from-fortran-openacc-and-cuda-fortran/1957/3 "2021-10-09T20:00:54Z")

</div>

> **[AMD publishes GPUFORT as Open Source to address CUDA’s dominance - itsfoss.net](https://www.itsfoss.net/amd-publishes-gpufort/)**
>
> NVIDIA dominates the parallel computing industry largely thanks to its own solution, CUDA. In response to this domain, AMD has published the source code of GPUFORT , a project that will be under Radeon Open eCosystem (ROCm) and that aims to offer a...
