Tuesday, December 31, 2019

Happy New Year!

2020, the year of the Rat

Have a good new Year everyone!

Janne and Ritsuko

Monday, December 23, 2019

Denver and SC19

I spent a week in Denver recently, attending the Supercomputing 2019 conference. This is something we do every year; it is part vendor meetings, part job training.

Naha airport has square windows toward the runway that make for a neat natural frame if you manage to catch a moment without people sitting or standing in front of them. This is Ritsukos idea by the way; I just copied her.

The conference itself has both academic research and practical workshops, but also a very large exhibition area and hundreds of companies large and small descending on the conference to meet customers and each other. I'm not too interested in the academic part, though it can be fun to follow. The tutorials and workshops are aimed at HPC professionals. They cover cluster management, teaching parallel programming and HPC, networking, user group meetings for popular tools and so on. Very useful and very interesting.

The conference is held at the Colorado Convention Center. It's right in the middle of the city, a couple of blocks from the main walking street.

The exhibition is like a car show for HPC computing. An enormous space filled with giant booths from Intel, DDN, IBM, AMD and so on down to small desk-size spots in the back with startups and highly specialised businesses - a Japanese company that only does pipe connectors for rack water-cooling systems, for instance. Many corporate visitors attend the conference only for the exhibition.

Immersion water cooling displays are always fun. You can see the liquid boiling away from the CPU in this image. It's clear that water cooling in some form is going to be mandatory for most high-performance clusters in the near future; Racks are getting denser and CPUs and GPUs more power hungry. Air is just not enough any longer.

Yes, AMD had juggling presenters in their booth this year. AMD is one of the big winners in HPC nowadays; they certainly deserve a bit of silliness.

Surrounding this conference is a cluster of vendor events. All the major companies organise their own meeting facilities, parties and even mini-conferences in hotels and other venues around the main event. If you are a customer this is the place to meet with your suppliers. You can get one-on-one meetings, get future trends and product roadmaps and generally figure out which direction you will want to go in the future.

Denver in the morning.


As many of these companies are very large, and as this event is quite important, they all tend to throw parties, serve lunch and organise other events to get people through their doors. Intel, for instance, runs an entire two-day developer conference every year right at the start of SC. The yearly DDN party is popular with younger visitors (leans towards loud music and dancing), while Mellanox has a "talk-show" and a live entertainer at their party.

Dell rented the Denver Hard Rock Cafe for their event. Like most events you can get a ticket by just asking for one at the booth. We picked the Dell and HP events over the others this year simply because the weather was cold (it started snowing this night) and these events were close by.

The final night there's always a big conference-wide party. It's usually held in a cool or special venue of some kind. This year it was in a military aircraft museum, right in the exhibition hangar. It was exciting — airplanes are cool technology! — but with a bit of a bad aftertaste; all this effort and all this ingenuity spent to kill other people.

Lots of cool-looking airplanes here.

The conference has a total of 15000 attendees; even though far from everyone attends the party you still need a large venue to hold so many people. Such as a large aircraft hangar for instance.

