# IT4Innovations 2020

name = 'PETSc'
version = '3.12.4'

homepage = 'https://www.mcs.anl.gov/petsc'
description = """PETSc, pronounced PET-see (the S is silent), is a suite of data structures and routines for the
 scalable (parallel) solution of scientific applications modeled by partial differential equations."""

toolchain = {'name': 'intel', 'version': '2020a'}
import os
if os.environ.get("CLUSTERNAME") in ["KAROLINA"]:
    toolchainopts = {'pic': True, 'usempi': True, 'optarch': 'march=core-avx2'}
else:
    toolchainopts = {'pic': True, 'usempi': True}

# https:// does not work here
source_urls = [
    'http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/',
    'ftp://ftp.mcs.anl.gov/pub/petsc/release-snapshots/',
]
sources = [SOURCELOWER_TAR_GZ]
patches = [
    'PETSc_ranlib-fix.patch',
]
checksums = [
    '56a941130da93bbacb3cfa74dcacea1e3cd8e36a0341f9ced09977b1457084c3',  # petsc-3.12.4.tar.gz
    '64cf9d5008d5e92117e65bdec5316d991b6a6b8c8ecf7ea46eb790a498266297',  # PETSc_ranlib-fix.patch
]

builddependencies = [('CMake', '3.16.4')]

dependencies = [
    ('Boost', '1.72.0'),
    ('METIS', '5.1.0'),
    ('SCOTCH', '6.0.9'),
    ('MUMPS', '5.2.1', '-metis'),
    ('SuiteSparse', '5.6.0', '-METIS-5.1.0'),
    ('Hypre', '2.18.2'),
]

configopts = '--LIBS="$LIBS -lrt" '

shared_libs = 1

# only required when building PETSc in a SLURM job environment
# configopts += '--with-batch=1 --known-mpi-shared-libraries=1 --known-64-bit-blas-indices=0 '
# prebuildopts = "srun ./conftest-arch-linux2-c-opt && ./reconfigure-arch-linux2-c-opt.py && "

moduleclass = 'numlib'
