Adding Cmake files for Bonsai and ProtoNN libs

This commit is contained in:
Suresh Parthasarathy 2017-11-16 09:50:05 +05:30
Родитель 4a9dd2cb53
Коммит 2af1ce6874
7 изменённых файлов: 160 добавлений и 2 удалений

67
CMakeLists.txt Normal file
Просмотреть файл

@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.3)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(EdgeML)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Turn on ability to create folders to organize projects
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Set global compilation flags
if(NOT WIN32 AND NOT CYGWIN)
add_compile_options("-fvisibility-inlines-hidden")
endif()
# Set Visual Studio-specific options
if(MSVC)
add_compile_options(/MP) #multi process build
endif()
#define variables for mkl include directories
#set your MKL_ROOT here
#set(MKL_ROOT "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2017/windows/mkl")
#set(MKL_INCLUDE_DIR ${MKL_ROOT}/include)
#include_directories(${MKL_INCLUDE_DIR})
#link_directories(${MKL_ROOT}/lib/intel64_win)
#link_directories(${MKL_ROOT}/../compiler/lib/intel64_win)
set(MKL_ROOT "/opt/intel/mkl/")
set(MKL_INCLUDE_DIR ${MKL_ROOT}/include)
include_directories(${MKL_INCLUDE_DIR})
link_directories(${MKL_ROOT}/lib/intel64_lin)
link_directories(${MKL_ROOT}/../compiler/lib/intel64_lin)
# add debug definitions to compiler flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLIGHT_LOGGER") #-DLOGGER #-DTIMER -DCONCISE #-DSTDERR_ONSCREEN #-DLIGHT_LOGGER -DVERBOSE #-DDUMP #-DVERIFY
set(CONFIG_FLAGS "-DSINGLE") #-DXML -DZERO_BASED_IO
# mkl flags
set(MKL_EIGEN_FLAGS "-DEIGEN_USE_BLAS -DMKL_ILP64")
# add
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CONFIG_FLAGS} ${MKL_EIGEN_FLAGS}")
IF(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcilkplus -DCILK")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DLINUX")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -p -g")
ENDIF (CMAKE_COMPILER_IS_GNUCC)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ox -DWINDOWS")
endif()
MESSAGE(STATUS "CMAKE_CXX_FLAGS:" ${CMAKE_CXX_FLAGS})
MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG:" ${CMAKE_CXX_FLAGS_DEBUG})
# Include project directories
add_subdirectory(src)
#add_subdirectory(test)

Просмотреть файл

@ -1,4 +1,4 @@
#include "stdafx.h"
//#include "stdafx.h"
#include "Bonsai.h"

25
src/Bonsai/CMakeLists.txt Normal file
Просмотреть файл

@ -0,0 +1,25 @@
set (library_name Bonsai)
set (src Bonsai.h
BonsaiFunctions.h
BonsaiHyperParams.cpp
BonsaiModel.cpp
BonsaiIngestTest.cpp
BonsaiPredictor.cpp
BonsaiFunctions.cpp
BonsaiParams.cpp
BonsaiTrainer.cpp)
source_group("src" FILES ${src})
set(PARAMETER_SPARSITY_FLAGS -DSPARSE_LABEL_BONSAI) #-DSPARSE_Z_BONSAI #-DSPARSE_V_BONSAI -DSPARSE_THETA_BONSAI -DSPARSE_W_BONSAI
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PARAMETER_SPARSITY_FLAGS}")
add_library(${library_name} ${src})
target_include_directories(${library_name} PUBLIC ../common ../../eigen)
target_link_libraries(${library_name} common)
set_property(TARGET ${library_name} PROPERTY FOLDER "Bonsai")

8
src/CMakeLists.txt Normal file
Просмотреть файл

@ -0,0 +1,8 @@
#
# cmake file for Edge ML subprojects
#
add_subdirectory(common)
add_subdirectory(Bonsai)
add_subdirectory(ProtoNN)

Просмотреть файл

@ -0,0 +1,28 @@
set (library_name ProtoNN)
set (src cluster.h
ProtoNNFunctions.h
ProtoNN.h
cluster.cpp
ProtoNNModel.cpp
ProtoNNTrainer.cpp
ProtoNNPredictor.cpp
ProtoNNFunctions.cpp
ProtoNNHyperParams.cpp
ProtoNNParams.cpp)
source_group("src" FILES ${src})
set(PARAMETER_SPARSITY_FLAGS -DSPARSE_LABEL_PROTONN) #-DSPARSE_Z_PROTONN #-DSPARSE_B_PROTONN #-DSPARSE_W_PROTONN
set(PROTONN_FLAGS -DL2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PARAMETER_SPARSITY_FLAGS} ${PROTONN_FLAGS}")
add_library(${library_name} ${src} ${include})
target_include_directories(${library_name} PUBLIC ../common ../../eigen)
target_link_libraries(${library_name} common)
set_property(TARGET ${library_name} PROPERTY FOLDER "ProtoNN")

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#include "stdafx.h"
//#include "stdafx.h"
#include "utils.h"
#include "ProtoNN.h"

30
src/common/CMakeLists.txt Normal file
Просмотреть файл

@ -0,0 +1,30 @@
set (library_name common)
set (src blas_routines.h
Data.h
goldfoil.h
logger.h
mmaped.h
metrics.h
par_utils.h
pre_processor.h
timer.h
utils.h
blas_routines.cpp
Data.cpp
goldfoil.cpp
logger.cpp
mmaped.cpp
metrics.cpp
par_utils.cpp
timer.cpp
utils.cpp)
source_group("src" FILES ${src})
add_library(${library_name} ${src})
target_include_directories(${library_name} PUBLIC ../../eigen)
set_property(TARGET ${library_name} PROPERTY FOLDER "common")