From 51c22fe434a7a9ba0db4f3f9497f04387e95563a Mon Sep 17 00:00:00 2001 From: chengduoZH Date: Tue, 3 Apr 2018 22:09:01 +0800 Subject: [PATCH] follow comments --- paddle/fluid/memory/CMakeLists.txt | 6 +++--- paddle/fluid/memory/pinned_memory_test.cu | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/paddle/fluid/memory/CMakeLists.txt b/paddle/fluid/memory/CMakeLists.txt index 66e4f8cdd02..8b3043af7a1 100644 --- a/paddle/fluid/memory/CMakeLists.txt +++ b/paddle/fluid/memory/CMakeLists.txt @@ -15,6 +15,6 @@ cc_library(paddle_memory cc_test(memory_test SRCS memory_test.cc DEPS place paddle_memory) -# if (WITH_GPU) -# nv_test(pinned_memory_test SRCS pinned_memory_test.cu DEPS place paddle_memory) -# endif() +#if (WITH_GPU) +# nv_test(pinned_memory_test SRCS pinned_memory_test.cu DEPS place paddle_memory) +#endif() diff --git a/paddle/fluid/memory/pinned_memory_test.cu b/paddle/fluid/memory/pinned_memory_test.cu index 926a5b265bb..a000001f417 100644 --- a/paddle/fluid/memory/pinned_memory_test.cu +++ b/paddle/fluid/memory/pinned_memory_test.cu @@ -11,6 +11,8 @@ distributed under the License is distributed on an "AS IS" BASIS, 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 +#include #include "paddle/fluid/memory/detail/memory_block.h" #include "paddle/fluid/memory/detail/meta_data.h" @@ -21,9 +23,6 @@ limitations under the License. */ #include "paddle/fluid/platform/gpu_info.h" #include "paddle/fluid/platform/place.h" -#include -#include - // This unit test is an example comparing the performance between using pinned // memory and not. In general, using pinned memory will be faster. template @@ -114,8 +113,8 @@ float test_pinned_memory() { cudaEventSynchronize(stop_e); cudaEventElapsedTime(&elapsedTime, start_e, stop_e); - std::cout << cpu_place << " " - << "time consume:" << elapsedTime / 30 << std::endl; + // std::cout << cpu_place << " " + // << "time consume:" << elapsedTime / 30 << std::endl; for (int l = 0; l < iteration; ++l) { for (int k = 0; k < data_size; ++k) { @@ -144,5 +143,5 @@ TEST(CPUANDCUDAPinned, CPUAllocatorAndCUDAPinnedAllocator) { // test for the time being. float time1 = test_pinned_memory(); float time2 = test_pinned_memory(); - EXPECT_GT(time1, time2) + EXPECT_GT(time1, time2); } -- GitLab