#linuxcnc Logs
Dec 02 2023
#linuxcnc Calendar
12:36 AM memleak: Hey guys I was thinking of making a second wiki for the gentoo preempt_rt image for LinuxCNC since I haven't received any feedback on it, do I over-explain things?
12:47 AM memleak: I just didn't want to miss important pieces of info but if it's too hard to follow I can make a separate page that's more like, pop in the flash drive, run this, do this, check for that, and then run this and type in that.
12:47 AM memleak: I just don't know if it'd help. I spent awhile writing the installer and it's kind of a shame it hasn't been tested.
12:58 AM Deejay: moin
01:00 AM memleak: hey waddap Deejay
01:00 AM * Deejay looks up at the ceiling
01:01 AM Deejay: nothing unnormal ;)
01:02 AM memleak: what's your timezone? it's 1am here.
01:02 AM Deejay: 8am here
01:03 AM memleak: ah ok :)
01:03 AM memleak: are you an avid linuxcnc user?
01:04 AM memleak: I see you here often just don't know your story.
01:04 AM memleak: I mostly focus on just the latency side of things :)
01:04 AM Deejay: nope, not really. I am running my home build CNC with linuxcnc. works fine and I should use the mill more often ;)
01:06 AM Deejay: I am here since I am in other IRC channels all the time, perhaps I can pick up some interesting things here. But most time I am just reading and not really there ;)
01:06 AM memleak: haha alrighty
01:08 AM memleak: Interesting thread: https://forum.linuxcnc.org/38-general-linuxcnc-questions/50860-uk-escort-girls
01:09 AM Deejay: lol
05:36 AM rigid: Did anyone try https://herbie.uwplse.org/demo/ ?
05:36 AM rigid: Seems there is quite some potential to improve fp math accuracy/speed in linuxcnc.
05:39 AM memfrob: LinuxCNC uses the C library for math functions, which are basically as optimized as you can get (fabs, sqrt etc)
05:41 AM rigid: not really, math.h can't optimize for accuracy. Check https://herbie.uwplse.org/doc/latest/error.html on why accurate FP math is hard.
05:42 AM rigid: also it doesn't use the math library at all places. e.g. x^2 is not done by pow(x,2.0) but by some sqr(x) { return (x)*(x) }; etc.
05:43 AM memfrob: yes but sqrt may already be as optimized as you can get. for example, for RTAI: https://github.com/NTULINUX/RTAI/blob/gnu11-libm-kbuild/src/math/sqrt.c sqrt uses an x86_64 assembly built-in for sqrt itself
05:43 AM memfrob: __asm__ ("sqrtsd %1, %0" : "=x"(x) : "x"(x));
05:44 AM memfrob: this would be the slower, software equivalent: https://git.musl-libc.org/cgit/musl/tree/src/math/sqrt.c
05:45 AM memfrob: MY EYES
05:46 AM rigid: e.g. this line from pentakins.c is optimized from 97.7% accuracy to 100.0% and 3.0x speedup: struts[i] = sqrt( sqr(xyz.z - za[i]) + sqr( sqrt(sqr(xyz.x) + sqr(xyz.y)) - ra[i]) );
05:47 AM rigid: struts[i] = hypot((xyz.z - za[i]), (hypot(xyz.x, xyz.y) - ra[i]));
05:48 AM rigid: https://herbie.uwplse.org/demo/8dc62f4a96213806290a43805808d944a57e6762.10eb16397304ba9e003d59ffd34803200ce7cfa6/graph.html
05:49 AM memfrob: why wouldn't glibc by default just do that then?
05:50 AM memfrob: or is herbie for optimizing how you use the math functions and not actually implement it's own math lib?
05:52 AM rigid: memfrob: because of the nature of IEEE 754 floating point math. You might want to give the herbie paper a closer look.
05:52 AM memfrob: just throwing this out there, for some CPUs, i.e. AMD you may have better luck with: https://www.amd.com/en/developer/aocl/libm.html
05:53 AM rigid: it's optimizing in multiple ways. e.g. using the math.h function when it's better or completely transform the equation
05:53 AM memfrob: got it!
05:53 AM rigid: not a lib
05:53 AM memfrob: ok that makes sense
05:53 AM rigid: it also supports python
05:53 AM rigid: pretty nifty
05:55 AM memfrob: IEEE 754 compliant can also cause slower math (albeit less accuracy) though too which is why -funsafe-math-optimizations / -ffast-math exist
05:55 AM rigid: also, some alternatives give huge speedups (100x and more) and DECREASE accuracy. Pretty interesting for cases where accuracy is not needed or jut for small input value ranges
05:55 AM memfrob: linuxcnc does a pretty good job filtering those cflags out though and for good reason
05:56 AM memfrob: i've always wondered how aggressive you can tune the math without getting errors with linuxcnc lol
05:56 AM memfrob: doesn't linuxcnc only use the first few decimals anyway? it doesn't calculate to the 10th decimal?
05:56 AM rigid: yeah, but in theory it should work fine if accuracy increases.
05:58 AM rigid: herbie accounts for that when you define input ranges. Also rounding errors accumulate. The CPU always uses the full accuracy of the datatype.
05:58 AM rigid: s/accuracy/precision/g
05:59 AM memfrob: how long would it take to run all the math funcs through herbie? :)
06:00 AM memfrob: in the case of RTAI's sqrt function btw, sqrtsd is part of SSE2 so that at least is done in hardware
06:00 AM memfrob: ideally you'd want everything to be done in SSE/AVX for best performance AFAIK
06:01 AM memfrob: i'm not too skilled at this math stuff though lol
06:02 AM memfrob: but i do find it interesting and i read up for what i can actually understand
06:03 AM memfrob: however that'd also break ARM if you hard-coded everything to x86_64 asm
06:05 AM memfrob: rigid, that 3x speed-up is that for all arches?
06:17 AM -!- #linuxcnc mode set to +v by ChanServ
06:17 AM JT-Shop: power out since 3am
06:23 AM JT-Cave: naturally the generator batteries were flat this morning
06:56 AM lcnc-relay: <travis_farmer (@_discord_731083529441640538:jauriarts.org)> oh dear 😦
08:37 AM rigid: memfrob: i suppose so, yes. Not sure what FPUs do in modern architectures really
08:38 AM rigid: there's a page explaining metrics
09:09 AM Deejay: re
09:13 AM Tom_L: rigid, does the licensing on herbie agree with lcnc?
09:13 AM Tom_L: that would be one of the first questions to ask i think
09:15 AM rigid: Tom_L: licensing? its a "static code analyzer" (not even that) based on an academic paper
09:16 AM rigid: havent got to run the docker image, yet. just played with the webdemo.
09:16 AM Tom_L: ok
09:17 AM rigid: maybe I come around to it in the next days but gotta lot of other stuff on the list.
09:19 AM rigid: but i guess it's an interesting tool for any fp-heavy application. This stuff is so hard to get right, I guess a lot of FOSS apps can't afford that kind of optimization.
09:42 AM lcnc-relay: <schoch_> is lcnc fp bound in any big way on moder procs?
09:44 AM lcnc-relay: <schoch_> this thing is actually pretty amazing, if you could integrate it wit that herbie thing you might be able to find some places to optimize. https://openworldai.com/plugins/ask-your-code
09:46 AM Unterhaus_ is now known as Unterhausen
09:46 AM lcnc-relay: <schoch_> * this thing is actually pretty amazing, if you could integrate it wit that herbie thing you might be able to find some places to optimize. https://askyourcode.ai/
09:47 AM lcnc-relay: <schoch_> you can just point it at a github repo. this would really benefit from the 200k context window of something like claude 2
09:55 AM lcnc-relay: <schoch_> ok, i asked in their discord if you can plug in static code analysis tools
10:10 AM solarwind: so the research papers are right, approach angle has a large influence on surface finish
10:10 AM solarwind: CBN doesn't seem to improve surface roughness, but cermet definitely does
10:10 AM solarwind: my results are consistent with the papers
10:10 AM Tom_L: i would hope so
10:10 AM solarwind: Although I have _no idea_ why
10:11 AM solarwind: I don't know what's happening in terms of the physics
10:11 AM solarwind: the CBN inserts I have seem to have a chamfered edge though, not very sharp, so they're prone to rubbing
10:12 AM solarwind: I don't know why using cermet gets you nearly half the surface roughness as uncoated carbide
10:13 AM solarwind: Time to braze some high hardness carbide grade and grind it to a very sharp edge
10:13 AM solarwind: 1000 grit diamond wheel should put a nice polish on it
10:18 AM solarwind: Tom_L well that's the beauty of the scientific method
10:18 AM solarwind: browser ad pops up: "Religious leaders HATE this one simple trick!"
12:27 PM lcnc-relay: <schoch_> solarwind: this guy seems to be pursuing optical surface finish quality https://www.youtube.com/@cylosgarage/videos
12:40 PM CloudEvil: :)
02:52 PM XXCoder: very heavy flood rain here
02:57 PM roycroft: we're not getting the rain that was forecast
02:58 PM roycroft: but i'm heading off to oakridge in a few minutes, and the forecast there is still for 60mm of rain today
02:58 PM roycroft: which may well hold true
02:59 PM Tom_L: still drizzling here
02:59 PM XXCoder: some hail also when I was returning to home lol
03:04 PM Tom_L: real or fake? http://tom-itx.no-ip.biz:81/~webpage/temp/hail/hail4.jpg
03:04 PM Tom_L: that's real :)
03:05 PM Tom_L: long time ago but still is the biggest i've seen
03:35 PM Tom_L: JT-Cave, https://www.youtube.com/watch?v=VKmJItYsPfY
03:36 PM XXCoder: ouch lol. it was small pebble sized here
03:38 PM Tom_L: after that for a few years everybody drove around in beaters
03:38 PM Tom_L: that broke all the car windows & N side of house glass
03:39 PM Tom_L: it was a mess
04:02 PM JT-Shop: that was a fun day
04:08 PM XXCoder: nice
04:09 PM JT-Shop: being in the Saint Genevieve xmas parade was a lot of fun... lots of little kids really liked seeing the cars
04:12 PM Tom_L: cool
04:12 PM Tom_L: cold wet day here
04:13 PM Tom_L: ^^ vid for you
04:13 PM Tom_L: i'm sure you know about it already though
04:13 PM JT-Shop: I check every saturday for new vids but just checked when I got back
04:13 PM JT-Shop: sad news and I thought something was up a few weeks back when Leo did the fund raiser for them
04:26 PM -!- #linuxcnc mode set to +v by ChanServ
04:31 PM XXCoder: pretty good joe today https://youtu.be/5yHnKdXc-uU
05:02 PM JT-Shop: I drove the side by side over some large rocks to get it next to the generator this morning to try and jump start the generator
05:03 PM JT-Shop: tomorrow's project is to clean out the rocks and get the kubota back out lol
05:07 PM JT-Shop: I may need a new battery for the generator...
05:07 PM XXCoder: power generator?
05:08 PM JT-Shop: yup an old diesel 2 cylinder 3 phase generator from a small police station near St Louis
05:09 PM XXCoder: cool
05:48 PM CaptHindsight: solarwind: I have found that using math tends to work well. Jesus vs math, guess who wins?
05:52 PM * JT-Shop calls it a night
08:43 PM perry_j1987: g'evening
08:46 PM Tom_L: yo
08:52 PM perry_j1987: found one of these in my boxes here http://www.vistacnc.com/manual_download/iMach3%20Pendant.pdf
08:52 PM perry_j1987: looks like it had a custom parallel port/serial port card back in the day? heh
11:24 PM XXCoder: Tom_L: why is you testing machine setip again?
11:24 PM Tom_L: checking joint following error
11:25 PM XXCoder: ahh cool
11:26 PM Tom_L: i ran it with G00 too
11:26 PM Tom_L: 210ipm no errors yet