forked from codeplaysoftware/portBLAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
144 lines (125 loc) · 5.45 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
from conans import ConanFile, tools, CMake, RunEnvironment
from conans.errors import ConanInvalidConfiguration, ConanException
import os
class SyclblasConan(ConanFile):
name = "sycl-blas"
version = "1.0"
settings = "os", "compiler", "build_type", "arch"
description = "An implementation of BLAS using the SYCL open standard for acceleration on OpenCL devices"
url = "https://github.com/codeplaysoftware/sycl-blas"
license = "Apache-2.0"
author = "Codeplay Software Ltd."
topics = ('sycl', 'blas')
options = {
"shared": [True, False],
"fPIC": [True, False],
"acl_backend": ["neon", "opencl"],
"build_acl_benchmarks": [True, False],
"build_benchmarks": [True, False],
"build_clblast_benchmarks": [True, False],
"build_expression_tests": [True, False],
"build_testing": [True, False],
"sycl_target": "ANY",
}
default_options = {
"shared": False,
"fPIC": True,
"acl_backend": "opencl",
"build_acl_benchmarks": False,
"build_benchmarks": False,
"build_clblast_benchmarks": False,
"build_expression_tests": False,
"build_testing": False,
"khronos-opencl-icd-loader:shared": True,
"clblast:shared": True,
"sycl_target": "spirv64"
}
scm = {
"type": "git",
"url": "auto",
"revision": "auto",
"submodule": "recursive",
}
generators = "cmake"
def dep(self, package, fallback_user="_", fallback_channel="_"):
"""
Helper function to switch between internal package forks and community packages
"""
try:
if self.user and self.channel:
return "%s@%s/%s" % (package, self.user, self.channel)
except ConanException:
pass
return "%s@%s/%s" % (package, fallback_user, fallback_channel)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if not self.options.build_benchmarks:
if self.options.build_acl_benchmarks:
raise ConanInvalidConfiguration("build_acl_benchmarks requires build_benchmarks")
if self.options.build_clblast_benchmarks:
raise ConanInvalidConfiguration("build_clblast_benchmarks requires build_benchmarks")
if not self.options.build_testing:
if self.options.build_expression_tests:
raise ConanInvalidConfiguration("build_expression_tests requires build_testing")
def build_requirements(self):
def build_dep(package, fallback_user="_", fallback_channel="_"):
return self.build_requires(self.dep(package, fallback_user, fallback_channel))
if self.options.build_benchmarks:
build_dep("benchmark/1.5.0")
if self.options.build_acl_benchmarks:
build_dep("computelibrary/19.08", "mmha", "stable")
if self.options.build_clblast_benchmarks:
build_dep("clblast/1.5.0", "mmha", "stable")
if self.options.build_testing:
build_dep("gtest/1.10.0")
if self.options.build_testing or self.options.build_benchmarks:
build_dep("clara/1.1.5", "bincrafters", "stable")
build_dep("openblas/0.3.7", "mmha", "stable")
def requirements(self):
self.requires(self.dep("khronos-opencl-icd-loader/20191007", "bincrafters", "stable"), override=True)
self.requires(self.dep("khronos-opencl-headers/20190806", "bincrafters", "stable"), override=True)
def imports(self):
tools.get(
"https://computecpp.codeplay.com/downloads/computecpp-ce/1.1.6/ubuntu-16.04-64bit.tar.gz"
)
_cmake = None
@property
def cmake(self):
if self._cmake is None:
self._cmake = CMake(self)
ccp_path = os.path.join(self.build_folder,
"ComputeCpp-CE-1.1.6-Ubuntu-16.04-x86_64")
clblast_benchmarks = self.options.build_clblast_benchmarks
config = {
"ACL_BACKEND": str(self.options.acl_backend).upper(),
"BLAS_ENABLE_BENCHMARK": self.options.build_benchmarks,
"BLAS_ENABLE_TESTING": self.options.build_testing,
"BLAS_VERIFY_BENCHMARK": self.options.build_benchmarks,
"BUILD_ACL_BENCHMARKS": self.options.build_acl_benchmarks,
"BUILD_CLBLAST_BENCHMARKS": clblast_benchmarks,
"COMPUTECPP_BITCODE": self.options.sycl_target,
"ComputeCpp_DIR": ccp_path,
"ENABLE_EXPRESSION_TESTS": self.options.build_expression_tests,
}
self._cmake.definitions.update(config)
with tools.environment_append(RunEnvironment(self).vars):
self._cmake.configure()
return self._cmake
def build(self):
with tools.environment_append(RunEnvironment(self).vars):
self.cmake.build()
if self.options.build_testing:
self.cmake.test()
def package(self):
self.cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
def package_id(self):
del self.info.options.build_testing
del self.info.options.build_expression_tests
del self.info.options.build_benchmarks
del self.info.options.build_acl_benchmarks
del self.info.options.build_clblast_benchmarks
del self.info.options.acl_backend