|
| 1 | +diff --git a/.bazelrc b/.bazelrc |
| 2 | +index c9ba801319..6c25d57934 100644 |
| 3 | +--- a/.bazelrc |
| 4 | ++++ b/.bazelrc |
| 5 | +@@ -37,6 +37,9 @@ test --test_env=RAY_USAGE_STATS_REPORT_URL="http://127.0.0.1:8000" |
| 6 | + # Enable cluster mode for OSX and Windows. By default, Ray |
| 7 | + # will not allow multinode OSX and Windows clusters. |
| 8 | + test --test_env=RAY_ENABLE_WINDOWS_OR_OSX_CLUSTER="1" |
| 9 | ++ |
| 10 | ++test --jobs=8 |
| 11 | ++test --local_ram_resources=8192 |
| 12 | + # This is needed for some core tests to run correctly |
| 13 | + build:windows --enable_runfiles |
| 14 | + # TODO(mehrdadn): Revert the "-\\.(asm|S)$" exclusion when this Bazel bug |
| 15 | +@@ -92,12 +95,12 @@ build:manylinux2010 --linkopt="-lrt" |
| 16 | + |
| 17 | + # LLVM (clang & libc++) build flags common across Linux installations and systems. |
| 18 | + # On Ubuntu, the remaining configurations can be generated by running ci/env/install-llvm-binaries.sh |
| 19 | +-build:llvm --action_env=CXXFLAGS=-stdlib=libc++ |
| 20 | +-build:llvm --action_env=LDFLAGS=-stdlib=libc++ |
| 21 | +-build:llvm --action_env=BAZEL_CXXOPTS=-stdlib=libc++ |
| 22 | +-build:llvm --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a |
| 23 | +-build:llvm --action_env=BAZEL_LINKOPTS=-lm:-pthread |
| 24 | +-build:llvm --define force_libcpp=enabled |
| 25 | ++# build:llvm --action_env=CXXFLAGS=-stdlib=libc++ |
| 26 | ++# build:llvm --action_env=LDFLAGS=-stdlib=libc++ |
| 27 | ++# build:llvm --action_env=BAZEL_CXXOPTS=-stdlib=libc++ |
| 28 | ++# build:llvm --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a |
| 29 | ++# build:llvm --action_env=BAZEL_LINKOPTS=-lm:-pthread |
| 30 | ++# build:llvm --define force_libcpp=enabled |
| 31 | + |
| 32 | + # Thread sanitizer configuration: |
| 33 | + build:tsan --per_file_copt="-bazel-ray/external/com_github_antirez_redis/.*$@-fsanitize=thread" |
1 | 34 | diff --git a/bazel/ray.bzl b/bazel/ray.bzl
|
2 |
| -index 4cd1aa2..95250a4 100644 |
| 35 | +index 4cd1aa2390..d051a6a36b 100644 |
3 | 36 | --- a/bazel/ray.bzl
|
4 | 37 | +++ b/bazel/ray.bzl
|
5 |
| -@@ -30,6 +30,9 @@ PYX_COPTS = select({ |
| 38 | +@@ -30,6 +30,10 @@ PYX_COPTS = select({ |
6 | 39 | "//conditions:default": [
|
7 | 40 | # Ignore this warning since CPython and Cython have issue removing deprecated tp_print on MacOS
|
8 | 41 | "-Wno-deprecated-declarations",
|
9 | 42 | + "-Wno-unused-variable",
|
10 | 43 | + "-Wno-unused-function",
|
| 44 | ++ "-Wno-unused-but-set-parameter", |
11 | 45 | + "-Wno-sign-compare",
|
12 | 46 | ],
|
13 | 47 | }) + select({
|
14 | 48 | "@bazel_tools//src/conditions:windows": [
|
15 | 49 | diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl
|
16 |
| -index f91eb30..b0d11ea 100644 |
| 50 | +index f91eb303c4..b0d11eafe6 100644 |
17 | 51 | --- a/bazel/ray_deps_setup.bzl
|
18 | 52 | +++ b/bazel/ray_deps_setup.bzl
|
19 | 53 | @@ -188,6 +188,10 @@ def ray_deps_setup():
|
@@ -110,7 +144,7 @@ index bee0ae6..ee0e3ea 100644
|
110 | 144 | "module": function.__module__,
|
111 | 145 | "function": pickled_function,
|
112 | 146 | - "collision_identifier": self.compute_collision_identifier(function),
|
113 |
| -+ # "collision_identifier": self.compute_collision_identifier(function), # code object is missing attribute '_varname_from_oparg' |
| 147 | ++ # "collision_identifier": self.compute_collision_identifier(function), # code object is missing attribute '_varname_from_oparg' |
114 | 148 | "max_calls": remote_function._max_calls,
|
115 | 149 | }
|
116 | 150 | )
|
@@ -254,7 +288,7 @@ index a34a39c..51a1a17 100644
|
254 | 288 | "fastapi",
|
255 | 289 | "aiorwlock",
|
256 | 290 | - "watchfiles",
|
257 |
| -+ # "watchfiles", # requires PyO3 patch (require embadding) |
| 291 | ++ # "watchfiles", # requires native libs embadding |
258 | 292 | ],
|
259 | 293 | "tune": ["pandas", "tensorboardX>=1.9", "requests", pyarrow_dep, "fsspec"],
|
260 | 294 | "observability": [
|
@@ -300,12 +334,22 @@ index a34a39c..51a1a17 100644
|
300 | 334 |
|
301 | 335 | bazel_flags = ["--verbose_failures"]
|
302 | 336 | if BAZEL_ARGS:
|
| 337 | +@@ -594,6 +595,9 @@ def build(build_python, build_java, build_cpp): |
| 338 | + if setup_spec.build_type == BuildType.TSAN: |
| 339 | + bazel_flags.extend(["--config=tsan"]) |
| 340 | + |
| 341 | ++ if os.environ.get('USE_GCC', '1') == '0': |
| 342 | ++ bazel_flags.extend(["--config=llvm"]) |
| 343 | ++ |
| 344 | + return bazel_invoke( |
| 345 | + subprocess.check_call, |
| 346 | + bazel_precmd_flags + ["build"] + bazel_flags + ["--"] + bazel_targets, |
303 | 347 | diff --git a/ray_build_backend.py b/ray_build_backend.py
|
304 | 348 | new file mode 100644
|
305 |
| -index 0000000000..10f532ae9e |
| 349 | +index 0000000000..89eb8fee6f |
306 | 350 | --- /dev/null
|
307 | 351 | +++ b/ray_build_backend.py
|
308 |
| -@@ -0,0 +1,125 @@ |
| 352 | +@@ -0,0 +1,155 @@ |
309 | 353 | +# We need a whole custom build backend just because the setup.py is in a subdir
|
310 | 354 | +import os
|
311 | 355 | +import re
|
@@ -407,19 +451,49 @@ index 0000000000..10f532ae9e
|
407 | 451 | + tar.add('.', filter=tarfilter)
|
408 | 452 | + return archive_path.name
|
409 | 453 | +
|
| 454 | ++llvm_bazel_conf = """ |
| 455 | ++build:llvm --action_env='BAZEL_COMPILER={LLVM_HOME}/bin/clang' |
| 456 | ++build:llvm --action_env='CC={LLVM_HOME}/bin/clang' |
| 457 | ++build:llvm --action_env='CXX={LLVM_HOME}/bin/clang++' |
| 458 | ++build:llvm --action_env='LLVM_CONFIG={LLVM_HOME}/bin/llvm-config' |
| 459 | ++build:llvm --repo_env='LLVM_CONFIG={LLVM_HOME}/bin/llvm-config' |
| 460 | ++build:llvm --linkopt='-fuse-ld={LLVM_HOME}/bin/ld.lld' |
| 461 | ++build:llvm --linkopt='-L{LLVM_HOME}/lib' |
| 462 | ++build:llvm --linkopt='-Wl,-rpath,{LLVM_HOME}/lib' |
| 463 | ++""" |
| 464 | ++ |
410 | 465 | +
|
411 | 466 | +def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
|
412 | 467 | + install_thirdparty_pkgs()
|
413 | 468 | + wheel_directory = Path(wheel_directory).absolute()
|
414 | 469 | + os.chdir('python')
|
415 | 470 | + env = os.environ.copy()
|
416 | 471 | + env['SKIP_THIRDPARTY_INSTALL'] = 'true'
|
417 |
| -+ try: |
418 |
| -+ system_num_cpus = __graalpython__.get_max_process_count() |
419 |
| -+ env['BAZEL_LIMIT_CPUS'] = '%d' % system_num_cpus |
420 |
| -+ except: |
421 |
| -+ # do not limit bazel |
422 |
| -+ pass |
| 472 | ++ use_gcc = env.get('USE_GCC', '0') |
| 473 | ++ if use_gcc == '0': |
| 474 | ++ llvm_home = env.get('LLVM_HOME', '') |
| 475 | ++ if llvm_home == '': |
| 476 | ++ clang_path = shutil.which('clang') |
| 477 | ++ if clang_path: |
| 478 | ++ bin_path = os.path.dirname(clang_path) |
| 479 | ++ llvm_home = os.path.dirname(bin_path) |
| 480 | ++ if llvm_home: |
| 481 | ++ use_gcc = '0' |
| 482 | ++ with open(os.path.join(os.path.dirname(__file__), '.llvm-local.bazelrc'), 'w') as fp: |
| 483 | ++ fp.write(llvm_bazel_conf.format(LLVM_HOME=llvm_home)) |
| 484 | ++ else: |
| 485 | ++ # we didn't find clang |
| 486 | ++ use_gcc = '1' |
| 487 | ++ |
| 488 | ++ env['USE_GCC'] = use_gcc |
| 489 | ++ |
| 490 | ++ if not os.environ.get('BAZEL_LIMIT_CPUS'): |
| 491 | ++ try: |
| 492 | ++ system_num_cpus = __graalpython__.get_max_process_count() |
| 493 | ++ env['BAZEL_LIMIT_CPUS'] = '%d' % system_num_cpus |
| 494 | ++ except: |
| 495 | ++ # do not limit bazel |
| 496 | ++ pass |
423 | 497 | + try:
|
424 | 498 | + if os.path.isdir(Path('dist')):
|
425 | 499 | + shutil.rmtree(Path('dist'))
|
|
0 commit comments