一键导入
mapl-build
Build MAPL with NAG, gfortran, or Intel compilers on macOS and Linux
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build MAPL with NAG, gfortran, or Intel compilers on macOS and Linux
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Safely switch between NAG, gfortran, and Intel compilers when building MAPL
MAPL Fortran coding standards and style conventions
GitHub workflow, commit conventions, and PR process for MAPL
MAPL error handling macros and best practices
First-time MAPL development environment setup and configuration
Run and debug MAPL tests with pFUnit framework
| name | mapl-build |
| description | Build MAPL with NAG, gfortran, or Intel compilers on macOS and Linux |
| compatibility | opencode |
Provide step-by-step instructions for building MAPL with different compilers on different platforms, including:
Use this skill when:
IMPORTANT: First question to answer - Which branch should we start with?
develop - For legacy MAPL (MAPL 2.x) workrelease/MAPL-v3 - For MAPL v3 developmentYour actual work will be on a feature/bugfix/hotfix branch, but these are the base branches.
Golden Rule: Use separate build directories for each compiler. Never mix compilers!
./nag # For NAG Fortran builds
./gfortran # For gfortran builds
./intel # For Intel compiler builds (on bucy)
Alternative pattern (if you prefer):
./build-nag
./build-gfortran
./build-intel
Configure your preference in ~/.opencode/mapl-config.yaml:
paths:
build_dir_prefix: "" # For ./nag pattern
# OR
build_dir_prefix: "build-" # For ./build-nag pattern
NAG is the fastest compiler for MAPL (~81 seconds from scratch) and provides strictest checking.
Check ~/.opencode/mapl-config.yaml for your module names, or use common defaults:
module load nag mpi baselibs
Common variations you might need:
module load compiler/nag-fortran openmpi MAPL-baselibs
# Or
module load nag-fortran/7.1 mpi/openmpi baselibs
module list
which nagfor
cmake -B nag -DCMAKE_BUILD_TYPE=Debug
cmake --build nag
For parallel builds (faster):
cmake --build nag -j 8 # Use 8 cores
120 seconds (2 minutes) - provides 25% padding over measured time
gfortran is slower (~6m 43s from scratch) but more portable and widely available.
module load gfortran mpi baselibs
Common variations:
module load gcc/13 openmpi MAPL-baselibs
# Or
module load gnu-fortran mpi/openmpi baselibs
module list
which gfortran
gfortran --version # Should be 10.x or newer
cmake -B gfortran -DCMAKE_BUILD_TYPE=Debug
cmake --build gfortran
Parallel build (recommended):
cmake --build gfortran -j 8
540 seconds (9 minutes) - provides 25% padding
For Intel compiler testing, use the remote bucy server. This requires PIV card authentication.
See the remote-build skill for complete bucy workflow, including:
Quick reference for bucy build:
ssh bucy "cd ~/swdev/VS/MAPL && source /etc/profile.d/modules.sh && module load ifx-stack && cmake -B intel -DCMAKE_BUILD_TYPE=Debug"
ssh bucy "cd ~/swdev/VS/MAPL && source /etc/profile.d/modules.sh && module load ifx-stack && cmake --build intel -j 6"
IMPORTANT: Commands must load modules in the same shell session (see remote-build skill for details).
cmake -B <compiler> -DCMAKE_BUILD_TYPE=Debug
cmake -B <compiler> -DCMAKE_BUILD_TYPE=Release
cmake -B <compiler> -DCMAKE_BUILD_TYPE=RelWithDebInfo
Use -j flag to speed up builds:
# Auto-detect available cores
cmake --build nag -j
# Specify number of cores
cmake --build nag -j 8
# Conservative (leave cores for other work)
cmake --build nag -j 4
NOTE: NAG builds are so fast (~81s) that parallel builds give minimal improvement. Gfortran benefits much more from parallelization.
Problem: CMake cannot find the Fortran compiler Solution: Forgot to load compiler module
# Check loaded modules
module list
# Load compiler module
module load nag mpi baselibs # Or gfortran
# Verify compiler accessible
which nagfor # or which gfortran
Problem: Reused build directory after switching compilers Solution: Use separate build directories, never reuse
# WRONG - reusing directory
cmake -B build -DCMAKE_BUILD_TYPE=Debug # with NAG
module load gfortran
cmake -B build -DCMAKE_BUILD_TYPE=Debug # ERROR!
# CORRECT - separate directories
cmake -B nag -DCMAKE_BUILD_TYPE=Debug
cmake -B gfortran -DCMAKE_BUILD_TYPE=Debug
If you made this mistake:
rm -rf ./build # Delete confused directory
cmake -B gfortran -DCMAKE_BUILD_TYPE=Debug # Start fresh
Problem: Cannot find MPI, NetCDF, or other dependencies Solution: Load baselibs module
module load baselibs # Provides ESMF, NetCDF, HDF5, etc.
Problem: Build uses cached old values Solution: Clean and reconfigure
rm -rf ./nag
cmake -B nag -DCMAKE_BUILD_TYPE=Debug
cmake --build nag
Problem: Loaded wrong module combination Solution: Purge and reload
module purge # Clear all modules
module load nag mpi baselibs
module list # Verify correct modules loaded
After making code changes, just rebuild (no need to re-run cmake):
cmake --build nag
CMake automatically detects changed files and rebuilds only what's needed.
Typical incremental build times: < 3 minutes
If working specifically on generic3g code, see the mapl-testing skill for a faster incremental build workflow that rebuilds only generic3g tests.
See the compiler-switching skill for detailed instructions on safely switching between compilers.
Key points:
module listSometimes you need to start completely fresh:
# Remove all build directories
rm -rf ./nag ./gfortran ./intel
# Or remove just one
rm -rf ./nag
# Reconfigure
cmake -B nag -DCMAKE_BUILD_TYPE=Debug
cmake --build nag
After successful build, run tests with:
cd nag # or gfortran, or intel
ctest --output-on-failure
See the mapl-testing skill for detailed testing workflows, including the fast generic3g-only testing method.
Standard build process applies. Most features are stable.
MAPL v3 pre-release branch. Build process is the same, but may have:
Check branch-specific README or INSTALL.md for any special requirements.
For continuous integration:
module load nag mpi baselibs
cmake -B nag -DCMAKE_BUILD_TYPE=Debug
cmake --build nag -j 8
cd nag && ctest --output-on-failure
module load gfortran mpi baselibs
cmake -B gfortran -DCMAKE_BUILD_TYPE=Debug
cmake --build gfortran -j 8
cd gfortran && ctest --output-on-failure
See remote-build skill for complete workflow.
which nagfor or which gfortran)