easyblock = 'CMakeMake'

name = 'Caffe'
version = '1.0'

local_cudaversion = '8.0.44'
versionsuffix = '-CUDA-%s-Python-%%(local_pyver)s' % local_cudaversion

homepage = 'https://github.com/BVLC/caffe'
description = """
Caffe is a deep learning framework made with expression, speed,
and modularity in mind. It is developed by the Berkeley Vision
and Learning Center (BVLC) and community contributors.
"""

toolchain = {'name': 'foss', 'version': '2016a'}
toolchainopts = {'optarch': True, 'pic': True}

sources = ['%(version)s.tar.gz']
source_urls = ['https://github.com/BVLC/caffe/archive/']

builddependencies = [
    ('CMake', '3.8.1', '', True),
]

local_protobuf_ver = '3.2.0'

dependencies = [
    ('glog', '0.3.4', '', True),
    ('gflags', '2.1.2', '', True),
    ('OpenCV', '3.1.0', '', True),
    ('CUDA', local_cudaversion, '', True),
    ('cuDNN', '5.1', '-CUDA-%s' % local_cudaversion, True),
    ('LMDB', '0.9.18', '', True),
    ('LevelDB', '1.18', '', True),
    ('snappy', '1.1.3', '', True),
    ('protobuf', local_protobuf_ver),
    #   ('protobuf-python', local_protobuf_ver, '-Python-%(local_pyver)s'),
    ('HDF5', '1.8.16', '-serial'),
    ('Boost', '1.63.0', '-Python-%(local_pyver)s'),
    ('Python', '2.7.13', '', True),
    ('scikit-image', '0.12.3', '-Python-%(local_pyver)s', True)
]

configopts = '-DBLAS=open'

modextrapaths = {'PYTHONPATH': ['python']}

sanity_check_paths = {
    'files': ['bin/caffe'] +
             ['include/caffe/proto/caffe.pb.h'],
    'dirs': [],
}

sanity_check_commands = [('python', "-c 'import caffe'")]

moduleclass = 'devel'
