Results 1 to 5 of 5
I'm dipping my toe in to coding for the first time since '83.
I'm not writing any; yet.
I'm trying to "revive" an old open source program I found.
It's ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-08-2013 #1
Recommend a C compiler that can optimize for local machine?
I'm dipping my toe in to coding for the first time since '83.
I'm not writing any; yet.
I'm trying to "revive" an old open source program I found.
It's not very big or complicated. The source code is 6.3KB
It performs one overall function with a couple of minor switches and variables that can be set to three different combinations.
It works fine, but slowly, as is.
I have four cores, hyperthreaded to eight. The program currently only runs on one thread.
I figure it will runs much faster if I can tell it to run on all eight threads.
That is currently beyond my skill level.
I'd like to find a compiler that will poll my machine and optimize the binary output to run on all eight threads.
Any links on how to's would be appreciated as well.
Thanks.
- 03-09-2013 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,233
It depends. The gcc compiler for Linux will happily work with posix threads; however, it depends upon whether or not the code can be parallelized. Also, there are a LOT of other optimizations that gcc can do, such as loop unrolling, etc. This is definitely a case where RTFM may be appropriate.
There is a lot of documentation on the net about this, especially in the GNU project site, since they wrote/maintain gcc. There are also other C compilers for Linux, such as Clang, LLVM (both open source), and Intel's proprietary compilers which do a lot of optimizations and threading when possible. As for Intel's compiler, you can get a 30-day evaluation license for free, although the regular license is about $3500USD as I recall from my last look (about a week ago).
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-09-2013 #3
Well I've got no problem reading the manual. Maybe it's a case of just not knowing where to start reading to do what I want to do. The deepest I ever got in to coding was one semester of 9th grade A-Basic and poking random memory exploits on a trash-80.
I guess what I'm looking for is some nice website where they start you from scratch on a complier?
- 03-09-2013 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,233
I don't know if there are online versions, but the basic (sic) bible for C programming is the Kernighan and RItchie (K&R) C Reference Manual. Here is what I found: C Programming Tutorial (K&R version 4) :: FreeTechBooks.com
For the gcc compiler: GCC, the GNU Compiler Collection - GNU Project - Free Software Foundation (FSF)
and this: http://gcc.gnu.org/onlinedocs/gcc/Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-10-2013 #5
Thanks for trhe links. I'll dig in to them and see if I can manage to figure out enough to ask an intelligent quesion next time.


Reply With Quote
