Compiler Portability
Compiler portability is PIC’s primary concern. The library is tested and maintained to work across multiple Fortran compilers.
Supported Compilers
PIC officially supports:
GNU Fortran (gfortran) - Versions 10-14
Intel Fortran (ifx/ifort) - 2024, 2025
NVIDIA HPC SDK (nvfortran) - 25.1+
LFortran - Latest
Cray Fortran (crayftn) - Latest
Classic Flang - Latest
Why Portability Matters
The Fortran ecosystem has multiple compilers, each with their own quirks and levels of standard compliance. Many Fortran libraries (including parts of stdlib) fail to compile on certain compilers.
PIC exists specifically to provide utilities that work everywhere. If code compiles with GNU but not NVIDIA, it’s a bug in PIC that needs to be fixed.
Writing Portable Code
Preprocessor Guards
Use preprocessor directives for compiler-specific code:
#ifdef __GFORTRAN__
! GNU-specific code
#endif
#ifdef __INTEL_COMPILER
! Intel-specific code
#endif
#ifdef __NVCOMPILER_LLVM__
! NVIDIA-specific code
#endif
#ifdef _OPENMP
use omp_lib
#endif
Common Portability Issues
Assumed-rank arrays - Not all compilers support
dimension(..). Use explicit ranks when possible.Coarrays - Support varies widely. Guard with
#ifdefchecks.IEEE modules -
ieee_arithmeticsupport differs. Test carefully.Intrinsic function behavior - Some intrinsics behave slightly differently across compilers.
OpenMP support - Always guard OpenMP code with
#ifdef _OPENMP.
Testing Portability
If you don’t have access to all compilers locally:
Use Compiler Explorer (Godbolt) to test compilation
Submit a PR and let CI test across the full compiler matrix
Check CI logs carefully for compiler-specific warnings
File Extensions
Use
.f90for standard Fortran sourceUse
.F90when preprocessor directives are needed (the file goes through cpp)
CI Testing Matrix
Every PR is tested against:
GNU Fortran 10, 11, 12, 13, 14
Intel oneAPI 2024, 2025
NVIDIA HPC SDK 25.1
LFortran (latest)
All compilers must pass before merge.
Reporting Compiler Issues
If you find code that doesn’t compile on a specific compiler:
Open an issue with the compiler name and version
Include the exact error message
Provide a minimal reproducing example if possible
We take portability issues seriously and will work to fix them promptly.