Thread: compiler using SMP (multiple CPUs)?

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    4

    Question compiler using SMP (multiple CPUs)?

    hello everybody,

    is there a compiler that actually makes use of a second cpu?
    As I read (maybe wrong), that Visual c++ wouldn't...
    ...of course I can imagine compiling big projects with many
    tasks (threads) then surely do use a second cpu, as they are a
    quantity that is distributed by the operating system amongst
    the CPUs. Is there a compiler that explicitly supports "SMP" though?

    I heard that gcc does (of course after you got your kernel
    compiled for SMP) , but then why the hell wouldn't
    visual c++?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Most programs built with Visual C++ run as user mode programs...and as such they dont really have much control over what processor runs what code - that is left up to the Operating system. If you run a version of windows that supports multi processors (like Win2000) then the part of the system that's responsible for scheduling threads and interupts will be coded to take advantage of having more than 1 CPU...so you still get the benefit without having to worry about the implications

    If you are using VC++ to write a device driver then you do need to worry about more than 1 processor...but then that's a whole different world than writing for user mode anyway

  3. #3
    Registered User
    Join Date
    Apr 2004
    Posts
    4
    that's correct, but what I actually meant is the following (maybe this isn't the appropriate board for this question):

    which of the c++ compilers are programs taking advantage of more than one cpu? Is there a win32 compiler that does?

    You probably know that there is fairly ten programs that really support two CPUs. For example under Windows, there is no packer,
    that actually can seperate the task and divide it into seperate threads. Meaning, I can't even speed up unpacking. But most renderers, a lot of video and and mp3 codecs do so. Now I want to know if there is a compiler, that does while compiling.

    On this page, he says, that gcc when you run it on a SMP kernel (which is a re-compiled kernel, with the SMP option set on) compiles twice as fast (I have to try this myself in the next time):

    (sorry it is german, but there is a table by the paragraph
    "Performanceanalyse - Compilieren eines großen Projektes")
    http://www.linux-magazin.de/Artikel/...7/SMP/smp.html

    but here, on this page, I found EPIC games saying, that Visual C++ "is not multithreaded"
    http://udn.epicgames.com/Technical/RecommendedHardware

    I have to make these tests myself as well, but I don't really have own programming projects, that are big enough yet ;-). Right now I am a little more interested in the "facts", originally I am not a computer science student, but mechanical engineering.

    regards,
    melmo

  4. #4
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    I don't think that a compiler needs to be aware of multiple processors, the kernel handles all of that when it is scheduling processes. It decides which cpu it is to run on. As said earlier, a driver would need to be smp aware, but not anything else, I think at least.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Allow me to rephrase your question:

    What C++ compilers exist, that are implemented using multiple threads (and thus can take advantage of multiple CPU's during compilation)?

    You've already ruled out VC++

    gg

  6. #6
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by Fordy
    Most programs built with Visual C++ run as user mode programs...and as such they dont really have much control over what processor runs what code
    They have control through the API: SetThreadAffinityMask
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Quote Originally Posted by Sang-drax
    They have control through the API: SetThreadAffinityMask
    Yeah...you can control what processor a thread can run on, but it's not really control in the sense that you can have complete access to a single processor to run a part of your program while the other processor is doing something else

  8. #8
    Registered User
    Join Date
    Feb 2002
    Posts
    20

    Wink

    I think he is asking for a multi-threaded compiler. One that uses more than one cpu for the purpose of compiling his source code.

    I'm not sure of any right off hand. VC++ might do that in the Enterprise and Architect versions. I have heard that some compilers can even go as far as to use distributed computing to do their work.

    Your best bet is to look up gcc.gnu.org and see what they have to say there. It might be possible that MinGW or Cygwin would be able to make use of the SMP but from my stand point it is unlikely.

    I have never had a project that takes more than 10 minutes on a 500MHz celeron to compile. I have never needed a multi-threaded compiler.

    On another note... all windows compilers that support the Windows API can allow your code to make threads. But that is not what your asking I take it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 06-08-2009, 03:03 PM
  2. questions on multiple thread programming
    By lehe in forum C Programming
    Replies: 11
    Last Post: 03-27-2009, 07:44 AM
  3. lcc win32 compiler download problems
    By GanglyLamb in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-01-2004, 07:39 PM
  4. Compiler Design... Anyone That Can Help!
    By ComputerNerd888 in forum C++ Programming
    Replies: 3
    Last Post: 09-27-2003, 09:48 AM
  5. Comile problem using latest Dev C++ Compiler
    By shiny_dico_ball in forum C++ Programming
    Replies: 6
    Last Post: 06-06-2003, 05:32 PM