Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rd_party/3rd_party.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if ("${HOST_SYSTEM_NAME}" STREQUAL "darwin")
else()
set(BOOST_ARCH "a64")
endif()
set(BOOST_EXTENSION "mt-${BOOST_ARCH}-1_83.dylib")
set(BOOST_EXTENSION "mt-${BOOST_ARCH}-1_86.dylib")
set(BOOST_LIBRARIES "atomic" "chrono" "date_time" "filesystem" "iostreams" "log" "log_setup" "program_options" "regex" "system" "thread" "unit_test_framework")
set(XML_LOCATION)
set(GCC_RT_LOCATION)
Expand Down
57 changes: 44 additions & 13 deletions build-setup/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,42 +66,42 @@ xcode-select --install

at the command prompt.

### Boost 1.83.0
### Boost 1.86.0

Download version 1.83.0 of Boost from <https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2>. You must get this exact version, as the Machine Learning build system requires it.
Download version 1.86.0 of Boost from <https://boostorg.jfrog.io/artifactory/main/release/1.86.0/source/boost_1_86_0.tar.bz2>. You must get this exact version, as the Machine Learning build system requires it.

Assuming you chose the `.bz2` version, extract it to a temporary directory:

```
bzip2 -cd boost_1_83_0.tar.bz2 | tar xvf -
bzip2 -cd boost_1_86_0.tar.bz2 | tar xvf -
```

In the resulting `boost_1_83_0` directory, run:
In the resulting `boost_1_86_0` directory, run:

```
./bootstrap.sh --with-toolset=clang --without-libraries=context --without-libraries=coroutine --without-libraries=graph_parallel --without-libraries=mpi --without-libraries=python --without-icu
```

This should build the `b2` program, which in turn is used to build Boost.

Edit `boost/unordered/detail/prime_fmod.hpp` and change line 134 from
Edit `boost/unordered/detail/prime_fmod.hpp` and change line 37 from

```
(13ul)(29ul)(53ul)(97ul)(193ul)(389ul)(769ul)(1543ul)(3079ul)(6151ul)( \
constexpr static std::size_t const sizes[] = {13ul, 29ul, 53ul, 97ul,
```

to:

```
(3ul)(13ul)(29ul)(53ul)(97ul)(193ul)(389ul)(769ul)(1543ul)(3079ul)(6151ul)( \
constexpr static std::size_t const sizes[] = {3ul, 13ul, 29ul, 53ul, 97ul,
```


To complete the build, type:

```
./b2 -j8 --layout=versioned --disable-icu cxxflags="-std=c++17 -stdlib=libc++ $SSEFLAGS" linkflags="-std=c++17 -stdlib=libc++ -Wl,-headerpad_max_install_names" optimization=speed inlining=full define=BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS define=BOOST_LOG_WITHOUT_DEBUG_OUTPUT define=BOOST_LOG_WITHOUT_EVENT_LOG define=BOOST_LOG_WITHOUT_SYSLOG define=BOOST_LOG_WITHOUT_IPC
sudo ./b2 install --layout=versioned --disable-icu cxxflags="-std=c++17 -stdlib=libc++ $SSEFLAGS" linkflags="-std=c++17 -stdlib=libc++ -Wl,-headerpad_max_install_names" optimization=speed inlining=full define=BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS define=BOOST_LOG_WITHOUT_DEBUG_OUTPUT define=BOOST_LOG_WITHOUT_EVENT_LOG define=BOOST_LOG_WITHOUT_SYSLOG define=BOOST_LOG_WITHOUT_IPC
sudo ./b2 -j8 install --layout=versioned --disable-icu cxxflags="-std=c++17 -stdlib=libc++ $SSEFLAGS" linkflags="-std=c++17 -stdlib=libc++ -Wl,-headerpad_max_install_names" optimization=speed inlining=full define=BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS define=BOOST_LOG_WITHOUT_DEBUG_OUTPUT define=BOOST_LOG_WITHOUT_EVENT_LOG define=BOOST_LOG_WITHOUT_SYSLOG define=BOOST_LOG_WITHOUT_IPC
```

to install the Boost headers and libraries.
Expand All @@ -127,7 +127,7 @@ Download the graphical installer for Python 3.10.9 from <https://www.python.org/

Install using all the default options. When the installer completes a Finder window pops up. Double click the `Install Certificates.command` file in this folder to install the SSL certificates Python needs.

### PyTorch 2.3.1
### PyTorch 2.5.0

PyTorch requires that certain Python modules are installed. To install them:

Expand All @@ -138,7 +138,7 @@ sudo /Library/Frameworks/Python.framework/Versions/3.10/bin/pip3.10 install nump
Then obtain the PyTorch code:

