xref: /petsc/config/examples/arch-olcf-frontier-opt.py (revision 517f4e3460cd8c7e73c19b8bf533f1efe47f30a7)
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-metis',
35    '--download-parmetis',
36    '--download-kokkos',
37    '--download-kokkos-kernels',
38    '--download-superlu_dist',
39  ]
40  configure.petsc_configure(configure_options)
41
42#  Use Cray compilers
43#    module load PrgEnv-cray
44#    module load cray-mpich
45#    module load amd-mixed/5.4.0
46
47# To enable GPU-aware MPI, one has to also set this runtime environment variable
48#
49#    export MPICH_GPU_SUPPORT_ENABLED=1
50#
51# Additional note: "craype-accel-amd-gfx90a" module is recommended for
52# "OpenMP offload" or "GPU enabled MPI". It requires "--with-openmp" option.
53# [otherwise building c examples gives link errors (when fortran bindings are enabled)]
54# Alternative is to use "-lmpi_gtl_hsa" as shown below.
55#
56#   ld.lld: error: lib/libpetsc.so: undefined reference to .omp_offloading.img_start.cray_amdgcn-amd-amdhsa [--no-allow-shlib-undefined]
57#
58#  Also, please ignore warnings like this. If you don't use Fortran, use '--with-fc=0' to get rid of them.
59#
60# ftn-878 ftn: WARNING PETSC, File = ../../../autofs/nccs-svm1_home1/jczhang/petsc/src/tao/f90-mod/petsctaomod.F90, Line = 37, Column = 13
61#  A module named "PETSCVECDEFDUMMY" has already been directly or indirectly use associated into this scope.
62
63
64# if __name__ == '__main__':
65#   import sys
66#   import os
67#   sys.path.insert(0, os.path.abspath('config'))
68#   import configure
69#   configure_options = [
70#     '--with-debugging=0',
71#     '--with-cc=cc',
72#     '--with-cxx=CC',
73#     '--with-fc=ftn',
74#     # -std=c2x is a workaround for this hipsparse problem
75#     #   /opt/rocm-5.4.0/include/hipsparse/hipsparse.h:8741:28: error: expected '= constant-expression' or end of enumerator definition
76#     #      HIPSPARSE_ORDER_COLUMN [[deprecated("Please use HIPSPARSE_ORDER_COL instead")]] = 1,
77#     # -Wno-constant-logical-operand is a workaround to suppress excessive warnings caused by -std=c2x in petsc source which we don't want to address, see MR !6287
78#     '--CFLAGS=-std=c2x -Wno-constant-logical-operand',
79#     'LIBS={GTLDIR} {GTLLIBS}'.format(GTLDIR=os.environ['PE_MPICH_GTL_DIR_amd_gfx90a'], GTLLIBS=os.environ['PE_MPICH_GTL_LIBS_amd_gfx90a']),
80#     #'--with-openmp=1', # enable if using "craype-accel-amd-gfx90a" module
81#     '--with-mpiexec=srun -p batch -N 1 -A csc314 -t 00:10:00',
82#     '--with-batch',
83#     '--with-hip',
84#     '--with-hipc=hipcc',
85#     '--download-kokkos',
86#     '--download-kokkos-kernels',
87#   ]
88#   configure.petsc_configure(configure_options)