This commit is contained in:
feiga 2016-06-23 16:04:07 +08:00
Родитель 1d852787d1 b943d5a1bc
Коммит 84f49ae8aa
6 изменённых файлов: 27 добавлений и 7 удалений

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

@ -72,8 +72,8 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir);$(MSMPI_INC);$(ThirdPartyPath)\ZeroMQ 4.0.4\include;$(SolutionDir)/src;$(SolutionDir)/include;$(VC_IncludePath);$(WindowsSDK_IncludePath);D:\multiverso-next\lib</IncludePath> <IncludePath>$(ProjectDir);$(MSMPI_INC);$(ThirdPartyPath)\ZeroMQ 4.0.4\include;$(SolutionDir)/src;$(SolutionDir)/include;$(VC_IncludePath);$(WindowsSDK_IncludePath);D:\git_dictionary\multiverso-master_update\multiverso-master\include;</IncludePath>
<LibraryPath>$(MSMPI_LIB64);$(SolutionDir)/x64/$(Configuration);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);D:\multiverso-next\lib</LibraryPath> <LibraryPath>$(MSMPI_LIB64);$(SolutionDir)/x64/$(Configuration);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);D:\git_dictionary\multiverso-master_update\multiverso-master\x64\debug;</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_zmq|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_zmq|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>

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

@ -25,6 +25,7 @@
#include <multiverso/updater/updater.h> #include <multiverso/updater/updater.h>
#include <multiverso/table_factory.h> #include <multiverso/table_factory.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
using namespace multiverso; using namespace multiverso;

3
include/.gitignore поставляемый
Просмотреть файл

@ -25,4 +25,5 @@
# Executables # Executables
*.exe *.exe
*.out *.out
*.app *.app

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

@ -1,10 +1,12 @@
#ifndef MULTIVERSO_MATRIX_TABLE_H_ #ifndef MULTIVERSO_MATRIX_TABLE_H_
#define MULTIVERSO_MATRIX_TABLE_H_ #define MULTIVERSO_MATRIX_TABLE_H_
#include "multiverso/multiverso.h" #include "multiverso/multiverso.h"
#include "multiverso/table_interface.h" #include "multiverso/table_interface.h"
#include <vector> #include <vector>
#include <random>
namespace multiverso { namespace multiverso {
@ -97,6 +99,7 @@ public:
explicit MatrixServerTable(const MatrixTableOption<T>& option); explicit MatrixServerTable(const MatrixTableOption<T>& option);
MatrixServerTable(integer_t num_row, integer_t num_col); MatrixServerTable(integer_t num_row, integer_t num_col);
MatrixServerTable(integer_t num_row, integer_t num_col, float min_value, float max_value);
void ProcessAdd(const std::vector<Blob>& data) override; void ProcessAdd(const std::vector<Blob>& data) override;

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

@ -84,8 +84,8 @@
<LibraryPath>$(MSMPI_LIB64);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);</LibraryPath> <LibraryPath>$(MSMPI_LIB64);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_zmq|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_zmq|x64'">
<IncludePath>$(ThirdPartyPath)\ZeroMQ 4.0.4\include;$(ProjectDir)\..\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath> <IncludePath>D:\ZeroMQ\include;$(ProjectDir)\..\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(ThirdPartyPath)\ZeroMQ 4.0.4\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);D:\multiverso-next\lib;</LibraryPath> <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);D:\multiverso-next\lib;D:\ZeroMQ\lib;</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<ClCompile> <ClCompile>
@ -154,7 +154,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>MULTIVERSO_USE_MPI;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>MULTIVERSO_USE_MPI;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OpenMPSupport>true</OpenMPSupport> <OpenMPSupport>true</OpenMPSupport>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>false</TreatWarningAsError>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -245,4 +245,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

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

@ -368,6 +368,21 @@ MatrixServerTable<T>::MatrixServerTable(integer_t num_row, integer_t num_col) :
server_id_, size, num_col, num_row, num_col); server_id_, size, num_col, num_row, num_col);
} }
template <typename T>
MatrixServerTable<T>::MatrixServerTable(integer_t num_row, integer_t num_col, float min_value,float max_value) :
MatrixServerTable<T>::MatrixServerTable(num_row, num_col) {
if (typeid(T) == typeid(float)){
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<float> dis(min_value,max_value);
for (int i = 0; i<storage_.size(); i++)
{
storage_[i] = dis(gen);
}
}
}
template <typename T> template <typename T>
void MatrixServerTable<T>::ProcessAdd(const std::vector<Blob>& data) { void MatrixServerTable<T>::ProcessAdd(const std::vector<Blob>& data) {
CHECK(data.size() == 2 || data.size() == 3); CHECK(data.size() == 2 || data.size() == 3);