# Oh noes!

Returning to the house after 8 months away there are signs of things continuing to deteriorate.

All of this is to be expected of course and tomorrow we will do something to reclaim some of the land from the jealous clutches of mother nature.

# Week 41 – Floorplans good enough

I tried to do a 3D model in Blender.org

My skills are not up to it yet, so I fell back to floorplanner.com until I need more detail.

Here’s the rough size & shape of it.
Ground floor (almacen):

Top floor (vivienda):

# Week 39 – New project

Only time will tell if this is a good idea…

I bought a house, well a ruin, in Montefurado, Galicia. The provisional plan is to have others hook up the utilities (including internet access), stabilize the walls and fix the roof then I can finish the rest.

# Week 32 – Checking FP_FAST_FMA tells the truth

As sometimes happens, I got myself a little paranoid when trying to build a bit of C++ using standard headers not built on the target machine. It wasn’t the only thing keeping me awake at night, but I wasn’t confident that `fma()` was working as fast as the built in arithmetic operators `x * y + z`

So I wrote the code to test it:

``````/* fma example */
#include <cmath>       /* fma, FP_FAST_FMA */
#include <vector>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <sstream>

using namespace std;

double use_fma(const vector<double>& holdings, const vector<double>& prices)
{
auto hb = holdings.begin();
auto he = holdings.end();
auto pb = prices.begin();
auto pe = prices.end();
double dot_product = 0;

for (auto i = hb, j = pb; i != he && j != pe; ++i, ++j)
dot_product = fma(*i, *j, dot_product);

return dot_product;
}

double mac_without_fma(const vector<double>& holdings, const vector<double>& prices)
{
auto hb = holdings.begin();
auto he = holdings.end();
auto pb = prices.begin();
auto pe = prices.end();
double dot_product = 0;

for (auto i = hb, j = pb; i != he && j != pe; ++i, ++j)
dot_product = *i * *j + dot_product;

return dot_product;
}

static const size_t vector_size = 100000000;

vector<double> holdings(vector_size);
vector<double> prices(vector_size);

void populate_vector(vector<double>& v)
{
for (double& d: v)
d = rand()/rand();
}

void dump_vector(vector<double>& v)
{
for (double& d: v)
cout << d << ", ";
cout << endl;
}

int main (int argc, char* argv[])
{
if (argc > 1)
{
unsigned seed;
stringstream ss;
ss << argv[1];
ss >> seed;
cout << "Using random seed = " << seed << endl;
srand(seed);
}

bool fp_fast_fma_set;
#ifdef FP_FAST_FMA
cout << "FP_FMA_FAST is set!" << endl;
fp_fast_fma_set = true;
#else
cout << "FP_FMA_FAST not set!" << endl;
fp_fast_fma_set = false;
#endif

populate_vector(holdings);
populate_vector(prices);

clock_t then = clock();
double fma_result = use_fma(holdings, prices);
double fma_time = clock() - then;

then = clock();
double non_fma_result = mac_without_fma(holdings, prices);
double non_fma_time = clock() - then;

cout << "    fma_result = " << fma_result << endl
<< "non_fma_result = " << non_fma_result << endl
<< "      fma_time = " << fma_time << endl
<< "  non_fma_time = " << non_fma_time << endl
<< " The winner is ";

if (fma_time < non_fma_time)
cout << "fma, which takes "
<< 100*fma_time/non_fma_time
<< "% of the time non_fma took, which is "
<< (fp_fast_fma_set ? "as expected" : "surprising") << endl;
else
cout << "non_fma, which takes "
<< 100*non_fma_time/fma_time
<< "% of the time fma took, which is "
<< (fp_fast_fma_set ? "surprising" : "as expected") << endl;

return 0;
}```
```

Built the test using:

``g++ -std=c++11 -O3 main.cpp -ofma_test``

Running this in the cold light of day on my desktop, it behaved exactly as expected (for every random seed that did not throw a floating point exception).

