30 October 2010

MITERS

Yesterday night, Bayley and I decided to head to MIT electronics research society, or MITERS, after hanging out watching people play League of Legends at Random and eating a hearty dinner consisting of tiny McDonalds' burgers. I figured this would be a good time to learn how to solder and hack the 17" Apple Studio Display (flat panel) with an Apple Display Connector (ADC) that Bayley gave to me, so I carried that along. The lab/warehouse was located a good minute's walk from Random, but walking with a rather large monitor tucked under my arm was rather troublesome. Once we got there, I found an empty lab bench and introduced myself to the MITERSers (should it be just MITers?), while Bayley got down to work with his laser. The hack, which I will elaborate in a future post, that I wanted to do was to convert the ADC plug (male) to a DVI plug (male). Sure, I could buy the breakout box from Apple for $99, but a ghetto setup for $0 would be much more awesome. It took about five hours to complete, from stripping the cables to testing the unit.

 Teaser image: My first real electronics project works!

Having nothing else to do, I hung around the lab and watched other MITERSers work on their projects and beta-test the 4-ft tall Tesla coil in the parking lot (this was at 3am today). The coil was particularly interesting in that it played loud, off tune music and had the peculiar ability of attracting drunk young adult females.



Bayley and I finally left around 4am, satisfied that our respective projects were successes.

27 October 2010

This Fated Moment

My printer "ran out of ink."

"Ran out of ink?"

Yes. The cartridge isn't actually empty; the printer, a Brother HL-2040 (a laser printer my dad purchased a few years ago for $50), is programmed so that when the toner level is below some threshold, will refuse to print any more documents. This means that I'll have to rely on the hall printer or some other Athena cluster printer, whose queue is usually jammed with 20-page articles people need to print for their humanities classes. Well, that's unfortunate.

[Interjection] The clever MIT student would say, ``Well, couldn't you just haul back any printer from the dumpster? They all work...'' To which I would respond: ``Hacking my current printer would be much cooler!''[/Interjection]

Actually not quite. A few years ago, when I was researching this particular printer in my leisure, I came across a highly insightful Amazon review (which I then stored in my Google Notebook):

135 of 136 people found the following review helpful:
Masking Tape Gives TN-350 Toner a Second Life,August 25, 2008
By C. MACPHAIL "cmacphail3" (Solana Beach, CA USA) - See all my reviews
(REAL NAME)       
I get 800 to 1100 extra copies from each cartridge.

After the "Toner Life End" message appears, it refuses to print even one more copy. Offensive...until you show it who's in charge.

Remove the cartridge and find 2 clear plastic port holes, one on each side. The printer shines a light through these to decide when to shut you off. But it's too sudden and too early.

Cover one or both windows with a small piece of masking tape. I get about 3400 copies per cartridge instead of 2400.

I really like Brother printers now that I have taught them some manners.

So I tried it...

Here is the hole on one side (close up).

Here is the hole relative to the cartridge unit.

Here is the hole covered by masking electrical tape.


...and hey, my printer now willingly spits out my biology homework!

The printer is nice and happy! (Green Ready light is on instead of the irksome orange Toner light).

For the keen eye: The processor sitting on my printer is a LGA775 Pentium 4.

Next hack: DIY ADC (female) to DVI (male) adapter! Stay tuned!

23 October 2010

Interesting MacBook Air Notes

I suppose this post is slightly late, but still worth sharing anyway. It's more of an analysis of the new MacBook Airs, rather than a hands-on. In fact, when I went to the CambridgeSide Galleria Apple Store a few hours after the keynote, the only MacBook Air in the store was a lonely 13.3" model. *sad*

