summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2020-04-04 11:35:23 -0500
committerGitHub <noreply@github.com>2020-04-04 11:35:23 -0500
commit9b9b46c0a98ec311db79592d716b27c79d501437 (patch)
treee7b8e4d417e64109cdb77d65ed09e7e48b1873f3
parent4ee9fd46bc41759e1c8e70b70d538a458edf8413 (diff)
downloadspack-9b9b46c0a98ec311db79592d716b27c79d501437.tar.gz
spack-9b9b46c0a98ec311db79592d716b27c79d501437.tar.bz2
spack-9b9b46c0a98ec311db79592d716b27c79d501437.tar.xz
spack-9b9b46c0a98ec311db79592d716b27c79d501437.zip
Package rename: intel-mkl-dnn -> dnnl (#15852)
-rw-r--r--var/spack/repos/builtin/packages/dnnl/package.py (renamed from var/spack/repos/builtin/packages/intel-mkl-dnn/package.py)47
-rw-r--r--var/spack/repos/builtin/packages/py-torch/package.py2
2 files changed, 39 insertions, 10 deletions
diff --git a/var/spack/repos/builtin/packages/intel-mkl-dnn/package.py b/var/spack/repos/builtin/packages/dnnl/package.py
index c57b3c70a7..9b339a5a01 100644
--- a/var/spack/repos/builtin/packages/intel-mkl-dnn/package.py
+++ b/var/spack/repos/builtin/packages/dnnl/package.py
@@ -3,14 +3,15 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-from spack import *
+import sys
-class IntelMklDnn(CMakePackage):
- """Intel(R) Math Kernel Library for Deep Neural Networks
- (Intel(R) MKL-DNN)."""
+class Dnnl(CMakePackage):
+ """Deep Neural Network Library (DNNL).
- homepage = "https://intel.github.io/mkl-dnn/"
+ Formerly known as Intel MKL-DNN."""
+
+ homepage = "https://01.org/dnnl"
url = "https://github.com/intel/mkl-dnn/archive/v1.3.tar.gz"
maintainers = ['adamjstewart']
@@ -46,15 +47,38 @@ class IntelMklDnn(CMakePackage):
version('0.10', sha256='59828764ae43f1151f77b8997012c52e0e757bc50af1196b86fce8934178c570')
version('0.9', sha256='8606a80851c45b0076f7d4047fbf774ce13d6b6d857cb2edf95c7e1fd4bca1c7')
+ default_cpu_runtime = 'omp'
+ if sys.platform == 'darwin':
+ default_cpu_runtime = 'tbb'
+
+ variant('cpu_runtime', default=default_cpu_runtime,
+ description='CPU threading runtime to use',
+ values=('omp', 'tbb', 'seq'), multi=False)
+ variant('gpu_runtime', default='none',
+ description='Runtime to use for GPU engines',
+ values=('ocl', 'none'), multi=False)
+
+ # https://github.com/intel/mkl-dnn#requirements-for-building-from-source
depends_on('cmake@2.8.11:', type='build')
- depends_on('intel-mkl')
- depends_on('llvm-openmp', when='%clang platform=darwin')
+ depends_on('tbb@2017:', when='cpu_runtime=tbb')
+ depends_on('llvm-openmp', when='%clang platform=darwin cpu_runtime=omp')
+ depends_on('opencl@1.2:', when='gpu_runtime=ocl')
def cmake_args(self):
- args = []
+ args = [
+ '-DDNNL_CPU_RUNTIME={0}'.format(
+ self.spec.variants['cpu_runtime'].value.upper()),
+ '-DDNNL_GPU_RUNTIME={0}'.format(
+ self.spec.variants['gpu_runtime'].value.upper()),
+ ]
+
+ if self.run_tests:
+ args.append('-DDNNL_BUILD_TESTS=ON')
+ else:
+ args.append('-DDNNL_BUILD_TESTS=OFF')
# https://github.com/intel/mkl-dnn/issues/591
- if self.spec.satisfies('%clang platform=darwin'):
+ if self.spec.satisfies('%clang platform=darwin cpu_runtime=omp'):
args.extend([
'-DOpenMP_CXX_FLAGS={0}'.format(self.compiler.openmp_flag),
'-DOpenMP_C_FLAGS={0}'.format(self.compiler.openmp_flag),
@@ -67,5 +91,10 @@ class IntelMklDnn(CMakePackage):
self.spec['llvm-openmp'].libs.ld_flags
),
])
+ elif self.spec.satisfies('cpu_runtime=tbb'):
+ args.append('-DTBBROOT=' + self.spec['tbb'].prefix)
+
+ if self.spec.satisfies('gpu_runtime=ocl'):
+ args.append('-DOPENCLROOT=' + self.spec['opencl'].prefix)
return args
diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py
index e1dbdccb6d..a60486a64c 100644
--- a/var/spack/repos/builtin/packages/py-torch/package.py
+++ b/var/spack/repos/builtin/packages/py-torch/package.py
@@ -154,7 +154,7 @@ class PyTorch(PythonPackage, CudaPackage):
# TODO: See if there is a way to use an external mkldnn installation.
# Currently, only older versions of py-torch use an external mkldnn
# library.
- depends_on('intel-mkl-dnn', when='@0.4:0.4.1+mkldnn')
+ depends_on('dnnl', when='@0.4:0.4.1+mkldnn')
# TODO: add dependency: https://github.com/Maratyszcza/NNPACK
# depends_on('nnpack', when='+nnpack')
depends_on('qnnpack', when='+qnnpack')