Skip to content

Commit

Permalink
fix eigen include path
Browse files Browse the repository at this point in the history
  • Loading branch information
QiJune committed Jun 27, 2017
1 parent ab91232 commit c5d9ca8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 48 deletions.
8 changes: 4 additions & 4 deletions cmake/external/eigen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ INCLUDE(ExternalProject)

SET(EIGEN_SOURCE_DIR ${THIRD_PARTY_PATH}/eigen3)

INCLUDE_DIRECTORIES(${EIGEN_SOURCE_DIR}/src/)
INCLUDE_DIRECTORIES(${EIGEN_SOURCE_DIR}/src/eigen3)

ExternalProject_Add(
eigen3
${EXTERNAL_PROJECT_LOG_ARGS}
URL "https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz"
URL_MD5 "4645c66075982da6fa0bcf6b20f3e8f7"
URL "https://bitbucket.org/eigen/eigen/get/3.3.4.tar.gz"
URL_MD5 "1a47e78efe365a97de0c022d127607c3"
PREFIX ${EIGEN_SOURCE_DIR}
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
Expand All @@ -17,4 +17,4 @@ ExternalProject_Add(
TEST_COMMAND ""
)

LIST(APPEND external_project_dependencies eigen3)
LIST(APPEND external_project_dependencies eigen3)
44 changes: 0 additions & 44 deletions paddle/framework/ddim_test.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include <sstream>
#include <vector>

#include "eigen3/Eigen/Core"
#include "eigen3/Eigen/Dense"
#include "eigen3/unsupported/Eigen/CXX11/Tensor"
#include "gtest/gtest.h"
#include "paddle/framework/ddim.h"

Expand Down Expand Up @@ -64,44 +61,3 @@ TEST(DDim, Print) {
ss << ddim;
EXPECT_EQ("2, 3, 4", ss.str());
}

template <typename T>
using Vec =
Eigen::TensorMap<Eigen::Tensor<T, 1, Eigen::RowMajor, Eigen::DenseIndex>,
Eigen::Aligned>;

template <typename T>
using Matrix =
Eigen::TensorMap<Eigen::Tensor<T, 2, Eigen::RowMajor, Eigen::DenseIndex>,
Eigen::Aligned>;

template <typename T>
void print(T* input, int size) {
for (int i = 0; i < size; i++) {
std::cout << input[i] << " ";
}
std::cout << std::endl;
}

TEST(Eigen, start) {
int size = 4;

float* t_a = (float*)malloc(size * sizeof(float));
float* t_b = (float*)malloc(size * sizeof(float));
float* t_c = (float*)malloc(size * sizeof(float));
for (int i = 0; i < size; i++) {
t_a[i] = i;
t_b[i] = i;
}
Vec<float> a(t_a, size);
Vec<float> b(t_b, size);
Vec<float> c(t_c, size);

Eigen::DefaultDevice dd;
c.device(dd) = a + b;
print<float>(t_c, size);

free(t_a);
free(t_b);
free(t_c);
}

0 comments on commit c5d9ca8

Please sign in to comment.