help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can single-threaded gcc be used for writing multi-threaded apps?


From: arahne
Subject: Re: Can single-threaded gcc be used for writing multi-threaded apps?
Date: Thu, 17 Jan 2008 22:34:04 +0100
User-agent: Thunderbird 2.0.0.9 (X11/20070801)

Viatly wrote:
> I 'd like to know whether single-threaded gcc can be used for:
> 1. Writing multithreaded C app ( gcc file.c -pthread ).
> 2. Writing multithreaded C++ app ( g++ file.cpp -pthread ).

Short answer: YES.
But just linking it with -phread library won't make it magically
multithreaded.
I suggest you read this tutorial.
http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html

Intel C/C++ compiler does have autovectorization, and
there you can really "just recompile" with -parallel
switch. In reality, this will mostly work for simple
initialization loops, not for complex code blocks
where you want it.

In any case, there is no free lunch and some extra
work is always required.

DuĊĦan Peterc
http://www.arahne.si


reply via email to

[Prev in Thread] Current Thread [Next in Thread]