This past Wednesday, Steve unveiled new MacBook Airs! It was a nice revision; the computers got smaller, lighter, and faster. Briefly looking through disassembly pictures courtesy of iFixit and hands on reports by Engadget, MacWorld, and Ars, I have notice several small details:
  • The SSD is no longer a 1.8" SATA unit; it is a very long Mini-PCIe card. In theory, you can transplant the unit to a different computer with such a slot and have a very fast, small, and light disk. The unit does have TRIM support, though.
  • The backlit keyboard has been omitted. I suspect it will be reintroduced in the next revision, as with the Aluminum MacBook (Late 2008) to the 13" MacBook Pro (Mid 2009).
  • The IR sensor and sleep indicator have been removed. Not sure why the IR sensor is gone, but I have a theory about the sleep indicator. One of the highly touted features of the computer is instant on and its 30-day standby time. From Jason Snell's report, he says that the new Macs go into deep sleep (hibernate) after it has been [normal] sleeping for a while, and when it is woken up from deep sleep, it does not show the gray loading bar like in other Macs. In essence, the computer has shut down, and other Macs do not pulsate the sleep light while they are in the off state. As for Snell's second observation, the MacBook Air omits the loading bar once awoken from deep sleep because it can jump back to the original state much quickly due to the SSD. Therefore, the MacBook Air can do away with both of those items.
  • The 11" MacBook Air has smaller function keys than the other Mac keyboards. The space between the keyboard and the start of the depression (on all sides but the side closest to the trackpad) has been shrunken considerably.
  • The power button has been moved to the location of the eject button, so the button is no longer aluminum.
  • The last row of keys on the 11" MacBook Air are the same height as the alphanumeric keys. This is a small turnoff for me, as I always appreciated the extra height of the space bar and the function, control, option, and command keys. 
  • The 13" model still uses the shrunken package low-voltage Core 2 Duos, but the 11" uses the shrunken ultra-low-voltage Core 2 Duos. This is the reason that 11" units have lower clocks than their larger siblings. 
  • Both units have stereo speakers! They are located underneath the the left and right sides of the keyboard.
  • Operating temperatures have been reported to be lower, and therefore fan speeds are lower. No more hair-drying (or jet engined) MacBook Airs!
I think that's about it; I kept out the bigger features because those are widely documented. Hopefully this report will be useful to potential MacBook Air buyers! I know for sure that I will be getting a decked out 13.3" MacBook Air in the near future to replace my current laptop. (it's a 5-year-old MacBook Pro!)

21 October 2010

A Revelation

I actually met and conversed with one of my 6.172 TAs today at a VMWare tech talk/recruiting seminar. He gave me some insight on his experience with the dynamic memory allocator project.

``When I did that project, I thought I could write the thing by myself two days before it was due. Turns out that didn't go so well.''

Oops.

19 October 2010

Oh Hey Seagate Answered!

Thank you for sending your Seagate E-mail inquiry.

I understand you purchased Seagate internal drive  ST3400832AS, at swap meet when I entered the serial number 4NF068V3 it is 400 gb drive.  I also noticed it is OEM drive we do not support OEM drives.  However  the  drive may be clipped to a lower capacity, so we need to use a tool to set it to the full capacity.

Please download Seatools for DOS from this page:

http://www.seagate.com/www/en-us/support/downloads/seatools/

It will create a bootable diskette or a bootable CD as you choose.

Choose 'C' to Set Capacity.  That should get the drive back to the correct capacity.

If that fails, please then choose 'Z' to zero-fill (quick) the drive and then click Done.

**WARNING** This will erase all data on this drive.
Then go back and try the Set Capacity once more.


Hmm, interesting. So the response indicates that either (a) the swapfest seller ran the drives and disabled 80GB or (b) Seagate ran the drives and disabled 80GB.

18 October 2010

Oh Snap.

My webserver died. (for the $n^{th}$ time.)

Coincidentally, this morning was Swapfest, a flea market for electronics and hardware. Since this is the last swapfest in 2010, I woke up at 0800 to beat the line. I got there at 0830 after making a stop at BofA to withdraw money. When buyers were allowed to enter at 0900, I made a trip around all the stands to sett what people had. There was EVERYTHING: from circular saws to i7s to oscilloscopes. I picked up a 400GB SATA disk for $30. It's not such a great deal (there was a 2TB disk for $120, but I only had $60 and didn't need such a huge disk), but it's on par with what I can get at Newegg. Plus, I could take it home in 15 minutes and use it!

So I take the drive home, plug it into my webserver, and format it. I was pretty spooked the first time when I saw that fdisk listed the drive as a 320GB unit. I looked at the drive again and the label on it was rather intact like the drive label on any (properly-marked) drive. There were no scuffs or hints that the drive had been re-labeled or whatnot. After installing ArchLinux, I plugged my old disk into the computer and went into the BIOS to change boot settings. I was horrified to see that the drive had a different model number (and of course a different capacity) than what was written on the label.

Um, what?!

The next day, I wrote the following message and submitted it to Seagate's support site.

Hello,

