OpenGLot Release

A short while ago I posted a new release of OpenGLot, which featured parametric curves, scalar fields, contour lines and flow fields all implemented in GLSL shaders.

And they support time dependence.

It can plot virtually any function in x, y and t, and on my MacBook with its NVIDIA GeForce 9400M it has been getting 10k+ fps. I’m still a little surprised by this number, but it seems to be running at that speed.

Flow (vector) fields appear as advected dye. They're currently streamlines, but in the near future I hope to support streaklines and particle flow as well.

Flow (vector) fields appear as advected dye. They're currently streamlines, but in the near future I hope to support streaklines and particle flow as well.

Scalar fields appear as a mapping of height onto color.  If this function were to be plotted in 3D, it would like a sheet rippling, but sometimes it's more useful to see it in 2D.

Scalar fields appear as a mapping of height onto color. If this function were to be plotted in 3D, it would like a sheet rippling, but sometimes it's more useful to see it in 2D.

On of the great thing about implementing this on the graphics card is that it doesn’t require much CPU time on the machine running it. Even at 10k frames per second, my MacBook never uses more than 30% of a single core’s time. A place where this particularly shines is on tiled displays – a bunch of HDTVs tiled together to run as if it were one large screen. In such setups, a computer will control 2-4 screens, and each computer’s graphics card has enough power to run the animation for its portion of the screen. There are still some bugs to be worked out, but I ran a proof-of-concept on one of the tiled displays at KAUST.

Running a demo of OpenGLot on a KAUST tiled display

Running a demo of OpenGLot on a KAUST tiled display

Lately I’ve been working on getting the 3D analogs of the various 2D primitives working, again all with time dependence (it’s the support for animation that really makes this shine in my mind). So far it’s surfaces, parametric curves and surfaces and flow fields, but the flow fields have some work yet. It turns out that while modern hardware is definitely capable of handling 3D flow fields, it doesn’t actually make much sense when you see the result – it’s just too busy. To be able to easily visualize flow in 3D is very much an open problem.

3D streamlines end up just becoming confusing more than they are helpful.

3D streamlines end up just becoming confusing more than they are helpful.

In order to get some interesting shapes working, I had to add support for cylindrical and spherical coordinates which is actually providing an interesting challenge – how best to generate the shaders. The shader source code (that runs on the graphics card) is generated and compiled when you run OpenGLot, and I’ve not found an altogether easy and intuitive interface for adding simple coordinate transformations to it. Still, it works, but the programatic interface will likely change.

This is a torus of sorts, which I got as an example from Grapher.app

This is a torus of sorts, which I got as an example from Grapher.app


This is the same torus, just colored by using its surface normals as RGB values

This is the same torus, just colored by using its surface normals as RGB values

In order to determine surface normals (which are something usually determined when one defines the geometry of an object), the vertex shader approximates various derivatives numerically. So far, the shading results have been pretty decent.

A trigonometric function, colored by mapping the surface normals to colors

A trigonometric function, colored by mapping the surface normals to colors


The superimposition of two trigonometric functions, lit based on their surface normals and a texture to give visual clues about distortion

The superimposition of two trigonometric functions, lit based on their surface normals and a texture to give visual clues about distortion

I’m still working on making video of this in action available, but so far a number of the tools I would usually use have come up short. I’ve been trying to integrate a video encoder into a utility library for OpenGLot so it can record video straight out of the box, but the framerate is still too low.

Tagged with:
 

Flood

Yesterday morning, I woke at 6:15 to the all-to-common fire alarm. Prepared to sleep through it if necessary, I went to my window to check for smoke or anything that might indicate that this wasn’t one of the dozens of false alarms. What I found was rain.

DSC_0052.NEF

Rain like cords was falling in Saudi Arabia. The streets were wet, and excited, I ran to get my camera and started taking pictures. I threw some clothes on, and ran around campus to try to document what I believe to be a very rare event here. I called several of my friends to make sure they were awake and witnessing this.

The rain let up about 7:30, and soaked and I tired I headed back to my building to get some sleep when I encountered several other students who also wanted to just feel the rain on their faces. We walked around campus to see it wet, but ended up surveying the damage. Students had ceilings collapse, water running out of light fixtures, flooding in their apartments – the list goes on.

DSC_0264.NEF

