Skip to content

Commit

Permalink
Updated libtorch to 2.4.1; fixes issue of libomp not beeing packaged
Browse files Browse the repository at this point in the history
  • Loading branch information
faressc committed Sep 23, 2024
1 parent 2cd37cb commit 2696a3d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ option(ANIRA_WITH_SEMAPHORE "Use semaphores for synchronization instead of atomi

set (PROJECT_NAME anira)

project (${PROJECT_NAME} VERSION 0.1.2)
project (${PROJECT_NAME} VERSION 0.1.3)

# Sets the minimum macOS version, c++20 is only available from macOS 11.0
if (APPLE)
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ processBlock(float** audioData, int numSamples) {
## Install
On **Apple Silicon Macs** you need to install the OpenMP library via Homebrew (``` brew install libomp ```).
### CMake
anira can be easily integrated into your CMake project. Either add anira as a submodule or download the pre-built binaries from the [releases page](https://github.com/anira-project/anira/releases/latest).
Expand Down
26 changes: 1 addition & 25 deletions cmake/SetupLibTorch.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(LIBTORCH_VERSION 2.2.2)
set(LIBTORCH_VERSION 2.4.1)

if (NOT WIN32)
set(TORCH_BUILD_TYPE "")
Expand Down Expand Up @@ -98,30 +98,6 @@ if (MSVC)
list(APPEND BACKEND_BUILD_LIBRARY_DIRS "C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64")
message(STATUS "Intel MKL library found at C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64")
endif()
elseif(APPLE)
if (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
# torch should automatically find and add the MKL library to the link directories
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
if (EXISTS "/opt/homebrew/opt/libomp/lib")
list(APPEND BACKEND_BUILD_LIBRARY_DIRS "/opt/homebrew/opt/libomp/lib")
message(STATUS "libomp library found at /opt/homebrew/opt/libomp/lib")
elseif (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
message(FATAL_ERROR "libomp library not found! Please install libomp using Homebrew: brew install libomp")
endif()
else()
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
# torch should automatically find and add the MKL library to the link directories
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
if (EXISTS "/opt/homebrew/opt/libomp/lib")
list(APPEND BACKEND_BUILD_LIBRARY_DIRS "/opt/homebrew/opt/libomp/lib")
message(STATUS "libomp library found at /opt/homebrew/opt/libomp/lib")
else()
message(FATAL_ERROR "libomp library not found! Please install libomp using Homebrew: brew install libomp")
endif()
else()
message(FATAL_ERROR "CMAKE_OSX_ARCHITECTURES and CMAKE_HOST_SYSTEM_PROCESSOR not defined.")
endif()
endif()
endif()

set(ANIRA_LIBTORCH_SHARED_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/modules/libtorch-${LIBTORCH_VERSION}${TORCH_BUILD_TYPE}/")
Expand Down

0 comments on commit 2696a3d

Please sign in to comment.