The drive that I bought yesterday at the MIT Swapfest was clearly labeled as a ST3400832AS, a 400GB unit. Upon close inspection, the sticker appears to be genuine; there is no evidence of it being placed sloppily. However, when I plugged it into my computer, the BIOS showed it as a ST3320620AS, a 320GB unit. Doing fdisk -l in Linux also says that the drive is a 320GB unit. I have included two images in the attached zip file: one is the original image my my digital camera and the other is an annotated version of the image showing the BIOS readout and disk drive sticker discrepancy. This is purely unacceptable and abysmal quality control on Seagate's part and I kindly ask for the drive to be replaced with the properly-marked (or better) unit. Thank you and have a nice day.


Because Seagate isn't Apple, I don't really expect them to respond with anything I want (never mind a better drive). The most I expect is a curt message along the lines of  ``Life sucks, have a nice day!'' In any case, stay tuned!

16 October 2010

iRepair Adventures, Dell Latitude D600 Part I

During my almost-daily runs to the Dumpster to search for goodies, I found this nice Dell Latitude D600! It was in fair condition: there were some scratches and dings on the top lid, worn out palmrests, and messy sticker removal traces on the bottom housing. Inspecting the externals, the laptop was missing its bottom-mount battery, but came with a bay-mount battery! GRanT, the 4E GRT (graduate residence tutor), graciously lent me his dell adapter (with a frayed charging end =P) so I could test the laptop. When I plugged it in, the charging LED came on. I tried to turn on the unit, but to no avail. Then I took the laptop to my desk and started unscrewing the bottom.

Before removing the bottom plate, I thought to myself, `Wouldn't it be a lot easier to check if it were missing critical components, say RAM, first?' So I unscrewed the RAM lid, and hey, both DIMMs were missing!

Good news: the wireless card is still there! [1]

So I took the computer home, found a 40GB IDE disk and two 512MB SO-DIMMs. One of the memory modules was rated at 266MHz and the other unknown, which might be a problem. I put in the components, plugged in the laptop, and pressed the power button. No cookie. However, the battery charging indicator went from a constant green light to four short blinks of orange and one longer flash of green. I searched online for possible indicators, but no conclusive answer showed up. The Dell service manual was pretty lame as well. Since Grant made no guarantees that the power adapter would work, I found my voltmeter and tested the plug. The reading showed +19.0V, not bad for a +19.5V unit (or at least I hope so).

At this point I don't know what to do; I also have my dad's old 14.1" `gaming laptop' (full with a Pentium 4!), but the CPU cooling fan does not start at bootup. This is a serious problem especially for something powered by a Pentium 4. The Dell is a nice unit too: it has a Pentium M processor, ATi 9000 series graphics card, and weighs approximately 4.5lbs, making the perfect netbook[2]. It is currently laying on the top of the family room couch in a half-disassembled state. Any suggestions?

