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

NCAR Kernels #1456

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

NCAR Kernels #1456

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 NCAR Kernels 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.

NCAR kernels:

https://github.com/NCAR/kernelOptimization

The NCAR kernel optimization repository consists of a lot kernels. For this initial report I looked at the following kernels:

  • PORT_sw_rad
  • CLUBB_advance_clubb_core
  • HOMME_laplace_sphere_wk
  • PSRAD_lrtm_codereview
  • MG2_opt
  • POP_comp_co3terms
  • WACCM_imp_sol_vector

Cloning the repository

git clone https://github.com/NCAR/kernelOptimization.git

Initial report for PORT_sw_rad:

  • Minimum version of Fortran required using gfortran: F2008

    • Required arguments to compile with version: "-fdec"
  • How to compile with gfortran:

    1. First cd to where the kernel is located at cd all/PORT_sw_rad/v02.
    2. After that you can compile the project by running:
    make COMPILER=gnu MPI=no
    
  • Does it compile with flang-new: No
    When compiling with make COMPILER=flang FC=flang-new MPI=no I get the following error:

    flang-new  -c -o mcica_random_numbers.o mcica_random_numbers.F90
    error: loc("./mcica_random_numbers.F90":36:51): /.../f18-llvm-fork/flang/lib/Lower/ConvertType.cpp:305: not yet implemented lowering derived type components with non default lower bounds
    make: *** [Makefile:139: mcica_random_numbers.o] Error 1
    

    Note that the reason for setting COMPILER=flang when calling Make is to stop the Makefile from defaulting to using intel compiler/flags.

Initial report for CLUBB_advance_clubb_core:

  • Minimum version of Fortran required using gfortran: F2003

    • Required arguments to compile with version: "-fdec"
  • How to compile with gfortran:

    1. First make sure to have a build of openblas.
    2. Next cd to where the kernel is located at cd all/CLUBB_advance_clubb_core/v02. I used v02 instead of v03 due to getting odd compiler failures which didn't occur with 'v02'.
    3. Next, load your openblas library. (This should set the OPENBLAS_LIB env varaible to point to the directory of where your openblas library file is located).
    4. Finally you can compile the project by running:
    make COMPILER=gnu MPI=no LD_FLAGS="-L$OPENBLAS_LIB -lopenblas"
    
  • Does it compile with flang-new: No
    When compiling with mmake COMPILER=flang FC=flang-new MPI=no LD_FLAGS="-L$OPENBLAS_LIB -lopenblas" I get the following error:

    flang-new  -c -o grid_class.o grid_class.F90
    error: loc("./grid_class.F90":1764:8): /.../f18-llvm-fork/flang/lib/Lower/ConvertExpr.cpp:285: not yet implemented component is boxed, retreive its type parameters
    make: *** [Makefile:22: grid_class.o] Error 1   
    

    Note that the reason for setting COMPILER=flang when calling Make is to stop the Makefile from defaulting to using intel compiler/flags.

Initial report for HOMME_laplace_sphere_wk:

  • Minimum version of Fortran required using gfortran: F2008

    • Required arguments to compile with version: "-fdec"
  • How to compile with gfortran:

    1. First cd to where the kernel is located at cd all/HOMME_laplace_sphere_wk/v02.
    2. After that you can compile the project by running:
    make COMPILER=gnu MPI=no
    
  • Does it compile with flang-new: No
    When compiling with make COMPILER=flang FC=flang-new MPI=no" I get the following error:

    flang-new  -c -o kgen_utils.o kgen_utils.F90
    error: Semantic errors in kgen_utils.F90
    ./kgen_utils.F90:362:11: error: No explicit type declared for 'getpid'
          pid = getpid()
                ^^^^^^
    make: *** [Makefile:15: kgen_utils.o] Error 1
    

    Note that the reason for setting COMPILER=flang when calling Make is to stop the Makefile from defaulting to using intel compiler/flags.

