473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

seeking highly efficient caches scheme for demanding engineering computing?


seeking highly efficient caches scheme for demanding engineering computing?

HI all,

To same the time of costly function evaluation, I want to explore the
possibility of caching.

Suppose in millions of calls to the function evaluation, there are some
computations, in which only a portion of the parameters change, others
remain the same as the parameters that are used in some other function
evaluations some time before. To save time, I can group the varying
parameters into sub-groups, and cache the results for later use. This needs
a highly efficient cache and a efficient organzation and look-up. Also, the
decision of whether a group of parameters has been seen before should be
based on data trunk in binary form, instead of decimal formats, so I can
compare memory data trunks directly using memory comparison.

Does anybody have good suggestions and pointers on this approach?

Thanks!



Jul 27 '07 #1
4 1559
Luna Moon wrote:
To same the time of costly function evaluation, I want to explore the
possibility of caching.
Good idea.
Suppose in millions of calls to the function evaluation, there are
some computations, in which only a portion of the parameters change,
others remain the same as the parameters that are used in some other
function evaluations some time before. To save time, I can group the
varying parameters into sub-groups, and cache the results for later
use. This needs a highly efficient cache and a efficient organzation
and look-up. Also, the decision of whether a group of parameters has
been seen before should be based on data trunk in binary form,
instead of decimal formats, so I can compare memory data trunks
directly using memory comparison.
Does anybody have good suggestions and pointers on this approach?
In some earlier posts you indicated that you spent 1+ years on the
algorithm. I won't pretend that in a few minutes reading about it
and typing my answer I can solve the problem, BUT it does sound like
your data structures would probably benefit from a redesign. Don't
take it personally, and don't dismiss it right away. It is very hard
to introduce a decent (and working) caching scheme into a very rigid
code structure (from both the data and procedural point of view) and
that's why you might want to reorganize the entire calculation to pull
the common bits out and perform them either beforehand (if guaranteed
that all of them are needed) or as you go, if you can record the fact
of them having been calculated (lazy calculation). It's a sheer
speculation on my part, no doubt, but what if you could identify the
common bits by means of the object being passed by a reference into
all those functions (thus making the whole thing OO, but slightly
differently than what you have now). It would be *like* caching,
yet you won't base it on the values of the arguments themselves, but
instead you'll build it into the algorithm...

If it all sounds awfully difficult or insane, just disregard.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 27 '07 #2
On Fri, 27 Jul 2007 00:12:57 -0400, "Luna Moon" <sp******@crayne.org>
wrote:
>
seeking highly efficient caches scheme for demanding engineering computing?

HI all,

To same the time of costly function evaluation, I want to explore the
possibility of caching.

Suppose in millions of calls to the function evaluation, there are some
computations, in which only a portion of the parameters change, others
remain the same as the parameters that are used in some other function
evaluations some time before. To save time, I can group the varying
parameters into sub-groups, and cache the results for later use. This needs
a highly efficient cache and a efficient organzation and look-up. Also, the
decision of whether a group of parameters has been seen before should be
based on data trunk in binary form, instead of decimal formats, so I can
compare memory data trunks directly using memory comparison.

Does anybody have good suggestions and pointers on this approach?

Thanks!

The problem with all caching schemes is determining whether
you have the required data in the cache, and fetching it or
updating it.

There are hardware solutions to help with CPU and disk caching, but
in your case you would be doing this all yourself. So it would
seem this is only feasible if the savings in computation time
is much more than the cost in housekeeping overhead.
Seems doubtful for most things...

Best regards,
Bob Masta

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Signal Generator
Science with your sound card!

Jul 27 '07 #3
In article <f8**********@news.stanford.edu>,
"Luna Moon" <sp******@crayne.orgwrites:
>
seeking highly efficient caches scheme for demanding engineering computing?

HI all,

To same the time of costly function evaluation, I want to explore the
possibility of caching.
....
>
Does anybody have good suggestions and pointers on this approach?
http://en.wikipedia.org/wiki/Dynamic_programming is a good starting
point.

Jul 28 '07 #4
Luna Moon wrote:
To same the time of costly function evaluation, I want to explore the
possibility of caching.

Suppose in millions of calls to the function evaluation, there are some
computations, in which only a portion of the parameters change, others
remain the same as the parameters that are used in some other function
evaluations some time before. To save time, I can group the varying
parameters into sub-groups, and cache the results for later use. This needs
a highly efficient cache and a efficient organzation and look-up. Also, the
decision of whether a group of parameters has been seen before should be
based on data trunk in binary form, instead of decimal formats, so I can
compare memory data trunks directly using memory comparison.

Does anybody have good suggestions and pointers on this approach?
Caching the results of calculations is always a trade-off between
several things. If I had a computer with infinite memory I'd pre-compute
the result of every function and then never actually calculate anything
at runtime. In the real world though you find that you can't cache
absolutely everything, and therefore it's best to cache only "the most
worthwhile" results, where "worthwhile" is usually some function of
frequency of hits and cost to calculate.

The other big thing to bear in mind is the cost of accessing the cache -
if the function is really cheap to compute (and may get inlined
automatically by any half decent optimising compiler if it makes sense
on your platform to do so) then there's no point adding a complicated
caching mechanism that will never be inlined and requires you getting a
global lock that's being contended for by all your threads. And you
could still find that on your architecture a (CPU) cache miss which
results in a fetch from RAM or worse still swap will be more expensive
than the function you're trying to cache.

It's been said a million times before, but profiling really is the only
sane way to start optimizing things.

I believe hash_map either is shortly will be standardised, with a struct
for that enables you to use your function parameters as a key with some
kind of added mask, a suitable hashing function, and some kind of RW
locking mechanism for MT support it should be possible to do what you want.

Alan
Aug 1 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
3
by: Jim Hubbard | last post by:
My own searches have proven to be of little help in understanding the implementation of this technology (available since Win98). Any information that you could share on Display Driver Management...
0
by: Volkan Arslan | last post by:
------------------------------------------------------------- LASER Summer School on Software Engineering Software engineering for concurrent and real-time systems Elba, Italy September 11 -...
0
by: Jsobel | last post by:
Hi all: I downloaded this new Personal Audio Link app. They issued a press release looking for beta testers, with a compensation offer of 6 months free Vonage service for qualified testers. ...
0
by: John_Gradian | last post by:
Hi all: I downloaded this new Personal Audio Link app. They issued a press release looking for beta testers, with a compensation offer of 6 months free Vonage service for qualified testers. ...
0
by: John_Gradian | last post by:
Hi all: I downloaded this new Personal Audio Link app. They issued a press release looking for beta testers, with a compensation offer of 6 months free Vonage service for qualified testers. ...
15
by: Oswald Kluge | last post by:
Dear Reader, I'm trying to implement the following short algorithm: Given a number n, remove all the multiples of n from the list of non-negative numbers from 1 through a limit k. My...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.