https://github.com/muellermichel/Hybrid-Fortran Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} muellermichel / Hybrid-Fortran Public * Notifications * Fork 17 * Star 113 Accelerate with CUDA, OpenACC and OpenMP - Unified and Performance Portable typhooncomputing.com License LGPL-3.0, GPL-3.0 licenses found Licenses found LGPL-3.0 COPYING.LESSER GPL-3.0 COPYING 113 stars 17 forks Star Notifications * Code * Issues 37 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights muellermichel/Hybrid-Fortran This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 16 branches 23 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/m] Use Git or checkout with SVN using the web URL. [gh repo clone muelle] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @muellermichel muellermichel Update CONTACT.md ... cfe9284 May 17, 2023 Update CONTACT.md cfe9284 Git stats * 998 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time doc switched to OpenMPI. fixed an issue where passed in iterators for ker... January 31, 2017 14:27 examples added naive simple weather implementation, after paper submission July 26, 2017 10:36 hf better naming of classes December 10, 2017 13:23 hf_bin checkin of idea May 13, 2017 13:19 hf_config improvements needed for ASUCA complete port, cleanup of git using git... December 11, 2014 10:39 hf_lib compatibility with some nicam build specifics February 2, 2018 12:47 hf_processor fixed cpu build issues February 7, 2018 00:51 hf_template openmp config for test examples February 6, 2017 12:03 results updated online documentation December 15, 2014 14:35 .gitignore added configure files to git ignore April 11, 2016 18:50 CONTACT.md Update CONTACT.md May 17, 2023 10:28 COPYING initial commit March 25, 2013 16:31 COPYING.LESSER initial commit March 25, 2013 16:31 CREDITS.md implemented directory creation in writeToFile interface, fixed diffus... January 19, 2015 10:47 HISTORY.md updated pdf documentation for v0.93 December 16, 2014 16:10 Makefile checkin of idea May 13, 2017 13:19 README.md Update README.md May 17, 2023 10:23 View code [ ] Hybrid Fortran - A Framework for GPU Acceleration What & Why Quickstart A Few More Words Even More Words License Sample Results Code Example Documentation Published Materials README.md Hybrid Fortran - A Framework for GPU Acceleration Join the chat at https://gitter.im/muellermichel/Hybrid-Fortran What & Why Problems With Accelerator Programming The Idea Behind Hybrid Fortran Quickstart 1. Clone this repo and point the HF_DIR environment variable to its path. 2. Type cd $HF_DIR && make example. This will create an example project directory below $HF_DIR. Note: You can move this wherever you want in order to use it as a template for your projects. 3. Have a look at example/source/example.h90, which will guide you through and show you how to use Hybrid Fortran. ( Psst: It's better to open it in your editor of choice with Fortran syntax highlighting, but if you want to skip steps 1-2 you may also click the link. ;-) ) A Few More Words Hybrid Fortran is .. * .. a directive based extension for the Fortran language. * .. a way for you to keep writing your Fortran code like you're used to - only now with GPGPU support. * .. a preprocessor for your code - its input are Fortran files (with Hybrid Fortran extensions), its output is CUDA Fortran or OpenMP Fortran code (or whatever else you'd like to have as a backend). * .. a build system that handles building two separate versions (CPU / GPU) of your codebase automatically, including all the preprocessing. * .. a test system that handles verification of your outputs automatically after setup. * .. a framework for you to build your own parallel code implementations (OpenCL, ARM, FPGA, Hamster Wheel.. as long as it has some parallel Fortran support you're good) while keeping the same source files. Hybrid Fortran has been successfully used for porting the Physical Core of Japan's national next generation weather prediction model to GPGPU. We're currently planning to port the internationally used Open Source weather model WRF to Hybrid Fortran as well. Hybrid Fortran has been developed since 2012 by Michel Muller, MSc ETH Zurich, as a guest at Prof. Aoki's Gordon Bell award winning laboratory at the Tokyo Institute of Technology, as well as during a temporary stay with Prof. Maruyama at the RIKEN Advanced Institute for Computational Science in Kobe, Japan. Even More Words The following Blog entry gives insight into why Hybrid Fortran has been created and how it can help you: Accelerators in HPC - Having the Cake and Eating It Too License Hybrid Fortran is available under GNU Lesser Public License (LGPL). Sample Results Speedup HF Speedup HF Speedup HF Name Performance on 6 Core on GPU vs 6 on GPU vs 1 Results vs. 1 Core Core [1] Core [1] [1] Japanese Physical Slides Only Weather Prediction Slidecast 4.47x 3.63x 16.22x Core (121 Kernels) 10.94x 1.06x Compare 3D Diffusion Link Compare Performance 11.66x Performance Compare Speedup 21.72x 9.08x Compare Particle Push Link Compare Performance 152.79x Performance Compare Speedup Poisson on FEM Solver with Jacobi Link 1.41x 5.13x 7.28x Approximation MIDACO Ant Colony Solver with MINLP Link 5.26x 10.07x 52.99x Example CPU Sample Result (Diffusion) GPU Sample Result (Diffusion) Code Example The following sample code shows a wrapper subroutine and an add subroutine. Please note that storage order inefficiencies are ignored in this example (this would create an implicit copy of the z-dimension in arrays a, b, c). module example contains subroutine wrapper(a, b, c) real, intent(in), dimension(NX, NY, NZ) :: a, b real, intent(out), dimension(NX, NY, NZ) :: c integer(4) :: x, y do y=1,NY do x=1,NX call add(a(x,y,:), b(x,y,:), c(x,y,:)) end do end do end subroutine subroutine add(a, b, c) real, intent(in), dimension(NZ) :: a, b, c integer :: z do z=1,NZ c(z) = a(z) + b(z) end do end subroutine end module example Here's what this code would look like in Hybrid Fortran, parallelizing the x and y dimensions on both CPU and GPU. module example contains subroutine wrapper(a, b, c) real, dimension(NZ), intent(in) :: a, b real, dimension(NZ), intent(out) :: c @domainDependant{domName(x,y), domSize(NX,NY), attribute(autoDom)} a, b, c @end domainDependant @parallelRegion{appliesTo(CPU), domName(x,y), domSize(NX, NY)} call add(a, b, c) call mult(a, b, c) @end parallelRegion end subroutine subroutine add(a, b, c) real, dimension(NZ), intent(in) :: a, b real, dimension(NZ), intent(out) :: c integer :: z @domainDependant{domName(x,y), domSize(NX,NY), attribute(autoDom)} a, b, c @end domainDependant @parallelRegion{appliesTo(GPU), domName(x,y), domSize(NX, NY)} do z=1,NZ c(z) = a(z) + b(z) end do @end parallelRegion end subroutine subroutine mult(a, b, c) !... end subroutine end module example Please note the following: * The x and y dimensions have been abstracted away, even in the wrapper. We don't need to privatize the add subroutine in x and y as we would need to in CUDA or OpenACC. The actual computational code in the add subroutine has been left untouched. * We now have two parallelizations: For the CPU the program is parallelized at the wrapper level using OpenMP. For GPU the program is parallelized using CUDA Fortran at the callgraph leaf level. In between the two can be an arbitrarily deep callgraph, containing arbitrarily many parallel regions (with some restrictions, see below). The data copying from and to the device as well as the privatization in 3D is all handled by the Hybrid Fortran preprocessor framework. Documentation * Samples Overview * Results Overview * Screencast * Full Documentation For Installation, Getting Started, Usage and Design (PDF) * Credits * Contact Information * Version History Published Materials * "New High Performance GPGPU Code Transformation Framework Applied to Large Production Weather Prediction Code", preprint, accepted for ACM Transactions on Parallel Computing 2018 * "Hybrid Fortran: High Productivity GPU Porting Framework Applied to Japanese Weather Prediction Model", in proceedings of WACCPD 2017, Denver CO, USA * Background Story (as mentioned/published in HPC Today, Inside HPC, HPCwire) * Poster SC14 * Talk GTC 2014 (Voice + Slides) * Poster GTC 2013 * Talk GTC 2013 * Master Thesis (2012): ftp://129.132.2.212/pub/students/2012-FS/ MA-2012-23_signed.pdf About Accelerate with CUDA, OpenACC and OpenMP - Unified and Performance Portable typhooncomputing.com Resources Readme License LGPL-3.0, GPL-3.0 licenses found Licenses found LGPL-3.0 COPYING.LESSER GPL-3.0 COPYING Stars 113 stars Watchers 22 watching Forks 17 forks Report repository Releases 3 Release 0.98 Latest Jan 29, 2016 + 2 releases Packages 0 No packages published Contributors 2 * @muellermichel muellermichel Michel Muller * @gitter-badger gitter-badger The Gitter Badger Languages * Python 85.4% * Fortran 9.7% * Shell 4.2% * Makefile 0.7% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.