public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0
@ 2014-05-08 23:47 jmichae3 at yahoo dot com
  2014-05-08 23:52 ` [Bug c++/61121] " jmichae3 at yahoo dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-05-08 23:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

            Bug ID: 61121
           Summary: -ftree-parallelize-loops=n (n as value) not accepted
                    in 4.9.0
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jmichae3 at yahoo dot com

https://groups.google.com/forum/#!topic/gnu.gcc.help/T1guYK8-z70
just says that -O2 is needed for things like -floop-parallelize-all,
-ftree-parallelize-loops=4 and probably similar functionality. I have this on
my commandline to multiply the speed of my code (should do some runtime tests):

-ftree-parallelize-loops=12 -floop-parallelize-all  -ftree-loop-vectorize
-ftree-slp-vectorize -O2

it is unclear to me from the manual is if these switches can be combined this
way (the -ftree-parallelize-loops=12 with -floop-parallelize-all and
-ftree-loop-vectorize with -ftree-slp-vectorize.

I wanted all the parallelization I coud get. wiki at
http://gcc.gnu.org/wiki/AutoParInGCC doesn't say much.
http://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Optimize-Options.html#Optimize-Options
(gcc optional manual) doesn't completely match what 4.9.0 is doing, it does not
take -ftree-parallelize-loops=n (n as a value) but it does take 12 for a value.
my machine has 12 threads. other people's machine might have only 1
thread/code. some HPC servers have 80+ and 1-4 procs or plenty more (fridge
boxes). 

manual should say you need to have -O2 to use those options that require it,
because joe dev can't figure this out.

I wish the -O2 were -Ofast. I desperately need my code to be fast as possible
as it has long runtimes (but I would understand if it's because too much
optimzation would remove that kind of optimization). I have plenty of RAM. most
of us do.

that's for personal use. for genral public use I would drop that number of
threads down to 4, maybe even 2 with just using numbers. I would very much like
for -ftree-parallelize-loops=12 to work equally as well as
-ftree-parallelize-loops=n or -ftree-parallelize-loops=0 but it does not (like
the documentation shows). it is possible to query the OS for the number of
processor threads and then allocate such, or percentage of number of cpu
threads/cores queried from the OS, like leaving 1 or 2 behind for the system or
general performance purposes. use all of the threads and the system might not
let let you do an awful lot of else very well (but it's workable, just slow).

but allocating a fixed number of threads presumes you know how many threads are
on every user's box. you can't assume that. some cpus have 1, 2, 3, 4, 6, 8,
12, 20, 30, and HPC servers have multiple cpus could be 120+ threads with 4+
procs.

so please put in support for not just numbers (which has its uses for the
80-thread box) that the manual says - n or 0 does auto-sizing. if you are using
atoi() to get the number of threads, you can use the value 0 as an "auto" if it
needs to be only a number. but that 0 or n as an actual value needs to to be
documented, with 2 examples, one using n and one using 4, or one using 0 and
one using 4.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61121] -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0
  2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
@ 2014-05-08 23:52 ` jmichae3 at yahoo dot com
  2014-05-08 23:59 ` jmichae3 at yahoo dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-05-08 23:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

--- Comment #1 from Jim Michaels <jmichae3 at yahoo dot com> ---
g++.exe: error: argument to '-ftree-parallelize-loops=' should be a
non-negative integer
Using built-in specs.
COLLECT_GCC=f:\x86_64-4.9.0-release-win32-sjlj-rt_v3-rev1\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=f:/x86_64-4.9.0-release-win32-sjlj-rt_v3-rev1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.0/lto-wrapper.ex
e
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.9.0/configure --host=x86_64-w64-mingw32
--build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 -
-prefix=/mingw64
--with-sysroot=/c/mingw490/x86_64-490-win32-sjlj-rt_v3-rev1/mingw64
--with-gxx-include-dir=/mingw64/x86_64-w64-ming
w32/include/c++ --enable-shared --enable-static --enable-targets=all
--enable-multilib --enable-languages=ada,c,c++,fortran,objc,obj
-c++,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp
--enable-libatomic --enable-lto --enable-graphite --ena
ble-checking=release --enable-fully-dynamic-string
--enable-version-specific-runtime-libs --enable-sjlj-exceptions
--disable-isl-ver
sion-check --disable-cloog-version-check --disable-libstdcxx-pch
--disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disa
ble-win32-registry --disable-nls --disable-werror --disable-symvers
--with-gnu-as --with-gnu-ld --with-arch-32=i686 --with-arch-64=n
ocona --with-tune-32=generic --with-tune-64=core2 --with-libiconv
--with-system-zlib --with-gmp=/c/mingw490/prerequisites/x86_64-w64
-mingw32-static --with-mpfr=/c/mingw490/prerequisites/x86_64-w64-mingw32-static
--with-mpc=/c/mingw490/prerequisites/x86_64-w64-ming
w32-static --with-isl=/c/mingw490/prerequisites/x86_64-w64-mingw32-static
--with-cloog=/c/mingw490/prerequisites/x86_64-w64-mingw32-
static --enable-cloog-backend=isl --with-pkgversion='x86_64-win32-sjlj-rev1,
Built by MinGW-W64 project' --with-bugurl=http://source
forge.net/projects/mingw-w64 CFLAGS='-O2 -pipe
-I/c/mingw490/x86_64-490-win32-sjlj-rt_v3-rev1/mingw64/opt/include
-I/c/mingw490/prer
equisites/x86_64-zlib-static/include
-I/c/mingw490/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2
-pipe -I/c/mingw49
0/x86_64-490-win32-sjlj-rt_v3-rev1/mingw64/opt/include
-I/c/mingw490/prerequisites/x86_64-zlib-static/include -I/c/mingw490/prerequi
sites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe
-L/c/mingw490/x86_64-490-win32-sjlj-rt_v3-rev1/mingw64/opt/lib -L/
c/mingw490/prerequisites/x86_64-zlib-static/lib
-L/c/mingw490/prerequisites/x86_64-w64-mingw32-static/lib'
Thread model: win32
gcc version 4.9.0 (x86_64-win32-sjlj-rev1, Built by MinGW-W64 project)

this is mingw-w64 "mingw" build.


source code is

#include <string>
#include <iostream>
int main(void) {
    std::string searchIn="abc(<a href=\"def.html\">def</a>", searchFor="<a
href=\"",equals="=";
    size_t posOpenElement=searchIn.find(searchFor); //should be 4
    std::cout<<"posOpenElement="<<posOpenElement<<", should be 4"<<std::endl;
    if (std::string::npos!=posOpenElement) {
        size_t posEquals=searchIn.find(equals,posOpenElement +
searchFor.size());//should fail
        std::cout<<"posEquals="<<posEquals<<", should be huge number
(-1)"<<std::endl;
    }
    return 0;
}

but it has no loops except for the stuff internal to the compiler.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61121] -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0
  2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
  2014-05-08 23:52 ` [Bug c++/61121] " jmichae3 at yahoo dot com
