"Carson" <ca****@ieee.org> wrote in message
news:0W*****************@newssvr21.news.prodigy.co m...
Hi,
I am now writing a c-code, which is extremely computational extensive.
My computer is 2.8GHz Pentium (supports hyperthreading), using cygwin cc
(latest version) to compile with the followings:
cc -c -O3 -mcpu=i686 $(FLIST)
when i run my program, (a.out), it takes a quite a bit of time to finish,
(around 2 hours each run, I need to run through many test cases.)
And i notice that my cpu load is only ~50% when my program is running.
is it possible to do some tricks on cc so that my code will use HT
during runtime?
Thanks.
Carson
Hyperthreading means that the processor can execute two threads
simultaneously, so one thread only uses 50% of the total CPU capacity while
the other execution unit is idle. Therefore, a single-threaded program can
never use more than 50% CPU. You need to make your application
multi-threaded (two or more threads) in order take full advantage of your
CPU. If you split the computations into two equal parts, you can set off two
threads doing half the work each and the runtime should be close to half the
time.
I have never used cygwin cc so I do not know what kind of multi-threading
support it has. Alternatively, you could run two separate processes doing
half the work each. If it is relatively easy to split the computational
tasks, this solution will be easier to implement than multi-threading.
Dag