Part II; Portland seminar

03 June 2014

The plane landed, as there was no more land. There was Frisco, the blue Pacific, the softest breeze, and also the fog beyond the bay, clam chowder, and warmth, a lot of warmth, certainly more warmth than I am used to. The chowder was still warm in my stomach as I stepped to the northbound airplane.

Mike was not a gregarious guy. Neither was he thin, not fat, nor exceptionally tall, nor exceptionally quiet for that matter. He was exceptional for his distinct similarity to a certain captain you see in the Tin-Tin cartoons - having the roughest beard, and an anchor tattoo. Mike - the sailor of the West - and a seat mate of mine for the shortest while.

Then the pines took over, and the low clouds, and the moist air; typical of the American North West - exactly what I imagined it to be. The green carpet floor of the airport made you think that you were walking on newly cut grass. I felt like laying down on this perfectly wonderful carpet; a delightful thing really. I dug it, I dug all of it - people are so franticly enthusiastic about California all the time; I like it also, but I the upper part of the West is pretty decent too, and so fresh.

Alright, tram. Where is the tram? I followed the crowd. Found it. Payed my ticket with a Jackson in the machine; it spat out $17.5: 17 $1 coins and 2 quarter dollars. My pocket grew heavier, and clinked while I walked towards the tram.

The people of Portland started to pour in as we got closer to the city in the light rain, most of them young; effectively lowering the mean age of the people riding the tram from the airport. There was one older guy - a spike in the age population - with a beard, and the toughest hands you've ever seen, they were black, like he had just stepped out of a coal mine. He had a dog, a corgi; wearing a black sweater with a few red stripes. The dog in the sweater lay beneath his tram seat, his head resting on the floor between his owner's legs, perfectly calm; they had known each other a while; they were tried travel buddies. The dog had the hugest regard for everybody, and took a look at all of the people riding the tram with a big smile for all and everything. I did the same, smiling at the dog, the rainclouds, the rain on the windows, and the people riding the tram with me. Some of them gave me the distinct feeling that we were here and now for the same reason as me. I was right.

We got off, close to the hotel; The Nines. I met my roommate for the next days: a Electrical Engineering major from Islamabad; he had arrived a bit earlier, and was battling with a circuit problem in Matlab - (in my experience that is what many EE majors do) in our room when I met him. I tried helping him; little luck. "Don't worry my friend - just go downstairs to the reception and register!".

"Welcome to the Fulbright enrichment seminar. What is your name?", the friendly girl in the reception asked. I answered promptly, anticipating the same face people make when I tell them my name for the first time. And yes, there it was - I would be seeing it a few times during the next couple of days. "Wait, you are the one from Iceland, right? - I saw your name earlier! Let me get you set up right away!" She set me up right away.

I got a schedule of the events, and a list of all of the participants: a mixture of people from 70 countries. I noticed that I recognized some of the names; I had met some of them before. The World was smaller than I thought. The seminar was one of nine enrichment seminars hosted across the US, and this one focused on social entrepreneurship and innovation. The event schedule included interactive panel discussions with leading social entrepreneurs, community service projects, cultural activities, and eating dinner with local families.

First off: cultural exposure, art gallery. Intriguing paintings, murals, and sculptures, but all those dead, inanimate objects felt dwarfed by the persons watching them, because there it all was, a mixture of people from all over the world with different backgrounds, here and now for three days, all able to communicate in at least one common language - and some in many more. What was their adventure? Where are you from? What do you do, or more importantly: what do you hope to get done? I met so many that were so tremendously excited with life and so into what they were doing and going to do: startups, entrepreneurship, new medicine, exploring earthquake engineering, looking for chemical signals in space, composing symphonies, telling stories through photography and films, studying the policies of drug abuse in Asia, photojournalism in the distraught places of the globe. There was the videographer, half Italian, half Argentinian; who said she had difficulties with her two passports sometimes at the airport as they had two different names, who originally thought I was just another Swedish marketing major. Then there were the two Norwegians, both sharply dressed and with carefully trimmed haircuts; who studied at the opposite coasts of the US continent, one of which liked Iceland's hot springs, but didn't care at all for the smell of sulfur in the showers. Then there was the girl from Thailand who "tended to make life a bit harder for people" (lawyer - haha!). Then there was the girl from Pakistan who invited me to her wedding right after saying her name; another friend who had climbed K2 and told me how the stars looked up there, closer to space. Then there was the South-Korean girl that studied linguistics, that told me that when strangers meet they usually ask for each other's age quickly, as the level of formality changes according to your age. There was the Latvian girl who liked to eat smoked pig-ears (no hairs), and the Japanese girl that said sea urchins had the texture of thick yellow toothpaste, and the Peruvians that ate guinea pigs and whose nationality I acquired for a while for knowing already new some of the colloquial slang from that part of the world. And there were so many more. We were all from somewhere else, from some faraway corner, valley, fjord, bay, cliff, plain, hill, yet we all took to each other at the drop of a hat. Networks of the virtual world were formed instantly, second nature: Facebook, gmail, Twitter. We were there to contribute to a more connected world. We did.

