diff --git a/cmake/util.cmake b/cmake/util.cmake index a91e1d56430144bb88072936989d83cd619e5771..5f2f4a075cc579fac827fefbfc30f6743d2e4cc9 100644 --- a/cmake/util.cmake +++ b/cmake/util.cmake @@ -104,9 +104,10 @@ function(link_paddle_exe TARGET_NAME) ${PROTOBUF_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${CBLAS_LIBS} - ${CMAKE_DL_LIBS} ${INTERAL_LIBS} - ${ZLIB_LIBRARIES}) + ${ZLIB_LIBRARIES} + ${CMAKE_DL_LIBS} + ) if(WITH_PYTHON) target_link_libraries(${TARGET_NAME} diff --git a/paddle/math/Allocator.h b/paddle/math/Allocator.h index ca8eadbc1aa42265c1e505d41e1a134b0e7f19b9..f7aa60380f23eeea91ee852480862f6b19caedec 100644 --- a/paddle/math/Allocator.h +++ b/paddle/math/Allocator.h @@ -49,7 +49,7 @@ public: */ virtual void* alloc(size_t size) { void* ptr; - posix_memalign(&ptr, 32ul, size); + CHECK_EQ(posix_memalign(&ptr, 32ul, size), 0); CHECK(ptr) << "Fail to allocate CPU memory: size=" << size; return ptr; } diff --git a/paddle/math/tests/test_SIMDFunctions.cpp b/paddle/math/tests/test_SIMDFunctions.cpp index bae5d8c684d8920b738fcd1cda1bd831f2333605..491b0cda7b9e1a13882aee6621e0de984709ae80 100644 --- a/paddle/math/tests/test_SIMDFunctions.cpp +++ b/paddle/math/tests/test_SIMDFunctions.cpp @@ -38,7 +38,7 @@ static std::mt19937 RandomEngine(time(0)); inline static std::unique_ptr NewVector(size_t len = VECTOR_LEN, size_t align = ALIGN) { float* ptr; - posix_memalign((void**)&ptr, align, len * sizeof(float)); + CHECK_EQ(posix_memalign((void**)&ptr, align, len * sizeof(float)), 0); return std::unique_ptr(ptr); } diff --git a/paddle/parameter/tests/test_common.cpp b/paddle/parameter/tests/test_common.cpp index 4f92aec1d967169e2c27579b8a95941c029a3e49..1a22abf7cf80157039f6147293e7648d654e45f7 100644 --- a/paddle/parameter/tests/test_common.cpp +++ b/paddle/parameter/tests/test_common.cpp @@ -125,9 +125,11 @@ TEST_F(CommonTest, sgdUpdate) { const size_t alignHeader[] = {0, 2, 3, 5, 7, 8}; for (auto& size : sizeVec_) { real *gradientBuffer, *valueBuffer, *momentumBuffer; - posix_memalign((void**)&gradientBuffer, 32, sizeof(real) * size); - posix_memalign((void**)&valueBuffer, 32, sizeof(real) * size); - posix_memalign((void**)&momentumBuffer, 32, sizeof(real) * size); + CHECK_EQ(posix_memalign((void**)&gradientBuffer, 32, sizeof(real) * size), + 0); + CHECK_EQ(posix_memalign((void**)&valueBuffer, 32, sizeof(real) * size), 0); + CHECK_EQ(posix_memalign((void**)&momentumBuffer, 32, sizeof(real) * size), + 0); for (size_t i = 0; i < size; i++) { gradientBuffer[i] = 1.0; diff --git a/paddle/utils/Stat.cpp b/paddle/utils/Stat.cpp index aab5446a98c0bae3f03b4b319836721bdd1112da..ff6e8ade2cd48f85c3f1a0c2acd5542097aa4117 100644 --- a/paddle/utils/Stat.cpp +++ b/paddle/utils/Stat.cpp @@ -25,7 +25,7 @@ namespace paddle { pid_t getTID() { #if defined(__APPLE__) || defined(__OSX__) pid_t tid = syscall(SYS_thread_selfid); - #elif defined(__LINUX__) + #else #ifndef __NR_gettid #define __NR_gettid 224 #endif diff --git a/paddle/utils/arch/linux/Locks.cpp b/paddle/utils/arch/linux/Locks.cpp index 939a04dc0fc2cbc2cf1c33afaa74250e0b552bd3..347ae64c26dfdfcdaff62886481c20e9c4c7cfec 100644 --- a/paddle/utils/arch/linux/Locks.cpp +++ b/paddle/utils/arch/linux/Locks.cpp @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/util/Locks.h" +#include "paddle/utils/Locks.h" #include #include @@ -35,7 +35,7 @@ bool Semaphore::timeWait(struct timespec* ts) { } void Semaphore::wait() { - sem_wait(&m->sem); + sem_wait(&m->sem); } void Semaphore::post() { @@ -82,4 +82,4 @@ void ThreadBarrier::wait() { pthread_barrier_wait(&m->barrier_); } -} // namespace paddle \ No newline at end of file +} // namespace paddle