Comments (11)
Number of threads should be equal or lower than number of cores you have on your machine.
from vgg16-pretrained-c.
Yes, the machine has 2 cores and the inference time is higher with 2 threads than with 1.
This is very strange because I'm running the code from the repository without any modification.
Any idea/suggestion?
from vgg16-pretrained-c.
- Check if you compile with OpenMP support. Flag -fopenmp. Also check if program really uses 2 threads.
- Try to increase number of threads to 4.
Slow down can be possible if overhead to start several threads higher than profit it gives.
from vgg16-pretrained-c.
These are the timings I get using the commands indicated in the repository on a different machine (Intel Core i5-2400 CPU @ 3.10GHz, 8GB RAM):
Reading weights (all layers): 42 seconds
Reading weights (convolution only): 5 seconds
Processing one image (all layers, single core): 19 seconds
Processing one image (all layers, 3 cores): 20 seconds
Processing one image (convolution only, single core): 17 seconds
Processing one image (convolution only, 3 cores): 18 seconds
from vgg16-pretrained-c.
Which system? Linux? Windows? Did you check if program really uses 3 threads?
from vgg16-pretrained-c.
Linux (Ubuntu 14.04). Yes, I checked it with htop.
This is very strange.
from vgg16-pretrained-c.
I will check it on Linux as well. I developed it on Windows, actually. ) Will post result ASAP.
from vgg16-pretrained-c.
Great, thanks.
from vgg16-pretrained-c.
The problem is with clock() function in multithreaded binaries.:
https://stackoverflow.com/questions/10874214/measure-execution-time-in-c-openmp-code
It shows incorrect elapsed time. It actually shows sum of times for all threads. I will try to fix it.
from vgg16-pretrained-c.
Problem fixed. You can pull from git.
Log:
Using 1 threads
Reading weights: 4.863 sec
Infer image cat.txt: 21.686 sec
Using 31 threads
Reading weights: 5.076 sec
Infer image cat.txt: 2.493 sec
from vgg16-pretrained-c.
Yes, now it works. Thanks!
Using 1 threads
Reading weights: 4.352 sec
Infer image cat.txt: 20.440 sec
Using 3 threads
Reading weights: 4.348 sec
Infer image cat.txt: 10.384 sec
from vgg16-pretrained-c.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vgg16-pretrained-c.