diff --git a/paddle/fluid/memory/allocation/CMakeLists.txt b/paddle/fluid/memory/allocation/CMakeLists.txt index 0816218a0d18a322570716a439b7e33518fdd1f0..bd1908ac65509343530aa57489661637eed72595 100644 --- a/paddle/fluid/memory/allocation/CMakeLists.txt +++ b/paddle/fluid/memory/allocation/CMakeLists.txt @@ -27,26 +27,23 @@ else () set(AllocatorFacadeDeps) endif() -# TODO: Fix this unittest failed on Windows -if(NOT WIN32) - if (WITH_GPU) - nv_test(best_fit_allocator_test - SRCS best_fit_allocator_test.cc - best_fit_allocator_test.cu - DEPS best_fit_allocator - locked_allocator - cpu_allocator - cuda_allocator - device_context - memcpy) - else() - cc_test(best_fit_allocator_test - SRCS best_fit_allocator_test.cc - DEPS best_fit_allocator - locked_allocator - cpu_allocator) - endif() -endif(NOT WIN32) +if (WITH_GPU) + nv_test(best_fit_allocator_test + SRCS best_fit_allocator_test.cc + best_fit_allocator_test.cu + DEPS best_fit_allocator + locked_allocator + cpu_allocator + cuda_allocator + device_context + memcpy) +else() + cc_test(best_fit_allocator_test + SRCS best_fit_allocator_test.cc + DEPS best_fit_allocator + locked_allocator + cpu_allocator) +endif() list(APPEND AllocatorFacadeDeps cpu_allocator locked_allocator aligned_allocator retry_allocator buffered_allocator naive_best_fit_allocator auto_growth_best_fit_allocator best_fit_allocator) diff --git a/paddle/fluid/memory/allocation/best_fit_allocator_test.cc b/paddle/fluid/memory/allocation/best_fit_allocator_test.cc index fa7662d2f81b1728d3949309283b9ab170bc11c4..d20a6fc0e061bc8ffad6ef2cece25779dbd48364 100644 --- a/paddle/fluid/memory/allocation/best_fit_allocator_test.cc +++ b/paddle/fluid/memory/allocation/best_fit_allocator_test.cc @@ -13,11 +13,13 @@ // limitations under the License. #include "paddle/fluid/memory/allocation/best_fit_allocator.h" + #include #include #include // NOLINT #include #include + #include "gtest/gtest.h" #include "paddle/fluid/memory/allocation/cpu_allocator.h" #include "paddle/fluid/memory/allocation/locked_allocator.h" @@ -33,7 +35,10 @@ class StubAllocation : public Allocation { }; TEST(BestFitAllocator, test_allocation) { - StubAllocation stub(4UL * 1024 * 1024 * 1024); + // NOTE(zhiqiu): On windows with msvc compiler, unsigned long (UL) is 32bits, + // so 4UL * 1024 * 1024 * 1024 becomes 0. + // We need to use 4ULL (unsigned long long) here. + StubAllocation stub(4ULL * 1024 * 1024 * 1024); BestFitAllocator allocator(&stub); { auto allocation = allocator.Allocate(64); } diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index e4a11e5b7a33d1782b254d4cfa95c46f77bcfc8b..17893a12189c150f8182a0cf135d3312a17404c3 100644 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -63,7 +63,6 @@ if(WIN32) list(REMOVE_ITEM TEST_OPS test_merge_ids_op) list(REMOVE_ITEM TEST_OPS test_split_ids_op) LIST(REMOVE_ITEM TEST_OPS test_ref_by_trainer_id_op) - LIST(REMOVE_ITEM TEST_OPS test_math_op_patch_var_base) endif() if(APPLE OR WIN32)