[1] Sorry Julia, my desk is still a mess =P
[2] My current `netbook' is my 15.4" MacBook Pro 1,1.

10 October 2010

Life at MIT

Preface: Okay, so it's been approximately two months living at MIT, but life is rather hectic. I do realize that the audience of this blog favors the storytelling-type articles over the technological articles, but you now have a dose of both.

Orientation was for the first week or so. I took two Advanced Standing Exams to hopefully pass out of Multivariable Calculus and Physics II: E&M, which I did. Doesn't it feel nice not having to take physics for the rest of your life? :) Another notable event during orientation was the East side vs. West side water wars, in which East side completely obliterated West side. Oh, those preppy sissies.

Towards the end of orientation was freshmen registration day. Having previously looked through all the classes I would have to take for a Course 6-3 (CS) and Course 15 (Management) double major, I had a decently good idea of my schedule.
  • 3.091 Introduction to Solid State Chemistry
  • 7.012 Introductory Biology
  • 14.02 Principles of Macroeconomics
  • 16.A47 The Engineer of 2020 (Freshmen Advising Seminar)
  • 21W.732 Science Writing and New Media

I walked into my advisor's, Dan Hastings (oh yes, the Dean for Undergraduate Education), office and he and my junior advisor (a Computer Science junior from Illinois Math and Science Academy) shot down my schedule as being completely academically unstimulating for someone of my caliber. I talked with them for a while, told them I liked high performance computing, and eventually got thrown into 6.172 Performance Engineering of Software Systems. Both of them were afraid that I would get utterly obliterated (like Hiroshima after the atomic bomb), but they let me take it anyway. That class took the place of Chemistry, which my junior advisor said was pretty easy and not worth using pass no record. So here was my final schedule:
  • 6.172 Performance Engineering of Software Systems
  • 7.012 Introductory Biology
  • 14.02 Principles of Macroeconomics
  • 16.A47 The Engineer of 2020
  • 21W.732 Science Writing and New Media
I then took the form to the Student Services Center to register for classes!

Now that we are five weeks into the semester, here is a quick summary of my classes:
  • 6.172 is EPIC AWESOME. It's a competitively graded lab-based class, not unlike TopCoder. The material is not difficult to grasp, but working with projects with multiple source files (including a Makefile) is certainly different than trying to jam everything into a main function in USACO or one file in my personal projects. Also, learning how to comment code and write comprehensible documentation has been very useful. The one note about this class is that it requires an enormously huge time commitment: you could always be trying out new algorithms, implementations, or bit hacks to increase the efficiency of your code, but either end up making the code slower or introducing new bugs [1]. BUT THE CLASS IS JUST SO FUUUUUNN!
  • 7.012 is boring. Dr. Bajwa has drilled down the content surprisingly well.
  • 14.02 is interesting, but I don't see how one learns from a 50-minute lecture in which the professor teaches a whole chapter. I would rather spend 90 minutes at home to take notes from the book and later reinforcing by reading the lecture notes.
  • 16.A47 is somewhat interesting. A two hour seminar does get rather boring for me, so I'll end up cracking my knuckles or staring at Dr. Hastings' brass clock for the last half hour. I think the other students in the class think I'm an obnoxious computer-obsessed genius because I either know the answer and am not afraid to blurt it out or just give some nonsensical answer. I try to be humorous though :)
  • 21W.732 is pretty sweet. As its name suggests, we use digital media: our past two assignments were to create an audio clip and video clip that captures the essence of something (not necessarily the same). I was plenty happy to exercise my ninja iMovie and GarageBand skills.
The first wave of midterms were the previous week, which is why I did not publish this post earlier. Okay, enough about classes.

Dorm life has been pretty interesting. I live in East Campus, which is infested by [mostly] EECS and some MechE nerds. Most of the floors enjoy building and destroying things. Tetazoo, the floor below mine, is obsessed with fire. I've already found a few places from which to acquire free but workable hardware (mostly computers, for now). My collection of computers (besides my quadbox and MacBook Pro) includes four Dell Optiplex GX270s, a Power Mac G4 Quicksilver, and a Power Mac G4 MDD. (Hmm should I pick up a Power Mac G4 Sawtooth just to complete my collection?) The Dells will be used for an experimental cluster and the two Power Macs (which I carefully gutted) will be used for case mods: one for my webserver, which currently just sits open on a counter, and the quadbox, which resides in a 15-year-old case (complete with its `Intel Inside Pentium II' and `Windows 95 compatible' stickers!). The Quicksilver Power Mac is my nightstand, on which resides a 17" Dell flat panel I obtained. The MDD Power Mac is at home to be case modded, which is currently underway.

Another notable event was CSW, or CSAIL Students Workshop. It was a day filled with computer science and good food at a resort for anyone with a CSAIL account. Who could resist? Everyone was surprised that I was an undergrad freshman (one person asked if I was a first year PhD candidate XD) and was taking 6.172. =D

One more note: There is a surprisingly small number of people who are both hardware maniacs and have an aptitude in computer science/math. Also, I have yet to meet someone as interested in cars as I am. Maybe it's time to go to MITERS and FSAE (Formula SAE)!

Anyway, instead of blabbering, I present some pictures of my room and other activities:

Bananas on a hook!

 Writing Rickroll lyrics on hall whiteboard.

Oh no! MIT Mobile app says I've fallen out of MIT!

 USB pet rock I got from the Google Tech Talk!