A sunken area of campus had turned into a lake (based on what it’s like when it’s dry, it must be 4 meters deep in some places), and some roads had become impassable rivers. Encountering a couple of students on motorcycles unsure if they should try to cross, I was reminded of Oregon trail. In the end, they forded the river.

DSC_0328.NEF

Tyler and I moved on, the water now thigh-high in the middle of the road. Cars’ mufflers were bubbling through the water, and one had to worry about the wake of passing cars. The womens’ residence was evacuated, and many families packed their kids in the car and left in search of higher ground. The timing was sweet and sour – it was the last day before break and school got cancelled on account of rain, but most students were leaving the country for the week, and some will return to find unlivable and extensively damaged homes.

DSC_0352.NEF

Rains like these are extremely rare in the area, and so I understand the lack of preparation. I don’t understand the shoddy craftsmanship of the homes, but that’s a running issue. Tonight’s Thanksgiving dinner will be a reflective one for certain. One exasperated student, waking to water pouring on him, household wiring fried and water running down the stairs like a waterfall felt that this was the last straw. He seemed to be set on the decision to return home at the earliest possible time.

It seems he’s not alone, and the school is expecting a non-negligible portion of the students to not return after winter break, though some are talking about not returning from Eid break at the end of next week. I hope for all our sakes and for the sake of the school, that the administration can refocus, get their act together and get their sometimes incredible mismanagement under control. We all came because we wanted to see KAUST succeed, and we hope it still can.

DSC_0387.JPG

That said, I would like to offer praise and criticism; the response from emergency services was what I’d expect in a modern country. Water tankers were on the streets, pumping out massive amounts of water, within four hours of the rain. The fire department helped evacuate a number of families, and each student was actually contacted by phone to make sure he had a livable apartment for the time being – those who did not were moved to safe lodgings. My criticism is this – why are not all of our other, very real concerns and problems not pursued with the same tenacity and efficiency. Why did it take a small disaster for KAUST to shine?

I took some more photos as well.

Tagged with:
 

Movember @ KAUST

Apparently a tradition many places, Mines had an annual “No-Shave November” competition, with prizes. And beards.

This year, after seeing a post about “Movember” (Movember = Mustache + November) on The Art of Manliness, Tyler and I decided enough was enough. It was time to grow beards for charity.

We’re busy students, and we can’t be training to run marathons for testicular cancer, so why not turn something we already do on a daily basis into something useful. Plus, we won’t have to waste time shaving.

A shave on October 31st will be my last for a month. The trick is to push on through past the “pedo-stache” stage and into the manly beard stage. I’ve grown a beard before, but was displeased with it and enough time has passed that it’s time to test the waters again, for, how can one truly know one’s beard without having one?

Movember @ KAUST has a few rules:

There are varying levels of moustached/bearded-ness.

Level 0: the Supporter. This means you support our cause, but are otherwise shaving regularly.

Level 1: the Sophisticate. You allow the growth of the facial hair, but still trim it into a neat moustache or beard.

Level 2: the Chuck Norris. Very minimal shaving. You are allowed to trim if there is unevenness, and do basic styling, but otherwise the amount of growth is way over the usual. Should be a complete beard and moustache if possible.

Level 3: the Castaway. No shaving or facial grooming allowed. Let your facial hair grow wild and free. Wilson! Wilson!

The rules for the month are that, in order to participate, you must increase at least one level from your current growth.

Unfortunately, there aren’t that many ladies on campus to impress with your manliness. On the bright side, though, in Saudi your glorious beard will be more acceptable than in many western countries. And, being graduate students, you certainly won’t be persecuted at work for an “unkempt” appearance.

But its not all about having fun and looking manly, we want some good to come from this event. Find friends and relatives willing to pledge money for your Movember month. Have them pledge a donation to one of the below listed mens-health related charities.

We’re still finalizing our chosen charity, but it looks at this point as if it will be Everyman, a group that helps to fund the Institution of Cancer Research.

UPDATE: We’ve settled on that group, and please feel free to donate!

Good luck, and good growing.

Tagged with:
 

It’s been said many times many ways, but the weakest point of a security system is the user.

Feynman had a great story about the commanding officer at Los Alamos demanding the most advanced safe available for all his secret documents. This was problematic when the CO passed on before revealing the combination. An amateur lock-picker, Feynman was extremely interested in how the “pros” solved it. It turned out to not be that hard, as it was still on the default combination.

