Closed dbl001 closed 1 year ago
I'm not sure what's up here, given we routinely build jaxlib on Mac.
The paths like /usr/local/include/llvm/Support/Compiler.h
make me think that for some reason a system LLVM is involved: it should not be.
There's a llvm-project built from github which installed with files in /usr/local/include and /usr/local/bin. There's also one from MacPorts
% port list llvm-15
llvm-15 @15.0.7 lang/llvm-15
Then there's the Apple version. What's the correct version to build jaxlib on the Mac? How do I specify which version to use (e.g. environment variable, build flag?
You shouldn't be using any of these. The jaxlib
build downloads its own LLVM version. I'm not sure how or why these are getting picked up, but one thing you could try is removing the MacPorts LLVM release.
The trace shows /usr/local ... but MacPorts would be in /opt/local. So, it's picking up the github version of llvm-project that was built and installed. Somehow,it seems that it's using my search path to find the include files and not one's that are local to the jaxlib build.
Also, issue finding xla:
% python build/build.py --bazel_options=--@xla//xla/python:enable_tpu=true
ERROR: @xla//xla/python:enable_tpu :: Error loading option @xla//xla/python:enable_tpu: no such package '@xla//xla/python': The repository '@xla' could not be resolved
If I remove ' --bazel_options=--@xla//xla/python:enable_tpu=true', then,
(ai) (jax-metal) davidlaxer@BlueDiamond-2 jax % export CC=/usr/local/bin/clang
export CXX=/usr/local/bin/clang++
% /usr/local/bin/clang --version
clang version 15.0.0 (https://github.com/llvm/llvm-project.git 89818f2dc0b6edeaf9f74ada513ebe489de8ba40)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /usr/local/bin
% python build/build.py
_ _ __ __
| | / \ \ \/ /
_ | |/ _ \ \ /
| |_| / ___ \/ \
\___/_/ \/_/\_\
WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE.
Bazel binary path: ./bazel-3.7.2-darwin-x86_64
Python binary path: /Users/davidlaxer/jax-metal/bin/python
Python version: 3.8
NumPy version: 1.24.4
SciPy version: 1.10.1
MKL-DNN enabled: yes
Target CPU features: release
CUDA enabled: no
TPU enabled: no
ROCm enabled: no
Building XLA and installing it in the jaxlib source tree...
./bazel-3.7.2-darwin-x86_64 run --verbose_failures=true --config=short_logs --config=avx_posix --config=mkl_open_source_only :build_wheel -- --output_path=/Users/davidlaxer/jax/dist
WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE.
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'run' from /Users/davidlaxer/jax/.bazelrc:
Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'run' from /Users/davidlaxer/jax/.bazelrc:
Inherited 'build' options: --repo_env PYTHON_BIN_PATH=/Users/davidlaxer/jax-metal/bin/python --action_env=PYENV_ROOT --python_path=/Users/davidlaxer/jax-metal/bin/python --repo_env TF_NEED_CUDA=0 --action_env TF_CUDA_COMPUTE_CAPABILITIES=3.5,5.2,6.0,6.1,7.0 --repo_env TF_NEED_ROCM=0 --action_env TF_ROCM_AMDGPU_TARGETS=gfx803,gfx900,gfx906,gfx1010 --distinct_host_configuration=false -c opt --apple_platform_type=macos --macos_minimum_os=10.9 --announce_rc --define open_source_build=true --define=no_kafka_support=true --define=no_ignite_support=true --define=grpc_no_ares=true --spawn_strategy=standalone --strategy=Genrule=standalone --enable_platform_specific_config
INFO: Found applicable config definition build:short_logs in file /Users/davidlaxer/jax/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:avx_posix in file /Users/davidlaxer/jax/.bazelrc: --copt=-mavx --host_copt=-mavx
INFO: Found applicable config definition build:mkl_open_source_only in file /Users/davidlaxer/jax/.bazelrc: --define=tensorflow_mkldnn_contraction_kernel=1
INFO: Found applicable config definition build:macos in file /Users/davidlaxer/jax/.bazelrc: --config=posix
INFO: Found applicable config definition build:posix in file /Users/davidlaxer/jax/.bazelrc: --copt=-Wno-sign-compare --define=no_aws_support=true --define=no_gcp_support=true --define=no_hdfs_support=true --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
Loading:
Loading: 0 packages loaded
DEBUG: /private/var/tmp/_bazel_davidlaxer/8ad43b8709647bf5741554c65757d353/external/tf_runtime/third_party/cuda/dependencies.bzl:51:10: The following command will download NVIDIA proprietary software. By using the software you agree to comply with the terms of the license agreement that accompanies the software. If you do not agree to the terms of the license agreement, do not use the software.
Analyzing: target //build:build_wheel (0 packages loaded, 0 targets configured)
Analyzing: target //build:build_wheel (0 packages loaded, 0 targets configured)
Analyzing: target //build:build_wheel (0 packages loaded, 0 targets configured)
DEBUG: Rule 'io_bazel_rules_docker' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1556410077 -0400"
DEBUG: Repository io_bazel_rules_docker instantiated at:
/Users/davidlaxer/jax/WORKSPACE:34:10: in <toplevel>
/private/var/tmp/_bazel_davidlaxer/8ad43b8709647bf5741554c65757d353/external/org_tensorflow/tensorflow/workspace0.bzl:108:34: in workspace
/private/var/tmp/_bazel_davidlaxer/8ad43b8709647bf5741554c65757d353/external/bazel_toolchains/repositories/repositories.bzl:37:23: in repositories
Repository rule git_repository defined at:
/private/var/tmp/_bazel_davidlaxer/8ad43b8709647bf5741554c65757d353/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in <toplevel>
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/4c4f1ae93ea7477ccb4772007fc78313f5a0644f.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 404 Not Found
INFO: Analyzed target //build:build_wheel (1 packages loaded, 2450 targets configured).
INFO: Found 1 target...
[0 / 5] [Prepa] BazelWorkspaceStatusAction stable-status.txt
ERROR: /private/var/tmp/_bazel_davidlaxer/8ad43b8709647bf5741554c65757d353/external/flatbuffers/grpc/src/compiler/BUILD:75:11: C++ compilation of rule '@flatbuffers//grpc/src/compiler:python_generator_private' failed (Exit 1): cc_wrapper.sh failed: error executing command
(cd /private/var/tmp/_bazel_davidlaxer/8ad43b8709647bf5741554c65757d353/execroot/__main__ && \
exec env - \
PATH='/Users/davidlaxer/.opam/_coq-platform_.2021.02.1/bin:/usr/local/bin:/Users/davidlaxer/jax-metal/bin:/Users/davidlaxer/.juliaup/bin:/Users/davidlaxer/.cabal/bin:/Users/davidlaxer/.ghcup/bin:/Users/davidlaxer/anaconda3/envs/ai/bin:/Users/davidlaxer/anaconda3/condabin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/davidlaxer/.cargo/bin:/Users/jetbrains/.local/bin' \
PWD=/proc/self/cwd \
TF_CUDA_COMPUTE_CAPABILITIES=3.5,5.2,6.0,6.1,7.0 \
TF_ROCM_AMDGPU_TARGETS=gfx803,gfx900,gfx906,gfx1010 \
external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++11' -MD -MF bazel-out/darwin-opt/bin/external/flatbuffers/grpc/src/compiler/_objs/python_generator_private/python_generator.d '-frandom-seed=bazel-out/darwin-opt/bin/external/flatbuffers/grpc/src/compiler/_objs/python_generator_private/python_generator.o' -iquote external/flatbuffers -iquote bazel-out/darwin-opt/bin/external/flatbuffers -Ibazel-out/darwin-opt/bin/external/flatbuffers/grpc/src/compiler/_virtual_includes/python_generator_private -Ibazel-out/darwin-opt/bin/external/flatbuffers/_virtual_includes/flatbuffers -Ibazel-out/darwin-opt/bin/external/flatbuffers/src/_virtual_includes/flatbuffers -Wno-sign-compare -mavx '-std=c++14' -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/flatbuffers/grpc/src/compiler/python_generator.cc -o bazel-out/darwin-opt/bin/external/flatbuffers/grpc/src/compiler/_objs/python_generator_private/python_generator.o)
Execution platform: @local_execution_config_platform//:platform
external/flatbuffers/grpc/src/compiler/python_generator.cc:19:10: fatal error: 'algorithm' file not found
#include <algorithm>
^~~~~~~~~~~
1 error generated.
Target //build:build_wheel failed to build
INFO: Elapsed time: 7.957s, Critical Path: 0.65s
INFO: 33 processes: 28 internal, 5 local.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target
FAILED: Build did NOT complete successfully
b''
Traceback (most recent call last):
File "build/build.py", line 564, in <module>
main()
File "build/build.py", line 559, in main
shell(command)
File "build/build.py", line 52, in shell
output = subprocess.check_output(cmd)
File "/Users/davidlaxer/anaconda3/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Users/davidlaxer/anaconda3/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['./bazel-3.7.2-darwin-x86_64', 'run', '--verbose_failures=true', '--config=short_logs', '--config=avx_posix', '--config=mkl_open_source_only', ':build_wheel', '--', '--output_path=/Users/davidlaxer/jax/dist']' returned non-zero exit status 1.
Successfully built 'jaxlib' with Python 3.9.
Description
I am trying to build jaxlib for metal, following these instructions.
https://developer.apple.com/metal/jax/
I'm on MacOS 13.5 with an AMD Radeon Pro 5700 XT GPU
What jax/jaxlib version are you using?
jaxlib-v0.4.10
Which accelerator(s) are you using?
MPS AMD GPU
Additional system info
Python 3.8, MacOS 13.5
NVIDIA GPU info
No response