The GM Alternative Energy group brought some of their cars outside of the Z Athletic Center for `show and tell.' Guess who got distracted from going to her makeup swim test on time to talk to an engineer for approximately 15 minutes? =D The above picture is a shot of the Chevy Volt interior.

 Chevy Volt steering wheel and instrument panel.

 GM Fuel-Cell Equinox right-side sticker.

 Front of Chevy Volt.

 Trunk of Fuel Cell Equinox. Notice the huge buldge needed to hold the hydrogen tank.

 Professor Steve Johnson (Applied Math) came to 4th East to ride our RC toilet chair!

 Bayley foraging for something good.

 Free, Free, FREE!
Computers, Computers, COMPUTERS!

 YAYYYYYYYYYYYYYYYYYYYY!

 Carting them back to EC!

 Back to our secret hideout to open this massive Sun box. (That's me unscrewing)

 What do we have here? 2x750MHz Sun Sparcs with 8x256MB RAM! Nice find, Bayley.

 Resort in which CSAIL Student Workshop was held.

 Scott Aaronson and his P vs. NP talk. This slide shows his [infamous] quote: ``If Vinay Deolalikar is awarded the $1,000,000 Clay Millennium Prize for his proof of P≠NP, then I, Scott Aaronson, will personally supplement his prize by the amount of $200,000.''

Heading to the resort's beach for lunch! That guy in the pic is a first year PhD candidate in CS. He did his undergrad at Harvard in CS and was Mark Zuckerberg's CS II teaching assistant!

 It's a BEACH!

 ITA's tech talk. Apparently they do some pretty neat stuff (i.e. NP-complete problems).

 Awesome error message in ITA's iPhone app.

 Lobster for dinner!

 Martin Rinard's closing presentation.

 Payoff vs. Intelligence graph, part I.

 Payoff vs. Intelligence graph, part II.

 Error message on Stata flat panel TV. This is the first MIT-owned computer running Windows that I've seen.

 I walked past Sloan as I headed to…

 Microsoft! 1 Memorial Drive, Cambridge, MA 02139.

 Checkers on Microsoft Surface. The touch screen requires a bit of effort to use.

 Cupcakes! Quiznos was catered for dinner.

 Trying out Xbox Kinect (Project Natal). It works really well and is much more intense than Wii games.

 Steve Sinofsky's Tech Talk. I was surprised that he touched on points made in a blog post I read earlier :)

 Here is my desk. Maybe I should clean it up.

 Here is my keyboard. I have two more split keyboards (that I found in the dumpster, of course) sitting in my drawer if anyone wants to use them :)

 Here is my hamper and stuff I got at MIT. I can be lazy and work at my bed now! [2]

 Here is my dresser. It has more electronics than clothes. I discovered that clothes belong on a clothes rack because electronics don't. 

 Here is stuff on top of my dresser. I think I need more real estate.

 Here I am looking at four different source files of evilwm. Vim split is pretty awesome.

 Here is where I sleep. I used to have an ethernet cord running on top of my bed. ULTRA NERDISM

 Here is the Power Mac G4 Quicksilver I hauled home by myself. The trick to carrying it is to *not* hold it by the handles, but to carry it by your side and support it from the bottom.

That's it for now!

[1] The commitment part is irrelevant for me because I'm limited to 54 units of class!
[2] Theoretically, I could use my laptop, but it's not a foot away and is not guaranteed to have power. I'm lazy :)

09 October 2010

To Branch, Or Not To Branch

In the first few 6.172 (Performance Engineering of Software Systems), the professors nailed into our heads the notion that branching was bad because of misprediction, or when the processor mispredicts the result of an if-statement. When it happens, the pipeline has to be emptied, which may be costly depending on the processor architecture (on the CSAIL cloud machines, which are powered by i7s, the processor pipeline is 14 levels deep. A branch misprediction costs approximately 16 cycles. (I'm not sure if branch misprediction cost to pipeline depth is 1:1.)) There are numerous examples to illustrate bad branching, namely quicksort, among other things. In any case, I was looking through evilwm source code at 01:30 this morning and came across the use of abs(). I thought to myself, `Gee, this looks easily exploitable with a bit hack. I wonder if the C math implementation uses branching. Well, there's only one way to find out!'

I wrote a program that would compare four different implementations of the absolute value function:
  1. inlined bithack
  2. inlined branching
  3. <math.h> implementation
  4. macro bithack
(The bithack is to find the absolute value of i is i + (i < 0) * (-2*i). Clever, huh? :)

The program was compiled with the following command:

gcc -o abs fast_abs.c -O0

and run with the following command:

pnqsub time ./abs i

where i was an integer from 0 to 3 indicating which algorithm should be tested.

Runtimes


The testing methodology was not the best; I timed the programs with the UNIX time command instead of using 6.172's ktiming framework (because I couldn't get the darn framework to cooperate with the linker). In any case I present (possibly inaccurate, but interesting) data:

