LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices



Reply
 
Search this Thread
Old 05-04-2014, 03:03 PM   #1
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 223

Rep: Reputation: 10
Raspberry PI, Slackware ARM and floating point calculations


Supposing I've a PI running with a Raspbian hardfloat enabled kernel and a Slackware ARM 14.0 or 14.1 userland that includes distribuited GCC package (and necessary dependencies to compile stuff).

If I write C code that does tons of floating point calculations can I instrucg gcc (on the slackware ARM userland) to compile the executable so as to use hardfloat ? or will I run into all sorts of problems dew to system libraries being compiled softfloat ?

I was looking at the GCC ARM options and I noticed a few things that might be of intrest concerning what I want to acheive:
Code:
-mfloat-abi=name
           Specifies which floating-point ABI to use.  Permissible values are:
           soft, softfp and hard.
-mfp=number
           This specifies what floating-point hardware (or hardware emulation)
           is available on the target.  Permissible names are: fpa, fpe2,
           fpe3, maverick, vfp, vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16,
           vfpv3xd, vfpv3xd-fp16, neon, neon-fp16, vfpv4, vfpv4-d16,
           fpv4-sp-d16 and neon-vfpv4.  -mfp and -mfpe are synonyms for
           -mfpu=fpenumber, for compatibility with older versions of GCC.

Last edited by louigi600; 05-04-2014 at 03:05 PM.
 
Old 05-04-2014, 07:54 PM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,243

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
I did some FP experiments on the RasPi.
http://www.linuxquestions.org/questi...8/#post4913580
But I didn't give any special instructions to the compiler.

jlinkels
 
Old 05-05-2014, 03:54 AM   #3
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 223

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by jlinkels View Post
I did some FP experiments on the RasPi.
http://www.linuxquestions.org/questi...8/#post4913580
But I didn't give any special instructions to the compiler.
jlinkels
Good to know ... but what distribution were you using when you did your tests ? as this may have a lot of influence on the FP performance.

The Slackware ARM userland is compiled to use softfloat, while I think that Debian derivates for the ARM platform are compiled to use hardfloat, while raspbian is specifically tune for the PI hardware.

What I'm asking for is advice on options (if there are any) on compiling stuff to use hardfloat on a softfloat userland.
 
Old 05-05-2014, 07:10 AM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,243

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Raspbian.

jlinkels
 
Old 05-05-2014, 07:24 AM   #5
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 223

Original Poster
Rep: Reputation: 10
Well then I think it's normal, the compiler is most likely configured to produce hardfloat binaries by default.

The question still remains what options are there (if any) for compiling stuff to use hardfloat on a softfloat userland ?
 
Old 06-23-2014, 04:55 PM   #6
gus3
LQ Newbie
 
Registered: Jun 2014
Distribution: Slackware (x86 and ARM)
Posts: 17

Rep: Reputation: Disabled
Linux distro managers configure GCC's defaults to produce object code using the specified ABI for the distro. In the case of ARM, Raspbian uses hard-float (and the VFP), and Slackware uses soft-float (and emulated floating-point, not VFP). You can compile, specifying the "wrong" hard/soft-float, and you will get an object file, but the linker will reject it as unsupported. Given that Glibc was built using GCC (with its already-configured defaults), just about every executable binary will need to use the same ABI as Glibc.

(Unless you're building a free-standing image, i.e. a Linux kernel or some other bare-metal programming. But that's for a different thread.)

There is also a third option for ARM: "softfp", which passes FP arguments on the stack, conforming to "soft" ABI, but generates instructions for using the VFP/Neon instruction within a function. It can provide a code speedup, as well as decreasing a process's RSS. It's even possible to rebuild Slackware's Glibc to use softfp for /lib/libm.*. I have a HOWTO explaining this, but bear in mind it is definitely not for the faint-hearted. I can't post a URL, but you can do a Google search for "slackware arm rebuild glibc vfp" and it will be at the top of the results.

Does that clarify things?

Last edited by gus3; 06-23-2014 at 04:57 PM. Reason: clarify a small point
 
1 members found this post helpful.
Old 06-26-2014, 06:04 AM   #7
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 223

Original Poster
Rep: Reputation: 10
Yes ... a whole lot more.
The biggest issue I have is time ... 2 lively, under 5, kids occupy almost all my spare time.
Although I dislike the idea it might be a whole lot faster to have an SD image with a PI tuned ready-made image (like raspbian) on it ... while waiting for raspware
Maybe next time I send wife and kids away a month or so for summer vacation I can look into vfp glibc ... I suppose that once I do that a lot of my ARM devices running slackwareARM could benefit from the effort ?
 
Old 06-26-2014, 06:11 PM   #8
gus3
LQ Newbie
 
Registered: Jun 2014
Distribution: Slackware (x86 and ARM)
Posts: 17

Rep: Reputation: Disabled
They can benefit only if they have an FPU (VFP or Neon). I have 3 Android devices, all ARM, and none of them have an FPU. The RPi is the only one with an FPU.
 
Old 06-27-2014, 03:40 AM   #9
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 223

Original Poster
Rep: Reputation: 10
The Pi obviously has VFP, as far as I know the tegra2 in the AC100 is lacking NEON but has VFPv3, the Allwinner Axx all have NEON, VFPv3 and Thumb-2, the RK3066 should be much like the A20, the MT8125 has a Cortex A7 core so I suspect it has FPU ...the PXA270 I don't use much anymore (I've forgotten if it had VFP) and the kirkwood plug related stuff needs not do much floating point anyway as they've become NAS and print server.

If I ever get round to follow your HOWTO I've more hardware that can benefit ;-)

Last edited by louigi600; 06-27-2014 at 04:54 AM.
 
Old 06-27-2014, 03:19 PM   #10
gus3
LQ Newbie
 
Registered: Jun 2014
Distribution: Slackware (x86 and ARM)
Posts: 17

Rep: Reputation: Disabled
Actually, it almost sounds like you have a build farm going there. Have you figured out how to shoe-horn Slackware into all of them?
 
Old 06-28-2014, 07:30 AM   #11
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 223

Original Poster
Rep: Reputation: 10
The RK3066 and MT8125 are the only 2 that are pending work to get into the slackware club ... all the others, have or had at some point, slackware installed on them (and if it was not a slackware it was my own Clash/ClashNG miniroot).
None of the the ones that currently run slackware are particularly good for building because they lack ram ... in any case I don't have much time for that at the moment: I'll look into buying an Odroid U3 or an Nvidia TK1 (or whatever will be bang for buck with tons of computing power) when the kids grow up a little and I might have a bit more time.
It might be interesting to see how the dual core 1.6Ghz RK3066 with 1Gb of ram manages compiling stuff ... more on this when I get slackware running on it. It's a damm pity it's lacking GPIO or I'd be using that instead of the pi for my droid model submarine project. It's just a matter of time now for the RK3066: this howto has all the information required ... it just needs a little bit of tinkering to adapt it to slackware.

Last edited by louigi600; 06-29-2014 at 09:37 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rTorrent 0.9.3 for Slackware ARM on a Raspberry Pi Exaga Slackware - ARM 0 12-22-2013 05:46 PM
Slackware ARM 14.1 on a Raspberry Pi Exaga Slackware - Installation 2 11-17-2013 09:11 AM
Installing Slackware ARM on a Raspberry Pi Penthux Slackware - Installation 20 03-24-2013 02:59 PM
JAVA/C++: Performance of floating point calculations traene Programming 4 04-16-2006 05:03 PM


All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration