Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > is it possible to switch on hyperthreading in cc?

Reply
Thread Tools

is it possible to switch on hyperthreading in cc?

 
 
Carson
Guest
Posts: n/a
 
      08-16-2004
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


 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      08-16-2004
On Mon, 16 Aug 2004 00:08:28 GMT, "Carson" <(E-Mail Removed)> wrote in
comp.lang.c:

> 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


There is no such thing as hyperthreading in C. There may or may not
be extensions available from your compiler or operating system, but
they have nothing to do with the standard C language. You need to ask
in a group that supports your compiler/OS combination.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      08-16-2004
"Carson" <(E-Mail Removed)> writes:
> 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?


That's really not a C language question; it's a question about your
compiler, so we can't help you here.

Cygwin's cc is really gcc. A Google search for "gcc hyperthreading"
might give you something useful. Failing that, try a gcc-specific
mailing list or newsgroup.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Dan Pop
Guest
Posts: n/a
 
      08-16-2004
In <0WSTc.3871$(E-Mail Removed)> "Carson" <(E-Mail Removed)> writes:

> 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?


If your CPU load is ~50% when your program is running, chances are that
hyperthreading is already activated and you may want to switch it off.

It is highly unlikely that this can be done with user mode code and
without rebooting your system. Your best chance is to do it with your
BIOS setup program, before booting the system.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: (E-Mail Removed)
 
Reply With Quote
 
Dag Viken
Guest
Posts: n/a
 
      08-17-2004
"Carson" <(E-Mail Removed)> wrote in message
news:0WSTc.3871$(E-Mail Removed) 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperthreading slows down server javed74@gmail.com ASP .Net 3 12-09-2005 02:54 PM
'Action Canceled' when hyperthreading enabled - ASP.NET bug? Joe Jax ASP .Net 1 04-21-2005 03:22 PM
Worth the price for hyperthreading technology? Patrick Cleburne Computer Support 3 04-06-2005 10:32 AM
p4 hyperthreading & web gardening Param - Home ASP .Net 6 08-24-2004 04:27 PM
Hyperthreading Problem Brad Grier Java 8 01-11-2004 12:19 AM



Advertisments