There is a door on campus that is extremely convenient to use as an entrance, but for “security reasons,” it was designated as an exit-only door, and cannot be opened from the outside. Enter ingenuity. We put a doorstop in it, propping it open, nullifying all the security value it would have otherwise had.

Tyler, a friend of mine, pointed this fact out – that by making the “real” solution difficult, they’ve shot themselves in the foot.

Another appropriate example is one of our computer labs. On the entrance, there’s a device that requires a password and a fingerprint scan, but anyone who’s seen “Spaceballs” could guess the combination, and the scanner at this point doesn’t recognize any fingerprints – it just requires that there’s a finger placed on it. An alternate method to gain entry is to slip in a credit card into the door. As a result of the scanner being difficult to set up, any purpose it might have had is gone.

Of course, it’s difficult to get onto campus in the first place, so this aren’t huge issues in my mind, but they seem overtly serious about security when clearly they are not. I get hassled regularly by security guards demanding to see my ID, and yet I’ve had a backpack, a camera and a Nintendo DS stolen. In separate incidents. The camera was even taken from a drawer which is locked more than 95% of the time. In my office. In the building with the highest security priority.

Tagged with:
 

My colleagues and I have formulated a new position (unfortunately fictitious) for KAUST: professional smooth-maker.

There are a number of small problems here, and under the collective weight of these straws, the camel’s back is breaking. No working printers in the library. No wifi access in most classrooms. No working projectors in many classrooms. No dishes in my home. No solution in sight.

With the money that KAUST is dishing out for various events and items, they would be better-served to set aside a certain amount in their embarrassingly large budge to fix problems in an ad-hoc fashion. Many of these issues will not be fixed in the near future, and in the mean time, we don’t have books for some classes still. People are scrambling to put the permanent solutions in place, but in the mean time, it’s as if we’re holding our breaths – hoping that we’ll surface from the ocean of incompetence soon.

A man about campus, man of the people, he’d trawl around seeing problems and fixing them. Hire a guy for this, buy that piece of crucial equipment.

While the rest of the administration is bogged down in bureaucratic black holes of paperwork, he’d be a classic cowboy hero – arrive just in time to save the day and ride off into the sunset. Victory for all.

This may not work in implementation, but students are forming their own ad-hoc solutions. Like a wiki for information about how things work on campus (like when the medical center is open) as the school hasn’t made it easy to find out. Or a forum for addressing issues as the school’s pricy issue-tracking software wasn’t rolled out in time. Why not embrace that this project is in flux and subject to rapid change and facilitate these solutions?

 

Home

A few days ago, I finally moved into what I’m told will be my permanent residence at KAUST.

I left the United States on August 16th making it almost two months of living out of a suitcase, sleeping in eight different beds in various places and cohabitating with a number of people. It’s far from perfect, but to have a home that will remain the same is enough for now. About half of the possessions I brought with me had not left my suitcase for those two months.

I’m moving furniture around and cleaning this weekend, but I’m very excited to nest. This may very well be where I live for the next several years of my life.

I’d post pictures, but the camera I got this summer (a Nikon D60) was stolen this week. My backpack and headphones preceded it in disappearing, and so my friend Tyler and I will be setting up a hidden spy camera in our office to hopefully get some of our belongings back or at least catch some nefarious individuals as security staff has been less than helpful.

 

KAUST Panorama

kaust_cropped

Probably the most attractive (read: finished) part of KAUST at the moment.

 

How to Ensure Failure

Manhole Fail

Why are manhole covers round?

I was reading an interesting piece recently about survivor bias. It was a book (I’ll try to find it again in the library) talking about building strong companies and they presented a criticism of other such books: that they only tell you what strong companies do. It’s equally important to understand the reason for failure among companies that flounder. They gave a very tangible and compelling example:

During World War II, the Royal Air Force would send planes out on missions and some would return home and some would not. They noticed that of those that made it back, bullet holes were concentrated on certain regions (like the wings and rear gunner positions). Seeing as reinforcing against bullets was costly and also added a lot of weight to the planes, they came up with a perfectly-reasonable-sounding idea – let’s just reinforce the areas that seem to get hit most. They followed through with this inspired idea but found that they did not see any improvement in the rate of planes that returned home.

