tensorflow/third_party/uv/uv.BUILD
Heiner 7628691e41 PR #16014: Gloo support for MacOS: Second try
Imported from GitHub PR https://github.com/openxla/xla/pull/16014

This works for me(tm) on

```
$ uname -a
Darwin joeliel.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031 arm64
```

I build the wheel via

```
python build/build.py --bazel_options=--override_repository=xla=~/src/xla/ --noenable_cuda
```

(in JAX, commit `833560deb1a94971c3f607a31b18d493b116e2d0`).

I then install the `jaxlib` wheel and update JAX via

```
uv pip install dist/jaxlib-0.4.32.dev20240812-cp310-cp310-macosx_11_0_arm64.whl --force-reinstall
uv pip install .
```

The following works:

```
$ python -c "import jax; print(jax.default_backend()); print(jax.devices()); print(len(jax.devices()))"
cpu
[CpuDevice(id=0)]
1
```

Likewise with this JAX wheel my use case for `jax_cpu_collectives_implementation:gloo` works on MacOS.
Copybara import of the project:

--
f8387de2cd9486356466a6d4daa6eabca4af0316 by Heiner <heiner@x.ai>:

Add Gloo support for MacOS.

This requires using libuv.

Update third_party/gloo/gloo.BUILD

Co-authored-by: Penporn Koanantakool <38085909+penpornk@users.noreply.github.com>

Update third_party/uv/uv.BUILD

Co-authored-by: Penporn Koanantakool <38085909+penpornk@users.noreply.github.com>

Update third_party/uv/BUILD

Co-authored-by: Penporn Koanantakool <38085909+penpornk@users.noreply.github.com>

Fix MacOS Gloo sources.

Context: https://github.com/openxla/xla/pull/15027#issuecomment-2266246249

--
9613e13fe468449b74771905b7d104f19b5a67b2 by Heiner <heiner@x.ai>:

Add more Gloo deps.

--
31a528b8e3caa0a3f5bc20db4a0a89a7e94dd68d by Heiner <heiner@x.ai>:

clang-format.

--
ad9d993caf389c5c267ac48aa74a945af7f4b46a by Heiner <heiner@x.ai>:

Fix test by linking statically.

--
41c1ec9bb2b104f31e827aaec39afd768c7c61c0 by Heiner <heiner@x.ai>:

Update xla/pjrt/cpu/gloo_collectives_test.cc

Co-authored-by: Penporn Koanantakool <38085909+penpornk@users.noreply.github.com>
--
483a250d9ab9bcdf8ee6994b13db68951d9cd584 by Heiner <heiner@x.ai>:

Update xla/python/xla.cc

Co-authored-by: Penporn Koanantakool <38085909+penpornk@users.noreply.github.com>

Merging this change closes #16014

PiperOrigin-RevId: 663315155
2024-08-15 08:56:55 -07:00

83 lines
2.0 KiB
Plaintext

# Description:
# libuv is a cross-platform asynchronous I/O library.
package(
default_visibility = ["//visibility:public"],
)
licenses(["notice"])
exports_files(["LICENSE"])
cc_library(
name = "uv",
srcs = [
"src/fs-poll.c",
"src/idna.c",
"src/inet.c",
"src/random.c",
"src/strscpy.c",
"src/threadpool.c",
"src/timer.c",
"src/uv-common.c",
"src/uv-data-getter-setters.c",
"src/version.c",
] + [
"src/unix/async.c",
"src/unix/core.c",
"src/unix/dl.c",
"src/unix/fs.c",
"src/unix/getaddrinfo.c",
"src/unix/getnameinfo.c",
"src/unix/loop.c",
"src/unix/loop-watcher.c",
"src/unix/pipe.c",
"src/unix/poll.c",
"src/unix/process.c",
"src/unix/random-devurandom.c",
"src/unix/signal.c",
"src/unix/stream.c",
"src/unix/tcp.c",
"src/unix/thread.c",
"src/unix/tty.c",
"src/unix/udp.c",
] + select({
"@platforms//os:osx": [
"src/unix/bsd-ifaddrs.c",
"src/unix/darwin.c",
"src/unix/darwin-proctitle.c",
"src/unix/fsevents.c",
"src/unix/kqueue.c",
"src/unix/proctitle.c",
"src/unix/random-getentropy.c",
],
}),
# TODO: Add Linux, etc. as in https://github.com/libuv/libuv/blob/v1.38.0/CMakeLists.txt.
hdrs = [
"include/uv.h",
"src/heap-inl.h",
"src/idna.h",
"src/queue.h",
"src/strscpy.h",
"src/unix/atomic-ops.h",
"src/unix/internal.h",
"src/unix/spinlock.h",
"src/uv-common.h",
] + select({
"@platforms//os:osx": [
"src/unix/darwin-stub.h",
],
}) + glob(["include/uv/*.h"]),
copts = [
"-fexceptions",
"-Wno-unused-variable",
],
includes = [
"include",
"src",
],
textual_hdrs = [
"include/uv.h",
],
)