Page 1 of 1

Wie füge ich Cuda-Header richtig in das Projekt von Bazel ein?

Posted: 06 Jan 2025, 05:43
by Anonymous
Hier sind meine Einstellungen:
Die Arbeitsbereichsdatei:

Code: Select all

local_repository(
name = "cuda",
path = "/usr/local/cuda-12.6",  # Adjust this path to your CUDA installation
)
Die BUILD-Datei:

Code: Select all

cc_library(
name = "cuda_headers",
hdrs = glob(["cuda/targets/x86_64-linux/include/**/*.h"]),  # Matches all .h files at any depth
includes = ["cuda/targets/x86_64-linux/include"],            # Specify the include directory
visibility = ["//visibility:public"],                        # Adjust visibility as needed
)

cc_library(
name = "tensorrt_llm",
srcs = ["libs/libtensorrt_llm.so"],
hdrs = glob(["include/**/*.h"]),
includes = ["include"],
deps = ["cuda_headers"],
)

cc_library(
name = "nvinfer_plugin_tensorrt_llm",
srcs = ["libs/libnvinfer_plugin_tensorrt_llm.so"],
hdrs = glob(["include/**/*.h"]),
# includes = ["include"],
)

# BUILD file
cc_binary(
name = "executorExampleBasic",
srcs = ["executorExampleBasic.cpp"],
includes = ["include"],
deps = [":nvinfer_plugin_tensorrt_llm", ":cuda_headers"],  # Assuming nvinfer_plugin_tensorrt_llm is in the same package
copts = ["-DENABLE_BF16", "-DENABLE_FP8", "-lcudart_static", "-lcuda_nvml", "-lcuda_driver", ],
)
In main.cpp:

Code: Select all

#include 
Der Fehler ist: executorExampleBasic.cpp:18:10: schwerwiegender Fehler: cuda_bf16.h: Keine solche Datei oder kein solches Verzeichnis 18 | #include
Meine Frage ist also: Ist die Methode, die ich verwende, um die Cuda-Header einzubeziehen, richtig? Wenn ja, warum kann Bazel cuda_bf16.h immer noch nicht finden?