Can't use multi-core CPU correctly!
Run on CPU with openblas and openmp.
Run the following code:
import time, os
def do(x, n):
return [mx.nd.dot(x,x) for i in range(n)]
def wait(x):
for y in x:
y.wait_to_read()
tic = time.time()
a = mx.nd.ones((1000, 1000))
b = do(a, 1000)
print('time for pushed into backend engine:\n %f sec' % (time.time()-tic))
wait(b)
print('time for all finished:\n %f sec' % (time.time()-tic))
when OMP_NUM_THREADS = 4, it will take about 8-9s. but when OMP_NUM_THREADS = 32, it will take about 28-32s.
I have checked and I am sure that when OMP_NUM_THREADS = 4, 4 cores are filled, when OMP_NUM_THREADS = 32, 32 cores are filled .
when I set a = mx.nd.ones((10000, 10000)) 32 cores will be faster than 4 cores, but only about 2 times faster.
why mxnet or openblas can't use the power of multi-core cpu, in such a simple situation?
Try to increase worker thread # as well: export MXNET_CPU_WORKER_NTHREADS=16
I found that changing $MXNET_CPU_WORKER_NTHREADS has no effect on the results. No matter it's 16, 32, or 1, the results are almost the same.
This issue is closed due to lack of activity in the last 90 days. Feel free to reopen if this is still an active issue. Thanks!
I'm still experiencing the same issue
This problem was addressed. Adding the export line increased the detection speed dramatically!
@apache/mxnet-committers: This issue has been inactive for the past 90 days. It has no label and needs triage.
For general "how-to" questions, our user forum (and Chinese version) is a good place to get help.
@daranday's comment above says setting 'MXNET_CPU_WORKER_NTHREADS' fixes the problem. I'm closing this issue. Please reopen if that suggestion doesn't fix the problem. Thanks!