Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miniGhost #1454

Open
Sezoir opened this issue Feb 9, 2022 · 1 comment
Open

miniGhost #1454

Sezoir opened this issue Feb 9, 2022 · 1 comment
Labels
apps Building Fortran applications with Flang - status + instructions

Comments

@Sezoir
Copy link
Collaborator

Sezoir commented Feb 9, 2022

Enable building and execution of the miniGhost application with the LLVM Flang compiler.

@Sezoir
Copy link
Collaborator Author

Sezoir commented Feb 9, 2022

Next steps: I am not planning to take on this project. This is just an initial report found. Please feel free to work on this.

miniGhost:

The miniGhost application can be run with either MPI or Serial. Since flang-new does not currently support MPI, this initial report is focused on Serial.

Initial report for miniGhost:

  • Minimum version of Fortran required using gfortran: F95
    • Required arguments to compile with version: "-fdec"
  • How to compile with gfortran:
    1. First you can download the project by running in bash:
    mkdir miniGhost
    cd miniGhost
    wget -N http://www.nersc.gov/assets/Trinity--NERSC-8-RFP/Benchmarks/Feb22/MiniGhostv0.9.tar
    tar xf MiniGhostv0.9.tar
    
    1. Now you can compile the project by running:
    cd source
    make FC=gfortran CC=gcc LD=gfortran PROTOCOL="-D_MG_SERIAL" FFLAGS="-ffree-form -D_MG_INT4 -D_MG_REAL8"
    
          Where the paths to the GNU compilers are correctly substituted in.
  • Does it compile with flang-new: Yes
    miniGhost can be compiled, however it requires a bit of a "hack" in the main.c, and a build of PGMATH. To compile:
    1. First at line 82 in main.c, change the #else branch statement from #define MINI_GHOST mini_ghost_ to #define MINI_GHOST _QPmini_ghost.
    2. Now you can compile by running
    export PGMATH_DIR="/path/to/flang/runtime/build"
    make FC=flang-new CC=clang-12 LD=flang-new PROTOCOL=-D_MG_SERIAL FFLAGS="-ffree-form -D_MG_INT4 -D_MG_REAL8" LIBS="-L${PGMATH_DIR}/lib -lpgmath"
    
    where PGMATH_DIR is the path to your PGMATH build directory.
    An important note for the compilation step is the change in main.c code of #define MINI_GHOST _QPmini_ghost. In theory we should not need to change this, however we do not currently include the ExternalNameConversion pass in the pass pipeline definition in the driver. We should not require this workaround once the pass is included in the default pass pipeline. Without it, the linker ends up not being able to find the MINI_GHOST subroutine in DRIVER.F that is called from main.c.

Versions:

  • gcc version used: 9.3.0
  • gfortran version used: 9.3.0
  • flang-new, fir-dev branch, HEAD: fb8eb63
  • clang-12: 12.0.0
  • pgmath built from classic flang, HEAD: e7dedbf9200e740bf38b37892597498fd7dcbb41
  • Architecture for compilation: aarch64

@banach-space banach-space added the apps Building Fortran applications with Flang - status + instructions label Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apps Building Fortran applications with Flang - status + instructions
Projects
None yet
Development

No branches or pull requests

2 participants