Initial report for PSRAD_lrtm_codereview:

  • Minimum version of Fortran required using gfortran: F2008

    • Required arguments to compile with version: "-fdec"
  • How to compile with gfortran:

    1. First cd to where the kernel is located at cd all/PSRAD_lrtm_codereview/v02.
    2. After that you can compile the project by running:
    make COMPILER=gnu MPI=no
    
  • Does it compile with flang-new: No
    When compiling with make COMPILER=flang FC=flang-new MPI=no" I get the following error:

    flang-new  -c -o mo_random_numbers.o mo_random_numbers.F90
    error: Semantic errors in mo_random_numbers.F90
    ./mo_random_numbers.F90:14:44: error: Must be a constant value
              LOGICAL, parameter :: big_endian = (transfer(1_i8, 1) == 0)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^
    make: *** [Makefile:56: mo_random_numbers.o] Error 1
    

    Note that the reason for setting COMPILER=flang when calling Make is to stop the Makefile from defaulting to using intel compiler/flags.

Initial report for MG2_opt:

  • Minimum version of Fortran required using gfortran: F2008

    • Required arguments to compile with version: "-fdec"
  • How to compile with gfortran:

    1. First cd to where the kernel is located at cd all/MG2_opt/v02.
    2. After that you can compile the project by running:
    make COMPILER=gnu MPI=no
    
  • Does it compile with flang-new: No
    When compiling with make COMPILER=flang FC=flang-new MPI=no" I get the following error:

    flang-new  -c -o kernel_driver.o kernel_driver.F90
    error: loc("./kernel_driver.F90":38:9): /path/to/f18-llvm-fork/flang/lib/Lower/IO.cpp:930: not yet implemented CONVERT not part of the runtime::io interface
    make: *** [Makefile:14: kernel_driver.o] Error 1
    

    Note that the reason for setting COMPILER=flang when calling Make is to stop the Makefile from defaulting to using intel compiler/flags.

Initial report for POP_comp_co3terms:

  • Minimum version of Fortran required using gfortran: F2008

    • Required arguments to compile with version: "-fdec"
  • How to compile with gfortran:

    1. First cd to where the kernel is located at cd all/POP_comp_co3terms/v02.
    2. After that you can compile the project by running:
    make COMPILER=gnu MPI=no
    
  • Does it compile with flang-new: No
    When compiling with make COMPILER=flang FC=flang-new MPI=no" I get the following error:

    flang-new  -c -o kgen_utils.o kgen_utils.F90
    error: Semantic errors in kgen_utils.F90
    ./kgen_utils.F90:60:11: error: No explicit type declared for 'getpid'
          pid = getpid()
                ^^^^^^
    make: *** [Makefile:55: kgen_utils.o] Error 1
    

    Note that the reason for setting COMPILER=flang when calling Make is to stop the Makefile from defaulting to using intel compiler/flags.

Initial report for WACCM_imp_sol_vector:

  • Minimum version of Fortran required using gfortran: F2008

    • Required arguments to compile with version: "-fdec"
  • How to compile with gfortran:

    1. First cd to where the kernel is located at cd all/WACCM_imp_sol_vector/v07.
    2. After that you can compile the project by running:
    make COMPILER=gnu MPI=no
    
  • Does it compile with flang-new: No
    When compiling with make COMPILER=flang FC=flang-new MPI=no" I get the following error:

    flang-new  -D _VECLEN=16  -c -o kgen_utils.o kgen_utils.F90
    error: Semantic errors in kgen_utils.F90
    ./kgen_utils.F90:336:11: error: No explicit type declared for 'getpid'
          pid = getpid()
                ^^^^^^
    make: *** [Makefile:54: kgen_utils.o] Error 1
    

    Note that the reason for setting COMPILER=flang when calling Make is to stop the Makefile from defaulting to using intel compiler/flags.

Versions:

  • NCAR kernel, HEAD: fdd2212469ff5fe1245dc8a92439e22b65e3d1fe
  • gcc version used: 9.3.0
  • gfortran version used: 9.3.0
  • flang-new, fir-dev branch, HEAD: fb8eb63
  • openblas version used: 0.3.10
  • 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