Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #130471

Re: OpenMP and AVX2 Problem [SOLVED]

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: OpenMP and AVX2 Problem [SOLVED]
Date 2018-05-12 14:04 -0700
Organization None to speak of
Message-ID <lnd0y0a8mq.fsf@kst-u.example.com> (permalink)
References <pd703u02761@news2.newsguy.com> <pd7g3301c99@news4.newsguy.com>

Show all headers | View raw


"F. Russell" <fr@random.info> writes:
> On Sat, 12 May 2018 15:09:50 +0000, F. Russell wrote:
>> Run Time Single-Thread: 0.010427 seconds
>> Run Time Multi-Thread: 0.05072 seconds
>
> I believe that I have found the reason for the discrepancy.
>
> The functions clock(), clock_gettime(CLOCK_PROCESS_CPUTIME_ID),
> and rusage(RUSAGE_SELF) are indeed the correct functions to
> measure the CPU time.
>
> But for a multi-threaded process these functions will return
> the SUM of the CPU time used by all threads:

If you're using Linux 2.6.12 or later, you can use either
CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID.

This is not defined by the C standard.  comp.unix.programmer might be a
better place to discuss it.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

OpenMP and AVX2 Problem "F. Russell" <fr@random.info> - 2018-05-12 15:09 +0000
  Re: OpenMP and AVX2 Problem Tim Prince <tprince@intelretiree.com> - 2018-05-12 11:33 -0400
  Re: OpenMP and AVX2 Problem Melzzzzz <Melzzzzz@zzzzz.com> - 2018-05-12 16:05 +0000
    Re: OpenMP and AVX2 Problem "F. Russell" <fr@random.info> - 2018-05-12 17:46 +0000
    Re: OpenMP and AVX2 Problem "F. Russell" <fr@random.info> - 2018-05-12 19:10 +0000
  Re: OpenMP and AVX2 Problem [SOLVED] "F. Russell" <fr@random.info> - 2018-05-12 19:42 +0000
    Re: OpenMP and AVX2 Problem [SOLVED] Keith Thompson <kst-u@mib.org> - 2018-05-12 14:04 -0700
  Re: OpenMP and AVX2 Problem scott@slp53.sl.home (Scott Lurndal) - 2018-05-13 17:47 +0000
  Re: OpenMP and AVX2 Problem Wouter Verhelst <w@uter.be> - 2018-05-13 09:57 +0200

csiph-web