Skip to content

Commit d88fa08

Browse files
committed
refactor(//third_party/cublas): Adding paths for x85 in the cuBLAS BUILD
to satisfy Bazel Adding the paths for cuBLAS in cuda to the BUILD for cuBLAS just to let bazel track them. We will still use the cuBLAS from the CUDA build on x86 since it will let us version better. Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent a8008f4 commit d88fa08

File tree

4 files changed

+56
-11
lines changed

4 files changed

+56
-11
lines changed

WORKSPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ new_local_repository(
3838
path = "/usr/local/cuda-11.1/",
3939
)
4040

41+
new_local_repository(
42+
name = "cublas",
43+
build_file = "@//third_party/cublas:BUILD",
44+
path = "/usr",
45+
)
4146
#############################################################################################################
4247
# Tarballs and fetched dependencies (default - use in cases when building from precompiled bin and tarballs)
4348
#############################################################################################################

third_party/cublas/BUILD

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

3+
# NOTE: This BUILD file is only really targeted at aarch64, the rest of the configuration is just to satisfy bazel, x86 uses the cublas source from the CUDA build file since it will be versioned with CUDA.
4+
35
config_setting(
46
name = "aarch64_linux",
57
constraint_values = [
@@ -8,9 +10,19 @@ config_setting(
810
],
911
)
1012

13+
config_setting(
14+
name = "windows",
15+
constraint_values = [
16+
"@platforms//os:windows",
17+
],
18+
)
19+
1120
cc_library(
1221
name = "cublas_headers",
13-
hdrs = ["include/cublas.h"] + glob(["include/cublas+.h"]),
22+
hdrs = select({
23+
":aarch64_linux": ["include/cublas.h"] + glob(["usr/include/cublas+.h"]),
24+
"//conditions:default": ["local/cuda/include/cublas.h"] + glob(["usr/cuda/include/cublas+.h"]),
25+
}),
1426
includes = ["include/"],
1527
visibility = ["//visibility:private"],
1628
)
@@ -19,7 +31,8 @@ cc_import(
1931
name = "cublas_lib",
2032
shared_library = select({
2133
":aarch64_linux": "lib/aarch64-linux-gnu/libcublas.so",
22-
"//conditions:default": "lib/x86_64-linux-gnu/libcublas.so",
34+
":windows": "lib/x64/cublas.lib",
35+
"//conditions:default": "local/cuda/targets/x86_64-linux/lib/libcublas.so",
2336
}),
2437
visibility = ["//visibility:private"],
2538
)
@@ -28,7 +41,7 @@ cc_import(
2841
name = "cublas_lt_lib",
2942
shared_library = select({
3043
":aarch64_linux": "lib/aarch64-linux-gnu/libcublasLt.so",
31-
"//conditions:default": "lib/x86_64-linux-gnu/libcublasLt.so",
44+
"//conditions:default": "local/cuda/targets/x86_64-linux/lib/libcublasLt.so",
3245
}),
3346
visibility = ["//visibility:private"],
3447
)

third_party/tensorrt/archive/BUILD

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

3+
config_setting(
4+
name = "aarch64_linux",
5+
constraint_values = [
6+
"@platforms//cpu:aarch64",
7+
"@platforms//os:linux",
8+
],
9+
)
10+
11+
config_setting(
12+
name = "windows",
13+
constraint_values = [
14+
"@platforms//os:windows",
15+
],
16+
)
17+
318
cc_library(
419
name = "nvinfer_headers",
520
hdrs = glob(
@@ -27,10 +42,13 @@ cc_library(
2742
deps = [
2843
"nvinfer_headers",
2944
"nvinfer_lib",
30-
"@cuda//:cublas",
3145
"@cuda//:cudart",
3246
"@cudnn",
33-
],
47+
] + select({
48+
":aarch64_linux": ["@cublas//:cublas"],
49+
":windows": ["@cuda//:cublas"],
50+
"//conditions:default": ["@cuda//:cublas"],
51+
}),
3452
)
3553

3654
####################################################################################
@@ -165,8 +183,11 @@ cc_library(
165183
"nvinfer",
166184
"nvinferplugin_headers",
167185
"nvinferplugin_lib",
168-
"@cublas//:cublas",
169186
"@cuda//:cudart",
170187
"@cudnn",
171-
],
188+
] + select({
189+
":aarch64_linux": ["@cublas//:cublas"],
190+
":windows": ["@cuda//:cublas"],
191+
"//conditions:default": ["@cuda//:cublas"],
192+
}),
172193
)

third_party/tensorrt/local/BUILD

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,13 @@ cc_library(
8686
deps = [
8787
"nvinfer_headers",
8888
"nvinfer_lib",
89-
"@cuda//:cublas",
9089
"@cuda//:cudart",
9190
"@cudnn",
92-
],
91+
] + select({
92+
":aarch64_linux": ["@cublas//:cublas"],
93+
":windows": ["@cuda//:cublas"],
94+
"//conditions:default": ["@cuda//:cublas"],
95+
}),
9396
)
9497

9598
####################################################################################
@@ -305,9 +308,12 @@ cc_library(
305308
"nvinfer",
306309
"@cublas//:cublas",
307310
"@cuda//:cudart",
308-
"@cuda//:cublas",
309311
"@cudnn",
310-
],
312+
] + select({
313+
":aarch64_linux": ["@cublas//:cublas"],
314+
":windows": ["@cuda//:cublas"],
315+
"//conditions:default": ["@cuda//:cublas"],
316+
}),
311317
alwayslink = True,
312318
copts = [
313319
"-pthread"

0 commit comments

Comments
 (0)