Archive

Posts Tagged ‘random’

Code generation via machine learning

April 2nd, 2009 Derek-Jones No comments

Commercial compiler implementors have to produce compilers that are capable of being used on a typical developer computer. A whole bunch of optimization techniques were known for years but could not be used because few computers had the available memory capacity (in the days when 2M was a lot of memory your author once attended a talk that presented some impressive results and was frustrated to learn that the typical memory footprint was 160M, who would ever imagine developers having so much memory to work within?) These days the available of gigabytes of storage has means that likely computer storage capacity is rarely a reason not to use some optimization technique, although the whole program optimization people are still out in the cold.

What is new these days is the general availability of multiple processors. The obvious use of multiple processors is to have make distribute the compilation load. The more interesting use is having the compiler apply different sets of optimizations techniques on different processors, picking the one that produces the highest quality code.

Optimizing code generation algorithms don’t appear to leave anything to chance and individually they generally don’t. However, selecting an order in which to apply individual optimization algorithms is something of a black art. In some cases code transformations made by one algorithm can interfere with the performance of another algorithm. In some cases the possibility of the interference is known and applies in one direction, choosing the appropriate relative ordering of the two algorithms solves the problem. In other cases the way in which two algorithms interfere with each other depends on the code being translated, now the ordering of the two algorithms becomes problematic. The obvious solution is to try both orderings and pick the one that produces the best result.

Several research groups have investigated the use of machine learning in compiler optimization. cTuning.org is a new project that aims to bring together groups interested in self-tuning adaptive computing systems based on statistical and machine learning techniques.
Commercial pressure is always forcing compiler implementors to produce faster code and use of machine learning techniques can produce some impressive results. Now that multi-processor systems are common it will not be long before compilers writers start to make use of the extra resources now available to them.

The safety critical people have problems trying to show the correctness of compiler output that has been generated by ‘fixed’ algorithms. It is not hard to envisage that in 10 years time all large production quality compilers will be using machine learning.

Readability, an experimental view

January 20th, 2009 Derek-Jones No comments

Readability is an attribute that source code is often claimed to have, but what is it? While people are happy to use the term they have great difficulty in defining exactly what it is (I will eventually get around discussing my own own views in post). Ray Buse took a very simply approach to answering this question, he asked lots of people (to be exact 120 students) to rate short snippets of code and analysed the results. Like all good researchers he made his data available to others. This posting discusses my thoughts on the expected results and some analysis of the results.

The subjects were first, second, third year undergraduates and postgraduates. I would not expect first year students to know anything and for their results to be essentially random. Over the years, as they gain more experience, I would expect individual views on what constitutes readability to stabilize. The input from friends, teachers, books and web pages might be expected to create some degree of agreement between different students’ view of what constitutes readability. I’m not saying that this common view is correct or bears any relationship to views held by other groups of people, only that there might be some degree of convergence within a group of people studying together.

Readability is not something that students can be expected to have explicitly studied (I’m assuming that it plays an insignificant part in any course marks), so their knowledge of it is implicit. Some students will enjoy writing code and spends lots of time doing it while (many) others will not.

Separating out the data by year the results for first year students look like a normal distribution with a slight bulge on one side (created using plot(density(1_to_5_rating_data)) in R).

First year

year by year this bulge turns (second year):

Second year

into a hillock (final year):

Final year

It is tempting to interpret these results as the majority of students assigning an essentially random rating, with a slight positive bias, for the readability of each snippet, with a growing number of more experienced students assigning less than average rating to some snippets.

Do the student’s view converge to a common opinion on readability? The answers appears to be No. An analysis of the final year data using Fleiss’s Kappa shows that there is virtually no agreement between students ratings. In fact every Interrater Reliability and Agreement function I tried said the same thing. Some cluster analysis might enable me to locate students holding similar views.

In an email exchange with Ray Buse I learned that the postgraduate students had a relatively wide range of computing expertise, so I did not analyse their results.

I wish I had thought of this approach to measuring readability. Its simplicity makes it amenable for use in a wide range of experimental situations. The one change I would make is that I would explicitly create the snippets to have certain properties, rather than randomly extracting them from existing source.

