【发布时间】:2014-06-15 04:40:21
【问题描述】:
我对 OpenCL 编程完全陌生,我决定从下载的 AMD SDK 中运行一些示例。我的第一选择是Reduction sample。每次我在 CPU 上执行程序时,我的执行时间比在 GPU 上低 10 倍左右。在计算方面,GPU 不应该比 CPU 更好吗?
我的硬件:
- CPU i5-2430M 2.40 Ghz
- GPU AMD Radeon 6630M
在平台 0 (GPU) 上执行:
$ Reduction.exe -x 33554432 -i 5 -q -t -p 0
Platform 0 : Advanced Micro Devices, Inc.
Platform 1 : Intel(R) Corporation
Selected Platform Vendor : Advanced Micro Devices, Inc.
Device 0 : Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz Device ID is 009E83A0
Executing kernel for 5 iterations
-------------------------------------------
Exec: 1.64225
| Elements | Time(sec) | (DataTransfer + Kernel)Time(sec) |
|----------|-----------|----------------------------------|
| 33554432 | 1.83705 | 1.64225 |
在平台 1 (CPU) 上执行:
$ Reduction.exe -x 33554432 -i 5 -q -t -p 1
Platform 0 : Advanced Micro Devices, Inc.
Platform 1 : Intel(R) Corporation
GPU not found. Falling back to CPU device
Selected Platform Vendor : Intel(R) Corporation
Device 0 : Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz Device ID is 040BEF1C
Executing kernel for 5 iterations
-------------------------------------------
Exec: 0.198049
| Elements | Time(sec) | (DataTransfer + Kernel)Time(sec) |
|----------|-----------|----------------------------------|
| 33554432 | 0.542269 | 0.198049 |
【问题讨论】:
标签: c++ parallel-processing opencl gpgpu