We had open panel discussions about diverse entrepreneurial and sustainability topics. There was Amelia, a young woman around my age that spoke with infectious enthusiasm, who founded a company which attacks the Fresh Food Access for All idea in a novel and holistic way, and answered the question: Eating food is a tremendous social act, then why not break bread together; or eat a fresh vegetable or fruit together in the sun? Don't we all belong to the special interest group PWEF: People Who Eat Food? And there was Ed, the director of Central City Concern, which tries to end the homelessness problem in an effective non-profit way (not enough to just provide housing, but also education, and job seeking opportunities; build their self esteem). And there was Deena, the founder of a company that helps marginalized children and children in minority groups to learn in groups with technology and science. They gave us advice:

  • Don't be flexible about your mission, but be flexible about the way you get there.

  • Ask yourself what drives you? And more importantly why? Why? Push, push, - embrace the why!

  • Surround yourself with people that know more than you.

  • Don't intend to ever leave the learning-phase; keep asking questions!

  • Everybody has the potential to make a change, a paradigm shift.

We talked about Oregon, the atmosphere, and the history. It rains; but it is fresh; it has always attracts people - people who like art and beauty and nature and studio apartments, but it also attracts companies and firms. Facebook's and Amazon's (and soon Apple's) main data-centers are there, and in fact a lot of tech companies make outposts in Oregon - hardly nobody makes silicon wafers in Silicon Valley anymore. And with the Dot-com era - when the muscle became less important and the mind grew - a lot of freelance coders and ".. Linus Torvalds came here, all of them, just to focus, and get away from it all."

We talked a lot about telling stories. What does humanity do, but make and tell stories? And how do you tell your story? Blogs, videos, facebook messages, emails, instagrams, tweeting; technology makes it easier than ever to share what you have to say. We went to Mercy Corps - an international development organization - that focuses on market based methods in what they do: giving away things for free can have a lot of negative impacts.

Later, as the sun began to grow red and late, we went and examined the night. There were stores, bars, gay bars, strip clubs, nail saloons, bridges, trams, a river, Montessori schools - the type of school you would send your kid if you call your sons name is Legolas, trees, bikes - and a lot of them, and that inverse auditorium spot, book shops, coffee shops, sandwich shops. Location now: bar, with red, dim lights; Hard rock/punk band; loud. We sat there, drank, spoke about everything, but also listened. The singer, looked like the Nyan-cat; face paint whiskers, and long black gloves, tiptoeing on the stage on high heels. The drummer wearing pink and black, she kept the beat rock steady. They all looked very young; might as well have been a high-school or college band; but they could play, tremendously. The people in the audience were even harder to describe; roughly two groups of hipsters: the international spanning the whole global spectrum, and the local juxtaposition.

Close by was Vodoo Doughnut, a cash only doughnut shop, just behind the bar with the dim red lights, and where it says Keep Portland Weird in plain big yellow letters on a hard brown background. This place is so popular that I never saw less than about 50 people standing in line for their interesting pastry, and you see people walking with pink "Good Things Come in Pink Boxes"-boxes all over downtown. What makes the place interesting is that they are not afraid to experiment, their signature product being a doughnut with strips of bacon and maple glaze. If I were to point at Portland's heart, I would point to this place; the essence of it all; the streams of people with pink boxes originated from there - the only thing you had to do was trace it back to the source. The crew: a chemist from New Zealand, an MBA from Mexico, and music compositor from Turkey, decided to tackle the line in the grey, rainy Portland night; believing that then would be the perfect time for it - the lines couldn't be shorter than then, could they?

We were wrong, the line was long; just as long as anytime. Waiting. It was our turn. No idea what to ask for. We didn't know where this was leading; we didn't care. They told me to ask for a doughnut that represented Iceland - I liked the idea and went ahead. The girl at the cash register was wearing a green robe of the sort that professor McGonnagall might have worn, and glasses, and a big smile. She grinned even more at my question, repeated it and thought for a brief moment. Then a bigger smile broke over here face: she offered me a "Dirty Old Bastard".

I was scheduled in the group to go to help out in The Food Bank. Other places were planned as well: going to the library, and tree planting. I had a split second opportunity to go to the tree planting bus - I seized it, and off we went to the Oregonian outdoors. On the ride back I met a lawyer from Japan - a tomodachi - Japaneese for friend. He had switched to studying the public policies of drug abuse in Japan, as his clients who sometimes were drug addicts, used to defended themselves all the time saying that they had diabetes. He also told me that although very secular in general, the Japanese are sometimes very superstitious: they often don't have fourth floors, as 4 can mean death (ich, ni, san, shi). We conversed on whaling, and the situation of our nations in it: whale watching and whaling seldom goes together - my family is in the business, I told him. "We are emotional people" he told me, who like to keep to our customs; they didn't like being told what to do; nobody does.

"Everybody from anywhere is invited to the party tonight." - it was the last night, the big night, when The Party was on hand, and we were all going. We all resolved to go to the same club, a crew of people from crazier countires roaring to the wild sounds of the electronic music. International hipsters, contemplating not jazz, but the thick and steady beat of new age electronica, dancing, smiling, not having a care in the world, but the biggest regard for everything.

I remember standing in the longest of lines in the Oregonian Spring rain to try to get there. I shared an umbrella with an Argentinian girl, who had the biggest interest in Iceland, and similarly I was interested in her country, and I told her what Borges’ grave looks like. And the German girl was there too - who just plainly refused to pronounce my name, and gave me an easier one instead - and the guy from the Middle East who spoke jazz English while he complained about the cold. It was the right line to be, to talk, to share, to learn; but it was the wrong bar; it was “The Loser Line”.

I remember the the after party in the hotel in the last hours of the day. By that time everybody knew everybody else; we were just old friends spending time together. I remember the wobbly Swiss guy, wearing round glasses and peered out of them with delight; he brought the beer, and accepted donations, and I had the odd sensation that I recognized him from somewhere, not that I had met him before, but from a cartoon that I had seen in the television as a kid. I remember the Mexican that said: "Me encanta estar contigo, y contigo, y contigo, y contigo", that told stories from his backpacking trips. I remember the two entrepreneurs that founded WeTravel (wetravel.to - check it out, its cool - I plan to use it!), while trying to say "Cheers!" in as many languages as possible. And then there was the guy that kept saying: "One more selfie, one more selfie!" at roughly 15 minute intervals, with the biggest smile you have ever seen. Some of us found this curious and kept laughing at all these suggestions and everything else that was happening at the time, but we saw later that this documentation game gave a brilliantly accurate description of who held it out and who had to leave when: the group gradually getting smaller and smaller as people had flights to catch, and perhaps those couple of hours of sleep before it first as well.

It was a sad night; it was also a merry night. It was one of those moments when you find yourself totally and absolutely in sync with life, immersed in the perpetual flow of time, and you feel that you can slow it down, by increasing the frequency of new experiences, and meeting new people, and you dig them as you try to remember them and their faces as best as you can. You didn't want to forget.

So really, if you have the chance, go visit Portland, I resonated with it. You feel like something is going on everywhere, in every corner, in every street. You want to meet and talk to everybody; you have that strange feeling of comradeship, the feeling I only find in a few places outside of Reykjavík, the only city in my country, but I have been looking. Many places in Portland reminded me of parts of Reykjavík - particularly those places back home that are scheduled to be “cleaned up”; cleaned up to make way for more of those generic glass office buildings that we like to lit up like jewels or the big hotels so they can accommodate more visitors and bill them for it, but at the same time take away the character the place once had and there is less to do. It was something about the outdoorsy way of life, the bikes, the many faces on the sidewalks, the moist freshness of the trees, the salty air, the hip espresso houses, the numerous microbreweries, the 'right-ons', the beards, the hats, the girls wearing summer dresses in the rain close to the goat park, and the beatest characters of the US who line the sidewalks - who complain about the weather, but came here because they like beauty and would like to share it; who do not leave until they find that special someone and have kids; and realize that they don’t fit all in that small studio apartment they have and find the need to relocate. And the cycle repeats.


Part I; The ride East to go West

27 May 2014

It was a bright day. I noticed how unusually clear the sky was - a nice change from the winter clouds that bring all the snow. I saw the bus with the "travel your world with us" logo, and was greeted by the bus driver. I was the first one to arrive.

"How are you doing? Going to Baltimore through Harrisburg, are ya? Step right on in!"

He spoke with a surprisingly squeaky voice for his size, but spoke in a very slow and direct manner - you immediately got the impression that he had been in the public transport system for a long time; that he knew the ins and outs of the system; that he knew what he was talking about. He wore spectacles, those round John-Lennon types. If I had met him in another setting my first guess would have been that he worked in a hot air balloon exploring uncharted territories in the South-hemisphere; or a doctor in some of the Western movies, healing a wounded hero.

"We still got 10 minutes?" asked a guy with a rough tangled hair and beard, wearing a baja-hoodie over a green State Patty's day T-shirt; the quintessential college kid. "Yes", the driver answered. He quickly realized the kids intent and remarked, "You can go ahead and smoke your cigarette - and in fact, I'll join you!"

There they stood close to the bus, putting up their sunglasses first; and then smoking; the young and the old, in the cold. Then off we went, with powerful flares of the horns of this mighty bus, and like that, we left the snowy streets of State College, for something entirely different.

The driver kept yawning on the way, I won't say as frequently as a gold fish opens its mouth, but the yawning had a steady periodicity to it. A can of diet Mountain Dew quickly beat the frequency down. He immediately seemed more intent on driving.

We drove past the Susquehanna river. I remembered Kerouac describing it as one of the mournful rivers of the East Coast. To me it felt cold and fierce, almost terrifying: frozen, not solid, but filled with cracked icebergs that stick out of it; thorns that carve out wider banks and steeper cliffs, and somewhere in the middle of all this stands a miniature Statue of Freedom, unshaken by the shards. Freedom persisted.

It is interesting to get to see and experience America through my own eyes, a country which has shaped Western culture in so many areas and aspects. The proportions and scales of everything are so different from what I am used to. The cars, the trucks, the pickups, the red plastic cups, the roads, the magnificently great houses, distances that can only be crossed by car, 'bridge-may-be-icy-signs', stores that have inventories of forklifts and golf-cars fit for a small nation, and so on and so forth.

In all, it was quite an ordinary bus trip, with people with their noses and pupils fixed on the transistors in their hand, some had headphones, and some which sang to themselves that new song by Pharrell which is going like mad over all America and further (probably higher than they thought they were singing), and the young mother with the crying baby in the back, and the interested middle-aged woman with the tattoos who was happy to help her out with the baby. In any case, it gave me some time to think, read the Pennsylvanian landscape (trees, trees), and put some ideas down on paper.

Suddenly I was at a student bar in Baltimore - not far from the Paper Moon; a hip place if you deem it from their zealous and colorfully decorated mannequins in their yard. The place was packed for a Wednesday night; people living in the here and now. A lot of pictures were on the walls, sport pictures, baseball, football. "I like Baltimore - its like living in an action movie; you can see police chases out your front window", said my friend over our big meal. "... and I'm pretty sure this 24/7 Pizza place has bulletproof glass in the counter. Some neighbourhoods are good though - the trick is to know were they are, and not wander too far off!". The meal kept me full for the entire night and the whole next morning, as I left this Capital of Crime for the West.

I knew it was an old airplane. I felt like I was in a kaleidoscope - the one you used to play around with as a kid: the color palette of row of old 90's CRT TV sets were off, each in a different way; blue, green, yellow, purple, all with this crazy, acidic, fluorescent hue. I was riding to the West in a flying kaledoscope; the psychedelic plane; Jefferson Airplane. A particular song started to play in my head, and I wondered if I was stuck in a Big Lebowski scene, or maybe if you are in one of those funny bathrooms when you have two opposite mirrors facing each other, and you have billions, and billions of copies of yourself smiling at you; wishing only that you could see through the back of your head. I dozed off, as we flew across the bulk of the American continent, heading to what really is her most exciting city.

And this was really the way that my whole spring break experience began, and the things that were to come are too fantastic not to tell.


The Parking Lot

27 April 2014

The Parking Lot

- As in people who park, and the people who somehow supervise parking

The 10 cents clinked as they ran through the thin black slit. One foot on the white parking stripe.

The meter blinked.

It read: 3 minutes.

"Hey you! Yes, you! Come over here! I see what you are trying to do, you are trying to cheat the system: you staying in the car, looking around, while your girlfriend over there goes out on her business, just to put coins in the meter when you see the parking officer coming - You know that parking here is expensive? Where are you from in Oregon?", said the man in the big Ford, in a strong, commanding voice. "We are not from Oregon, we just rented the car there - the thing is ..", answered the young man in an uncertain voice, as he walked up to the shaded windows of the oversized Ford. The engine was on. "Not from Oregon? I reckoned so from your licence plate. Wherefrom are you then?", the man in the car quickly intervened, cutting the former off mid sentence. "Wherefrom? I'm from Iceland, and we're visiting Vancouver briefly; we drove from Oregon. We actually study in Pennsylvania in the States - I study astrophysics." "Iceland! My god man, I've never met anybody from Iceland. Tell me, are there black people there, do you reckon' that I'd fit in?"

For a split second, the young man seemed quite taken aback, utterly perplexed; under no circumstances had these two met before.

The young man, choosing his word carefully started:

"Aaaam, I'm sure you would, of course man, yes! Why not? But the thing about the car is, we just came to Canada, and we haven't got any Canadian coins, just this one that, .." "Do you see that person over there? - That my friend, is a parking meter officer!", noted the man, a smile breaking over his face as he pointed at a man wearing a bright yellow vest over a distinctive uniform.

The young man's expression changed. Some part of him wanted to run off; still he was bolted to the same spot. Were the three minutes up? Who was this guy?

"So astrophysics? Have you heard what Hawking has been doing lately, with his symmetry theories?", the man in the car began, seemingly wanting to delve into a lengthy discussion about the topic. The young man answered vaguely, and kept nodding abstractly: all his presence was focused on the man in the bright yellow vest who was going through his checking routine; his routine no doubt included his car; he drew closer. The young man made a stern comment; his face grave - what was going on? "You are cheating the system. You see, I am in the Canadian Secret Service; I guard the Prime Minister from time to time - twice now actually. I'm on leave now, but I couldn't help but notice what you were doing. I sometimes help out the local enforcement in this way", the man in the car answered enthusiastically.

His car was bigger than average; the type you really wouldn't want to drive downtown in big city; a big car for only one man. Unergonomic. He had a couple of coffee cups, one empty sitting in the cup holder, the other in his hand, half full. You could tell it was getting cold. Several notebooks and loose, scrawled papers were scattered over the front and back seats.

"Tell you what, here are 2 Canadian dollars - we don't want to get you busted, do we?" said the man in the car, another wide smile breaking over his face. He produced a shiny coin. Without hesitation the young man accepted the shiny coin and hurried to the meter. The parking officer drew closer.

-The coin slit through: a heavier cling than before, both feet on the parking stripe-

-The meter blinked-

-A sigh of relief-

The engine roared. The young man walked slowly back to the big Ford, dragging his feet.

"Hey, have you ever met anybody from Iceland?", the man in the car yelled at the man in the yellow vest. The parking officer said no; he was Croatian. "I've been to Croatia man!", started the young man: "I was there a few years ago; had a swell time in Zagreb and the surrounding area. The Plitvice lakes - that azure blue all over the place - I dug them man!" They exchanged names, and shook hands. Undoubtedly, they both forgot them right away. Awkward silence.

Making conversation, the parking officer started:

"How did you guys feel about the tryouts for the World Cup? You had a pretty good team, but what is his name - Gudjohnsen? He's retiring right?"

"Yep, it was tragic - we could have been the smallest nation ever to participate. Regretfully it didn't work out."

"A real shame that was, I was rooting for you guys", the man in the car started, in that same loud commanding voice.

Then the girl came; a big questionmark all over her face.

"Your boyfriend here, has made a major error. He is going to jail," the man in the car started in that same ruthless voice. For a second he almost burst out laughing, but managed to keep a straight face, promptly launching into his spiel about the secret service. Even more perplexity: the girl and the officer both wondered why a secret service agent would even start to reveal his identity. The young man, however, for the first time started to smile: the parking officer made an excuse to leave, he had other meters to check, a routine to adhere to. He bid farewell.

The conversation with the man in the continued; like nothing had happened.

"How good is your memory? Who, can you tell me, was the ferryman that carries the souls of the deceased across Styx in Greek mythology?"

Eyebrows up; strange looks.

"In fact, I believe one of the furthest objects in our solar system bear this name as well"

"Charon?", the young man answered.

"Indeed", the man in the car answered.

He started to back up.

"Be sure to bring coins with you next time."

As he backed the car up along the white parking stripes, both eyes fixed at them - much like a spider retreating to the centerpoint of its web where it best feels the vibrations of its domain - he called through the car window: "Who knows, we might see each other again."

The young couple exchanged looks. They had no intention of staying there any longer. They walked back to the car, staying clear of the white parking stripes, and drove off into the day.


Astro585 discussion

16 April 2014

Goals to try to achieve

  • Zen with Git

The "I'm embarrassed about my code mentality"

"My code isn't perfect, I'll be embarrassed if I put it out there for everybody to see. What if there are bugs in it?" - Making code public accelerates the finding of bugs. Its better to find them, rather than letting them fest.

Philosophical debate

Science should be reproducible: do we have an ethical responsibility to share our code?

Throwing out stuff out there with little documentation might end up giving you headaches later in life; you might end up getting a lot of emails from users that want to use the code, but they didn't understand it properly. Solution: documentation, examples, short tutorials - people will appreciate it!

Code sharing in grant proposals

Reviewers rarely comment on: "Oh, this person is going to make their code public", with a bad connotations. Sharing code is actually getting much more hip these days - which is a good thing!

If your goal is to be useful

Make tutorial style examples. People are more likely to use the code if those are provided.

Should we publish our source code with the paper?

That would be lovely actually. There are already some journals out there that make you submit source code with your paper. It might make more sense to have a source code repository though (for example on Github or Bitbucket), and just link to it. That way you can also make smaller updates without have to resubmit your whole code when you fix that one tiny bug; less headache for the world.

Finding bugs when code reviewing

If you make it your purpose it life to find bugs, you will find them. But they might be stupid bugs; like "this was actually a tab, not 4 spaces". Common, friend, at the end of the day, this is supposed to be useful!

Questions to think about for writeup

  • What did you get out of the project?

  • What did you do?

  • What were your parallelization strategies?

  • How did things scale when you parallelized them?

  • Did you use a profiler?

  • How did the tests go? What did you test? Did they pass?


Portland

15 April 2014

Ef þið fílið On the Road, kíkið til Portland, farið þangað einhvurtíma; og takið kærustuna eða kærastann með - eða í hópi vina, eða hitchhikið, eða farið sjálf á eigin spýtur - its the place where young people go to retire; allir hjóla, stelpurnar eru í sumarkjólum í rigningunni hjá geitagarðinum nálægt staðnum þar sem þið sofið aðeins of lítið eftir vonda vínflösku sem hefur ferðast með ykkur til Canada og aftur til baka - sum vín ferðast ekki vel; eignist vini frá Pakistan, eina stelpu sem býður ykkur í giftingu hennar rétt eftir að þið segið nafnið ykkar, og annan sem leyndist til að fara á topp K2 og lifði það af, án þess að láta fjölskylduna sína vita sem hefði án efa aldrei leyft honum að fara þangað til að byrja sem býðst síðan til að sýna ykkur stökkpall jarðar til himins; hittið óðverjann með spænska nafnið sem klæðist tættu strigaskónum og jakkanum með olnbogabætunum sem spyr þig hvort þú sért með ID, og gætið hjálpað honum aðeins, bara pínu, svo hann geti dansað og dansað og drukkið eitrað vín en þú þú lýgur og segist yngri en 21árs; sjáið parið sem spilar á þriggja strengja banjó á miðri götunni þar sem Hagrid þessa heims dansar við taktinn, þennan eilífa takt, í núinu, núna; bíðið á viðar-rútustoppustöð sem er sívalíngslaga og lítur út eins og sveppur þar sem þið kynnist fólkinu sem eru svartklædd en eru hinir innilegustu hippar inn við beinið, eftir að einn af öllum svartklæddu ókunnugu förunautunum sem lítur út eins og Kolbeinn Kafteinn hefur kveikt í og það byrjar að lykta eins og á götum Montreal, og þið deilið hópfaðmlagi; og farið á hipsterasta kleinuhringjastað á meginlandi beggja Ameríka og biðjið um kleinuhring sem representar Ísland, og þegar þið bíðið eftir að stelpan í skykkjunni sem afgreiðir ykkur aðúðlega, byrjar að brosa og afhendir ykkur kleinuhringinn "Dirty Old Bastard".

Farið til Portland, og haldið henni skrítni.


Astro 585 discussion 8

24 February 2014

Bottom lines

  • Write your parallel code as if the machine doesn't have a shared memory system (more distributed), and then if it has, spend time to optimize it for shared memory.

  • If there is a doubt in your mind that you need a sync statement - use it!. Also, help yourself (and potentially others) out by commenting on how confident you are on this sync statement.

  • Optimize later is a good motto to keep in mind when parallelizing code.

Interactive vs batch machines

Interactive

They usually have very short walltimes (maybe something like 5 minutes or so) Good for rapidly debugging your code, but they might have very short walltimes - (like 5 minutes!).

Examples of such clusters here at Penn State: Tesla (has GPUs), and Hammer

Batch

More queue oriented. Has a scheduler, and a load-balancer

Infiniband vs Gigabit

Gigabit has very low latency vs Infiniband. Moreover, Infiniband has more bandwidth.

Scheduling jobs on a cluster

When you are starting out it might get good get the cluster to send you an email when your program starts, ends, and/or aborts. It can be done per-core or per-node.

False sharing

Too frequent updates on caches between different processors. This can severly hurt application performance.

Common strategies to reduce this traffic

You can intentionally group all your writes into a single job.

Julia's three datastructures that are good for parallel

1. Normal arrays

Good!

2. Distributed arrays

Can be spread across many processors. Each processor owns a chunk of the array. Other processors can ask for other chunks of it - costs communication time though. As slow as the network is, it is still faster than a hard-disk, if you really need a lot of memory using distributed arrays might be a good choice.

3. Shared arrays - Warning this is labeled as experimental

This type of array is shared between multiple cores at a workstation. So with a shared array, there is one copy of the array in the shared memory, and the multiple cores each have a part of it, but all of them can access the other parts that are on the other cores (this access is slower than just accessing the local part of the array).

Downside: You have to be careful if you have multiple processes that are reading and writing simultaneously to the shared array. You can use sync or other types of barriers to prevent running into unvanted troubles, but if you have a lot of synchronization statements then the parallization might not work to well for you.

Advice: If there is a doubt in your mind that you need a sync statement - use it!. Also, help yourself (and others) out by commenting on how confident you are on this sync statement.

Virtualizing

Very good for debugging parallel code, and stress test it. People who work in cloud computing really love this.


Astro 585 discussion 7

19 February 2014

Q: What is TLB?

The translation-look-aside-buffer (TLB) is a cache that memory management hardware uses to improve virtual address translation speed. Issues:

  • But then what happens if this buffer isn't big enough?

  • The way the TLB works is likely different between different processors.

Virtual Memory Space/Virtual Address Space

In the old days when you had only say 2MB of RAM, then you could use a feature called 'Virtual memory space' to simulate that you might actually have 4MB of data. This was came in handy when you were running Windows, and running both Word, and Excel at the same time, and both were hogging your memory. So when you alt-tabbed you could actually save the memory on the window that was not being used to disk.

Using higher level interfaces vs knowing the minute details

Higher level interfaces: You don't really know what you are doing, but the good thing is, you are much quicker at it!

Q: Why are micro commands reordered by the compiler/assembler?

Lets say we are doing the computation: A*B + C. Once you have translated the high-level language to micro-commands like move this byte over here, and that one over there, - you can figure out which ones depend on one another. And once you have done then the idea is to try to make the hardware try to perform as many operations that it can concurrently, while not breaking any of the dependencies. Use the hardware better = performance gains.

Memory and garbage collection

If you say: Get me this memory and your computer gives it to you, you also have the responsibility to de-allocate it.

Remember:

With great memory allocation comes great memory de-allocation. Surprisingly, a lot of people forget to do the second part; those people fall in the group of B-programmers or Bad-programmers - a curious lot. Its probably fine to be sloppy about memory issues if your program only runs for a fifth of a second. But what if you are running a web-server that you want to run for months without crashing - then memory leaks really are a bad thing. At some point, someone got the idea to take this responsibility away from bad-programmers; this was the dawn of garbage collection - then the computer is responsible for de-allocating dynamically allocated memory.

Garbage collectors

They do make life easier, but you pay the price of slowing things down. So: you can be sloppy, and not worry about it. Don't be sloppy though - then you will need to collect less of it!

The bottom line here is:

There is no perfect garbage collector, but some are more equal than others.

In Julia you can disable the garbage collector when you want. To turn it on: gc()

You can even specify your own memory manager.

Electric fence

Checkout using efence within gcc to check for memory leaks. Static variables exist once it is allocated until the program ends.

Smart pointers

Pointers that contain information of how many other pointers are currently pointing to that place in memory.

Bad side:

  • Overhead of changing the increment/decrement information

  • Can be hard to deal with those if you have a circular linked list. Solution: even smarter pointers?? --> more overhead.

Constant pointers

In C, C++, Fortran you can define constant pointers. Its a way to tell the compiler that this specific variable will not change over the course of the program. The reason Fortran used to be much faster than C was due to aliasing.

Static vs Dynamic memory allocation

Static
  • Then you know up front the size of the memory you want to allocate.

  • If you only use this, you are probably very unlikely to run into memory leaks.

  • The memory can be allocated to the stack if it is small enough, but a reasonable compiler would allocate it on the heap if it is relatively big. Only small enough statically allocated variables are allocated on the stack, but can the stack dynamically grow?

  • Garbage collectors do not work on the stack.

Dynamic

Then you don't know up front the size of the memory you want to allocate.


Astro 585 discussion 6

17 February 2014

Now we are getting to the most interesting part of the curse.

Q: How are matrices stored in memory?

It really helps knowing to know how matrices are stored in memory. Are they colum-major, or row-major? Julia is like Fortran, storing matrices as column-major data structures; while C uses row-major data structures.

So then in your implementation of the simulation of Life, the Universe, and Everything, then might need to have big matrices; and you might save a lot of Big-Thought's computing time by knowing if it is faster to traverse your Big-Matrix by the columns-first, or by rows-first.

Q: What about sparse matrices?

If you have a lot of 0 entries in your matrix, then instead of allocating a big rectangular block of memory for it, then rather store it as a list of non-zero entries instead. For example, if you had a diagonal-matrix you really would only need one vector to store the data, right? And similarily, a tri-diagonal one would need 3.

The power of views

A powerful example: What's a clever algorithm to transpose a matrix? Just flip the indices!

Cache associativity

When you have data in the big memory and you want it in the cache - what do you do? Where can it be? The main philosophy here is: How do we reuse data that is already in the cache?

Non-associative cache?

It might go something like this:

  • Byte-1 of main memory can only go to Byte-1 in the cache

  • Byte-2 of main memory can only go to Byte-2 in the cache

...

  • Byte-1024 of main memory can only go to Byte-1024 in the cache

  • Byte-1025 of main memory can only go to Byte-1 in the cache

Reading a cache like this is very fast, as you don't have to search for the data too long - every byte has a fixed and known location. But the main downside is: you rarely use the whole cache!

Solution to this is called padding.

Latency-Bandwidth diagram


Astro 585 discussion 5

12 February 2014

Bottom lines:

  • Try to find the thing that takes the longest - and do something about it!

  • Every bit of code that you write, write it as you were trying to convince somebody else to use it. Make it public (push on Github), and sure enough the person that is going to be reusing your code is, well, most likely yourself! Your group is also likely to benefit; and maybe somebody else in the world - and there is that off chance that he/she might benefit you someday!

Profiling

A profiler is a program to see where a program is spending most of its time (examples: prof, and gprof). Early profiling tools were mostly based on counting; monitoring how often, and how long calling a function takes.

Downsides

You are adding more instructions to your program! In a way you are interrupting the whole enterprise every time you call a function. If you are limited by caches, and writing in registers running a profiler on it makes the program run slower - so in fact you are timing a slower version of your program with the additional overhead the profiler inserts.

Perks

You get information about where the program is spending most of its time - then you can see what places you might want to speed up! Some hardware actually offer hardware profiling where the hardware has special registers only used for profiling - not interfering with the main program too much (however, you are still disrupting things - you need to unwind the pipeline, creating additional overhead, etc.)

Timed profiler

You can interfere less: instead of checking every line with a statistical profiler - you can check the program at a fixed interval, asking the program: "Where are you now?" in a fixed time interval. Note: you can have resonance in for-loops - which gives a bad representation of how the program is actually running.

This is how the Julia profiler works.

If you are trying to figure out something about branching, then statistical profiling is better.

Overloaded functions, profiling and name mangling

C++ supports overloaded functions i.e. functions that have the same names. Then if you are profiling C++ code the profiler puts extra identifiers to distinguish the different versions of the overloaded functions. The identifiers have sometimes something to do with the variables that the functions use, or sometimes just complete random gibberish - this is called: name mangling.

Astronomers and code writing

Most of what astronomers do isn't so complicated that we really need to talk to a computer scientist about our code.

However, if you are gonna ask NSF about of a lot of computer resources - then it really helps to have collaborated a bit with a computer scientist, or at least had conversations over lunch with a computer scientist. And if you really, really care then you would write the proposal with one.

Still, computer scientists are expensive (compare 1 month of a computer scientist's time vs funding 2 grad students for a semester). And yet, sometimes you are required to write the proposal with one.

In an ideal world these things would be well matched; but sometimes a bit of bending is needed.

The world of writing code between CS students, and astronomy students are different. In astronomy we don't really care if you solve a problem cleverly, just that you solve it. The typical scenario is that an astronomy graduate student is thrown into a pond to solve a problem, hopefully to reach shore with the solution in hand.

Taking people into lunch (for example a computer scientist - or maybe that particular girl you like) can be very productive. If you converse with the former then you can potentially get hints on how to solve a particular problem efficiently, and you can expand upon it by googling about it; a very high-yielding collaboration per unit time, per unit dollar.

For the latter party you might ask: "Are there proposals that we want to work together on?"

In any case, don't spend too much of your time to reinvent the wheel, when somebody else has already done it for you.

Some things that we should do more of

Code reviews

Make somebody else review your code. It doesn't need to be too formal - the bottom line is: getting feedback can be beneficial!

It can be good for spotting coding standards, and other small bugs - but doesn't necessarily catch the Big-Picture things.

Q: How do you organize your code into files and folders?

Not a single magic answer.

Using a bottom-up approach

What usually works: Do a bottom up approach (i.e. the start-without-a-plan plan), starting with 1 file, and then expand it to a few files, grouping similar ones together, and then from there branching into dividing the code into subdirectories, again grouping similar-purpose code together.

There are tools that can be used to automate complex work flow issues - like make-files. This can lead to a multi-step process: even before you type make - then you might need to configure the code, and then you have to make it, and then to make install it etc.

Using Cmake

If you have a complex thing that is not related to operating system issues, then cmake might be useful. It makes a lot easier to have logic in your build system - you can have if and loops, and variables - to do logic!.

Q: How should we use Git tags?

If you cloned an ever changing code to use for a project, and then when you update it something doesn't work as it did, then in principle you can revert to an earlier point in time. However, it might not be obvious to what point in time to revert to! Then, tags can come in handy: you can tag your version that you used, making it much easier to find that specific version later.

Tag-example: Final-version-that-was-used-for-my-paper

Q: What is the difference between libraries and packages?

In the old days people compiled code into libraries and then linked other code to those libraries. Programming languages like Python now offer you to manage your code in packages - which is much more convenient (you don't have to spend time with linking issues - usually you are just an addPackage() away from using somebody else's packaged code!) This has saved many a person a lot of time.


Astro 585 discussion 4

10 February 2014

Basic optimization techniques for serial code

Ideas for simple optimizations
  • Don't call your functions too often

  • Pass pointers rather than by reference

  • Know what your computer is doing - what is going on under the hood?

  • Providing types at compile-time

  • If using an interpreted language: Vectorize!

  • Reduce branching

Loops

Compilers can be smart, and can speed up one-dimensional loops. They have a harder time to figure out of how to make nested loops faster.

Difference between unit tests and regression tests

Unit tests

A test that makes sure that one function in your code (or one small, and very well defined part of your code) works properly.

Regression tests

Bigger scale tests, that usually combine many functions, and to check if they are working correctly together. For example: Calculating the Planck spectrum and then write the results to an external ASCII file.

Using _Try-Catch

Its a way to see if the program says: "Hey! There is a problem here!" - then if you don't have a Try-Catch clause your program will crash. An IF statement can also work if you know how it can fail. However, the advantage of Try-Catch is that you can catch some errors that are buried deep down maybe. Still, its a much more expensive way to deal with a problem, rather than using an IF statement. Its for things that don't have a clear order. It doesn't really happen too often in scientific programming. Good places to use would be in I/O, and networks.

Q. Should we optimize serial code first, before we parallelize it?

It kind of depends on your problem. They key is to think about: "How are you gonna parallelize it?" It can be embarrassingly parallel , and you can then basically distribute the serial code to a lot of workers and gain speedups that way. If not, then you can also go into the idea of parallelizing at multiple levels.



Ergonomically handwritten code, with a little help from my friends; vim, jekyll and twitter bootstrap