提交 51c22fe4 编写于 作者: C chengduoZH

follow comments

上级 e099b180
......@@ -15,6 +15,6 @@ cc_library(paddle_memory
cc_test(memory_test SRCS memory_test.cc DEPS place paddle_memory)
# if (WITH_GPU)
#if (WITH_GPU)
# nv_test(pinned_memory_test SRCS pinned_memory_test.cu DEPS place paddle_memory)
# endif()
#endif()
......@@ -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 <gtest/gtest.h>
#include <unordered_map>
#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 <gtest/gtest.h>
#include <unordered_map>
// This unit test is an example comparing the performance between using pinned
// memory and not. In general, using pinned memory will be faster.
template <typename T>
......@@ -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<paddle::platform::CPUPlace>();
float time2 = test_pinned_memory<paddle::platform::CUDAPinnedPlace>();
EXPECT_GT(time1, time2)
EXPECT_GT(time1, time2);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册