Skip to content

paddle在cpu上计算速度过慢问题 #75760

@liuqi45

Description

@liuqi45

bug描述 Describe the Bug

这是一个老问题,从paddle2.5到现在的paddle3.2一直没有解决,那就是paddle算子在cpu上速度过慢,远远比numpy与pytorch缓慢
下面是测试代码

import time
import numpy as np
#numpy计算矩阵乘法
a = np.random.randn(10000,10000).astype(np.float64)
b = np.random.randn(10000,10000).astype(np.float64)


start = time.time()
c = a @ b
end = time.time()
print(end - start)
import time
import torch
#pytorch计算矩阵乘法
a = torch.randn((10000,10000), dtype=torch.float64)
b = torch.randn((10000,10000), dtype=torch.float64)


start = time.time()
c = a @ b
end = time.time()
print(end - start)
import time
import paddle
#paddle计算矩阵乘法
paddle.device.set_device('cpu')
a = paddle.randn((10000,10000), dtype=paddle.float64)
b = paddle.randn((10000,10000), dtype=paddle.float64)


start = time.time()
c = a @ b
end = time.time()
print(end - start)

在我的AMD R7 5700x cpu,windows平台上,numpy,pytorch耗时都在7.5秒左右,而paddle耗时143秒,这是不可接受的缓慢计算速度

其他补充信息 Additional Supplementary Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions