Skip to content

Commit 20415f0

Browse files
narendasanandi4191
authored andcommitted
fix(//third_party/cublas): cuBLAS source was incorrect, breaking out
cuBLAS into its own dependency should follow the same workflow as CUDA (i.e. local only) Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 28fc9ff commit 20415f0

File tree

2 files changed

+64
-22
lines changed

2 files changed

+64
-22
lines changed

third_party/cublas/BUILD

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
config_setting(
4+
name = "aarch64",
5+
values = {
6+
"cpu" : "aarch64",
7+
},
8+
)
9+
10+
cc_library(
11+
name = "cublas_headers",
12+
hdrs = ["include/cublas.h"] + glob(["include/cublas+.h"]),
13+
includes = ["include/"],
14+
visibility = ["//visibility:private"],
15+
)
16+
17+
cc_import(
18+
name = "cublas_lib",
19+
shared_library = select({
20+
"aarch64" : "lib/aarch64-linux-gnu/libcublas.so.10",
21+
"//conditions:default" : "lib/x86_64-linux-gnu/libcublas.so.10",
22+
}),
23+
visibility = ["//visibility:private"],
24+
)
25+
26+
cc_library(
27+
name = "cublas",
28+
deps = [
29+
"cublas_headers",
30+
"cublas_lib"
31+
],
32+
visibility = ["//visibility:public"],
33+
)

third_party/cuda/BUILD

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
package(default_visibility = ["//visibility:public"])
22

3+
config_setting(
4+
name = "aarch64",
5+
values = {
6+
"cpu" : "aarch64",
7+
},
8+
)
9+
310
cc_library(
411
name = "cudart",
5-
srcs = glob([
6-
"lib/**/libcudart.so",
7-
]),
12+
srcs = select({
13+
":aarch64": [
14+
"targets/aarch64-linux-gnu/lib/libcudart.so",
15+
],
16+
"//conditions:default": [
17+
"targets/x86_64-linux/lib/libcudart.so",
18+
]
19+
}),
820
hdrs = glob([
921
"include/**/*.h",
1022
"include/**/*.hpp",
@@ -15,16 +27,26 @@ cc_library(
1527

1628
cc_library(
1729
name = "nvToolsExt",
18-
srcs = glob([
19-
"lib/**/libnvToolsExt.so.1"
20-
])
30+
srcs = select({
31+
":aarch64": [
32+
"targets/aarch64-linux-gnu/lib/libnvToolsExt.so.1",
33+
],
34+
"//conditions:default": [
35+
"targets/x86_64-linux/lib/libnvToolsExt.so.1",
36+
]
37+
}),
2138
)
2239

2340
cc_library(
2441
name = "cuda",
25-
srcs = glob([
26-
"lib/**/*libcuda.so",
27-
]),
42+
srcs = select({
43+
":aarch64": glob([
44+
"targets/aarch64-linux-gnu/lib/**/lib*.so",
45+
]),
46+
"//conditions:default": glob([
47+
"targets/x86_64-linux/lib/**/lib*.so",
48+
])
49+
}),
2850
hdrs = glob([
2951
"include/**/*.h",
3052
"include/**/*.hpp",
@@ -34,16 +56,3 @@ cc_library(
3456
linkopts = ["-Wl,-rpath,lib/"],
3557
)
3658

37-
cc_library(
38-
name = "cublas",
39-
srcs = glob([
40-
"lib/**/*libcublas.so",
41-
]),
42-
hdrs = glob([
43-
"include/**/*cublas*.h",
44-
"include/**/*.hpp",
45-
"include/**/*.inl",
46-
]),
47-
includes = ["include/"],
48-
linkopts = ["-Wl,-rpath,lib/"],
49-
)

0 commit comments

Comments
 (0)