diff --git a/.travis.yml b/.travis.yml index e1bd940a3997ba4033a19462d291b4f719901b49..da7d1e3ee488931a58c1dcae0ed5aab13c986726 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ cache: directories: - $HOME/.ccache - $HOME/.cache/pip - - $TRAVIS_BUILD_DIR/build/third_party sudo: required dist: trusty os: @@ -20,6 +19,9 @@ addons: - python-wheel - clang-format-3.8 - ccache +script: + /bin/bash ./tests.sh + notifications: email: on_success: change diff --git a/CMakeLists.txt b/CMakeLists.txt index 064e6b2076302eb72c6d02669a4de1a8b6be729a..b0fe4f0276cdeb3540b39a4d545a151e606a9bc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,12 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.2) project(VisualDL) +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) +endif(CCACHE_FOUND) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "-fPIC") @@ -25,16 +31,16 @@ include_directories(${PROJECT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${PROJECT_SOURCE_DIR}/thirdparty/local/include) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/visualdl/backend/storage) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/visualdl/backend/logic) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/visualdl/storage) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/visualdl/logic) add_executable(vl_test - ${PROJECT_SOURCE_DIR}/visualdl/backend/test.cc - ${PROJECT_SOURCE_DIR}/visualdl/backend/storage/storage_test.cc - ${PROJECT_SOURCE_DIR}/visualdl/backend/utils/test_concurrency.cc - ${PROJECT_SOURCE_DIR}/visualdl/backend/logic/im_test.cc - ${PROJECT_SOURCE_DIR}/visualdl/backend/utils/concurrency.h - ${PROJECT_SOURCE_DIR}/visualdl/backend/utils/filesystem.h + ${PROJECT_SOURCE_DIR}/visualdl/test.cc + ${PROJECT_SOURCE_DIR}/visualdl/storage/storage_test.cc + ${PROJECT_SOURCE_DIR}/visualdl/utils/test_concurrency.cc + ${PROJECT_SOURCE_DIR}/visualdl/logic/im_test.cc + ${PROJECT_SOURCE_DIR}/visualdl/utils/concurrency.h + ${PROJECT_SOURCE_DIR}/visualdl/utils/filesystem.h ) target_link_libraries(vl_test storage im gtest glog protobuf gflags pthread) diff --git a/tests.sh b/tests.sh new file mode 100644 index 0000000000000000000000000000000000000000..7e51cb30e28d1597a5aa70db7fb64e3e46f6b3b9 --- /dev/null +++ b/tests.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -ex + +sudo pip install numpy +#sudo apt-get install --only-upgrade cmake -y +mkdir -p build +cd build +cmake .. +make +make test + +#if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./travis/run_on_pull_requests; fi +#if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./travis/run_on_non_pull_requests; fi diff --git a/visualdl/backend/logic/CMakeLists.txt b/visualdl/backend/logic/CMakeLists.txt deleted file mode 100644 index b28e299a98afe9970d6f9e654ecae39f95f8a6b7..0000000000000000000000000000000000000000 --- a/visualdl/backend/logic/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_library(sdk ${PROJECT_SOURCE_DIR}/visualdl/backend/logic/sdk.cc) -add_library(im ${PROJECT_SOURCE_DIR}/visualdl/backend/logic/im.cc) - -## pybind -add_library(core SHARED ${PROJECT_SOURCE_DIR}/visualdl/backend/logic/pybind.cc) -add_dependencies(core pybind python im storage sdk protobuf glog) -target_link_libraries(core PRIVATE pybind python im storage sdk protobuf glog) diff --git a/visualdl/logic/CMakeLists.txt b/visualdl/logic/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f021af7015d585a2d713029323b445f6941cea4 --- /dev/null +++ b/visualdl/logic/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(sdk ${PROJECT_SOURCE_DIR}/visualdl/logic/sdk.cc) +add_library(im ${PROJECT_SOURCE_DIR}/visualdl/logic/im.cc) +add_dependencies(im storage_proto) +add_dependencies(sdk storage_proto) + +## pybind +add_library(core SHARED ${PROJECT_SOURCE_DIR}/visualdl/logic/pybind.cc) +add_dependencies(core pybind python im storage sdk protobuf glog) +target_link_libraries(core PRIVATE pybind python im storage sdk protobuf glog) diff --git a/visualdl/backend/logic/im.cc b/visualdl/logic/im.cc similarity index 98% rename from visualdl/backend/logic/im.cc rename to visualdl/logic/im.cc index 305fb42c73cf4c6992a7d7fbd71ccbb00f7f7a5d..76d55d225bafe1754d14c351436bfde97041665e 100644 --- a/visualdl/backend/logic/im.cc +++ b/visualdl/logic/im.cc @@ -1,7 +1,7 @@ #include #include -#include "visualdl/backend/logic/im.h" +#include "visualdl/logic/im.h" namespace visualdl { diff --git a/visualdl/backend/logic/im.h b/visualdl/logic/im.h similarity index 92% rename from visualdl/backend/logic/im.h rename to visualdl/logic/im.h index de884b0a890a97025e90a90342909e9b33a6ba18..5df59e2994807cdfe4a0a5e746f8bbc264759433 100644 --- a/visualdl/backend/logic/im.h +++ b/visualdl/logic/im.h @@ -1,12 +1,12 @@ -#ifndef VISUALDL_BACKEND_LOGIC_IM_H -#define VISUALDL_BACKEND_LOGIC_IM_H +#ifndef VISUALDL_LOGIC_IM_H +#define VISUALDL_LOGIC_IM_H #include -#include #include #include -#include "visualdl/backend/storage/storage.h" +#include "visualdl/storage/storage.h" +#include "visualdl/utils/concurrency.h" namespace visualdl { diff --git a/visualdl/backend/logic/im_test.cc b/visualdl/logic/im_test.cc similarity index 94% rename from visualdl/backend/logic/im_test.cc rename to visualdl/logic/im_test.cc index c387565477ee9df0ae8d2872ae6416f79e08ca7e..deaab5e4704063cabb652b1a7940d6321ae93adb 100644 --- a/visualdl/backend/logic/im_test.cc +++ b/visualdl/logic/im_test.cc @@ -1,4 +1,4 @@ -#include "visualdl/backend/logic/im.h" +#include "visualdl/logic/im.h" #include "gtest/gtest.h" diff --git a/visualdl/backend/logic/pybind.cc b/visualdl/logic/pybind.cc similarity index 98% rename from visualdl/backend/logic/pybind.cc rename to visualdl/logic/pybind.cc index 4b114a53344c91102876b008f95c77ee797bfe05..7a79429a7dde5f11a9690ab326eb2cf2129610d6 100644 --- a/visualdl/backend/logic/pybind.cc +++ b/visualdl/logic/pybind.cc @@ -2,7 +2,7 @@ #include #include -#include "visualdl/backend/logic/sdk.h" +#include "visualdl/logic/sdk.h" namespace py = pybind11; namespace vs = visualdl; diff --git a/visualdl/backend/logic/sdk.cc b/visualdl/logic/sdk.cc similarity index 99% rename from visualdl/backend/logic/sdk.cc rename to visualdl/logic/sdk.cc index b5bebe56d17dcc454560158bade5360f725df07a..513541511d48adc00e1a95f5bf51974fb0b1988f 100644 --- a/visualdl/backend/logic/sdk.cc +++ b/visualdl/logic/sdk.cc @@ -1,4 +1,5 @@ -#include "visualdl/backend/logic/sdk.h" +#include "visualdl/logic/sdk.h" + #include namespace visualdl { diff --git a/visualdl/backend/logic/sdk.h b/visualdl/logic/sdk.h similarity index 97% rename from visualdl/backend/logic/sdk.h rename to visualdl/logic/sdk.h index 9948ab709896784cea1c9294a2e4fac0586cee99..3937ffafbb91ac2792cb88a242a3833fa2bfc3e4 100644 --- a/visualdl/backend/logic/sdk.h +++ b/visualdl/logic/sdk.h @@ -1,11 +1,11 @@ -#ifndef VISUALDL_BACKEND_LOGIC_SDK_H -#define VISUALDL_BACKEND_LOGIC_SDK_H +#ifndef VISUALDL_LOGIC_SDK_H +#define VISUALDL_LOGIC_SDK_H #include #include #include -#include "visualdl/backend/logic/im.h" +#include "visualdl/logic/im.h" namespace visualdl { diff --git a/visualdl/backend/python/__init__.py b/visualdl/python/__init__.py similarity index 100% rename from visualdl/backend/python/__init__.py rename to visualdl/python/__init__.py diff --git a/visualdl/backend/python/summary.py b/visualdl/python/summary.py similarity index 100% rename from visualdl/backend/python/summary.py rename to visualdl/python/summary.py diff --git a/visualdl/backend/python/test_read_service.py b/visualdl/python/test_read_service.py similarity index 100% rename from visualdl/backend/python/test_read_service.py rename to visualdl/python/test_read_service.py diff --git a/visualdl/backend/python/test_summary.py b/visualdl/python/test_summary.py similarity index 100% rename from visualdl/backend/python/test_summary.py rename to visualdl/python/test_summary.py diff --git a/visualdl/backend/python/test_write_service.py b/visualdl/python/test_write_service.py similarity index 100% rename from visualdl/backend/python/test_write_service.py rename to visualdl/python/test_write_service.py diff --git a/visualdl/backend/storage/CMakeLists.txt b/visualdl/storage/CMakeLists.txt similarity index 100% rename from visualdl/backend/storage/CMakeLists.txt rename to visualdl/storage/CMakeLists.txt diff --git a/visualdl/backend/storage/storage.cc b/visualdl/storage/storage.cc similarity index 95% rename from visualdl/backend/storage/storage.cc rename to visualdl/storage/storage.cc index 9ed2e20e245d72aba003ce4074bb684c69e11a2f..2b88ad091a9810fb7473c12fa6daa4c2a214017b 100644 --- a/visualdl/backend/storage/storage.cc +++ b/visualdl/storage/storage.cc @@ -1,9 +1,9 @@ #include -#include #include -#include "visualdl/backend/storage/storage.h" -#include "visualdl/backend/utils/filesystem.h" +#include "visualdl/storage/storage.h" +#include "visualdl/utils/concurrency.h" +#include "visualdl/utils/filesystem.h" namespace visualdl { diff --git a/visualdl/backend/storage/storage.h b/visualdl/storage/storage.h similarity index 98% rename from visualdl/backend/storage/storage.h rename to visualdl/storage/storage.h index a827a6dbd8d936ff6f9c8de9c95289cd8cbff0ee..2787d9af87a9547921531b7dc509798a70001b71 100644 --- a/visualdl/backend/storage/storage.h +++ b/visualdl/storage/storage.h @@ -5,7 +5,7 @@ #include #include -#include "visualdl/backend/storage/storage.pb.h" +#include "visualdl/storage/storage.pb.h" namespace visualdl { diff --git a/visualdl/backend/storage/storage.proto b/visualdl/storage/storage.proto similarity index 100% rename from visualdl/backend/storage/storage.proto rename to visualdl/storage/storage.proto diff --git a/visualdl/backend/storage/storage_test.cc b/visualdl/storage/storage_test.cc similarity index 95% rename from visualdl/backend/storage/storage_test.cc rename to visualdl/storage/storage_test.cc index 91c2a59d47ed38f8f6a6eb5affc27305171bbf92..9ddf13a36153b8bbdb2b14ceabea7c79c971efbe 100644 --- a/visualdl/backend/storage/storage_test.cc +++ b/visualdl/storage/storage_test.cc @@ -1,4 +1,4 @@ -#include "visualdl/backend/storage/storage.h" +#include "visualdl/storage/storage.h" #include #include diff --git a/visualdl/backend/test.cc b/visualdl/test.cc similarity index 100% rename from visualdl/backend/test.cc rename to visualdl/test.cc diff --git a/visualdl/backend/test.py b/visualdl/test.py similarity index 100% rename from visualdl/backend/test.py rename to visualdl/test.py diff --git a/visualdl/backend/utils/concurrency.h b/visualdl/utils/concurrency.h similarity index 94% rename from visualdl/backend/utils/concurrency.h rename to visualdl/utils/concurrency.h index 45c8f88cc7b3bad8cb23752da62d3e894971baa9..5a8c320dfd4f57a28c1e420d92166504defd5c25 100644 --- a/visualdl/backend/utils/concurrency.h +++ b/visualdl/utils/concurrency.h @@ -1,5 +1,5 @@ -#ifndef VISUALDL_BACKEND_UTILS_CONCURRENCY_H -#define VISUALDL_BACKEND_UTILS_CONCURRENCY_H +#ifndef VISUALDL_UTILS_CONCURRENCY_H +#define VISUALDL_UTILS_CONCURRENCY_H #include #include diff --git a/visualdl/backend/utils/filesystem.h b/visualdl/utils/filesystem.h similarity index 95% rename from visualdl/backend/utils/filesystem.h rename to visualdl/utils/filesystem.h index 9a509407c12816f77a2a97f1d2ed5e2972a7c531..593013515ca5f0c3b60c47cd1e0476649dd070c4 100644 --- a/visualdl/backend/utils/filesystem.h +++ b/visualdl/utils/filesystem.h @@ -1,5 +1,5 @@ -#ifndef VISUALDL_BACKEND_UTILS_FILESYSTEM_H -#define VISUALDL_BACKEND_UTILS_FILESYSTEM_H +#ifndef VISUALDL_UTILS_FILESYSTEM_H +#define VISUALDL_UTILS_FILESYSTEM_H #include #include diff --git a/visualdl/backend/utils/log.h b/visualdl/utils/log.h similarity index 78% rename from visualdl/backend/utils/log.h rename to visualdl/utils/log.h index 9aed0806d905079b09e37734224bbf2ddb3b376c..2ee54bd33efd665edddeb87ac3d5cf3eec1d6f64 100644 --- a/visualdl/backend/utils/log.h +++ b/visualdl/utils/log.h @@ -1,7 +1,8 @@ -#ifndef VISUALDL_BACKEND_UTILS_LOG_H -#define VISUALDL_BACKEND_UTILS_LOG_H +#ifndef VISUALDL_UTILS_LOG_H +#define VISUALDL_UTILS_LOG_H #include + namespace visualdl { namespace log { diff --git a/visualdl/backend/utils/test_concurrency.cc b/visualdl/utils/test_concurrency.cc similarity index 81% rename from visualdl/backend/utils/test_concurrency.cc rename to visualdl/utils/test_concurrency.cc index 9657e2d31e16453a790cf052703605da389999a2..96f18caabcf13a49fc4c98f31e3c0f7ff37cede2 100644 --- a/visualdl/backend/utils/test_concurrency.cc +++ b/visualdl/utils/test_concurrency.cc @@ -1,4 +1,4 @@ -#include "visualdl/backend/utils/concurrency.h" +#include "visualdl/utils/concurrency.h" #include #include @@ -16,4 +16,4 @@ TEST(concurrency, test) { cc::PeriodExector::Global()(std::move(task), 200); } -} // namespace visualdl \ No newline at end of file +} // namespace visualdl