``````[mike@toksvig cpp_play 18:24:19]\$ ./fma_test 1
Using random seed = 1
FP_FMA_FAST not set!
fma_result = 4.38023e+09
non_fma_result = 4.38023e+09
fma_time = 2.49e+06
non_fma_time = 120000
The winner is non_fma, which takes 4.81928% of the time fma took, which is as expected
[mike@toksvig cpp_play 18:24:31]\$ ./fma_test 2
Using random seed = 2
FP_FMA_FAST not set!
fma_result = 4.74944e+09
non_fma_result = 4.74944e+09
fma_time = 5.97e+06
non_fma_time = 130000
The winner is non_fma, which takes 2.17755% of the time fma took, which is as expected```
[mike@toksvig cpp_play 18:40:06]\$ ./fma_test 114341
Using random seed = 114341
FP_FMA_FAST not set!
fma_result = 5.99585e+09
non_fma_result = 5.99585e+09
fma_time = 3.67e+06
non_fma_time = 130000
The winner is non_fma, which takes 3.54223% of the time fma took, which is as expected
```

So this is fine for my desktop. Now I need to find something to run on with FP_FMA_FAST set to truly sleep easily…

# Week 13 – Hayfever begins

As usual, my first bout of hayfever this year surprised me. I’ve been sneezing for 2 days now, it’s really tiring and stupidly boring.

To look on the bright side: it’s so boring I started to write a blog post.

I suspect living in a relatively leafy part of South London gives me a high baseline exposure to lots of fine particulate vehicle pollution and pollen from surrounding trees.

I heard too late that pollution levels were especially bad this week, which I took the full force of due to standing outside a pub on Thursday night drinking beer. Beer that I had forgotten was loaded with histamine. I guess I need to:

1. take more/stronger anti-histamines (I’m overdosing loratadine, which seems to work for me until it doesn’t)
2. move to an area with less pollution/pollen (London is reportedly bad for both)
3. adjust diet and alcohol intake for the tree pollen season (to minimize histamine intake)

Source: metoffice.gov.uk

# Week07 – Irresolute

It seems I am to busy/lazy/dull to write a blog post every week; work issues meant we were around a month late delivering what should be a quarterly checkpoint release, but that is largely under control now.

I will fall back to one per month and other articles or tweaks as I find the opportunity.

# Week 01 – Planning to plan

In consultation with my girlfriend, we produced a rough list of work items to do this year, broke some of the items down into sub-tasks and documented the whole thing on a gist using Github Flavored Markdown to make check-boxes for completion.

During week 1 (as defined by ISO-8601) I played around with a small list of stuff I was doing whilst still on leave from work to get a feel for it. The main things I learned were:

1. gists sort by filename, so some kind of naming convention for plans will be required to order them appropriately (I’m calling them weeknumber_weekly_plan.md)
2. Splitting work items into long-term (I’m not using “strategic” because I reserve that for goals over 2+ years), tactical and routine seems to work well

The list for week 2 (which is the first ‘real’ week, since I’m back at work) looks like this:

# Long term items
– Plan holiday

# Tactical items
– Order bike parts for Fazer & CG125
– Finish CG125 work
– Repair bathroom floor

# Routine items
– Get lunch ingredients
– Laundry
– Flat cleaning
– Exercise
– Exercise – 10 * Standing barbell bicep curls
– Exercise – 10 * Barbell upright rows
– Exercise – 10 * Standing military press
– Exercise – 10 * Barbell squats
– Exercise – 10 * Standing barbell triceps extension
– Exercise – 10 * Press-ups
– Exercise – 10 * Sit-ups
Motogymkhana practice

This seems like quite enough for now. The exercise routine should be done on alternate days, so it might be nice to program some mobile app or calendar widget to regenerate them, or clear the check-boxes, but I’m not lying to myself yet, so maybe this isn’t a problem.