-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#**************************************************** | ||
# Authors: David Leon | ||
# 29/10/2021 | ||
# | ||
# @copyright Copyright (c) 2021 Nerlnet | ||
# *****************************************************/ | ||
|
||
project(torchBridge) | ||
|
||
set(NIFPP_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../nifpp/") | ||
set(SIMPLE_LOGGER_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../simple-cpp-logger/include") | ||
set(COMMON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../common") | ||
set(Torch_DIR "/usr/local/lib/libtorch/share/cmake/Torch") | ||
|
||
find_package(Torch REQUIRED "TorchConfig.cmake" CONFIG ) | ||
|
||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
set(CMAKE_CXX_FLAGS "-fpic") | ||
set(ERL_NIF_DEFAULT_LOCATION "/usr/local/lib/erlang/usr/include") | ||
|
||
# cpp Simple logger options | ||
add_definitions( -D LOGGER_MAX_LOG_LEVEL_PRINTED=6 ) | ||
add_definitions( -D LOGGER_PREFIX_LEVEL=2 ) | ||
add_definitions( -D LOGGER_ENABLE_COLORS=1 ) | ||
add_definitions( -D LOGGER_ENABLE_COLORS_ON_USER_HEADER=0 ) | ||
|
||
set(SRC_CODE | ||
"torchNIF.h" | ||
"torchNIF.cpp" | ||
) | ||
|
||
add_library(${PROJECT_NAME} SHARED ${SRC_CODE}) | ||
|
||
target_link_libraries(${PROJECT_NAME} "${TORCH_LIBRARIES}" common) | ||
|
||
# Include NIF, OpenNN and Simple Cpp Logger | ||
target_include_directories(${PROJECT_NAME} PUBLIC | ||
${COMMON_PATH} | ||
${NIFPP_PATH} | ||
${SIMPLE_LOGGER_PATH} | ||
${ERL_NIF_DEFAULT_LOCATION}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Torch Bridge | ||
|
||
(Unsupported yet) | ||
This is a bridge that extends Nerlnet to support libtorch as cpp neural network library. | ||
|
||
### Installation | ||
|
||
1. Go to [Pytorch site](https://pytorch.org/get-started/locally/) and download libtorch | ||
2. Extract libotorch to ```/usr/local/lib/libtorch``` | ||
3. Execute Nerlnet build with --t=ON or --torch=ON | ||
4. Select worker infrastructe in Nerlplanner as torch. | ||
|
||
For apple silicon use [this repo](https://github.com/Nerlnet/libtorch_compiled) to download compiled libtorch. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <torch/torch.h> |