forked from NVIDIA-Merlin/HierarchicalKV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8a15cc
commit 349b09c
Showing
23 changed files
with
3,942 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
build -c opt | ||
build --copt -O3 | ||
build --copt -pthread | ||
build --linkopt -pthread | ||
build --linkopt -ldl | ||
build --incompatible_linkopts_to_linklibs | ||
build --copt -g --strip=never | ||
build --experimental_repo_remote_exec | ||
|
||
# This config refers to building CUDA kernels with nvcc. | ||
build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain | ||
|
||
# CUDA options | ||
build:cuda --action_env GCC_HOST_COMPILER_PATH="/opt/rh/devtoolset-9/root/usr/bin/gcc" | ||
build:cuda --action_env CUDA_TOOLKIT_PATH="/usr/local/cuda" | ||
build:cuda --action_env CUDA_VERSION="11" | ||
build:cuda --action_env CUDNN_VERSION="8" | ||
build:cuda --action_env CUDNN_INSTALL_PATH="/usr/local/cuda" | ||
build:cuda --action_env CUDA_COMPUTE_CAPABILITIES="7.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
workspace(name = "HierarchicalKV") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("//build_deps/gpus:configure.bzl", "cuda_configure") | ||
|
||
http_archive( | ||
name = "bazel_skylib", | ||
sha256 = "1dde365491125a3db70731e25658dfdd3bc5dbdfd11b840b3e987ecf043c7ca0", | ||
urls = [ | ||
"https://github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz", | ||
], | ||
) | ||
|
||
cuda_configure(name = "local_config_cuda") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
load("@local_config_cuda//cuda:build_defs.bzl", "cuda_library") | ||
|
||
cc_binary( | ||
name = "benchmark_util", | ||
deps = [ | ||
":benchmark_lib", | ||
], | ||
) | ||
|
||
cuda_library( | ||
name = "benchmark_lib", | ||
srcs = [ | ||
"merlin_hashtable_benchmark.cc.cu", | ||
], | ||
hdrs = [ | ||
"benchmark_util.cuh", | ||
], | ||
copts = ["-Iinclude/"], | ||
linkopts = ["-pthread"], | ||
deps = [ | ||
"//include:merlin_hashtable", | ||
"@local_config_cuda//cuda", | ||
], | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Copyright (c) 2023, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
"""Verifies that a list of libraries is installed on the system. | ||
Takes a list of arguments with every two subsequent arguments being a logical | ||
tuple of (path, check_soname). The path to the library and either True or False | ||
to indicate whether to check the soname field on the shared library. | ||
Example Usage: | ||
./check_cuda_libs.py /path/to/lib1.so True /path/to/lib2.so False | ||
""" | ||
import os | ||
import os.path | ||
import platform | ||
import subprocess | ||
import sys | ||
|
||
# pylint: disable=g-import-not-at-top,g-importing-member | ||
try: | ||
from shutil import which | ||
except ImportError: | ||
from distutils.spawn import find_executable as which | ||
# pylint: enable=g-import-not-at-top,g-importing-member | ||
|
||
|
||
class ConfigError(Exception): | ||
pass | ||
|
||
|
||
def check_cuda_lib(path, check_soname=True): | ||
"""Tests if a library exists on disk and whether its soname matches the filename. | ||
Args: | ||
path: the path to the library. | ||
check_soname: whether to check the soname as well. | ||
Raises: | ||
ConfigError: If the library does not exist or if its soname does not match | ||
the filename. | ||
""" | ||
if not os.path.isfile(path): | ||
raise ConfigError("No library found under: " + path) | ||
objdump = which("objdump") | ||
if check_soname and objdump is not None: | ||
# Decode is necessary as in py3 the return type changed from str to bytes | ||
output = subprocess.check_output([objdump, "-p", path]).decode("utf-8") | ||
output = [line for line in output.splitlines() if "SONAME" in line] | ||
sonames = [line.strip().split(" ")[-1] for line in output] | ||
if not any(soname == os.path.basename(path) for soname in sonames): | ||
raise ConfigError("None of the libraries match their SONAME: " + | ||
path) | ||
|
||
|
||
def main(): | ||
try: | ||
args = [argv for argv in sys.argv[1:]] | ||
if len(args) % 2 == 1: | ||
raise ConfigError("Expected even number of arguments") | ||
checked_paths = [] | ||
for i in range(0, len(args), 2): | ||
path = args[i] | ||
check_cuda_lib(path, check_soname=args[i + 1] == "True") | ||
checked_paths.append(path) | ||
# pylint: disable=superfluous-parens | ||
print(os.linesep.join(checked_paths)) | ||
# pylint: enable=superfluous-parens | ||
except ConfigError as e: | ||
sys.stderr.write(str(e)) | ||
sys.exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.