What they should have done, as this book points out, is to reinforce the places that didn’t seem to get hit on the planes that return. That’s because that’s precisely where the planes that didn’t make it back were hit, and they were seeing a sort of negative filter of the weakest points on the aircraft. Survivor bias – a systematic skewing of data based on patterns in groups from which you gather your data. In some sense, talking about what’s great about successful companies is committing the same mistake.

I am a big believe in `lessons-learned.’ After a project, it’s good to reflect on it, and think about what you’d change. What worked well, and equally importantly, what did not. Similarly, I encourage people to report negative results in their work, as they are sometimes just as useful.

In terms of ensuring failure, I’ve been taking note of a lot of things in the management of this project (the instantiation of this school) that I would change. If you want to make your life more difficult, here are some things you might try:

  1. Keep No Real Records – What we see when we go to the housing office is a couple of guys sitting at a solitary computer and a man with a cell phone and sticky notes sitting at a table. We tell this guy what’s wrong with our apartments, or what we’d like to know, and so forth, and he writes this down on a sticky note. I’ve been asked over a dozen time for my email address by the housing office alone, and I’ve had to explain to them as many times that I don’t have a cell phone. And yet, when developments occur, they try to contact me by phone.

    It’s an endless game of “telephone” where over successive conveyances of information, the message becomes utter garbage. My friend Ben has had his dishwasher checked 4 times by housing maintenance, but it’s his washing machine that’s broken. At the point of collection, make widely-accessible notes of the issues. Better yet would be to allow students to describe in writing their problems directly. (This is especially important when accents are often so thick as to be unintelligible.) It’s almost as if there were dozens of commercial and free tools out there.

  2. Don’t Use Your Products – I swear that our toilet paper dispensers were designed by people who don’t use toilet paper, and our faucets by people who don’t use water faucets. With respect to the faucets, the area of activation for the soap dispenser is a superset of the area of activation for the water, meaning you can’t get access to water to rinse your hands without having more soap applied. There are more examples, I’m sure.
  3. Foster Resentment – Treat your clients like incompetents and infantilize them at every step. When they ask for assistance, give it to them in the most inconvenient way possible.
    I’ve been moved twice since on campus, and each time they’ve given me a 30-minute window from the time I bring up the problem. I have since learned to pack all my belongings in about 15 minutes, but it’s not how I’d like to be treated. Our campus recently hosted 60+ leaders of various nations as part of the inauguration and other VIPs totaling 3,500. There was no room made for the student body one tenth that size. I was sure that the reason for this was the security concerns, until the night of the event they realized they wouldn’t fill the space and sent out buses to campus to round up random people to stand in for the event. It sends a clear message about who this event was for. Even now, some of us have been moved into the maid’s quarters of houses on campus; these serve as a bedroom – 30 square feet all to yourself.

I didn’t mean for this to turn into a rant, but I meant rather to illustrate some organizational observations. Tying this back to the picture at the top, it’s a question commonly asked at interviews (from PhD programs to Microsoft) – why are manhole covers round? It’s because otherwise hard hats would have to be a lot harder. If it’s square (like this one on KAUST campus), the 100+ pound plate can fall down the manhole itself.

Tagged with:
 

KAUST is a beautiful idea. In the king’s wisdom, he saw that oil would not last forever and for reasons pure and pragmatic, he commissioned an institution that would provide clever people with the tools they needed to grow science. And for this, I am very grateful to the king. Thank you.

That said, there have been issues. Birthing pains. And there were bound to be some. Anyone who writes code knows that nothing compiles the first time around, and even when it does, it rarely works exactly as planned. Early adopters know that a product is a brilliant idea in principle but there may still be design flaws in the implementation.

Last night saw the inauguration of the school. The king came to the school (along with 3,500 of his closest friends – leaders from various countries, nobel laureates, distinguished guests) and there was a very long and involved ceremony. Given the guest list, I understand that there are security concerns and not everyone can attend, but the initial plan for the ceremony did not include students. Or much of the faculty. Upon learning of this, a petition went around, was signed, and we are told eventually reached the king himself and he extended an invitation to one student per country. These students were then included on stage during a reading of poetry to the king.

I find it very symbolic that these students were then not guests, but performers. Perhaps it’s ego-centric or self-involved to think that it’s the students and faculty who make the school the school, but they’ve been telling us this from the beginning. Why then, did we watch on TV an event that was happening on campus? And as far as the security concerns go, we all submitted to background checks, and “police clearances” and the extensive medical tests. Oh the medical tests! I literally gave more blood samples and stool samples for getting my visa than I have in the rest of my life. We’re academics – not zealots or crazy and dangerous people.

I imagine that it’s different in a monarchy. I realized in watching the festivities, that the people presenting and speaking at the event were proffering a gift, or a thanks. A promise to the king that they hoped and prayed he would find pleasant as a man with absolute power in the land. I tried to imagine an analog in the United States and I couldn’t think of one. There are ceremonies like this stateside, but they are displays of gratitude without the fear or reverence.

KAUST has to walk a fine line – the Saudi general population sometimes feels as though this is too free or too liberal a place while many of the people who constitute the school feel it’s too restrictive. That’s in part because we were promised that there would be no segregation when we got here, and there is. We were promised that there would be no dress code, and though it’s not always strictly enforced, there is one. We were promised we would have unfettered access to the internet (we were incredulous, but that’s what they said up until we got here), but many legitimate things are censored. I understand that there is a tight-rope walk in play here, but at the same time, it’s hard to ask people to stay and work in the name of the king when there is greener grass elsewhere.

I stay and will stay because I believe in the dream. I laud King Abdullah for his insight and inspiration. It’s with certain implementation issues that I take exception.

I have been asking for two weeks whether or not my permanent residence is ready. I look forward to making this campus my home, but while we’re living out of suitcases for the last six weeks, it’s impossible to be settled. And despite asking and asking the people they’ve told us to ask, no one can tell me if my home is ready for me. The people who will be my next-door neighbors once I move in… they have been living there since the beginning. Sure there may be a problem with my apartment only, but why can no one tell me?

Things are getting better (we’re getting put in touch more directly with the people in charge of housing, IT, and other issues), but there’s still a ways to go. Perhaps with this inauguration over, things will clear up more, but I feel it’s been very trying and a lot to ask of students. And more than students, it has been a lot to ask of the families of students and faculty that have joined them here. Some professors haven’t been able to live in a house with their wives and children under the same roof because their homes aren’t ready.

The coverage of the school that we see is all roses and sunshine. And by and large, I agree – it’s very impressive and I very much look forward to working here. But I take that coverage as a slight. I find the KAUST Inauguration Twitter feed particularly revealing.

On the one hand, it’s hard to look a gift horse in the mouth, but I would a smaller and less problematic gift horse. They’ve given us t-shirts and messenger bags and thumb drives, but I want a web page with the bus schedule on it. They’ve given us apartments with 10 chairs and granite countertops, but I want a reliable internet connection. I don’t need or want the flash – I want the tools I need to do the work and research for which I came to this institution. Access to a printer that works has gone a long way. More paper for it, however, would be much appreciated. All these great whiteboards everywhere in the office area where I do my work are awesome! There are the whiteboards where interesting and important discussions will will take place. Markers would help. I don’t need a doorman at the entrance to every building. I need someone to fix my washing machine.

It’s not as though there aren’t resources enough – it’s as though the pieces are there but they’re not clicking. We have the money to actually have books in the library, but somewhere along the lines, the people in charge of ordering books neglected to do so, and so the staff is driving to Jeddah on a daily basis, buying books at what is essentially Borders, and driving them back here. I’m sure there’s a repository of paper and markers somewhere on campus, for the life of any of us, no one can tell us where that is. There is a symposium today that’s going to be very inspiring and filled with impressive people that I’ve been looking forward to for two weeks. We had to RSVP a week and a half in advance, but I haven’t been told what time it starts or where. And yet no fewer than 6 people have come by my desk to check whether or not my lamp works. My lamp works. My phone and internet connection don’t.

In order to get onto the compound, we have to present student IDs. Presumably, then, people walking into academic buildings carrying a backpack are students and are allowed to be there and are trusted. But I have to sign in at a security desk if I go in the main entrance to my building, and occasionally have my bag searched.

This has grown longer than I intended, but the thing I hope to have impressed upon you is this: I’m grateful to the king. Very grateful, and I wish I knew how best to convey my gratitude. That said, I wish we could get to work, manage ourselves as competent and trusted colleagues. We very much want to build this community and start making our homes here. To the administration: please allow us to do so.

 

How Appropriate

I ran across this in my daily reading. How appropriate that I should run across this video of three Saudi guys “pavement skating” out of a moving vehicle. I’d hate to lose a sandal while attempting this.

Tagged with: