-
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.
Merge pull request #358 from leondavi/torch
Torch WIP
- Loading branch information
Showing
34 changed files
with
887 additions
and
80 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
179 changes: 179 additions & 0 deletions
179
inputJsonsFiles/DistributedConfig/dc_FedTorchTest_5d_2s_2r_4c_4w.json
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,179 @@ | ||
{ | ||
"nerlnetSettings": { | ||
"frequency": "300", | ||
"batchSize": "100" | ||
}, | ||
"mainServer": { | ||
"port": "8900", | ||
"args": "" | ||
}, | ||
"apiServer": { | ||
"port": "8901", | ||
"args": "" | ||
}, | ||
"devices": [ | ||
{ | ||
"name": "C0VM0", | ||
"ipv4": "10.0.0.5", | ||
"entities": "apiServer,mainServer" | ||
}, | ||
{ | ||
"name": "Minion2", | ||
"ipv4": "10.0.0.19", | ||
"entities": "c1,r1,s1" | ||
}, | ||
{ | ||
"name": "Minion3", | ||
"ipv4": "10.0.0.20", | ||
"entities": "c2,r2,s2" | ||
}, | ||
{ | ||
"name": "Minion7", | ||
"ipv4": "10.0.0.24", | ||
"entities": "c3" | ||
}, | ||
{ | ||
"name": "Minion8", | ||
"ipv4": "10.0.0.25", | ||
"entities": "c4" | ||
} | ||
], | ||
"routers": [ | ||
{ | ||
"name": "r1", | ||
"port": "8086", | ||
"policy": "0" | ||
}, | ||
{ | ||
"name": "r2", | ||
"port": "8087", | ||
"policy": "0" | ||
} | ||
], | ||
"sources": [ | ||
{ | ||
"name": "s1", | ||
"port": "8085", | ||
"frequency": "200", | ||
"policy": "0", | ||
"epochs": "1", | ||
"type": "0" | ||
}, | ||
{ | ||
"name": "s2", | ||
"port": "8085", | ||
"frequency": "200", | ||
"policy": "0", | ||
"epochs": "1", | ||
"type": "0" | ||
} | ||
], | ||
"clients": [ | ||
{ | ||
"name": "c1", | ||
"port": "8083", | ||
"workers": "w1" | ||
}, | ||
{ | ||
"name": "c2", | ||
"port": "8083", | ||
"workers": "w2" | ||
}, | ||
{ | ||
"name": "c3", | ||
"port": "8083", | ||
"workers": "w3" | ||
}, | ||
{ | ||
"name": "c4", | ||
"port": "8083", | ||
"workers": "w4" | ||
} | ||
], | ||
"workers": [ | ||
{ | ||
"name": "w1", | ||
"model_sha": "0771693392e898393c9b2b8235497537b5fbed1fd0c9a5a7ec6aab665d2c1896" | ||
}, | ||
{ | ||
"name": "w2", | ||
"model_sha": "0771693392e898393c9b2b8235497537b5fbed1fd0c9a5a7ec6aab665d2c1896" | ||
}, | ||
{ | ||
"name": "w3", | ||
"model_sha": "0771693392e898393c9b2b8235497537b5fbed1fd0c9a5a7ec6aab665d2c1896" | ||
}, | ||
{ | ||
"name": "w4", | ||
"model_sha": "c081daf49b8332585243b68cb828ebc9b947528601a6852688cea0312b3e3914" | ||
} | ||
], | ||
"model_sha": { | ||
"0771693392e898393c9b2b8235497537b5fbed1fd0c9a5a7ec6aab665d2c1896": { | ||
"modelType": "0", | ||
"_doc_modelType": " nn:0 | approximation:1 | classification:2 | forecasting:3 | image_classification:4 | text_classification:5 | text_generation:6 | auto_association:7 | autoencoder:8 | ae_classifier:9 |", | ||
"modelArgs": "", | ||
"_doc_modelArgs": "Extra arguments to model", | ||
"layersSizes": "5,6,6,4,3", | ||
"_doc_layersSizes": "List of postive integers [L0, L1, ..., LN]", | ||
"layerTypesList": "1,3,3,3,3", | ||
"_doc_LayerTypes": " Default:0 | Scaling:1 | Conv:2 | Perceptron:3 | Pooling:4 | Probabilistic:5 | LSTM:6 | Reccurrent:7 | Unscaling:8 | Flatten:9 | Bounding:10 |", | ||
"layers_functions": "1,8,8,8,11", | ||
"_doc_layers_functions_activation": " Threshold:1 | Sign:2 | Logistic:3 | Tanh:4 | Linear:5 | ReLU:6 | eLU:7 | SeLU:8 | Soft-plus:9 | Soft-sign:10 | Hard-sigmoid:11 |", | ||
"_doc_layer_functions_pooling": " none:1 | Max:2 | Avg:3 |", | ||
"_doc_layer_functions_probabilistic": " Binary:1 | Logistic:2 | Competitive:3 | Softmax:4 |", | ||
"_doc_layer_functions_scaler": " none:1 | MinMax:2 | MeanStd:3 | STD:4 | Log:5 |", | ||
"lossMethod": "2", | ||
"_doc_lossMethod": " SSE:1 | MSE:2 | NSE:3 | MinkowskiE:4 | WSE:5 | CEE:6 |", | ||
"lr": "0.001", | ||
"_doc_lr": "Positve float", | ||
"epochs": "1", | ||
"_doc_epochs": "Positve Integer", | ||
"optimizer": "5", | ||
"_doc_optimizer": " GD:0 | CGD:1 | SGD:2 | QuasiNeuton:3 | LVM:4 | ADAM:5 |", | ||
"optimizerArgs": "none", | ||
"_doc_optimizerArgs": "String", | ||
"infraType": "0", | ||
"_doc_infraType": " opennn:0 | wolfengine:1 |", | ||
"distributedSystemType": "1", | ||
"_doc_distributedSystemType": " none:0 | fedClientAvg:1 | fedServerAvg:2 |", | ||
"distributedSystemArgs": "SyncMaxCount=50", | ||
"_doc_distributedSystemArgs": "String", | ||
"distributedSystemToken": "9922u", | ||
"_doc_distributedSystemToken": "Token that associates distributed group of workers and parameter-server" | ||
}, | ||
"c081daf49b8332585243b68cb828ebc9b947528601a6852688cea0312b3e3914": { | ||
"modelType": "0", | ||
"_doc_modelType": " nn:0 | approximation:1 | classification:2 | forecasting:3 | image_classification:4 | text_classification:5 | text_generation:6 | auto_association:7 | autoencoder:8 | ae_classifier:9 |", | ||
"modelArgs": "", | ||
"_doc_modelArgs": "Extra arguments to model", | ||
"layersSizes": "5,6,6,4,3", | ||
"_doc_layersSizes": "List of postive integers [L0, L1, ..., LN]", | ||
"layerTypesList": "1,3,3,3,3", | ||
"_doc_LayerTypes": " Default:0 | Scaling:1 | Conv:2 | Perceptron:3 | Pooling:4 | Probabilistic:5 | LSTM:6 | Reccurrent:7 | Unscaling:8 | Flatten:9 | Bounding:10 |", | ||
"layers_functions": "1,8,8,8,11", | ||
"_doc_layers_functions_activation": " Threshold:1 | Sign:2 | Logistic:3 | Tanh:4 | Linear:5 | ReLU:6 | eLU:7 | SeLU:8 | Soft-plus:9 | Soft-sign:10 | Hard-sigmoid:11 |", | ||
"_doc_layer_functions_pooling": " none:1 | Max:2 | Avg:3 |", | ||
"_doc_layer_functions_probabilistic": " Binary:1 | Logistic:2 | Competitive:3 | Softmax:4 |", | ||
"_doc_layer_functions_scaler": " none:1 | MinMax:2 | MeanStd:3 | STD:4 | Log:5 |", | ||
"lossMethod": "2", | ||
"_doc_lossMethod": " SSE:1 | MSE:2 | NSE:3 | MinkowskiE:4 | WSE:5 | CEE:6 |", | ||
"lr": "0.001", | ||
"_doc_lr": "Positve float", | ||
"epochs": "1", | ||
"_doc_epochs": "Positve Integer", | ||
"optimizer": "5", | ||
"_doc_optimizer": " GD:0 | CGD:1 | SGD:2 | QuasiNeuton:3 | LVM:4 | ADAM:5 |", | ||
"optimizerArgs": "none", | ||
"_doc_optimizerArgs": "String", | ||
"infraType": "0", | ||
"_doc_infraType": " opennn:0 | wolfengine:1 |", | ||
"distributedSystemType": "2", | ||
"_doc_distributedSystemType": " none:0 | fedClientAvg:1 | fedServerAvg:2 |", | ||
"distributedSystemArgs": "SyncMaxCount=50", | ||
"_doc_distributedSystemArgs": "String", | ||
"distributedSystemToken": "9922u", | ||
"_doc_distributedSystemToken": "Token that associates distributed group of workers and parameter-server" | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
inputJsonsFiles/experimentsFlow/exp_FedTorchTest_5d_2s_2r_4c_4w.json
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,54 @@ | ||
{ | ||
"experimentName": "synthetic_3_gausians", | ||
"experimentType": "classification", | ||
"batchSize": 100, | ||
"csvFilePath": "/tmp/nerlnet/data/NerlnetData-master/nerlnet/synthetic_norm/synthetic_full.csv", | ||
"numOfFeatures": "5", | ||
"numOfLabels": "3", | ||
"headersNames": "Norm(0:1),Norm(4:1),Norm(10:3)", | ||
"Phases": | ||
[ | ||
{ | ||
"phaseName": "training_phase", | ||
"phaseType": "training", | ||
"sourcePieces": | ||
[ | ||
{ | ||
"sourceName": "s1", | ||
"startingSample": "0", | ||
"numOfBatches": "500", | ||
"workers": "w1,w2", | ||
"nerltensorType": "float" | ||
}, | ||
{ | ||
"sourceName": "s2", | ||
"startingSample": "0", | ||
"numOfBatches": "500", | ||
"workers": "w3", | ||
"nerltensorType": "float" | ||
} | ||
] | ||
}, | ||
{ | ||
"phaseName": "prediction_phase", | ||
"phaseType": "prediction", | ||
"sourcePieces": | ||
[ | ||
{ | ||
"sourceName": "s1", | ||
"startingSample": "50000", | ||
"numOfBatches": "500", | ||
"workers": "w1,w2", | ||
"nerltensorType": "float" | ||
}, | ||
{ | ||
"sourceName": "s2", | ||
"startingSample": "50000", | ||
"numOfBatches": "500", | ||
"workers": "w3", | ||
"nerltensorType": "float" | ||
} | ||
] | ||
} | ||
] | ||
} |
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,46 @@ | ||
#**************************************************** | ||
# 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 | ||
"nerltensorTorchDefs.h" | ||
"nifppNerlTensorTorch.h" | ||
"torchNIF.h" | ||
"torchNIF.cpp" | ||
"NerlWorkerTorch.h" | ||
"NerlWorkerTorch.cpp" | ||
"NerlWorkerTorchNIF.h" | ||
) | ||
|
||
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 @@ | ||
#include "NerlWorkerTorch.h" |
Oops, something went wrong.