ejolson
Posts: 5640
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Sat May 09, 2020 2:37 am

DarkElvenAngel wrote:
Sat May 09, 2020 2:33 am
ejolson wrote:
Sat May 09, 2020 2:12 am
ejolson wrote:
Fri May 08, 2020 10:09 pm
I am interested to know whether it will finish more quickly or slowly compared to the other reports.
The command

$ nohup time make -j4 >world.log 2>&1 &

just finished with the report

Code: Select all

43263.01user 3026.42system 3:47:18elapsed 24%CPU (0avgtext+0avgdata 559976maxresident)k
5321056inputs+20579864outputs (53921major+163622952minor)pagefaults 0swaps
which suggests that it took 3 hours and 47 minutes to compile gcc 10.1. Therefore, if people are really seeing 7 hours when using an SD card, then iSCSI over a WireGuard VPN is almost twice as fast.
Was that skipping the verification of the compiler? I wasn't sitting watching the compile the whole time it may have finished sooner. Maybe I'll recompile on my other card and see what time I get.
I used the default build strategy to obtain a stage 3 compiler. I'm still quite amazed how much better optimised the generated code is for the Pi 4 compared to previous versions of the compiler.

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Sat May 09, 2020 4:13 am

ejolson wrote:
Sat May 09, 2020 2:12 am
which suggests that it took 3 hours and 47 minutes to compile gcc 10.1. Therefore, if people are really seeing 7 hours when using an SD card, then iSCSI over a WireGuard VPN is almost twice as fast.
My overclocked (1800MHz) 4GB Pi4 build took 3.5 hours using an SD card.
I used -j5
Pi4 8GB running PIOS64 Lite

ejolson
Posts: 5640
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Sat May 09, 2020 4:23 am

jahboater wrote:
Sat May 09, 2020 4:13 am
ejolson wrote:
Sat May 09, 2020 2:12 am
which suggests that it took 3 hours and 47 minutes to compile gcc 10.1. Therefore, if people are really seeing 7 hours when using an SD card, then iSCSI over a WireGuard VPN is almost twice as fast.
My overclocked (1800MHz) 4GB Pi4 build took 3.5 hours using an SD card.
I used -j5
That's quite good. Still, it makes me think I'm not losing much, if anything, by placing the build directory on an iSCSI drive over WireGuard. Were you using a Sandisk A1 SD card?

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Sat May 09, 2020 7:17 am

ejolson wrote:
Sat May 09, 2020 4:23 am
Were you using a Sandisk A1 SD card?
Yes. 64GB
Always use those now.

Note that I used -j5 (NCPUs + 1)
I've not done any comparison with -j4 (as in make -j `nproc` in the script)

By the way, the Pi Zero build definitely needs extra swap, even with -j1

The hex core Odroid N2 (at stock speed) took 2.6 hours -j7 (running from its eMMC card)
My old Intel PC running from a 12GB ramdisk took 45 minutes -j5

My build includes Fortran which is a big powerful language nowadays, so that may take a bit longer.
Pi4 8GB running PIOS64 Lite

User avatar
buja
Posts: 575
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: New major release of GCC

Sat May 09, 2020 8:59 am

It took my Pi 4B-4GB over 7 hours to compile. I went to the supermarket and when I came back the installation script was waiting for me to tell if I wanted to install or not, so I should subtract 15 minutes or so.
I left out the Fortran part and I did not install, for me it's just a sort of burn-in test of the 4B.

Output time:

Code: Select all

real	432m55.221s
user	1222m28.463s
sys	123m35.679s
The user time is more than 20 hours, so this must be the combined result for all 4 cores.

The maximum CPU temperature was 83 degrees.
I used this cron job line to measure the temperature every 5 minutes:

Code: Select all

*/5 * * * * vcgencmd measure_temp >> /home/pi/temps
The Pi is powered through a USB meter that continually shows the supply voltage and current. The voltage is 5.15-5.16 volts, the idle current is usually 0.45 amperes, during the compilation it was around 0.65 but I saw peaks as high as 0.95 amperes. I wasn't watching all the time, so there could have been higher peak currents.

The micro SD card in my Pi is a Sandisk Ultra 16 GB A1.

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Sat May 09, 2020 9:37 am

buja wrote:
Sat May 09, 2020 8:59 am
The maximum CPU temperature was 83 degrees.
It will have been throttling.
after the build:

vcgencmd get_throttled

should return 0x0
there is a "sticky" throttled bit, so there is no need to keep monitoring it.

