##
# This file is an EasyBuild reciPY as per https://github.com/easybuilders/easybuild
#
# OriginalAuthor:    Stephane Thiell <sthiell@stanford.edu>
# Author:    Ake Sandgren <ake.sandgren@hpc2n.umu.se>
##
easyblock = 'Tarball'

# The full version of the library can be found using
# strings -a cuda/lib64/libcudnn_static.a | grep cudnn_version_
name = 'cuDNN'
version = '7.5.0.56'

homepage = 'https://developer.nvidia.com/cudnn'
description = """The NVIDIA CUDA Deep Neural Network library (cuDNN) is a GPU-accelerated library of primitives for
    deep neural networks."""

# fosscuda 2018b uses CUDA 9.2
toolchain = {'name': 'fosscuda', 'version': '2019a'}

# Nvidia developer registration required.
# Download link: https://developer.nvidia.com/rdp/cudnn-download
# Unpack the downloaded tar file.
# Then rename as:
# v=`strings -a cuda/lib64/libcudnn_static.a | grep cudnn_version_ | cut -d_ -f3-6 | tr _ .`
# mv cudnn-9.2-linux-x64-v7.1.tgz cudnn-9.2-linux-x64-v$v.tgz
sources = ['%(namelower)s-9.2-linux-x64-v%(version)s.tgz']

sanity_check_paths = {
    'files': ['include/cudnn.h', 'lib64/libcudnn_static.a'],
    'dirs': ['include', 'lib64'],
}

moduleclass = 'numlib'