AlgorithmTime (s)
15.20
24.88
32.61
42.62

At first, I was like, woah, how does inlined branching go 5% faster than inlined branching? I should probably delve into the assembly and check it out. The second thing of note is that the abs() in <math.h> does probably the same thing as macro-ed bithack.

Branch Misses


The next set of data I collected was branch miss ratios from perf, a Linux performance counter utility.

The command used to collect perf data was:

pnqsub perf stat -e branches -e branch-misses ./abs i

where i was an integer from 0 to 3 indicating which algorithm should be tested.

AlgorithmBranchesBranch Misses
130009493718268
245008992477919
310005008267316
410005114796681

All four algorithms have very little branch misses! As expected, #2 has more branches than #1, but the branch predictor is too good to incur any branch misses. Darn.

Cache Misses


The last set of data I collected was cache miss ratios (again from perf purely for my amusement.

The command used to collect perf data was:

pnqsub perf stat -e L1-dcache-loads -e L1-dcache-load-misses ./abs i

where i was an integer from 0 to 3 indicating which algorithm should be tested.

AlgorithmLoadsMisses
1800155290439584
2800147747837913
3200083160425153
4200083986024283

All four algorithms have a very low percentage of cache misses! But oh my, #1 and #2 have a massively higher number of cache loads and more misses and #3 and #4 have very similar numbers!

Conclusion


Overall, the [possibly inaccurate] data suggest that the math library's absolute value function is more or less just the bit hack macro. The processor's branch prediction is complex enough to correctly predict the branches in #2, thus having a less of a cost than computing the bithack. The experiment also says loudly and clearly that calling user-defined functions (even when inlined) incurs a substantial overhead; maybe declaring them static would speed up the program. Finally, perhaps writing four different programs, each with its own algorithm, would make a difference.

#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include "ktiming.h"

#define FAST_ABS(i) ((i) + ((i) < 0) * (-2*(i)))
#define MAXN 10000000
#define REP 100

inline int fast_abs(int i)
{
 return i + (i < 0) * (-2*i);
}

inline int slow_abs(int i)
{
 if(i < 0)
 {
  return -i;
 }
 return i;
}

int main(int argc, char **argv)
{
 printf("argc = %d\n", argc);
 if(argc < 1)
 {
  fprintf(stderr, "Usage: ./abs i\n");
  return 1;
 }
 int cmd = atoi(argv[1]);
 int i, rep;
#ifdef KTIMING
 clockmark_t time1, time2;
#endif
 switch(cmd)
 {
  case 0: // fast abs
#ifdef KTIMING
   time1 = ktiming_getmark();
#endif
   for(rep = 0; rep < REP; ++rep)
   {
    for(i = -MAXN/2; i < MAXN/2; ++i)
    {
     fast_abs(i);
    }
   }
#ifdef KTIMING
   time2 = ktiming_getmark();
#endif
   break;
  case 1: // slow abs
#ifdef KTIMING
   time1 = ktiming_getmark();
#endif
   for(rep = 0; rep < REP; ++rep)
   {
    for(i = -MAXN/2; i < MAXN/2; ++i)
    {
     slow_abs(i);
    }
   }
#ifdef KTIMING
   time2 = ktiming_getmark();
#endif
   break;
  case 2: // math.h:abs
#ifdef KTIMING
   time1 = ktiming_getmark();
#endif
   for(rep = 0; rep < REP; ++rep)
   {
    for(i = -MAXN/2; i < MAXN/2; ++i)
    {
     abs(i);
    }
   }
#ifdef KTIMING
   time2 = ktiming_getmark();
#endif
   break;
  case 3: // macro abs
#ifdef KTIMING
   time1 = ktiming_getmark();
#endif
   for(rep = 0; rep < REP; ++rep)
   {
    for(i = -MAXN/2; i < MAXN/2; ++i)
    {
     FAST_ABS(i);
    }
   }
#ifdef KTIMING
   time2 = ktiming_getmark();
#endif
   break;
  default:
   fprintf(stderr, "This isn't supposed to happen.\n");
   break;
 }
#ifdef KTIMING
 float elapsedf = ktiming_diff_sec(&time1, &time2);
 printf("Elapsed execution time: %f sec\n", elapsedf);
#endif
 return 0;
}