Optimize armour directory

This commit is contained in:
yangyuan 2021-07-07 10:39:46 +08:00
parent 2b2925f0d0
commit 818f608f13
35 changed files with 56 additions and 62 deletions

View File

@ -227,11 +227,6 @@ set(SUB_COMP
common debug pybind_api utils vm profiler ps fl
)
if(ENABLE_CPU AND NOT WIN32)
add_compile_definitions(ENABLE_ARMOUR)
list(APPEND SUB_COMP "armour")
endif()
foreach(_comp ${SUB_COMP})
add_subdirectory(${_comp})
string(REPLACE "/" "_" sub ${_comp})

View File

@ -1,12 +0,0 @@
file(GLOB_RECURSE ARMOUR_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
set(SERVER_FLATBUFFER_OUTPUT "${CMAKE_BINARY_DIR}/schema")
set(FBS_FILES
${CMAKE_CURRENT_SOURCE_DIR}/../../schema/cipher.fbs
${CMAKE_CURRENT_SOURCE_DIR}/../../schema/fl_job.fbs
)
set_property(SOURCE ${ARMOUR_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_ARMOUR)
add_library(_mindspore_armour_obj OBJECT ${ARMOUR_FILES})
add_dependencies(_mindspore_armour_obj generated_fbs_files)
target_link_libraries(_mindspore_armour_obj mindspore::flatbuffers)

View File

@ -34,6 +34,18 @@ if(NOT ENABLE_CPU OR WIN32)
list(REMOVE_ITEM _FL_SRC_FILES "server/round.cc")
list(REMOVE_ITEM _FL_SRC_FILES "server/server.cc")
list(REMOVE_ITEM _FL_SRC_FILES "worker/fl_worker.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/secure_protocol/encrypt.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/secure_protocol/key_agreement.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/secure_protocol/random.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/secure_protocol/secret_sharing.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/cipher/cipher_init.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/cipher/cipher_keys.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/cipher/cipher_meta_storage.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/cipher/cipher_reconstruct.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/cipher/cipher_shares.cc")
list(REMOVE_ITEM _FL_SRC_FILES "armour/cipher/cipher_unmask.cc")
else()
add_compile_definitions(ENABLE_ARMOUR)
endif()
list(LENGTH _FL_SRC_FILES fl_file_num)

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "armour/cipher/cipher_init.h"
#include "fl/armour/cipher/cipher_init.h"
#include "fl/server/common.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -19,12 +19,12 @@
#include <vector>
#include <string>
#include "armour/secure_protocol/secret_sharing.h"
#include "fl/armour/secure_protocol/secret_sharing.h"
#include "proto/ps.pb.h"
#include "utils/log_adapter.h"
#include "schema/fl_job_generated.h"
#include "schema/cipher_generated.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
#include "armour/cipher/cipher_keys.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_keys.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -21,11 +21,11 @@
#include <string>
#include <memory>
#include <map>
#include "armour/secure_protocol/secret_sharing.h"
#include "fl/armour/secure_protocol/secret_sharing.h"
#include "proto/ps.pb.h"
#include "utils/log_adapter.h"
#include "armour/cipher/cipher_init.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_init.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
#include "fl/server/common.h"
namespace mindspore {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -28,7 +28,7 @@
#endif
#include "proto/ps.pb.h"
#include "utils/log_adapter.h"
#include "armour/secure_protocol/secret_sharing.h"
#include "fl/armour/secure_protocol/secret_sharing.h"
#include "schema/fl_job_generated.h"
#include "schema/cipher_generated.h"
#include "fl/server/distributed_metadata_store.h"

View File

@ -14,11 +14,11 @@
* limitations under the License.
*/
#include "armour/cipher/cipher_reconstruct.h"
#include "fl/armour/cipher/cipher_reconstruct.h"
#include "fl/server/common.h"
#include "armour/secure_protocol/random.h"
#include "armour/secure_protocol/key_agreement.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/secure_protocol/random.h"
#include "fl/armour/secure_protocol/key_agreement.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -22,11 +22,11 @@
#include <memory>
#include <map>
#include <utility>
#include "armour/secure_protocol/secret_sharing.h"
#include "fl/armour/secure_protocol/secret_sharing.h"
#include "proto/ps.pb.h"
#include "utils/log_adapter.h"
#include "armour/cipher/cipher_init.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_init.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "armour/cipher/cipher_shares.h"
#include "fl/armour/cipher/cipher_shares.h"
#include "fl/server/common.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -22,11 +22,11 @@
#include <memory>
#include <map>
#include <utility>
#include "armour/secure_protocol/secret_sharing.h"
#include "fl/armour/secure_protocol/secret_sharing.h"
#include "proto/ps.pb.h"
#include "utils/log_adapter.h"
#include "armour/cipher/cipher_init.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_init.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -14,10 +14,10 @@
* limitations under the License.
*/
#include "armour/cipher/cipher_unmask.h"
#include "fl/armour/cipher/cipher_unmask.h"
#include "fl/server/common.h"
#include "fl/server/local_meta_store.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -20,11 +20,11 @@
#include <vector>
#include <string>
#include <map>
#include "armour/secure_protocol/secret_sharing.h"
#include "fl/armour/secure_protocol/secret_sharing.h"
#include "proto/ps.pb.h"
#include "utils/log_adapter.h"
#include "armour/cipher/cipher_init.h"
#include "armour/cipher/cipher_meta_storage.h"
#include "fl/armour/cipher/cipher_init.h"
#include "fl/armour/cipher/cipher_meta_storage.h"
namespace mindspore {
namespace armour {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "armour/secure_protocol/encrypt.h"
#include "fl/armour/secure_protocol/encrypt.h"
namespace mindspore {
namespace armour {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "armour/secure_protocol/key_agreement.h"
#include "fl/armour/secure_protocol/key_agreement.h"
namespace mindspore {
namespace armour {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "armour/secure_protocol/random.h"
#include "fl/armour/secure_protocol/random.h"
namespace mindspore {
namespace armour {

View File

@ -22,7 +22,7 @@
#ifndef _WIN32
#include <openssl/rand.h>
#endif
#include "armour/secure_protocol/encrypt.h"
#include "fl/armour/secure_protocol/encrypt.h"
namespace mindspore {
namespace armour {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "armour/secure_protocol/secret_sharing.h"
#include "fl/armour/secure_protocol/secret_sharing.h"
namespace mindspore {
namespace armour {

View File

@ -27,7 +27,7 @@
#include "fl/server/common.h"
#include "fl/server/parameter_aggregator.h"
#ifdef ENABLE_ARMOUR
#include "armour/cipher/cipher_unmask.h"
#include "fl/armour/cipher/cipher_unmask.h"
#endif
namespace mindspore {

View File

@ -22,7 +22,7 @@
#include "fl/server/common.h"
#include "fl/server/kernel/round/round_kernel.h"
#include "fl/server/kernel/round/round_kernel_factory.h"
#include "armour/cipher/cipher_init.h"
#include "fl/armour/cipher/cipher_init.h"
#include "fl/server/executor.h"
namespace mindspore {

View File

@ -22,7 +22,7 @@
#include "fl/server/kernel/round/round_kernel.h"
#include "fl/server/kernel/round/round_kernel_factory.h"
#include "fl/server/executor.h"
#include "armour/cipher/cipher_keys.h"
#include "fl/armour/cipher/cipher_keys.h"
namespace mindspore {
namespace ps {

View File

@ -22,7 +22,7 @@
#include "fl/server/kernel/round/round_kernel.h"
#include "fl/server/kernel/round/round_kernel_factory.h"
#include "fl/server/executor.h"
#include "armour/cipher/cipher_keys.h"
#include "fl/armour/cipher/cipher_keys.h"
namespace mindspore {
namespace ps {

View File

@ -18,7 +18,7 @@
#include <vector>
#include <memory>
#include <string>
#include "armour/cipher/cipher_shares.h"
#include "fl/armour/cipher/cipher_shares.h"
namespace mindspore {
namespace ps {

View File

@ -21,7 +21,7 @@
#include "fl/server/common.h"
#include "fl/server/kernel/round/round_kernel.h"
#include "fl/server/kernel/round/round_kernel_factory.h"
#include "armour/cipher/cipher_shares.h"
#include "fl/armour/cipher/cipher_shares.h"
#include "fl/server/executor.h"
namespace mindspore {

View File

@ -23,7 +23,7 @@
#include "fl/server/common.h"
#include "fl/server/kernel/round/round_kernel.h"
#include "fl/server/kernel/round/round_kernel_factory.h"
#include "armour/cipher/cipher_reconstruct.h"
#include "fl/armour/cipher/cipher_reconstruct.h"
#include "fl/server/executor.h"
namespace mindspore {

View File

@ -22,7 +22,7 @@
#include "fl/server/executor.h"
#include "fl/server/kernel/round/round_kernel.h"
#include "fl/server/kernel/round/round_kernel_factory.h"
#include "armour/cipher/cipher_shares.h"
#include "fl/armour/cipher/cipher_shares.h"
namespace mindspore {
namespace ps {

View File

@ -22,7 +22,7 @@
#include "fl/server/model_store.h"
#include "fl/server/iteration.h"
#ifdef ENABLE_ARMOUR
#include "armour/cipher/cipher_init.h"
#include "fl/armour/cipher/cipher_init.h"
#endif
namespace mindspore {

View File

@ -19,7 +19,7 @@
#include <string>
#include <csignal>
#ifdef ENABLE_ARMOUR
#include "armour/secure_protocol/secret_sharing.h"
#include "fl/armour/secure_protocol/secret_sharing.h"
#endif
#include "fl/server/round.h"
#include "fl/server/model_store.h"

View File

@ -27,7 +27,7 @@
#include "fl/server/executor.h"
#include "fl/server/iteration.h"
#ifdef ENABLE_ARMOUR
#include "armour/cipher/cipher_init.h"
#include "fl/armour/cipher/cipher_init.h"
#endif
namespace mindspore {

View File

@ -161,7 +161,6 @@ file(GLOB_RECURSE MINDSPORE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"../../../mindspore/ccsrc/fl/*.cc"
"../../../mindspore/ccsrc/profiler/device/common/*.cc"
"../../../mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/fp32/adam_fp32.c"
"../../../mindspore/ccsrc/armour/*.cc"
)
list(REMOVE_ITEM MINDSPORE_SRC_LIST