@ 2014-05-08 23:59 ` jmichae3 at yahoo dot com
  2014-05-09  7:08 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-05-08 23:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

--- Comment #2 from Jim Michaels <jmichae3 at yahoo dot com> ---
the commandline:

"f:\x86_64-4.9.0-release-win32-sjlj-rt_v3-rev1\mingw64\bin\g++.exe" -Wall
-Wextra -v -save-temps -m64 -static -O2 -fno-strict-aliasing -fwrapv -lstdc++
-ftree-parallelize-loops=n -floop-parallelize-all  -ftree-loop-vectorize
-ftree-slp-vectorize -O2 -Wall -W -Wextra -Xlinker -Map=gcc-substr-bug.map
-std=c++11 -o "gcc-substr-bug.exe" "gcc-substr-bug.cpp" 2>gcc-substr-bug.err

there is no .ii file of course.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61121] -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0
  2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
  2014-05-08 23:52 ` [Bug c++/61121] " jmichae3 at yahoo dot com
  2014-05-08 23:59 ` jmichae3 at yahoo dot com
@ 2014-05-09  7:08 ` jakub at gcc dot gnu.org
  2014-05-13 19:02 ` jmichae3 at yahoo dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-05-09  7:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
To me the manual looks clear, the documentation uses further
-ftree-parallelize-loops=@var{n} so if you e.g. look at pdf version the n there
is written in different font, and the error message is clear as well.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61121] -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0
  2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
                   ` (2 preceding siblings ...)
  2014-05-09  7:08 ` jakub at gcc dot gnu.org
@ 2014-05-13 19:02 ` jmichae3 at yahoo dot com
  2014-06-20 13:21 ` jmichae3 at yahoo dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-05-13 19:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

--- Comment #4 from Jim Michaels <jmichae3 at yahoo dot com> ---
which means to me it takes only a constant.
it should be able to take the equivalent of "auto" (however the gcc folk want
to write that), again due to the wide difference between processors. for
targeting public machines, you can't assume they are all the same (can't assume
they all have 4 threads - some machines are dual-core).

I *think* the value 0 does the equivalent of auto, but still testing this. if
this is working, it should be documented as such.

-ftree-parallelize-loops=@var{n}
is not in the manual.

alsdo, according to the HTML documentation at
https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Optimize-Options.html#Optimize-Options

n is not in a different font.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61121] -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0
  2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
                   ` (3 preceding siblings ...)
  2014-05-13 19:02 ` jmichae3 at yahoo dot com
@ 2014-06-20 13:21 ` jmichae3 at yahoo dot com
  2014-06-20 13:24 ` [Bug c++/61121] -O2 -ftree-parallelize-loops=0 for maximum " jmichae3 at yahoo dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-06-20 13:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

Jim Michaels <jmichae3 at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #5 from Jim Michaels <jmichae3 at yahoo dot com> ---
I am on windows. @var(n) means nothing on my platform please describe it in the
documentation.

I just tested mingw-w64 with the value 0 and with the value 12, and both give
me 1-threaded code.
yes, I included -O2

so, since "n" is not allowable, I am recommending the value 0 for auto or max
or max-1.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61121] -O2 -ftree-parallelize-loops=0 for maximum not accepted in 4.9.0
  2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
                   ` (4 preceding siblings ...)
  2014-06-20 13:21 ` jmichae3 at yahoo dot com
@ 2014-06-20 13:24 ` jmichae3 at yahoo dot com
  2014-06-20 13:57 ` jmichae3 at yahoo dot com
  2014-07-10 20:56 ` jmichae3 at yahoo dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-06-20 13:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

