[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rtl] more floating point problems



I'd like to second David Christini's problem.

Like Pavel, I have various RT applications that use doubles. (I never use
floats to avoid unnecessary bugs.) I use several math functions, 
specifically: exp(), sin(), cos() and sqrt();

Like David however, none of my systems are particularly stable.  As
Pavel suggested I think the instability is coming from memory related
issues, but not the user/kernel type. 

All of my modules are stable if I use a 'small' number of doubles,
and a 'small' number of operations on those doubles (per period in a
periodic rt thread.) I observe two possibly related phenomena--

1) as I increase the number of double operations in a cycle, the cpu will
	eventually lock up. This doesn't concern me, perhaps I'm asking
	too much of it --
		It works with something like 100 double fxns
	{ie. exp(),sin(),etc.} & 1000 double operations {ie +-*/}
	every 100 microseconds, on a 450MHz PIII.

2) as I increase the number of doubles I use, the system will eventually
	spontaneously reboot itself.  This phenomenon is unpredictable.
		~100  double variables ->  works every time.
			'every time' =  hundreds of trials for up to
					millions of periods per trial.
		~1000 double variables -> reboots every time.
		~100->1000 double variables -> works/reboots randomly.

	Obviously I observe this when using arrays of doubles, and the
	numbers I listed above are highly dependent on the number of
	operations I perform in a given period.  But even if I perform
	almost no operations in a loop (say, only one typecast), an array
	of 2000 doubles in my module will reboot the system upon
	insertion. Understand that for a given operation number, the
	number of stable double variables is a constant.

	Two examples:
	1) 1 array of 100 doubles & 10 other doubles
		~400 operations & 99 functions
		-works fine every time
	   1 array of 105 doubles & 10 other doubles
		~400 operations & 99 functions (extra doubles aren't used)
		- reboots every time

	2) 4 arrays of 10 doubles & 30 other doubles
		~150 operations & 78 functions
		- works fine every time
	   4 arrays of 11 doubles & 30 other doubles
		~150 operations & 78 functions (extra doubles aren't used)
		- reboots every time

If I use 'int' in place of 'double', (of course I can't use the math
fxns), but I find arrays of 100,000 members reliable, without any crash
or reboot. (I assume I could go to millions of members before running into
a problem.) 

After extreme frustration, I gave up pressing this issue about a month
ago, and just restricted myself to small double arrays. But I suspect that
my issues are related to David Christini's, so I thought I'd bring it up.

If anyone is interested in examining my problem,
let me know and I'll send out the code...

Chuck

On Tue, 11 Apr 2000, Pavel Andris wrote:
> David,
> I use kernel 2.2.13, RTL 2.0. My RT application uses double variables
> and operations heavily including sin(), cos(), sqrt(), atan2(). I also
> use shared memory (Tomek Motylewski's mbuff). I don't remember any
> crash caused by floating point operations. I'd expect your trouble is
> caused by something else (float/double confusion?, kernel/user memory
> context trouble?). 
> Regards, Pavel Andris