My Pi4 4GB has a stick-on passive heat sink https://uk.rs-online.com/web/p/heatsinks/7500951/ and I didn't see the temp go over 58C but I wasn't watching all the time of course (and that was overclocked to 1800MHz)
Pi4 8GB running PIOS64 Lite

ejolson
Posts: 5640
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Sat May 09, 2020 3:52 pm

buja wrote:
Sat May 09, 2020 8:59 am
It took my Pi 4B-4GB over 7 hours to compile. I went to the supermarket and when I came back the installation script was waiting for me to tell if I wanted to install or not, so I should subtract 15 minutes or so.
I left out the Fortran part and I did not install, for me it's just a sort of burn-in test of the 4B.

Output time:

Code: Select all

real	432m55.221s
user	1222m28.463s
sys	123m35.679s
The user time is more than 20 hours, so this must be the combined result for all 4 cores.

The maximum CPU temperature was 83 degrees.
I used this cron job line to measure the temperature every 5 minutes:

Code: Select all

*/5 * * * * vcgencmd measure_temp >> /home/pi/temps
The Pi is powered through a USB meter that continually shows the supply voltage and current. The voltage is 5.15-5.16 volts, the idle current is usually 0.45 amperes, during the compilation it was around 0.65 but I saw peaks as high as 0.95 amperes. I wasn't watching all the time, so there could have been higher peak currents.

The micro SD card in my Pi is a Sandisk Ultra 16 GB A1.
With those temperatures either your 4B is in the official case or you live in the desert without air conditioning.

In the past I've recommended making holes in the official case to let the hot air out as in the thread

viewtopic.php?t=210431&start=50#p1305528

I've recently changed my mind about the official case. Because the lack of holes is so impractical, it's much better to keep that case unmodified in the original form as a collector's item. But do remove the Pi and place it where there's some airflow.

The Pi 4B here is mounted vertically to a block of wood. Right now there is no fan blowing on it. Convection of air across the bare circuit board was enough to prevent that Pi from throttling while compiling the new version of gcc.

User avatar
buja
Posts: 575
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: New major release of GCC

Sat May 09, 2020 6:22 pm

Confirmed: official case.
A full aluminium case is on its way. I might try again when it arrives.
Or try again without the official case lid on it.

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Sat May 09, 2020 8:29 pm

buja wrote:
Sat May 09, 2020 6:22 pm
Confirmed: official case.
A full aluminium case is on its way. I might try again when it arrives.
Or try again without the official case lid on it.
Two other possibilities:-

try "make -j1" or "make -j2" to use only one or two cores.

Or just reduce the clock speed? Drop it down to 1GHz perhaps and you should be fine.
arm_freq=1000

Or both!
Pi4 8GB running PIOS64 Lite

DarkElvenAngel
Posts: 946
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Sun May 10, 2020 4:41 am

Now that I have this built is it possible to copy the gcc10 folder to a USB stick and run make install on a different system?

I have a Buildroot image and it has no compiler natively but I did install make on it. Do you think it would work? I might just try it tomorrow nothing to lose I can just reflash it.

ejolson
Posts: 5640
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Sun May 10, 2020 4:59 am

DarkElvenAngel wrote:
Sun May 10, 2020 4:41 am
Now that I have this built is it possible to copy the gcc10 folder to a USB stick and run make install on a different system?

I have a Buildroot image and it has no compiler natively but I did install make on it. Do you think it would work? I might just try it tomorrow nothing to lose I can just reflash it.
What i usually do is specify

--prefix=/usr/local/gcc-X.Y

so install puts everything together in a single subdirectory. After that I can pack up the destination and easily copy it to any compatible system. Copying the build directory should also work as long as you're careful with timestamps and unpack it so it has the same path on the other system as on the first.

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Sun May 10, 2020 8:05 am

DarkElvenAngel wrote:
Sun May 10, 2020 4:41 am
Now that I have this built is it possible to copy the gcc10 folder to a USB stick and run make install on a different system?
You could copy (probably cp -a) or tar up the tree (I use "tar Jcf" but its slow).

When you have the tree on a USB drive, just do:

cd gcc-10.1.0/obj
sudo make install

@ejolson
Does --prefix=/usr/local/gcc-X.Y include everything in /usr/local ?
man pages, include files, libraries etc ?
If so its much less to copy around than the build tree and a better method.
Pi4 8GB running PIOS64 Lite

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: New major release of GCC

Sun May 10, 2020 8:55 am

Why is watching the temp cycling between 55°C and 65°C as the fan starts and stops quite so mesmerising ? :lol:
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

DarkElvenAngel
Posts: 946
Joined: Tue Mar 20, 2018 9:53 pm

Re: New major release of GCC

Sun May 10, 2020 8:10 pm