Jim Michaels <jmichae3 at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-ftree-parallelize-loops=n  |-O2
                   |(n as value) not accepted   |-ftree-parallelize-loops=0
                   |in 4.9.0                    |for maximum not accepted in
                   |                            |4.9.0

--- Comment #6 from Jim Michaels <jmichae3 at yahoo dot com> ---
changed title to something more appropriate since value is always numeric. so
give 0 a special meaning. really, there is always a minimum of 1 thread. so the
value 0 could be used for the max number of threads on the system or ther max
number of threads on the system -1 (1 for the OS to use as a NICE factor).


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61121] -O2 -ftree-parallelize-loops=0 for maximum not accepted in 4.9.0
  2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
                   ` (5 preceding siblings ...)
  2014-06-20 13:24 ` [Bug c++/61121] -O2 -ftree-parallelize-loops=0 for maximum " jmichae3 at yahoo dot com
@ 2014-06-20 13:57 ` jmichae3 at yahoo dot com
  2014-07-10 20:56 ` jmichae3 at yahoo dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-06-20 13:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

--- Comment #7 from Jim Michaels <jmichae3 at yahoo dot com> ---
http://msdn.microsoft.com/en-us/library/windows/desktop/dd405485%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms680582%28v=vs.85%29.aspx
in windows, 
#if defined(_MSC_VER)||defined(__BORLANDC__)||defined(__MINGW32__)
#include <windows.h>
int64_t getmaxthreads(void) {
    DWORD numprocs=GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
    if (0==numprocs) {
        //ERROR. do something.
        DWORD lasterr=GetLastError();
        //do something with error
        return 0;//failure
    }
    return numprocs-1;
}
#endif


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61121] -O2 -ftree-parallelize-loops=0 for maximum not accepted in 4.9.0
  2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
                   ` (6 preceding siblings ...)
  2014-06-20 13:57 ` jmichae3 at yahoo dot com
@ 2014-07-10 20:56 ` jmichae3 at yahoo dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-07-10 20:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61121

--- Comment #8 from Jim Michaels <jmichae3 at yahoo dot com> ---
in the mingw-w64 gcc compiler at least, -ftree-parallize-loops=12 -O2 runs
single-threaded.

https://gcc.gnu.org/ml/gcc-help/2007-01/msg00165.html

I probably don't understand the compiler, but  I have been trying

with -static and without, using -Wall -Wextra -v -save-temps
-ftree-parallelize-loops=12 -O2 -std=c++11

I have also tried 0 on that number with same results.

I always get single-threaded programs, and my stuff contains a lot of vectors
and loops.

I have also tried with -floop-parallelize-all  -ftree-slp-vectorize
additionally with same results.

it's like that -ftree-parallize-loops is being ignored by the compiler. I did
what everybody said and used the posix/pthreads version. this has not helped.
auto-threading seems broken in 4.9.0 v3rev2.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-07-10 20:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-08 23:47 [Bug c++/61121] New: -ftree-parallelize-loops=n (n as value) not accepted in 4.9.0 jmichae3 at yahoo dot com
2014-05-08 23:52 ` [Bug c++/61121] " jmichae3 at yahoo dot com
2014-05-08 23:59 ` jmichae3 at yahoo dot com
2014-05-09  7:08 ` jakub at gcc dot gnu.org
2014-05-13 19:02 ` jmichae3 at yahoo dot com
2014-06-20 13:21 ` jmichae3 at yahoo dot com
2014-06-20 13:24 ` [Bug c++/61121] -O2 -ftree-parallelize-loops=0 for maximum " jmichae3 at yahoo dot com
2014-06-20 13:57 ` jmichae3 at yahoo dot com
2014-07-10 20:56 ` jmichae3 at yahoo dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).