xref: /petsc/config/examples/arch-olcf-frontier-opt.py (revision ea9ee2c1d69c9e3cf6d2b3c8a205b9880d3dba39)
1#!/usr/bin/python3
2
3#  Use GNU compilers
4#    module load PrgEnv-gnu
5#    module load cray-mpich
6#    module load amd-mixed/5.4.0
7#
8# To enable GPU-aware MPI, one has to also set this runtime environment variable
9#
10#    export MPICH_GPU_SUPPORT_ENABLED=1
11#
12# To use hipcc with GPU-aware Cray MPICH, use the following environment variables to setup the needed header files and libraries.
13#
14#    -I${MPICH_DIR}/include
15#    -L${MPICH_DIR}/lib -lmpi ${PE_MPICH_GTL_DIR_amd_gfx90a} ${PE_MPICH_GTL_LIBS_amd_gfx90a}
16#
17# See also https://docs.olcf.ornl.gov/systems/frontier_user_guide.html#gpu-aware-mpi
18#
19if __name__ == '__main__':
20  import sys
21  import os
22  sys.path.insert(0, os.path.abspath('config'))
23  import configure
24  configure_options = [
25    '--with-debugging=0',
26    '--with-cc=cc',
27    '--with-cxx=CC',
28    '--with-fc=ftn',
29    '--with-mpiexec=srun -p batch -N 1 -A csc314 -t 00:10:00',
30    '--with-batch',
31    '--with-hip',
32    '--with-hipc=hipcc',
33    'LIBS={GTLDIR} {GTLLIBS}'.format(GTLDIR=os.environ['PE_MPICH_GTL_DIR_amd_gfx90a'], GTLLIBS=os.environ['PE_MPICH_GTL_LIBS_amd_gfx90a']),
34    '--download-kokkos',
35    '--download-kokkos-kernels',
36  ]
37  configure.petsc_configure(configure_options)
38
39#  Use Cray compilers
40#    module load PrgEnv-cray
41#    module load cray-mpich
42#    module load amd-mixed/5.4.0
43
44# To enable GPU-aware MPI, one has to also set this runtime environment variable
45#
46#    export MPICH_GPU_SUPPORT_ENABLED=1
47#
48# Additional note: "craype-accel-amd-gfx90a" module is recommended for
49# "OpenMP offload" or "GPU enabled MPI". It requires "--with-openmp" option.
50# [otherwise building c examples gives link errors (when fortran bindings are enabled)]
51# Alternative is to use "-lmpi_gtl_hsa" as shown below.
52#
53#   ld.lld: error: lib/libpetsc.so: undefined reference to .omp_offloading.img_start.cray_amdgcn-amd-amdhsa [--no-allow-shlib-undefined]
54#
55#  Also, please ignore warnings like this. If you don't use Fortran, use '--with-fc=0' to get rid of them.
56#
57# ftn-878 ftn: WARNING PETSC, File = ../../../autofs/nccs-svm1_home1/jczhang/petsc/src/tao/f90-mod/petsctaomod.F90, Line = 37, Column = 13
58#  A module named "PETSCVECDEFDUMMY" has already been directly or indirectly use associated into this scope.
59
60
61# if __name__ == '__main__':
62#   import sys
63#   import os
64#   sys.path.insert(0, os.path.abspath('config'))
65#   import configure
66#   configure_options = [
67#     '--with-debugging=0',
68#     '--with-cc=cc',
69#     '--with-cxx=CC',
70#     '--with-fc=ftn',
71#     # -std=c2x is a workaround for this hipsparse problem
72#     #   /opt/rocm-5.4.0/include/hipsparse/hipsparse.h:8741:28: error: expected '= constant-expression' or end of enumerator definition
73#     #      HIPSPARSE_ORDER_COLUMN [[deprecated("Please use HIPSPARSE_ORDER_COL instead")]] = 1,
74#     # -Wno-constant-logical-operand is a workaround to supress excessive warnings caused by -std=c2x in petsc source which we don't want to address, see MR !6287
75#     '--CFLAGS=-std=c2x -Wno-constant-logical-operand',
76#     'LIBS={GTLDIR} {GTLLIBS}'.format(GTLDIR=os.environ['PE_MPICH_GTL_DIR_amd_gfx90a'], GTLLIBS=os.environ['PE_MPICH_GTL_LIBS_amd_gfx90a']),
77#     #'--with-openmp=1', # enable if using "craype-accel-amd-gfx90a" module
78#     '--with-mpiexec=srun -p batch -N 1 -A csc314 -t 00:10:00',
79#     '--with-batch',
80#     '--with-hip',
81#     '--with-hipc=hipcc',
82#     '--download-kokkos',
83#     '--download-kokkos-kernels',
84#   ]
85#   configure.petsc_configure(configure_options)