ejolson wrote:
Sun May 10, 2020 4:59 am
DarkElvenAngel wrote:
Sun May 10, 2020 4:41 am
Now that I have this built is it possible to copy the gcc10 folder to a USB stick and run make install on a different system?

I have a Buildroot image and it has no compiler natively but I did install make on it. Do you think it would work? I might just try it tomorrow nothing to lose I can just reflash it.
What i usually do is specify

--prefix=/usr/local/gcc-X.Y

so install puts everything together in a single subdirectory. After that I can pack up the destination and easily copy it to any compatible system. Copying the build directory should also work as long as you're careful with timestamps and unpack it so it has the same path on the other system as on the first.
Is that done in the configuration step? I'm thinking I'll mount the SD card and switch the prefix to install to SD card so no copying required.

I looked in the makefile there is an entry

Code: Select all

prefix = /usr/local
If I change this to /mnt/rootfs/usr/local is that enough or is it just

Code: Select all

prefix=/mnt/rootfs/usr/local make install

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Sun May 10, 2020 8:13 pm

Its normally added to the configure entry, for example:

Code: Select all

../configure --enable-languages=$LANG --prefix=/mnt/rootfs/usr/local --with-cpu=cortex-a72 \
  --with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \
  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Pi4 8GB running PIOS64 Lite

ejolson
Posts: 5640
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Sun May 10, 2020 8:30 pm

jahboater wrote:
Sun May 10, 2020 8:13 pm
Its normally added to the configure entry, for example:

Code: Select all

../configure --enable-languages=$LANG --prefix=/mnt/rootfs/usr/local --with-cpu=cortex-a72 \
  --with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \
  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
That's right, my configure command looked like

Code: Select all

../gcc-10.1.0/configure -v --prefix=/usr/local/gcc-10.1 \
--enable-languages=c,c++,fortran --with-cpu=cortex-a72 \
--with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
After installing, I create a file 01-gcc.conf in /etc/ld.so.conf.d containing the line

Code: Select all

/usr/local/gcc-10.1/lib
and run ldconfig so I don't have to set LD_LIBRARY_PATH every time I want to run one the generated binaries. Then to use the compiler, I typically change the appropriate lines in the Makefile to call the desired compiler explicitly. If that turns out to be difficult, one can also add /usr/local/gcc-10.1/bin at the head of the search path.

Not only does keeping everything in a single directory make it easy to copy, but it's also easy to delete after too many compilers get installed. If one is so inclined, keeping the compiler in a separate directory further allows one to switch between different versions without the double indirection employed by /etc/alternatives in Debian.

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: New major release of GCC

Mon May 11, 2020 2:25 pm

Built just C on a 4Gb Pi4 with external USB3 hard disk and Pimoroni fan shim (so no throttling).

time taken for "make -j 4"

Code: Select all

real	243m46.436s
user	742m43.580s
sys	63m1.061s
That's 4 hrs 3 min 46 sec

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: New major release of GCC

Mon May 11, 2020 3:06 pm

cglm will not build with 10.1 https://github.com/recp/cglm/

Code: Select all

pi@raspberrypi:/opt/RPI/Pi4GL/cglm $ make
make  all-am
make[1]: Entering directory '/opt/RPI.local/Pi4GL/cglm'
  CC       src/euler.lo
In file included from src/../include/cglm/simd/intrin.h:87,
                 from src/../include/cglm/common.h:35,
                 from src/../include/cglm/cglm.h:11,
                 from src/euler.c:8:
src/../include/cglm/simd/arm.h: In function ‘glmm_hmin’:
src/../include/cglm/simd/arm.h:37:7: error: incompatible types when assigning to type ‘float32x4_t’ from type ‘float32x2_t’
   37 |   v = vpmin_f32(vget_low_f32(v), vget_high_f32(v));
      |       ^~~~~~~~~
src/../include/cglm/simd/arm.h:38:17: error: incompatible type for argument 1 of ‘vpmin_f32’
   38 |   v = vpmin_f32(v, v);
      |                 ^
      |                 |
      |                 float32x4_t
In file included from src/../include/cglm/simd/intrin.h:67,
                 from src/../include/cglm/common.h:35,
                 from src/../include/cglm/cglm.h:11,
                 from src/euler.c:8:
/usr/local/lib/gcc/arm-linux-gnueabihf/10.1.0/include/arm_neon.h:3813:24: note: expected ‘float32x2_t’ but argument is of type ‘float32x4_t’
 3813 | vpmin_f32 (float32x2_t __a, float32x2_t __b)
      |            ~~~~~~~~~~~~^~~
