# IT4Innovations 2020

easyblock = 'ConfigureMake'
name = 'GlobalArrays'
version = '5.7.2'

homepage = 'http://hpc.pnl.gov/globalarrays'
description = "Global Arrays (GA) is a Partitioned Global Address Space (PGAS) programming model"

toolchain = {'name': 'intel', 'version': '2020a'}
toolchainopts = {'usempi': True}

source_urls = ['https://github.com/GlobalArrays/ga/releases/download/']
sources = ['v%(version)s/ga-%(version)s.tar.gz']

# patch for bugs on v5.7 causing errors on NWChem
#patches = [
#    'GlobalArrays-v5.7_ga_diag_std.patch',             # fix bug ga_diag_std https://github.com/GlobalArrays/ga/pull/101
#    'GlobalArrays-v5.7-intel-2018b-MKL_issue.patch',   # fix MKL issue https://github.com/GlobalArrays/ga/pull/122
#]

checksums = [
    '8cd0fcfd85bc7f9c168c831616f66f1e8b9b2ca31dc7dd93cc55b27cc7fe7069',
#   '8049543e6442e13acb54cb4afd9a6ad78102864b2ef138ad9f4b1a45bd0666bb',  # GlobalArrays-v5.7_ga_diag_std.patch
#   'e5b9fff47d471b3552b167b82153f8f1fd6406c52e39a11b693cb9c4bf12645e',  # GlobalArrays-v5.7-intel-2018b-MKL_issue.patch
]

configopts = ' --with-mpi --enable-i8'
configopts += ' --with-blas8="-L$EBROOTIMKL/mkl/lib/intel64 -lmkl_sequential -lmkl_intel_ilp64"'
configopts += ' --with-scalapack8="-L$EBROOTIMKL/mkl/lib/intel64 -lmkl_sequential -lmkl_scalapack_ilp64"'

# select armci network as (Comex) MPI-1 two-sided
configopts += ' --with-mpi-ts'

sanity_check_paths = {
    'files': ['bin/adjust.x', 'bin/collisions.x', 'bin/ga-config', 'lib/libarmci.a', 'lib/libcomex.a', 'lib/libga.a'],
    'dirs': ['include'],
}

moduleclass = 'lib'
