Giter Site home page Giter Site logo

Number of threads about vgg16-pretrained-c HOT 11 CLOSED

jcanore avatar jcanore commented on August 16, 2024
Number of threads

from vgg16-pretrained-c.

Comments (11)

ZFTurbo avatar ZFTurbo commented on August 16, 2024

Number of threads should be equal or lower than number of cores you have on your machine.

from vgg16-pretrained-c.

jcanore avatar jcanore commented on August 16, 2024

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.

ZFTurbo avatar ZFTurbo commented on August 16, 2024
  1. Check if you compile with OpenMP support. Flag -fopenmp. Also check if program really uses 2 threads.
  2. 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.

jcanore avatar jcanore commented on August 16, 2024

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.

ZFTurbo avatar ZFTurbo commented on August 16, 2024

Which system? Linux? Windows? Did you check if program really uses 3 threads?

from vgg16-pretrained-c.

jcanore avatar jcanore commented on August 16, 2024

Linux (Ubuntu 14.04). Yes, I checked it with htop.

This is very strange.

from vgg16-pretrained-c.

ZFTurbo avatar ZFTurbo commented on August 16, 2024

I will check it on Linux as well. I developed it on Windows, actually. ) Will post result ASAP.

from vgg16-pretrained-c.

jcanore avatar jcanore commented on August 16, 2024

Great, thanks.

from vgg16-pretrained-c.

ZFTurbo avatar ZFTurbo commented on August 16, 2024

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.

ZFTurbo avatar ZFTurbo commented on August 16, 2024

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.

jcanore avatar jcanore commented on August 16, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.