I don't yet know where the problem lies.

PeterO

Update: Problem in cglm fixed by author
@PeterOGB thank you very much.
--> old: vst1q_f32(dest, veorq_s32(vld1q_f32(v), vdupq_n_f32(-0.0f)));
--> new: vst1q_f32(dest, vnegq_f32(vld1q_f32(v)));
Can you try again please? This must be fixed with 269bdb3
It seems ARM NEON provides a single intrinsic to negate vector: vnegq_f32
My own code fell foul of the change in gcc defualt behaviour from -fcommon to -fno-common which caused "multiple definintion" errors on every global variable shared between modules. Added "-fcommon" to the compiler switches and all is good again. I did notice that the executable code is significantly smaller than when compiled with 8.3.0

Code: Select all

pi@raspberrypi:~/ELLIOTT-803/3D803 $ ls -l 803*
-rwxr-xr-x 1 pi pi 468148 May 11 18:47 803
-rwxr-xr-x 1 pi pi 522764 Apr 15 18:59 803old
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Mon May 11, 2020 8:03 pm

PeterO wrote:
Mon May 11, 2020 3:06 pm
Added "-fcommon" to the compiler switches and all is good again. I did notice that the executable code is significantly smaller than when compiled with 8.3.0
It might go even smaller if you fixed the common problem?
That is, as far as I can see, define data only in one place (and use extern to refer to it elsewhere).
Pi4 8GB running PIOS64 Lite

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: New major release of GCC

Mon May 11, 2020 9:35 pm

jahboater wrote:
Mon May 11, 2020 8:03 pm
PeterO wrote:
Mon May 11, 2020 3:06 pm
Added "-fcommon" to the compiler switches and all is good again. I did notice that the executable code is significantly smaller than when compiled with 8.3.0
It might go even smaller if you fixed the common problem?
That is, as far as I can see, define data only in one place (and use extern to refer to it elsewhere).
Over they years I seem to have gone backwards and forwards a few times between using extern and not using extern. I must admit that I thought it was frowned upon these days as in most instances it is redundant (well it was redundant until this change in the default settings).

I doubt using extern would make any difference to the size as even with -fcommon they all uses of the same variable get resolved to one instance by the linker.

I have yet to do any comparisons of performance of the compiled code between 8.3 and 10.1

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Mon May 11, 2020 9:55 pm

PeterO wrote:
Mon May 11, 2020 9:35 pm
Over they years I seem to have gone backwards and forwards a few times between using extern and not using extern. I must admit that I thought it was frowned upon these days as in most instances it is redundant (well it was redundant until this change in the default settings).
From day one, I have been careful never to define the same object in more than one place, so have never noticed!

I saw this in the release notes, so thought the code may be a little faster:-
GCC now defaults to -fno-common. As a result, global variable accesses are more efficient on various targets. In C, global variables with multiple tentative definitions now result in linker errors. With -fcommon such definitions are silently merged during linking.
As an aside, I see they report improved the 64-bit arithmetic on the 32-bit ARM which should be good for Raspbian.
Pi4 8GB running PIOS64 Lite

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Tue May 12, 2020 12:50 am

The Pi Zero build for fun (C and C++ only) took 70.78 hours :(
Pi4 8GB running PIOS64 Lite

ejolson
Posts: 5640
Joined: Tue Mar 18, 2014 11:47 am

Re: New major release of GCC

Tue May 12, 2020 1:19 am

jahboater wrote:
Tue May 12, 2020 12:50 am
The Pi Zero build for fun (C and C++ only) took 70.78 hours :(
The good news seems to be that it even worked. It'd be much worse if one needed to iterate that as a debugging cycle.

Has anyone tried the UTF8 support?

jahboater
Posts: 5967
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: New major release of GCC

Tue May 12, 2020 1:27 am

ejolson wrote:
Tue May 12, 2020 1:19 am
jahboater wrote:
Tue May 12, 2020 12:50 am
The Pi Zero build for fun (C and C++ only) took 70.78 hours :(
The good news seems to be that it even worked. It'd be much worse if one needed to iterate that as a debugging cycle.
TBH I am always amazed that a tiny $5 computer can even complete such huge task!
Pi4 8GB running PIOS64 Lite

George441
Posts: 22
Joined: Tue Jan 21, 2020 4:13 pm
Location: 571 Willow Oak Dr 36695, Mobile, AL, US
Contact: Website

Re: New major release of GCC

Tue May 12, 2020 1:47 am

Its really :!: :!: :!: :!:
*************************************************************************
"Save a Tree - Save The Environment - Save Your Life "
=========================================================

Return to “C/C++”