delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/03/14/09:13:16

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=jPtBLusmkhy2fKEVlCa0rLamBq84+XqYsHXsBymCrtN
imsCtr5pDViSl2yfltW05nCunTyMgUorQ61DBeqoWk96f3UtCPM41kTGK5IuoR0Z
I5+JlZbgF/1XQq84lVHDJVqMbp/Il6d3FCsbAyceT+YyCKhZ30xc6Jwbnj5lagOg
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=loDXm0ETSE1e2j0qfzLvPq0gE3M=; b=sqdQpWMKQEeiQrpxn
KNt8XPeHUkafImIXGHGB++GgCHgIQBA1rbv0TjdtbgkKd2nXC3nUNU77XeEybYG9
bJqvqDXXStmConhBZcheLorfRTan8B/k2UJDTTOxTNbG7zJeJ30s1KkCw5OoWHf0
10mm6VnJD+95L0yngqT15QSy6Y=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-bk0-f43.google.com
X-Received: by 10.205.11.132 with SMTP id pe4mr675489bkb.46.1394802774366; Fri, 14 Mar 2014 06:12:54 -0700 (PDT)
Message-ID: <5323004B.5070500@gmail.com>
Date: Fri, 14 Mar 2014 14:12:43 +0100
From: Marco Atzeri <marco DOT atzeri AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Some Problems about gcc 4.8.2 on cygwin
References: <CAFrJEvN+Rckr6_XDYr5WUWLtYA6T6694bwPZAzUmR8OZdJ-_Zw AT mail DOT gmail DOT com>
In-Reply-To: <CAFrJEvN+Rckr6_XDYr5WUWLtYA6T6694bwPZAzUmR8OZdJ-_Zw@mail.gmail.com>
X-IsSubscribed: yes


On 14/03/2014 13:42, rexdf Rexdf wrote:
> 1.the following code:
>
> #include <unistd.h>
> #include <curses.h>
> int main() {
>     initscr();
>     move(0, 0);
>     addstr("hello, world\n");
>     refresh();
>     sleep(5);
>     endwin();
>     return 0;
> }
>
> The following is my shell command:
>
> $ pkg-config --libs --cflags ncurses
> -I/usr/include/ncurses  -lncurses
>
> $ gcc $(pkg-config --libs --cflags ncurses) curses_test.c -o curses_test

try this way

gcc  curses_test.c -o curses_test $(pkg-config --libs --cflags ncurses)


> 2.It's about OpenMP
> openmp_1.cpp
> #include <iostream>
> #include <time.h>
> void test()
> {
>      int a = 0;
>      for (int i=0;i<100000000;i++)
>          a++;
> }
> int main()
> {
>      clock_t t1 = clock();
>      for (int i=0;i<8;i++)
>          test();
>      clock_t t2 = clock();
>      std::cout<<"time: "<<t2-t1<<std::endl;
> }
>
> openmp_2.cpp
> #include <iostream>
> #include <time.h>
> void test()
> {
>      int a = 0;
>      for (int i=0;i<100000000;i++)
>          a++;
> }
> int main()
> {
>      clock_t t1 = clock();
>      #pragma omp parallel for
>      for (int i=0;i<8;i++)
>          test();
>      clock_t t2 = clock();
>      std::cout<<"time: "<<t2-t1<<std::endl;
> }
>
> On cygwin
> g++ openmp_1.cpp -o openmp_1.exe
> g++ openmp_2.cpp -o opemnp_2.exe -fopenmp
> time 1937
> time 2297
>
> On MingW-g++ 4.8.1
> g++ openmp_1.cpp -o openmp_1.exe
> g++ openmp_2.cpp -o opemnp_2.exe -fopenmp
> time 1975
> time 492
>
> On Visual Studio 2013
> Openmp_2.cpp Project
> C/C++ --> Language --> Open MP Support yes(/openmp)
> time 1849
> time 321

and the question is ?

Marco

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019