Monte Carlo arithmetic operations

December 5th, 2008 Derek-Jones No comments

Working out whether software based calculations involving floating-point values delivers a sensible answer requires lots of mathematical sophistication and in practice is often impractical or intractable. The vast majority of developers make no effort, indeed most don’t even know why the effort is needed. Various ‘end-user’ solutions have been proposed, e.g., interval arithmetic.

One interesting solution is to perturb the result of floating-point operations and measure the effect on the final answer. Any calculation that is sensitive to small random changes in the result of an operation (there is randomness present in any operation that operates on values that can only be represented to a finite precision) will produce answers that depend on the direction and magnitude of the perturbation. Comparing the answers from several program executions provides a measure of one kind of error present in the calculation.

Monte Carlo arithmetic is a proposed extension of floating-point arithmetic that operates by randomly selecting how round-off errors occur (the proposer provides sample code).

With computing power continuing to increase, running a program several times is often a viable option (we don’t all number crunch for cpu days). Most of the transistors on a modern CPU chip are devoted to memory cache, using a few of these to support Monte Carlo arithmetic instructions is entirely practical. Perhaps when vendors get over supporting the base-10 radix required by the latest IEEE 754R standard and are looking for something new to attract customers they will provide a mechanism that makes it practical to obtain estimates of some of the error in floating-point calculations.

www.wenn.com
FireStats icon Powered by FireStatswww.tinynibbles.com cialis soft pills

order prescription propecia

how to get cialis in canada

indian generic levitra

cialis dosage mg

buy levitra overnight

canadian viagra india

canada viagra

cialis 5 mg

buy cialis once daily

buy levitra us

lowest price on non generic levitra

levitra now online

cialis from canada

indian viagra

mexico pharmacy cialis

buy generic levitra

cheapest prices for viagra

levitra prescription

cheapest viagra

generic propecia alternative

generic propecia for sale

cheap prescription propecia

5 mg daily cialis

generic viagra canadian

cheap order prescription propecia

brand name cialis

cheap cialis soft

buy generic viagra india rx

lowest price levitra

canadian pharmacy

buy propecia in the uk

levitra for sale

buy viagra

female viagra pills

cialis for woman

cheapest propecia uk

generic propecia finasteride

buy propecia online pharmacy

online propecia uk

discount propecia online

lowest priced propecia

levitra online no prescription

generic cialis sale

order cheap propecia

buy viagra on line

cialis price in canada

buy cialis canada

canada levitra

discount cialis india

buy real viagra online

cialis daily

buy generic propecia

how to buy cialis in canada

canadian viagra 50mg

buy levitra vardenafil

buy viagra online cheap us

drug generic propecia

generic levitra online

mail order levitra

buy levitra online from canada

info levitra

cialis next day delivery

levitra 10mg

generic cialis soft tabs

levitra mg

cialis transdermal

buy propecia cheap

low cost canadian viagra

online pharmacy propecia viagra

best price levitra

canada propecia prescription

generic levitra cheap

low price levitra

cheap levitra uk

cialis and ketoconazole

generic propecia fda approved

natural viagra

name brand cialis

buy can from i propecia who

best viagra

cialis cheap us pharmacy

online viagra gel to buy

cialis no prescription

cialis discount

how much cialis

buying cialis

levitra in canada

cialis professional no prescription

cialis cheap

buying cialis next day delivery

brand cialis for sale

genuine cialis pills

cialis tablets foreign

order viagra or levitra

cialis woman

buy propecia online from usa pharmacy

how much to buy viagra in pounds

levitra low price

buy canada levitra

brand name cialis overnight

get levitra

cialis fast delivery usa

canadian healthcare pharmacy

cialis price 100 mg

canada meds viagra

levitra viagra online

buy cialis fedex shipping

levitra discount

buy propecia generic

cialis daily dosage pharmacy

cialis in mexico

hydrochlorothiazide cialis

buying propecia online

cialis 50 mg

cheapest price propecia cheap

