f18-llvm-project
f18-llvm-project copied to clipboard
SNAP Application Build and Test
Enable building and execution of the SNAP application with the flang compiler. Test with and without OpenMP. https://github.com/lanl/SNAP
Prepare LLVM Flang
Follow these steps to build LLVM Flang. Remember to use the fir-dev
branch from f18-llvm-project.
# Clone `fir-dev`
git clone https://github.com/flang-compiler/f18-llvm-project.git
cd f18-llvm-project && git checkout fir-dev
# Build and test LLVM Flang
mkdir build && cd build
cmake -G Ninja -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="mlir;flang;clang" ../llvm
ninja check-flang
Note: Tested with this commit from fir-dev: 2d17c37e08bc34cfdac34e22f3667c00b295438d.
Prepare pgmath
LLVM Flang currently depends on pgmath for Math routines. You can build it from sources like this:
# Clone Classic Flang
git clone https://github.com/flang-compiler/flang.git
# Build pgmath
cd flang/runtime
mkdir build
cd build
cmake -G Ninja ../libpgmath/
ninja
Prepare SNAP
SNAP does not support LLVM Flang yet. We have prepared a patch with the necessary Makefile changes, see this GitHub branch. Remember to set LLVM_FLANG_DIR
(LLVM Flang build directory) and PGM_DIR
(PGMath build directory).
# Clone SNAP
git clone https://github.com/banach-space/SNAP.git
cd SNAP
git checkout enable_flang
Building SNAP with LLVM Flang
Note that MPI
needs to be set to off
.
cd SNAP/src
# Build SNAP with LLVM Flang. Choose either 1. or 2.
# 1. OpenMP _disabled_:
make TARGET=fsnap OPENMP=off MPI=off
# 2. OpenMP _enabled_:
make TARGET=fsnap OPENMP=on MPI=off
Run SNAP
We have been using 2d_mms_st.inp as our input file. Change npey to 1 to make sure that you run SNAP in single-threaded mode. Next, run it like this:
./fsnap ../qasnap/mms_src/2d_mms_st.inp snap-output
You should see output that ends with:
Success! Done in a SNAP!
Great to see that this is starting to pass applications!
I have a quick question but didn't want to raise an issue for this just yet: I don't see BLAS/LAPACK (the original) in https://github.com/flang-compiler/f18-llvm-project/projects/11, should this be added?
I have a quick question but didn't want to raise an issue for this just yet: I don't see BLAS/LAPACK (the original) in https://github.com/flang-compiler/f18-llvm-project/projects/11, should this be added?
That's a good suggestion, I've just added it :)
CI for SNAP on fir-dev was added in https://github.com/flang-compiler/f18-llvm-project/commit/744a3bbc0be1f35d15dae61e73228abb977be372. You can view the corresponding action here: https://github.com/flang-compiler/f18-llvm-project/actions/workflows/flang-tests-snap.yml.
-Andrzej