fix code style

panyx0718-patch-1
peizhilin 7 years ago
parent ef8a7db81e
commit dc339b78d7

@ -77,7 +77,6 @@ option(WITH_INFERENCE_API_TEST "Test fluid inference high-level api interface"
option(WITH_SYSTEM_BLAS "Use system blas library" OFF) option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION}) option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION})
option(WITH_FAST_MATH "Make use of fast math library, might affect the precision to some extent" ON) option(WITH_FAST_MATH "Make use of fast math library, might affect the precision to some extent" ON)
option(WITH_PREBUILD_OPENBLAS "Make use of the pre-built openblas library" ${WIN32})
# PY_VERSION # PY_VERSION
if(NOT PY_VERSION) if(NOT PY_VERSION)

@ -31,10 +31,12 @@ IF(NOT ${CBLAS_FOUND})
ADD_DEFINITIONS(-DPADDLE_USE_OPENBLAS) ADD_DEFINITIONS(-DPADDLE_USE_OPENBLAS)
IF (WITH_PREBUILD_OPENBLAS) IF (WIN32)
SET(CBLAS_FOUND true) SET(CBLAS_FOUND true)
MESSAGE(STATUS, "Use prebuild openblas, please put it at " ${CBLAS_INSTALL_DIR}) MESSAGE(WARNING, "In windows, openblas only support msvc build, please build it manually and put it at " ${CBLAS_INSTALL_DIR})
ELSE(WITH_PREBUILD_OPENBLAS) ENDIF(WIN32)
IF (NOT WIN32)
SET(OPENBLAS_CC "${CMAKE_C_COMPILER} -Wno-unused-but-set-variable -Wno-unused-variable") SET(OPENBLAS_CC "${CMAKE_C_COMPILER} -Wno-unused-but-set-variable -Wno-unused-variable")
SET(OPENBLAS_COMMIT "v0.2.20") SET(OPENBLAS_COMMIT "v0.2.20")
@ -76,9 +78,8 @@ IF(NOT ${CBLAS_FOUND})
ExternalProject_Add( ExternalProject_Add(
extern_openblas extern_openblas
${EXTERNAL_PROJECT_LOG_ARGS} ${EXTERNAL_PROJECT_LOG_ARGS}
# GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git
GIT_REPOSITORY http://admin@172.20.90.14:8080/r/openblas.git GIT_TAG ${OPENBLAS_COMMIT}
# GIT_TAG ${OPENBLAS_COMMIT}
PREFIX ${CBLAS_SOURCES_DIR} PREFIX ${CBLAS_SOURCES_DIR}
INSTALL_DIR ${CBLAS_INSTALL_DIR} INSTALL_DIR ${CBLAS_INSTALL_DIR}
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
@ -88,8 +89,8 @@ IF(NOT ${CBLAS_FOUND})
UPDATE_COMMAND "" UPDATE_COMMAND ""
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
) )
ENDIF (WITH_PREBUILD_OPENBLAS) ELSE()
ENDIF(NOT WIN32)
SET(CBLAS_PROVIDER openblas) SET(CBLAS_PROVIDER openblas)
IF(WITH_C_API) IF(WITH_C_API)
INSTALL(DIRECTORY ${CBLAS_INC_DIR} DESTINATION third_party/openblas) INSTALL(DIRECTORY ${CBLAS_INC_DIR} DESTINATION third_party/openblas)