```
git clone --depth=1 --branch=v2.3.1 https://github.com/pytorch/pytorch.git
git clone --depth=1 --branch=v2.5.0 https://github.com/pytorch/pytorch.git
cd pytorch
git submodule sync
git submodule update --init --recursive
Expand Down Expand Up @@ -170,6 +170,38 @@ inline void to_bytes(bytestring& bytes, const unsigned long arg) {

at around line 189. This is necessary to resolve a template specialization issue.

Depending on your version of macOS it may also be necessary to follow these additional steps:

* Edit `aten/src/ATen/mps/MPSDevice.mm` and change
```
return MTLLanguageVersion3_0;
```
to
```
return MTLLanguageVersion2_0;
```
* Edit `aten/src/ATen/native/mps/operations/Indexing.mm` and change
```
indexABContents[idx] =
getMTLBufferStorage(indexTensor).gpuAddress + (indexTensor.storage_offset() * indexTensor.element_size());
```
to
```
//indexABContents[idx] =
// getMTLBufferStorage(indexTensor).gpuAddress + (indexTensor.storage_offset() * indexTensor.element_size());
```
* Edit `third_party/onnx/CMakelists.txt` and change
```
# find_package(Python ${PY_VERSION} COMPONENTS Interpreter Development REQUIRED)
find_package(PythonInterp ${PY_VERSION} REQUIRED)
```
to
```
set(PY_VERSION 3.10)
find_package(Python3 ${PY_VERSION} COMPONENTS Interpreter Development REQUIRED)
#find_package(PythonInterp ${PY_VERSION} REQUIRED)
```

For compilation on `macOS Mojave (10.14)`

* Edit `torch/csrc/jit/api/module.h` and change
Expand Down Expand Up @@ -216,12 +248,11 @@ export BUILD_TEST=OFF
export BUILD_CAFFE2=OFF
export USE_NUMPY=OFF
export USE_DISTRIBUTED=OFF
[ $(uname -m) != x86_64 ] && export DNNL_TARGET_ARCH=AARCH64
export DNNL_TARGET_ARCH=AARCH64
export USE_MKLDNN=ON
export USE_QNNPACK=OFF
export USE_PYTORCH_QNNPACK=OFF
[ $(uname -m) = x86_64 ] && export USE_XNNPACK=OFF
export PYTORCH_BUILD_VERSION=2.3.1
export PYTORCH_BUILD_VERSION=2.5.0
export PYTORCH_BUILD_NUMBER=1
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 setup.py install
```
Expand Down
9 changes: 7 additions & 2 deletions cmake/variables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,14 @@ set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_DEBUG_RUNTIME OFF)
set(Boost_COMPILER "${ML_BOOST_COMPILER_VER}")

set(Boost_VERSION 1.83.0)
set (Boost_VERSION 1.83.0)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
message(WARNING "Using Boost 1.86.0 on macOS.")
set (Boost_VERSION 1.86.0)
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
message(WARNING "Using Boost 1.86.0 on Windows only.")
message(WARNING "Using Boost 1.86.0 on Windows.")
set(Boost_VERSION 1.86.0)
endif()
find_package(Boost ${Boost_VERSION} EXACT REQUIRED COMPONENTS iostreams filesystem program_options regex date_time log log_setup thread unit_test_framework)
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/download_macos_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ case `uname -m` in
ARCHIVE=local-x86_64-apple-macosx12.0-1.tar.bz2
;;
arm64)
ARCHIVE=local-arm64-apple-macosx11.1-10.tar.bz2
ARCHIVE=local-arm64-apple-macosx11.1-11.tar.bz2
;;

*)
Expand Down
4 changes: 2 additions & 2 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

=== Enhancements

* Update the PyTorch library to version 2.5.0. (See {ml-pull}2783[#2783].)
* Upgrade Boost libraries to version 1.86. (See {ml-pull}2780[#2780].)
* Update the PyTorch library to version 2.5.0. (See {ml-pull}2783[#2783], {ml-pull}2778[#2778].)
* Upgrade Boost libraries to version 1.86. (See {ml-pull}2780[#2780], {ml-pull}2779[#2779].)

== {es} version 8.16.0

Expand Down
2 changes: 1 addition & 1 deletion lib/core/unittest/CMemoryUsageTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ BOOST_AUTO_TEST_CASE(testSmallVector) {
// off of internal storage it would NEVER go back to internal storage.
// Arguably that was a bug, and this assertion started failing after
// upgrading Boost to 1.86.0, meaning that boost::small_vector has been improved.
BOOST_TEST_REQUIRE(extraMem >= 0); // Change this to "==" when all platforms have been upgraded to Boost 1.86.0
BOOST_TEST_REQUIRE(extraMem >= 0); // Change to `==` once upgraded to Boost 1.86 on all platforms
}

BOOST_AUTO_TEST_CASE(testAlignedVector) {
Expand Down