I wrote a whole section on trends and things; I doubt anybody reading this blog really cares, so I will summarize (just look at the pictures if it doesn't interest you):

The last days it started snowing. I haven't experienced winter weather for years so I really enjoyed it. 

AMD is beating Intel big time right now. They were everywhere on the trade floor, and a lot of new clusters are using their Rome CPU.  It has better price/performance, better power/performance and just plain better performance in absolute numbers than anything Intel has

ARM is starting to show up for real, with the absolutely insane Fujitsu A64FX cpu that's going to power Fugaku, Japans next supercomputer. 48 cores, 512 bit wide vector extensions and 32GB high bandwidth memory right on the package with a 1Tbit/s throughput.

This leaves Intel in a tough spot. AMD is leading them on CPUs and ARM is skulking in the wings. Once Moore's law is well and truly dead they'll likely end on roughly equal footing and Intels former dominance on CPUs may be permanently gone.

I went running, of course. It's a great antidote for jetlag, and a quick way for some sightseeing. Here an amusement park closed for the season.

Speaking of ARM, NVIDIA bought Mellanox (the maker of Infiniband tech) early this year, and are now partnering with ARM to build complete HPC server nodes with their own GPUs, CPUs and networking. They clearly no longer want to just act as a part supplier to system builders. But with NVIDIAs dominance in GPU computing this makes everyone else very nervous.

AMD has a GPU line already, and they are moving to counter NVIDIA with a GPU computing systems of their own. Intel does not, and they really, desperately need it especially as their CPU dominance is eroding. They announced a new GPU for computing with a lot of fanfare, but the word is the performance will be quite disappointing for this first generation.

Snowed-in scooters. The winter weather really got going the day we left. And we were lucky — just a couple days later Denver got completely snowed in with all flights cancelled. Two days earlier and 15000 attendees would have been unable to leave.

Interesting times. And a fun conference.

Friday, November 15, 2019


I'm late, I know. I've got years worth of posts I've drafted but never finished. But I've decided to no longer fear the delay or feel ashamed for my lateness. Accept your tardiness! Embrace procrastination! Tomorrow! Or some other day!

Anyway, on to the subject at hand.

It's a short flight, and along the way you get a good view of the Kerama islands.

We usually do something for our birthdays. This year I turned 50, so we flew to Kumejima island at the end of June. It's a smaller Okinawan island only 30 minutes by propeller plane from Naha airport. If you like you can take a 3-hour ferry from Naha, and bring a car or a bicycle.

Small island. Small airplane. I will say this though: These Bombardiers are really comfortable. Quiet, smooth and with plenty of legroom. Nothing like turboprops of old.

Kumejima is a small island. The taxi driver showed us the islands only traffic light (he ran a red light), and one of the two convenience stores. We stayed at a hostel in Shimajiri on the eastern end of the island; the entire trip from the airport on the western edge takes less than 25 minutes.

The "tatami rock" is one of the few real tourist spots. It's vertical columns of volcanic rock that solidified in a hexagonal pattern. It's pretty, and during low tide there's plenty of small animals in the rock pools that form.

Sugar cane fields. Very Okinawa.

People mostly come here to dive or snorkel, though I did see some surfers as well. The island itself is fairly undeveloped, and I understand this is by choice. People have seen the effects of rapid development on Miyakojima island, so the land-owners here have seemed to agree not to sell to big hotel developments. And a good thing too; the peace and quiet is a major asset, and something I hope won't change soon.

The village is very quiet at night. Peaceful or unsettling depends on your mood, I guess.
There are a dozen restaurants, mostly izakayas, in the local area. During the day the village seems almost deserted and you wonder how these places can stay in business. The looks are deceiving, though, as almost all tourists leave early in the morning for diving or snorkel charters. Once they return they fill the places — you need to book a table in the morning if you want to have dinner around 7-8 and not have to wait.

There are only a few places to eat lunch. One of them does have pretty good shaved ice for dessert. Ice cream and brown sugar topping.

I went running, of course, and the best place to run, by far, was south along the east coast to Shimajiri village, then follow the road south around the cape, then across and back again. It's about 10km, and the road around the cape crosses a large ridge with some very steep sections. But the scenery feels almost primordial; it's a real jungle dotted with a few farms. It is wild enough that you're advised to run along the center of the road to avoid startling snakes resting near the edge.

The south-eastern end of the island is strikingly beautiful.

This is a paradise if you are a diver. It's also great place to visit if you just want to get away from the the main island for a couple of days. I want to go again, and I'm sure we will.

Friday, August 23, 2019

Hello Cycling

I've had bicycles since I was old enough to learn and I rode motorbikes for many years. I want some way to get around on my time off. We have a car of course, but I drive to work every day and don't really want to spend even more time in the car. Also, driving on the narrow streets in Okinawa is stressful and no fun. I prefer two wheels.

But Okinawa is hot and humid for much of the year, and Naha is quite hilly. A regular bicycle leaves me literally drenched in sweat. I'm not kidding - if I bike from home up to Omoromachi in summer, I will form literal puddles around me when I stop. Bicycles are great for exercise but not that practical as utility vehicles.

A bit of coast close to the new Parco City shopping mall. Easy to get to with a bicycle. Hopeless with a car since there's no place to park around here.

A few months ago I discovered Hello Cycling. It's an app-based rental service (owned by Softbank) for electric assist bicycles. They have cycle stations — each with a handful of bikes — around town, typically by convenience stores, car parks and apartment buildings. It's available in Naha, Tokyo, Osaka and a few other cities. Fukuoka has lots of them, Kyoto has a few, while Nagoya curiously have none at all.

A typical station by a Yamaha bike shop. Not coincidentally, the bicycles seem to all be Yamaha as well.

The service is really simple to use: you download the app and register your email address and a credit card. On the app (and online) you can see all the stations in an area. Hover over them to see how many bikes and empty return spots are available. Select a bike, press "book", and you get a 4-digit number in the app and in an email. Go to the bike (you have 30 minutes), turn it on and enter the number. The bike unlocks and is ready to use.

Returning it is just as simple. Stop at any station, park and lock the bike, press "return" and confirm. If you want to stop on the way, you just lock the bike. When you get back, turn it on again, then enter your number to unlock it. You can also register an IC card (any card — I use my "Okica" transit pass) then use that instead of the PIN. A registered card also lets you take any free bike directly without booking in the app.

They're extending the increasingly popular monorail. This is the future Ishimine station.

Electric assist bicycles

These are regular bicycles with an electric helper motor: you pedal, the bike measures how strongly you push and the motor adds power in proportion to the effort you put in. Simple, but the effect is profound. Flat areas feel like rolling on a gentle downward slope, while steep hills and strong headwinds effectively disappear.

If you stay within certain limits they legally count as bicycles. You need no license, and you can ride and park them just like a regular bicycle. They do cost a fair amount, however; you add the cost of a motor and an expensive high-capacity battery to a regular bicycle.  Decent ones start at 100k yen, and really good ones can be several times that. We don't have a place to put a full-size bicycle, so I — foreshadowing alert — would need a foldable model. That further increases the cost of course.

A Yamaha PAS With bicycle. You can see the small motor control by the left handle and the larger rental terminal (with GPS and cellular connection) in the center.

This is actually quite a nice bicycle and well suited for its intended use. But it is quite small for me; the saddle is as high as it will go. The curved handlebars are good for manoeuvring it around a parking lot but get a bit too close to be comfortable when bicycling.

The most common Hello Cycling bicycles are Yamaha "PAS With" city bikes. A solid frame with low instep; three-speed internal gears; a wide saddle, curved handlebars and sturdy tires; and a large front basket. It's heavy and stable and will never win a speed competition. But it will take you to the supermarket and back with the basket full of groceries like a champ. It will take you to the beach, your university lecture or the rail station with equal aplomb. It sells for about 110K yen.

It's heavy but the weight really doesn't matter — it's an electric assist bicycle. For the most part you simply don't notice the weight, but you do appreciate the stability. On flat roads with "Eco" assist it feels like you could coast forever. On steep hills you gear down, increase the assist level to strong, and ride up without breaking a sweat. I've effortlessly pedalled up hills on Pipeline Road so steep that I would have to stop and walk if I were out running. I happily went up a back road in Urasoe that was so steep it was a little scary to ride back down again.

The bicycles also come in a very nice powder blue. 

Battery capacity is plentiful. How much you use obviously depends on the terrain, weather, your speed and how much you rely on the motor. They are normally charged to 90% (that greatly extends the battery lifetime), and after a day of cycling in hilly Naha — perhaps 25-30km — I have typically used about 30-40%. Yamaha states the battery lasts for 56km, and that seems conservative.

On the downside, the brakes are inadequate. I can squeeze the rim brakes until my hands hurt without locking the wheels. Also, I'm not a tall guy, but even with the seat in the topmost position it's still a little short, and the handlebars are a bit too close to feel really comfortable. The intended demographic for this bicycle is likely women running household errands.

A walking path near Shuri castle.

If I got this bike for myself, I would absolutely replace the brakes with disc brakes. For comfort I would replace the seat post with a longer one, and also replace the curved handlebars with a straight type. Or (more foreshadowing) just get myself a different type of bike of course.

The entrance to Urasoe Yodore, an old royal burial tomb. 

Overall the bikes and the booking service both work really well. I've yet to have a bad experience with either.

  • The service is cheap and almost frictionless. Just pick up a bike, go cycling, then return it. At 1000 yen per day I don't even think about the money.
  • The bikes are pretty good, and they're kept charged and well maintained. I guess the business (convenience store, apartment or so) that house the station are tasked with seeing to the bikes docked there.
  • This is really useful when travelling. In Tokyo, for instance, you can probably get from your hotel to your meeting or conference way faster going straight across town with a bicycle than finding your way through the subway system.
  • Unlike rental scooters in other cities, you return these at bike stations. They don't clutter up the streets and side-walks; they get better maintained; and they're soon ready for use again. And there's no backlash against them so the service is much more likely to stay available in the long run.
  • Our nearest station is 600m away, too far to pick one up just for shopping or carting a package home. They work better as all-day joyrides for us.
  • Stations usually have only a few bikes, so you can't count on a bike always being available. There usually are, but if you need to make really sure, you can of course pick a bike up ahead of time then park it until you need it.
  • A couple of blogs have mentioned booking a bike, only to find the battery nearly drained. They were recently returned and the battery hadn't yet been replaced. You can't see the battery level in the app, so make sure you check it when you go pick it up. You can always cancel and book another bike if it doesn't have enough charge.
  • Many stations in the big cities have raised their prices to 100 yen per 15 minutes and 1500 yen per day. That's still cheap, and I would still not hesitate to use them, but I guess it's a sign they're not always going to be this inexpensive.
Hello Cycling is a good service. It's aimed at residents (Docomo has a similar service for tourists centered around hotels for more than twice the daily cost), so stations tend to be in residential and business areas, and there's no real way to use it in anything but Japanese. If you can use it, I would warmly recommend it.

Friday, July 19, 2019


So I go to work this morning, and just as I get to my desk, our car emails me to tell me I forgot to lock the door. I had parked by the outside wall of the parking garage and the key fob has a fairly long range, so fortunately I could walk over and lock it from the ground without having to climb two floors.

The future has a way of creeping up on us without noticing.

LED lights is another revolutionary change we don't even think about. But it's almost as big a change as going to electric bulbs from gas and oil was a century ago.

Apparently the future still includes propeller aircraft and disembarking right onto the runway. This makes me irrationally happy.

Friday, June 28, 2019


Fifty years old. That's almost half my life gone. Half? Our first 15 years are spent learning how to be a human, then how to be an adult. I've spent thirty-five adult years so far, and I can likely expect to have another thirty to forty. That's enough time for at least another whole new career, by the way.

The second half of our lives is not the same as the first, though. Our joints wear out. Our immune systems get weaker. Old sins catch up with us. Heart disease, cancers, neurological issues, autoimmune diseases — the list of things that can get you will get longer every year.

When I started running a year ago, it wasn't just an idle whim. I'm already feeling the effects of ageing, and I can see the writing on the wall as well as anybody. I need to take my health seriously right now if I want to stay healthy and active the next few decades.

The secret of long, healthy lives isn't secret at all, of course. We know how to live long and stay healthy. Exercise, eat mostly plants, eat and drink in moderation, don't be sedentary, have an active social and intellectual life, get regular check-ups and never ever smoke.

In addition to running I've stopped drinking heavily. I had a lot of fun partying in my 20s, and I bounced back quickly from a night out. But I'm not really enjoying it any longer, and I certainly don't "bounce back". If I drink one evening the whole next day is wasted. I still enjoy a beer or two on a weekend — but I no longer drink more than that.

And yes, regular check-ups have become part of my normal life. Blood tests, dental care, EKGs and ultrasounds. I had a gastroscopy last month and it's time for my every-few-years colonoscopy next week — not exactly the anticipated event of the year, but it's a low-risk, low discomfort insurance against some very nasty high-risk conditions.

(I can get some) Satisfaction

On the other hand, it's often claimed that life satisfaction gradually drops from a high in your 20's to its lowest in your 40's. But as you continue to get older it rapidly rises again, and by the time of retirement satisfaction will surpass your 20s to reach the highest level it will ever be. I can easily believe it.

I'm certainly in a good place right now. I have an interesting, varied job that I look forward to every morning; I and Ritsuko have a close relationship and fun daily life together; and I'm free from the stresses and doubts of my younger self. Yes, I'm happier and more content than I have been in many years, and perhaps ever.

We have both marked some noteworthy milestones this year. Rather than giving each other individual gifts we decided to splurge, and got ourselves a new car as a joint birthday gift.

2019 Prius. It's blue. It's also very comfortable. And blue.

It's a 2019 model Prius, with more functions, more extras, more automation — and more computers — than you can shake a sizeable stick at. Many things, such as automatic windshield wipers and the connected Android app, are surprisingly practical. Some things — self-parking — aren't really. Some, such as the ability for the car to post updates on Line, we haven't even enabled yet.

From one perspective it's fair to say a modern car really is a complex computer system that just happens to be mobile. You have half a dozen serious computers and perhaps hundreds of microcontrollers, all connected through a hardened internal network that handles real-time data traffic in harsh environmental conditions. The wheels and engine are almost incidental.

With all that said. my favourite function — by far — is the seat ventilation. A couple of fans connected to the AC blow air through holes in the leather seat and back. This keeps your back cool and dry no matter how hot it gets. For the first time ever I can get to work in summer without my t-shirt sweaty and damp after an hour in the car. A small thing, but so very much worth it.

Tuesday, June 18, 2019

Bonsamatic Dot Com

This is a long and slightly geeky post about refreshing my home server. But I also add in a bunch of mostly irrelevant Osaka photographs, so feel free to scroll past the text and look at the pictures. They are, by the way, taken with the excellent Fuji GF670 folding camera on Kodak Ektar 100 (color); and with the Pentax 67 on Ilford delta 100 (black and white).

Nagai station, Midosuji line, Osaka.

I've had a small server at home for some years now, first only using my desktop for an RSS reader, then setting up a dedicated machine with its own public IP address. I've upgraded it once since then, but kept the installation pretty much the same. I never got around to getting a proper hostname, so I always accessed it directly through the IP address.

In March, the drive suddenly developed an issue ("suddenly" - it was five years old already) and the server went offline. I couldn't do anything about it from here in Naha, but as we planned to spend the Golden Week holiday in Osaka I decided to rebuild the whole thing when I got there. I would have to replace the failed disk, and I wanted to add more storage. Also, while the software worked it felt unreliable and difficult to maintain.

Sleepy. Amemura, Osaka.

Set up the Hardware

I got an SSD to replace the faulty drive, and an external USB hard drive for bulk storage. The computer itself - a six year old Intel NUC with 8GB of ram - is still fine, and more than fast enough for a server like this.

I installed Ubuntu server (using our TV as a monitor). The only tweak I had to do was to use NetworkManager instead of Systemd to set up my network; Systemd lacks support for PPPoE connections that I use to get my public IP address. plug in and format the external drive, and the hardware was ready.

Connecting. Shinsaibashi, Osaka.

The Web Server

I didn't want to keep the messy server set-up I used previously. To set up a real web server with a proper domain and secure connections we need the following things:

  1. A web server. I'll use Nginx.
  2. a fixed IP address. I already buy one from our internet provider.
  3. A domain name. This is the name we want for our server; something like "google.com", "docomo.jp" and so on.
  4. Set up encryption with SSL. The internet is a dangerous place these days, and we want all communication to be encrypted.

I installed Nginx from the Ubuntu repos as the main web server. It's fast, light on resources and straightforward to set up. Also, it's really well suited for redirecting requests to other applications, which is exactly what we'll want to do. I created a quick web page just to have something to look at.

Up until now I had used the IP address. I was the only one using the server so that worked, sort of, but it's ugly and clumsy, and I can't get a real SSL certificate (used to encrypt the communication between server and clients) without a domain name. Domain names are cheap, so there's really no reason not to get one for myself.

Crepe L'Oriant. Minamisenba, Osaka.

Domain Name

There are many, many domain name sellers around. They range from expensive business oriented full-stack providers to cheap sellers with hideous websites, sketchy business practices and lousy reputations. In the end I went with Namecheap, for no better reason than that they're on the FSF recommend list and their website doesn't make me want to gouge out my eyes with a fork.

Buying a domain name is very simple, and the setup is, again, fairly straightforward after a bit of googling. I got bonsamatic.com after my plant watering project a few years back. I point the "cloud.bonsamatic.com" subdomain and "bonsamatic.com" to the server, redirect "www.bonsamatic.com" to "bonsamatic.com" and everything else to an error page.

For the SSL certificate I use the amazing (and free!) "Let's Encrypt" provider. It's, again, recommend by the FSF, and let's you set up a reliable and secure certificate for your site with very little pain. You add the "certbot" repository, install the script for your webserver (so "python-certbot-nginx" in my case) and run the script with parameters for the domain names you want to use ("bonsamatic.com" and "www.bonsamatic.com"). The script then automatically configures your web server to use SSL encryption properly.

Let's Encrypt does another, clever, thing: It is set to expire in only 90 days. Sounds like a bad thing, I know, but it also let's you renew very easily by just running that script. The script sets up a periodic job that automatically checks if it's time to renew every so often. The clever thing about it is that the short expiration period forces you to set up automatic renewal, and to make sure it actually works. With a long expiration date it would be easy to neglect setting up automatic renewal, and to forget renewing it at all.

We have everything we need: a web server, a way to reach it (as https://bonsamatic.com ) and proper encryption to keep the conenction secure. We even have a small place-holder website, just to have something to look at.

HEP5, Umeda. Osaka.


I'm using my server for a few different things. It is the backup target for my other computers, but this is very simple: I run "rsync" on the machines to the external disk on the server. All I need for that is a working SSH connection. I also use it for my git repositories. But again, a working SSH server - included by default in any linux distro - and git is all I need. Trivial.

Neat architecture. Nagai, Osaka.


Nextcloud is a very useful "personal cloud"-type application. It gives you remote storage on the server that you can synchronise to your desktop and smartphone (there's apps for both Android and iOS), and you can share data with others using a browser or an app, very much like Dropbox. You can use it to upload pictures from your phone and share with others. But it's much more than that.

It has a large selection of "apps" you can install that add more functionality. The "Notes" application, for instance, lets you write and synchronise notes anywhere; I can work on blog posts like this one from my work computer, my desktop, and my smartphone (I'm using it right now). There's also calendar apps, email clients, image gallery viewers, collaborative editing tools and lots of other stuff.

One thing that's particularly interesting is "Nextcloud Talk". It's a full chat and video call application (using WebRTC) in your browser or using a dedicated Android app. On the Google app store it's cheap and will support the developers; but it's open source so you can also download it from F-Droid for free if you like. I haven't tested it a lot, but it seems to work well enough so far.

Complicated! Nagahori, Osaka.

Installing Nextcloud is intimidating. Like most web apps it is a complex beast with many moving parts. If you get something wrong it may refuse to work; or worse, will leave gaping security holes open to the internet. Fortunately Ubuntu has "snaps", self-contained packages with all the programs and configurations an app needs.

The Nextcloud snap contains nextcloud itself, along with PHP, MySQL and all the other bits and bobs it needs. Installing nextcloud becomes as easy as "snap install nextcloud", then edit the Nginx config so "https://cloud.bonsamatic.com" points at the nextcloud app.

I have one minor issue: Snaps are sandboxed and secure — this is a good thing — but it means that I can't give the Nextcloud snap access to the external drive. That's still OK, as I'm not storing any large data sets in Nextcloud, but I would have preferred to use the external drive for storage.

Very retro. Kobe.


I still use RSS to follow blogs, news and comics. You can simply use a standalone RSS reader without a server if you want, but then you can't synchronize the feeds across different devices. You can also use an online service (Feedly looks nice) if you like. For various reasons I prefer to host my own. Up until now I've been using "Tiny Tiny RSS" as an RSS server. I used the web client on my computers, and the TT-RSS app on my phone. It worked well enough.

But the Tiny Tiny RSS developer doesn't inspire confidence. He doesn't do releases at all, and is actively hostile to people packaging it for distributions. Instead you clone his repository whenever you want to update and trust that it doesn't break anything. The developer himself is rather abrasive and the forums are unfriendly. I really don't want to continue to rely on this software.

Fortunately Nextcloud has come a long way, and one of the apps is "News", a full-fledged RSS server and webapp, with an Android mobile client. The app itself is trivial to install: look for "News" from the list of available apps, click "install" and you're done. If you have a list of feeds in OPML format from another reader, you can import them from the settings. It works quite well on both web and mobile, and I'm not missing anything from TT-RSS. I do wish there was a "recently read" category, but that's just a quibble.

Midosuji line, Osaka.

And From Here

Setting up this server was fairly painless; much easier than the last time I did this. It took perhaps one full day in total, and that included a lot of googling and playing around. A lot of my time was spent figuring out the right domain name settings, and even that wasn't difficult, just time consuming. I also spent a lot of time double-checking that I really understand what all the Nginx and Let's Encrypt configuration settings actually do.

Next I want add some actual content to the website (I don't need a site, but now that I have one I might as well use it for something). Also, I want to test the Nextcloud Talk service a bit more; as Google is killing Hangouts this fall it might be a decent alternative for keeping in touch with family and friends.

If you have any ideas of what else I could use this server or the website for, please tell me! I feel this has a lot more potential for use.

Work is over. Relax. Nagai park, Osaka.

Sunday, May 19, 2019

- One Year On

I have been running for a year now. My goal was to make this a regular habit, and I think I've succeeded. I run four times a week, for a total of 35-40km. Usually I run three times over lunch on weekdays, then a longer run on the weekend.

When I started I doubted that I would persevere for more than a couple of months. I thought I would hurt, I would get bored and I'd soon make excuses not to go out running any more. But running turned out to be quite fun and very satisfying.

Distance I run per week (green bars) and the average Polar "running index" (red line).

I believe the image above sums it up nicely. I went from complete beginner to 35-40km a week in about 6 months. The "Running Index" is a proprietary index of how good a runner you are. But it's really little more than the ratio of your heart rate and your running speed, with a log scale factor to account for the distance.

You see a lot of stuff when you run. Here a tiny "dekotora" ("decoration truck") near the airport in Naha.

Our heart rate is directly proportional to our effort. As we work harder our muscles need more oxygen, so the heart will beat faster to deliver it. As we get more fit our muscles become more efficient at using the oxygen; our lungs can deliver more oxygen to the blood; and the heart is able to pump a larger volume of blood with each beat.

Figuring out a detailed measurement is a little complicated. But you can divide your speed by your heart rate for a simple index of how well trained you are - a higher number means you are faster for the same heart rate, and so you're better at running (or whatever sport you do). Of course, as you run for longer you will get more tired, so the number will drop. To account for that you can adjust it with a logarithmic scale factor that depends on the distance. Something like

"index = log(a*distance) * (speed/heart_rate)".

You could find out "a" by fitting it to running data from a bunch of runners, so that the index is about the same from the beginning of a run to the end.

So if I'm getting better then why has the index been dropping since April? Summer, is why. Our blood doesn't just supply oxygen; it also cools us down. It transports heat from within the body out to the skin where our sweat will take it away. But any blood diverted to our skin is blood that's not going to a muscle. Our hearts have to work harder, our muscles get less oxygen, and we are running worse through no fault of our own. Our efficiency — and the running index — is similarly affected by hills, by humidity, by altitude and many other factors.

My weight over the past three years. The line is a two-week average.

I've also lost the weight I've gained since coming to Okinawa. In Osaka I got a lot of exercise from walking and taking the subway everywhere. Since coming to Okinawa, though, I mostly travel by car, and my job gives me little stress and plenty of free time. I gained about 3kg in the year and a half since coming here.

But since I started running I've dropped from 75kg back to 68-70kg. That's not mainly due to the running; exercise by itself doesn't make you lose weight. If you exercise more, you'll also eat more to make up for it. But I'm careful with what I eat and drink now (I've mostly stopped drinking alcohol) and in combination with running it's had a large impact on my weight.

Sunset in Osaka. Drawback of running is, you can't bring a good camera.

I really enjoy running. It's especially fun to run longer distances, and to explore new areas while running. I've been tempted to increase my distance and increase my pace even further, but I tend to get knee pain when I do. Stretching and other exercises help a bit, but ultimately I have to limit my distance and run mostly slow runs to stay injury free. The joys of growing older, I guess.

Will I continue? Yes, absolutely. It's fun, I feel good and I have no reason not to. I'm even thinking of doing a half-marathon this fall. It's easy enough - I've run close to that distance already - and it'd be a fun event.

Monday, March 18, 2019

AMD GPU on Ubuntu

Summary: I upgraded my Ubuntu desktop to an AMD graphics card; here's my notes on the (very simple) process. You don't need AMDs closed drivers and you don't need any external repositories — everything you need for both graphics and OpenCL is already included in Ubuntu itself.

I built my own desktop in early 2016. Not a high-end system, but pretty fast, with plenty of memory and with great cost-performance. Overall, it's aging remarkably well and will be fine for at least another three years, possibly longer. The exception is the graphics card. The Nvidia 750ti I had was a midrange card when it launched in late 2013, and already a generation behind when I bought it(1).  It has served me well, but by now it's really starting to show its age. Some of my current games only run at the lowest possible graphical settings.

Do people still use desktops? Yes, many do. Do people bring their desktops — and monitor, and keyboard, and mouse — with them when they travel? No, normal people don't. Somebody must have forgotten to tell this guy. Supercomputing 17, Denver.

Worse, the Nvidia Linux drivers — not open source so they must be installed separately — have increasingly been causing problems. I've had screen tearing and other glitches for the past year. The driver now often fails to restart properly after waking the machine so I can no longer put it to sleep. Botched driver upgrades have left me without a usable desktop a couple of times. I don't know if my card is too old to be supported properly, or if the quality of the Nvidia drivers are declining.

AMD is Nvidia's main competitor, and the underdog in the GPU market. They provide full open source Linux drivers for their GPUs. For a few years now, any AMD card should theoretically work out of the box; in practice you always seemed to have to tweak your graphics settings, add unstable or unfinished external components or upgrade your kernel. But for the past year or so, people have increasingly insisted that yes, nowadays it really is as simple as just switching cards, with no messing about with your system.

I didn't think to take a picture of the card until I had already installed it. Besides, for all that I like computers in principle, seeing modern hardware if often as exciting as watching paint dry. Instead, here's a Cray 1 supercomputer on display at the Supercomputing conference in Dallas last year.

So I took the plunge. I got an AMD RX570 with 8GB of memory — a two-year old mid-range card from their previous generation. Not hugely fast, but inexpensive and great performance for the money. The hardware installation is straightforward: unplug and open your computer, pull out the old card then slot in new one. Remember to connect the PCIe power cord to the card, then close the case and restart.

My machine came back up with no issues. The desktop and 3D rendering all worked out of the box. I have no more tearing, and the system definitely feels more responsive. One game was confused by the Nvidia drivers still on the system so I removed them (you can do this from the software center, but it's faster on the command line):

  $ sudo apt purge nvidia*
  $ sudo apt autoremove


While OpenGL support is included out of the box in Ubuntu, the newer, faster Vulkan support is not (these are both standard libraries for rendering 3D graphics). You can install the Vulkan libraries with the following line:

  $ sudo apt install mesa-vulkan-drivers vulkan-utils mesa-vulkan-drivers:i386 libvulkan-dev dkms

What difference does Vulkan make? "The Talos Principle" is a fully immersive 3D puzzle game with a cool storyline that aims for a photorealistic graphical style. It can use either OpenGL or Vulkan. Here's a set of benchmarks with my old 750ti card and my new RX570, with OpenGL or Vulkan, at three different levels of graphical detail:

Dotted lines are OpenGL, solid lines are Vulkan. The blue pair is my old card, the red pair is the new one. The red, horizontal line marks 60 frames/s; you ideally want the graphics to be faster than this at all times.

Take-away: Vulcan is around 25% faster than OpenGL in this game, both for the old card and for the new one. That's a major speed difference just for changing a rendering library. Also, my new card is ~120% faster than my old one. Sounds reasonable for the same class of card about three years apart.


At this point I had a fully feature-complete, well-working graphics system. But GPUs are used for more than graphics these days. You can use GPUs as general accelerators for certain kinds of computations, deep learning and certain kinds of molecular dynamics in particular. We have several dozen compute nodes with very high-end GPUs at work for this purpose (and no, they don't do graphics at all, just computation).

Nvidia is completely dominant today with their CUDA library and compilers, but it's not the only alternative. If you want to do do real compute on an AMD card you should install ROCm, and I intend to do that in the near future. Meanwhile, you can install basic OpenCL 1.1 support using only the open tools in Ubuntu.

OpenCL is an open standard for programming GPUs, and you can use it on AMD GPUs, on Intel GPUs and on smartphones (yes, they have GPUs and yes, they can be useful for this in some cases) and it works on Nvidia GPUs as well. It's not as efficient as CUDA, and it's not as popular, but it still gets the job done, especially if you're just looking to learn.

Today, getting basic OpenCL support for AMD on Ubuntu is easy. Ubuntu already carries all packages you need. Install them with:

sudo apt install clinfo mesa-opencl-icd opencl-headers

"clinfo" is a utility that reports what kind of OpenCL support you have, if any. Run "clinfo" on the command line to see what your particular hardware supports.

"mesa-opencl-icd" (and the packages it pulls in) is the actual OpenCL 1.1 libraries, compiler and other stuff. The "opencl-headers" gives you a set of standard headers for your own code.

There is one single hack you do need to get OpenCL working completely transparently. For some reason, the OpenCL library doesn't get a symbolic link "libOpenCL.so", and this is needed to be able to link with the library without giving the linker the exact file. You can add the link yourself like this:

$ cd /usr/lib/x86_64-linux-gnu/
$ sudo ln libOpenCL.so.1 libOpenCL.so
$ cd

Now you can take any OpenCL program, compile it and run on the GPU. For instance, download this vector addition example: vecAdd.c (from this short tutorial). Compile the program, then run it:

$ gcc vec_add.c -o vec_add  -lOpenCL -lm
$ ./vec_add
final result: 1.000000

There you have it. Full 3D graphics capability using OpenGL and Vulkan (and with working Proton support on Steam); and OpenCL 1.1 support both for running and developing code. All using open source and without enabling a single PPA or going outside the Ubuntu repos. Not bad, not bad at all.

1) Buying the newest, greatest high-end GPUs rarely makes sense. You pay a huge extra cost — in money and in power — for a bit of extra performance and perhaps some new functionality. But games are made to run well on mid-range cards or lower (for as many potential buyers as possible), so that extra cost is largely wasted. They also tend to be physically large and won't fit a small case; and they use a lot of power so you may need to upgrade your power supply and add fans. And as they're new, the drivers won't be as stable or polished. 

You'll spend a lot of money for a computer that's noisy, big, uses lots of power, with frequent graphical glitches and crashes. For all that, you get some nice, cool in-game graphical effects that you notice once then ignore, because you're too busy playing the actual game to notice.

Tuesday, February 19, 2019

The Last JLPT

I retake the Japanese Language Proficiency Test level N1 every year or so. I took level 2 many years ago, but I've never passed N1, the highest level. Honestly, the main reason is that I don't really study for it. The N1 is mostly useful for job hunting or entering university (neither of which apply to me) so I'm just not very motivated.

As it happened, the Naha Marathon was right on the morning of the JLPT. Spent half an hour watching the endless stream of runners passing by as they ran through the city center.

So why do I do it? In part I want to "catch them all". I have all the other levels, and getting the highest one would give me the complete set. But it's also a nice day away from home. I go to some area I'd normally wouldn't visit, have lunch, mill about with hordes of nervous people — mostly young, almost all from nearby Asian countries — then take a relaxing walk on the way back home.

The Convention Center is a really pleasant facility. Most of it — the park, especially — is open to anybody when there's no event happening here.

This year the test was at the Convention Center in XXX on Okinawa. It's a nice parkland area right next to the sea, with a beach and a marina, well worth visiting for an afternoon. The N1 test was in a single, huge room with over 200 seats. The echoes made the listening portion more challenging than usual, but it was bright and airy so not bad overall.

Part of the test hall. Bad shot; sorry about that.

The results came a couple of weeks ago. And I passed.

To be sure, I didn't pass by a lot — 103/180 points is only 3 points over the limit — but still. To nobody's surprise, my reading score was very good (I love reading, after all). The listening was also quite good — it had better be, living here — while the grammar score was lousy. I'm sure all my old language teachers would nod in recognition.

What does this mean? On one hand, I now have all the JLPT levels. On the other, I no longer have any motivation at all to study grammar in the future. And I no longer have a yearly excursion to some random area to look forward to. Maybe it's time to start studying for the Kanji kentei :)

Just a house. It's not notable, it doesn't appear in any guidebook or anything. But it is pretty neat, and I would never have seen it if I hadn't sat the JLPT nearby and walked back.