@ -211,12 +211,12 @@ void PrepareLSTMWeight(const LoDTensor& W_forget_w0,
VLOG(30) << "LSTMWeight resized to " << out->dims(); VLOG(30) << "LSTMWeight resized to " << out->dims();
float* out_data = out->mutable_data<float>(platform::CPUPlace()); float* out_data = out->mutable_data<float>(platform::CPUPlace());
std::array<const float*, 4> tensors = std::array<const float*, 4> tensors{
{W_forget_w0.data<float>(), W_input_w0.data<float>(), {W_forget_w0.data<float>(), W_input_w0.data<float>(),
W_output_w0.data<float>(), W_cell_w0.data<float>()}; W_output_w0.data<float>(), W_cell_w0.data<float>()}};
std::array<const float*, 4> tensors1 = std::array<const float*, 4> tensors1{
{W_forget_w1.data<float>(), W_input_w1.data<float>(), {W_forget_w1.data<float>(), W_input_w1.data<float>(),
W_output_w1.data<float>(), W_cell_w1.data<float>()}; W_output_w1.data<float>(), W_cell_w1.data<float>()}};
for (int row = 0; row < D; row++) { for (int row = 0; row < D; row++) {
for (int col = 0; col < 4; col++) { for (int col = 0; col < 4; col++) {
@ -238,9 +238,9 @@ void PrepareLSTMWeight(const LoDTensor& W_forget_w0,
void PrepareLSTMBias(const LoDTensor& B_forget, const LoDTensor& B_input, void PrepareLSTMBias(const LoDTensor& B_forget, const LoDTensor& B_input,
const LoDTensor& B_output, const LoDTensor& B_cell, const LoDTensor& B_output, const LoDTensor& B_cell,
LoDTensor* out) { LoDTensor* out) {
std::array<const float*, 4> tensors = std::array<const float*, 4> tensors{
{B_forget.data<float>(), B_input.data<float>(), B_output.data<float>(), {B_forget.data<float>(), B_input.data<float>(), B_output.data<float>(),
B_cell.data<float>()}; B_cell.data<float>()}};
PADDLE_ENFORCE_EQ(B_forget.dims().size(), 1); PADDLE_ENFORCE_EQ(B_forget.dims().size(), 1);
int D = B_forget.dims()[0]; int D = B_forget.dims()[0];

@ -207,7 +207,7 @@ struct PassRegistrar : public Registrar {
return 0; \ return 0; \
} \ } \
static ::paddle::framework::ir::PassRegistrar<pass_class> \ static ::paddle::framework::ir::PassRegistrar<pass_class> \
&__pass_tmp_registrar_##pass_type##__ __UNUSED__() = \ &__pass_tmp_registrar_##pass_type##__ UNUSED = \
__pass_registrar_##pass_type##__ __pass_registrar_##pass_type##__
#define USE_PASS(pass_type) \ #define USE_PASS(pass_type) \
@ -215,7 +215,7 @@ struct PassRegistrar : public Registrar {
__use_pass_itself_##pass_type, \ __use_pass_itself_##pass_type, \
"USE_PASS must be called in global namespace"); \ "USE_PASS must be called in global namespace"); \
extern int TouchPassRegistrar_##pass_type(); \ extern int TouchPassRegistrar_##pass_type(); \
static int use_pass_itself_##pass_type##_ __UNUSED__() = \ static int use_pass_itself_##pass_type##_ UNUSED = \
TouchPassRegistrar_##pass_type() TouchPassRegistrar_##pass_type()
} // namespace ir } // namespace ir

@ -24,7 +24,6 @@
#include "glog/logging.h" #include "glog/logging.h"
#if !defined(_WIN32) #if !defined(_WIN32)
#define UNUSED __attribute__((unused))
#include <dlfcn.h> // dladdr #include <dlfcn.h> // dladdr
#include <execinfo.h> // backtrace #include <execinfo.h> // backtrace
#include <sys/stat.h> #include <sys/stat.h>
@ -34,9 +33,6 @@
#include <io.h> // _popen, _pclose #include <io.h> // _popen, _pclose
#include <windows.h> #include <windows.h>
#include <numeric> // std::accumulate in msvc #include <numeric> // std::accumulate in msvc
// windows version of __attribute__((unused))
#define UNUSED __pragma(warning(suppress : 4100))
#ifndef S_ISDIR // windows port for sys/stat.h #ifndef S_ISDIR // windows port for sys/stat.h
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) #define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
#endif // S_ISDIR #endif // S_ISDIR

@ -18,8 +18,8 @@
#include <cuda_runtime.h> #include <cuda_runtime.h>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include "ThreadPool.h"
#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/enforce.h"
#include "third_party/threadpool/src/extern_threadpool/ThreadPool.h"
namespace paddle { namespace paddle {
namespace platform { namespace platform {

@ -45,8 +45,8 @@ limitations under the License. */
// some platform-independent defintion // some platform-independent defintion
#if defined(_WIN32) #if defined(_WIN32)
#define __UNUSED__() #define UNUSED
#define __builtin_expect(EXP, C) (EXP) #define __builtin_expect(EXP, C) (EXP)
#else #else
#define __UNUSED__() __attribute__((unused)) #define UNUSED __attribute__((unused))
#endif #endif
Loading…
Cancel
Save