Skip to content

Commit

Permalink
Fixes to build scripts to generate pjrt_c_api_cpu_plugin.o under /usr…
Browse files Browse the repository at this point in the history
…/local/lib as well.
  • Loading branch information
janpfeifer committed Nov 24, 2024
1 parent 98de5dc commit cfbcdac
Show file tree
Hide file tree
Showing 3 changed files with 514 additions and 5 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ For Linux (or Windows+WSL)+CUDA (NVidia GPU) support, in addition also run ([see
curl -sSf https://raw.githubusercontent.com/gomlx/gopjrt/main/cmd/install_cuda.sh | bash
```

* ** 🚧🛠️ Mac (Darwin) support currently broken 🛠🚧️**: follow discussion in [XLA's issue #19152](https://github.com/openxla/xla/issues/19152) (and on XLA's discord channels)
Currently for Darwin (MacOS) 🚧🛠 it only works with statically linked CPU plugin 🛠🚧️ so that is the default (see issue in [XLA's issue #19152](https://github.com/openxla/xla/issues/19152) and on XLA's discord channels).
**Experimental**.

```bash
curl -sSf https://raw.githubusercontent.com/gomlx/gopjrt/main/cmd/install_darwin_arm64.sh | bash
```

**That's it**. The next sections explains in more details for those interested in special cases.

Expand Down Expand Up @@ -304,6 +309,8 @@ All tests support the following build tags to pre-link the CPU plugin (as oppose
* `--tags pjrt_cpu_dynamic`: link (preload) the CPU PJRT plugin from the dynamic library (`.so`) version.
Faster to build, but deployments require deploying the `libpjrt_c_api_cpu_dynamic.so` file along.

For Darwin (MacOS), for the time being it's hardcoded with static linking, so avoid using these tags.

## Acknowledgements
This project utilizes the following components from the [OpenXLA project](https://openxla.org/):

Expand Down
10 changes: 6 additions & 4 deletions c/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ genrule(
],
outs = ["lib/libpjrt_c_api_cpu_dynamic.so"],
cmd = """
mkdir -p "$(@D)/gomlx/pjrt/"
ln "$(location @xla//xla/pjrt/c:pjrt_c_api_cpu_plugin.so)" "$(@D)/gomlx/pjrt/pjrt_c_api_cpu_plugin.so"
mkdir -p "$(@D)"
ln -sf "gomlx/pjrt/pjrt_c_api_cpu_plugin.so" "$@"
mkdir -p "$(@D)/gomlx/pjrt/" ;
ln -f "$(location @xla//xla/pjrt/c:pjrt_c_api_cpu_plugin.so)" "$(@D)/gomlx/pjrt/pjrt_c_api_cpu_plugin.so" ;
pushd "$(@D)" ;
ln -sf "gomlx/pjrt/pjrt_c_api_cpu_plugin.so" "libpjrt_c_api_cpu_dynamic.so" ;
ln -sf "gomlx/pjrt/pjrt_c_api_cpu_plugin.so" "pjrt_c_api_cpu_plugin.so" ;
popd
""",
)

Expand Down
Loading

0 comments on commit cfbcdac

Please sign in to comment.