online propecia prescriptions

buy prescription propecia without

cialis 5 mg buy

cialis 5 mg italia

discount generic propecia

levitra tabs

cialis and canada custom

cheap propecia online

discount propecia rx

cialis professional 20 mg

brand viagra professional

cheap levitra

buy cialis cannada

buying propecia

generic levitra overnight delivery

gele viagra

generic levitra vardenafil

generic viagra 100 mg

generic levitra purchase

overnight delivery cialis

next day delivery cialis

cialis en mexico

next day viagra

discount us propecia

cialis fast delivery

generic viagra made in india

cialis overnight

buy propecia now

get propecia online pharmacy

buy levitra uk

cheap cialis from india

buy online prescription propecia

buy propecia without prescription

buying viagra in canada

discount drug propecia

buy fast propecia

buy cialis online uk

cheap viagra canada or india

cialis headaches

cheapest propecia sale uk

buy cheap generic propecia

cialis 100 mg generic

levitra mail order

buy cialis without prescription

online levitra

buying online propecia

cialis prescription

canadian pharmacy cialis

cheap levitra tablets

buy levitra online viagra

cialis on women

cheapest overnight cialis

cialis daily in canada

best price for propecia

levitra cost

levitra where to buy

canadian viagra and healthcare

levitra online

canada online pharmacy propecia

cialis online

canadian healthcare

china viagra

canada cheap propecia

buy viagra germany canadian meds

lowest propecia prices in canada

lowest price for propecia

cialis profesional

cheap discount levitra

buy propecia where

cheap levitra without prescription

levitra online overnight delivery

buy real cialis

get levitra online

indian cialis

online generic cialis 100 mg

cheapest viagra online

generic viagra online

levitra pill

getting cialis from canada

cialis strenght mg

levitra from canadian pharmacy

cheapest viagra usa

cheap propecia uk

cialis vs levitra

order cheap levitra

cialis 100 mg

mail order propecia

online ordering propecia

generic levitra canada

discount levitra purchase

online cheap viagra

5 mg original brand cialis

buy viagra without prescription

once daily cialis

levitra order prescription

levitra next day delivery

overnight delivery viagra

lowest propecia prices

cheap propecia online prescription

cialis quick shipment

canada generic propecia

how to get viagra

cialis by mail

canadian healthcare viagra

generic viagra canada

lowest price propecia

buy cialis 5 mg

cost of daily cialis

cialis 20 mg

canada viagra pharmacies scam

cialis uk

buying cialis soft tabs 100 mg

canadian pharmacy discount code viagra

healthcare canadian pharmacy

buy cialis in usa

best price propecia

order levitra online

cialis to buy

daily dosage cialis

once a day viagra

obtain viagra without prescription

buy viagra online

combine cialis and levitra

cialis tablets

cialis pharmacy

can i get viagra in mexico

generic viagra india

canadian pharmacies cialis

order generic levitra

buy cheapest propecia

levitra in india

buy branded viagra

ganeric cialis

lowest propecia 1 mg

for sale levitra

buy propecia online prescription

cheap fast levitra

buy 5 mg cialis

cialis purchase

lowest cost levitra

buy dosages levitra

cheap viagra online

cheap canadian viagra

levitra canadian

cialis from mexico

online pharmacy propecia renova

cialis one a day

buy viagra china

cheap cialis

levitra online sales

levitra buy online

cialis professional 100 mg

cialis price

buy generic cialis

bestellen levitra online

get cialis online

buy now propecia

generic propecia sale

cheapest propecia prescription

buying generic propecia

bio viagra herbal

online cialis

buy cialis usa

canadian propecia rx

buy levitra online no prescription

canadian pharmacy viagra

cheap propecia 5mg

buy cialis online canada

generic propecia online pharmacy

cheap viagra from uk

cheap propecia no prescription

cialis overnight delivery

ordering propecia online

herbal propecia

how much does cialis cost

fda levitra

canadian viagra

discount levitra online

does generic cialis work

canada online pharmacy levitra

levitra online us

levitra online prescription

cialis refractory

buy propecia canada