22 lines
417 B
Python
22 lines
417 B
Python
from multiprocessing import Process
|
|
import numpy as np
|
|
import os
|
|
|
|
def burn():
|
|
a = np.random.rand(2000, 2000)
|
|
b = np.random.rand(2000, 2000)
|
|
|
|
while True:
|
|
# 浮点 + SIMD + 内存访问
|
|
np.dot(a, b)
|
|
|
|
if __name__ == "__main__":
|
|
procs = []
|
|
for _ in range(os.cpu_count()):
|
|
p = Process(target=burn)
|
|
p.start()
|
|
procs.append(p)
|
|
|
|
for p in procs:
|
|
p.join()
|