{"id":13318909,"url":"https://github.com/ROCm/gpufort","last_synced_at":"2025-03-11T02:31:41.850Z","repository":{"id":42590780,"uuid":"339066195","full_name":"ROCm/gpufort","owner":"ROCm","description":"GPUFORT: S2S translation tool for CUDA Fortran and Fortran+X in the spirit of hipify","archived":false,"fork":false,"pushed_at":"2023-12-04T08:16:09.000Z","size":7842,"stargazers_count":161,"open_issues_count":19,"forks_count":16,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-03-05T09:12:08.482Z","etag":null,"topics":["cuda","cuda-fortran","fortran","gpgpu","gpu","hip","interoperability","openacc","openmp","rocm"],"latest_commit_sha":null,"homepage":"https://rocmsoftwareplatform.github.io/gpufort/","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ROCm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-02-15T12:10:48.000Z","updated_at":"2024-12-17T05:14:49.000Z","dependencies_parsed_at":"2023-12-17T21:46:32.856Z","dependency_job_id":null,"html_url":"https://github.com/ROCm/gpufort","commit_stats":{"total_commits":293,"total_committers":4,"mean_commits":73.25,"dds":"0.19795221843003408","last_synced_commit":"b3d392cf28200cd9b3b2f77689d5a81176b3ec42"},"previous_names":["rocm/gpufort","rocmsoftwareplatform/gpufort"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2Fgpufort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2Fgpufort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2Fgpufort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2Fgpufort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ROCm","download_url":"https://codeload.github.com/ROCm/gpufort/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242959404,"owners_count":20212971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","cuda-fortran","fortran","gpgpu","gpu","hip","interoperability","openacc","openmp","rocm"],"created_at":"2024-07-29T18:31:30.706Z","updated_at":"2025-03-11T02:31:41.327Z","avatar_url":"https://github.com/ROCm.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GPUFORT\n\nThis project develops a source to source translation tool that is able to convert:\n\n1. Fortran+OpenACC and CUDA Fortran -\u003e Fortran + OpenMP 4.5+\n2. Fortran+OpenACC and CUDA Fortran -\u003e Fortran + [GCC/AOMP OpenACC/MP runtime calls] + HIP C++\n\nThe result of the first translation process, can be compiled\nwith AOMP, which has a Fortran frontend.\nThe result of the second translation process can be compiled\nwith hipfort or a combination of hipcc and gfortran.\nNote that a OpenACC runtime is only necessary for translating\nOpenACC code.\n\nAn overview of the different translation paths that we work on is shown below:\n\n![Image](https://github.com/ROCmSoftwarePlatform/gpufort/blob/develop/gpufort.png?raw=true)\n\n**NOTE:** GPUFORT is a research project. We made it publicly available because \nwe believe that it might be helpful for some.\nWe want to stress that the code translation and code generation outputs produced\nby GPUFORT will in most cases require manual reviewing and fixing.\n\n## Installation and usage\n\nPlease take a look at the (slightly outdated) [user guide](https://rocmsoftwareplatform.github.io/gpufort/).\n\n## Implementation details\n\n[This presentation](https://github.com/ROCmSoftwarePlatform/gpufort/blob/main/gpufort_slides.pdf)\ngives an overview of GPUFORT's building blocks.\n\n## Limitations\n\n* GPUFORT is not a compiler (yet)\n\nGPUFORT is not intended to be a compiler.\nIt's main purpose is to be a translator that allows\nan experienced user to fix and tune the outcomes\nof the translation process. \nHowever, we believe GPUFORT can develop into an \nearly-outlining compiler if enough effort \nis put into the project.\nGiven that all code and especially the grammar is\nwritten in python3, GPUFORT can be developed at a quick \npace.\n\n* GPUFORT assumes syntactically and functionally correct input\n\nGPUFORT does only perform a small number of syntax checks as we assume\nthat developers apply GPUFORT to code that can be run correctly on CUDA devices.\n(We plan to add the option to prescribe a user-specified syntax checker tool.)\n\n* GPUFORT does a bad job in analyzing what code parts can be offloaded and which ones not\n* GPUFORT does a bad job in reorganizing loops and assignments in order to maximize\n  the available parallelism\n\nWhile both would be possible as the translator works with a tree structure, \nwe simply have not started to implement much in this direction yet.\n\n* GPUFORT does not implement the full OpenACC standard (yet)\n\nGPUFORT was developed to translate a number of HPC apps\nto code formats that are well supported by AMD's ROCm ecosystem.\nThe development of GPUFORT is steered by the requirements\nof these applications.\n\n### Fortran-C Interoperablity Limitations\n\nTo interface generated HIP C++ kernels with the original Fortran code, GPUFORT relies on the `iso_c_binding` interoperability mechanisms that were added to the Fortran language with \nthe Fortran 2003 standard. Please be aware that the interoperability of C structs and Fortran derived types is quite limited\ntill this date:\n\n* \"Derived types with the C binding attribute shall not have the sequence attribute, type parameters, the extends attribute, nor type-bound procedures.\"\n* \"Every component must be of interoperable type and kind and may not have the **pointer** or **allocatable** attribute. The names of the components are irrelevant for interoperability.\"\n\n(Source: https://gcc.gnu.org/onlinedocs/gfortran/Derived-Types-and-struct.html)\n\nWe are currently investigating what workarounds could be automatically applied.\nUntil then, you have to modify your code manually to circumvent the above limitations.\n\n## Currently supported features:\n\n* ACC:\n   * ACC2OMP \u0026 ACC2HIP\n   * Translation of data directives: `!$acc enter data`, `!$acc exit data`, `!$acc data`\n   * Synchronization directives: `!$acc wait, !$acc update self/host/device`\n   * Kernel and loop constructs `!$acc kernels` plus `!$acc loop` in subsequent line, `!$acc kernels loop`, `!$acc parallel` plus `!$acc loop` \n     in subsequent line, `!$acc parallel loop`, `!$acc loop`\n   * Support for `!$acc routine seq` functions with scalar arguments\n* CUF:\n   * CUF2HIP\n     * Majority of CUDA libary functionality via HIPFORT\n     * Kernel and loop constructs: `!$cuf kernel do`\n     * Overloaded intrinsics: `allocate`, `allocated`, `deallocate`, `deallocated`, `=`\n     * Support for CUDA Fortran `attributes(global)` (array and scalar arguments), \n       and `attributes(host,device)`, `attributes(device)` procedures (only scalar arguments supported for the latter)\n\n(List is not complete ...)\n\n## Planned features (or: \"more limitations\")\n\n* Current work focuses on:\n  * ACC:\n    * Initial support for `!$acc declare` (detected but not considered in codegen yet)\n    * Improve support for`!$acc parallel (loop)`\n    * Add support for `!$acc parallel` without `!$acc loop` in next line)\n      * Results in `gang` parallelism\n    * Add support for `!$acc kernels` without `!$acc loop` in next line)\n      * Auto detection of offloadable code parts \n    * Rewrite of GPUFORT Fortran runtime in (HIP) C++\n  * ACC/CUF:\n    * Support of derived types with allocatable, pointer members\n* Planned:\n  * Add option for prescribing syntax checker (e.g. use other compiler for syntax checks.)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FROCm%2Fgpufort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FROCm%2Fgpufort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FROCm%2Fgpufort/lists"}