Monday, April 30, 2007

If you need hypre on your Mac!

[This piece was originally written for the hypre support mailing list. I guess this can be of some use to people in the same situations, so I also post it here. If you don't understand what this is all about, you can visit the hypre webpage at LLNL, or you can just move on...]


Hi hypre-list,

As far as I can tell, MacOSX (Darwin) is not supported by hypre. We are however building a piece of sotware at Simula Research Lab, Norway, where we have added hypre as one of the dependenices (mainly for BoomerAMG), and since we need to support MacOSX, I went through the necessary steps for building hypre on MacOSX. I share it on this list as plain text now. If you in the future want to support Mac, and want help with testing or anything (patches?), just contact me!

I have to admit, some of my changes are a bit hack'y, my motivation was to get things going; I'll see if I can clean up things later. For reference, I am working with hypre-2.0.0 as downloaded from http://www.llnl.gov/casc/hypre/software.html in mid-april 2007.

This is how I run configure:
LDFLAGS="-framework vecLib -flat_namespace" CXX=g++-4 F77=gfortran ./configure --without-MPI --enable-shared --prefix=$HOME/software/hypre --without-fei --without-superlu --without-mli --with-blas --with-lapack


* First, I needed to add a "Darwin" section in the script src/configure, around line 9885:
---8<---
Darwin*) FFLAGS="${FFLAGS} -fno-common -fPIC"
CFLAGS="${CFLAGS} -fno-common -fPIC"
CXXFLAGS="${CXXFLAGS} -fno-common -fPIC"
BUILD_F77_SHARED="${F77} -flat_namespace -dynamiclib -undefined dynamic_lookup"
BUILD_CC_SHARED="${CC} -flat_namespace -dynamiclib -undefined dynamic_lookup"
BUILD_CXX_SHARED="${CXX} -flat_namespace -dynamiclib -undefined dynamic_lookup"
;;
---8<---

* Next problem was with multiple definitions of symbol 'final_innerprod_result', which appear as a global symbol in both src/struct_mv/struct_innerprod.c and src/struct_mv/struct_overlap_innerprod.c. To fix this, I changed the symbol to 'final_overlapinnerprod_result' in src/struct_mv/struct_overlap_innerprod.c.

* The common way to use blas and lapack on MacOSX is with the '-framework vecLib' LDFLAG. Because of this, the variables 'LAPACKLIBDIRS' and 'BLASLIBDIRS' in config/Makefile.config contains 'null' after finished configure. This is probably something that should be fixed in config/Makefile.config.in or in the configure script, but for now I just removed 'null' such that those variables read:

LAPACKLIBDIRS =
BLASLIBDIRS =

* There are some paths that seems to be hardcoded that end up in LDFLAGS in Makefile.config; after configure I have '-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.3' in there. On Darwin, gcc exit with an error if non-existent directories are passed in with -L flag, so this path must be removed. Also, /usr/apps/libs and /lib are in there. I removed all three in the configure script.

* On Darwin, dynamic libs should have the suffix .dylib, not .so. Unfortunately, .so is hardcoded into the hypre buildsystem. I tried to do something such that the same buildsystem could do both .so and .dylib, based on platform, but it took more effort than the hour I was willing to spend :) Renaming the compiled .so into .dylib seems to be sufficient, at least to compile and run some of the tests. So, while this is something that have to be fixed if Darwin is to be supported, it is not a showstopper.

As far as I can tell from the notes I made during my work on this, you'll have a working hypre on MacOSX after working through these steps.

Hope this can be of some help!

Qtpfsgui 1.8.5 for MacOSX

The new version of qtpfsgui, v.1.8.5, for MacOSX can now be downloaded from the qtpfsgui page at sourceforge. New with this release is that you have a choice. You can either get a small package with just the qtpfsgui program, or you can get a larger package that bundles the necessary Qt libraries. I know there has been some confusion about this in the past.

If you want to run other Qt applications as well, or you already have downloaded and installed Qt v.4 from Trolltech, you can choose the small package, names qtpfsgui.1.8.5.dmg. If you just want to run this, and don't want to care too much about dependencies you can grab qtpfsgui.1.8.5.qt.dmg.

New with this version is also that I have put the manual into the application bundle. Unfortunately, the path to the manual is hardcoded in for now, so it will only work if you place the qtpfsgui application bundle in /Applications. If you do that, you can open the manual directly from the Help menu.

For other, non-Mac related, news for the program, check out the sourceforge projectpage.

Go create some HDRs! And comments are welcome, as always!

Saturday, April 28, 2007

How I get the Nokia E61i working for me

These are some notes a made while setting up the Nokia E61i phone such that it works for me.

My main requirements are:
  • Beeing able to call people from my phone (!)
  • Reading email, both my company imap account and GMail.
  • Syncing events and contacts with my MacOSX computer
  • Ssh from the phone
  • Using phone as modem for the Mac
  • Using phone as modem for my linux laptop
  • More secondary, IRC, GTalk, MSN, etc. from the phone.
  • And probably some more
During the first day, I just poked around on the phone, tried to figure out the Nokia S60 system. As I always have been a Sony Ericsson guy, this is all new to me. But fortunately quite easy to figure out. And I was of course able to call people and send SMS right away.

Email


Setting up email for my company account took me a few minutes. First time I started the email application on the phone, it asked me whether I wanted to set up an account. Sure, I did, so I went through the wizard, entering in imap and smtp server, account information and so on. After that, nothing works. Of course, I knew that our server requires SSL/TLS, but as I was not asked about security during the wizard phase, I just assumed it detected these things by it self. But it didn't. After consulting the booklet that came with the phone, I figured out where to go. After turning on SSL/TLS for both in- and outbound messages, and entering account information for our smtp server, I can send and receive messages. It even supports the concept of selecting a subset of folders on the imap server for synchronization, and actually just shows me thoses selected folders when I open the mail application. A life-saver for me. Now, I have set the phone up to automatically download email from 3 different folders, every day of the week between 16:00 and 02:00, every half hour. That should cover my requirements just fine.

Then I moved on with GMail. First, I opened the webbrowser using the WiFi connection we have at home. Entered in http://gmail.com, and on the top of the GMail page I was asked whether I want "Faster GMail for phone". Of course I want faster GMail, so I followed the link. This downloads a S60 (or maybe Java?) application that works quite nice on the E61i. So far I have to select the internet connection to use for the GMail application each time I start it, but I guess this is something that can be adjusted.

Bluetooth


Bluetooth is of course working flawlessly on this device. New to me was that I had to go into the Bluetooth system after pairing a device to mark it as an authorized device. On devices I have had in the past, this was a question during the pairing phase. But as soon as I figured this out, it really doesn't matter - just different ways of doing things.

After sending a few pictures to the desktop Mac just to see that Bluetooth is working, I proceed to the syncing issue. Actually, I attached the usb-phone cable first, and started iSync, but scan for new device in iSync does not find the phone. So I went to goole instead, and found this page at Nokia where it is possible to download an iSync plugin for many Nokia phones, the E61i beeing among them. As told on that page, I closed iSync, installed the plugin. Then I used the "Setup new Bluetooth device" in the Bluetooth system on the Mac, and put the phone in discoverable mode. The phone was detected just fine, and I had the option of selecting it for iSync use and as a modem. I selected both. Now iSync started up in the configure new device mode, with some reasonable defaults. I adjusted which calendars in iCal to synchronize with the phone and did a few other adjustments. Then I pressed the "Sync Devices" button in iSync, and suddenly all my events and all my contacts are on the phone. Quite nice.

As I selected the phone for use as a modem during the Bluetooth setup, that is probably ok already, but it remains to be tested.

Other connectivity from the phone


Ssh from the phone is coverd by installing PuTTY for S60. As stated on the s2putty page right now, I went for the "unofficial build" of PuTTY, as some nasty bugs on v.3 of S60 have been clean up in some recent builds. This PuTTY works very well. Actually, I went to the s2putty page using the browser on the phone on my WiFi connection, dowloaded a zip with the application. Within a minute, it was downloaded, installed, and running. As the E61i have a full keyboard, even with a Ctrl key, I can connect to a linux server at work, attaching a screen I have running, and instantly chat on irc channels and read news. And do all sorts of other things I regularly do in a shell.

As I want to be able to use Skype, GTalk and maybe even MSN from the phone, I also installed fring. The installation and getting started part is very nicely covered on that webpage, so I want say anything more about it. Just go there, type in the required information. You will then get a text message with download instruction, and in just a few minutes you have all the internet-phone and chat connectivity you ever want.

From time to time I may want to IRC directly from the phone. To cover this, I installed mIRGGI. It just works. Probably, I will usually use PuTTY, and the screen on my linux server, if I need to use IRC, but you'll never know. It is nice to have.

As you can see, most things are comming along quite nice. I guess there will be annoying things creeping up when I dig deeper down, but so far I am happy with the E61i. I will get back with a review on how it works for me in the daily life after I have used it for a week or two.

Stay tuned, and take care!

Thursday, April 26, 2007

Have to move on...

It feels like it was yesterday I bought the HTC TyTN. Of course it was not, it was back in November 2006 according to the archives in this very blog. Back then I threw out the Sony Ericsson M600 due to lack of support for MacOSX, and bad support for Linux too. Although I have been quite happy with the TyTN during these months, there are some issues of course.

First it is the OS. I have never had a phone in the past I need to reboot that often. Sorry Microsoft. In the past I just told everyone that you are bad, and that people should choose something else (Linux, MacOSX, Symbian, Whatever). Now that I have actually used a Windows Mobile for some months, I can put so more momentum into those statements. Sure, WM6 will fix all the problems. Right, I don't believe it. And there are no WM6 upgrade for TyTN out there yet. When the phone is working it is quite ok, though. Even though I can not get the Imap client to just show me subscribed folders, and the camera freeze quite often (easily fixed with a reboot...), I can read and send messages, receive and call contacts and listen to music, snapping photos (as you can see over at my photoblog) and browsing web quite well. So the TyTN is not that bad. And the full keyboard is a life saver, the best I have ever had on phone or pda so far. Based on all the nice things with the phone, I can actually live with the bad OS, and keep it.

It is the second problem that make me switching again. The hardware is not holding up much longer. Every other time I switch the phone out of standby now, the screen just goes white. Turning on and off again usually fix the problems, but from time to time I also need to pull out the keyboard and push it back in again. Then there are the keys on the front. Earlier I could scroll with the directional buttons and press the mid button to select. But this does not work so well any more. Some of the other keys have problems as well. I suspect the reason to be the connection between the bottom "keyboard" part and the upper "display" part. There must be some weakness in the design there. Maybe this can be fixed by sending the phone off to support, but in the long run I can't live with this stability. When I get a new phone probably check out what support can do for me - if they can fix the problem on the TyTN I'll probably keep it as a backup; and for use on HSDPA networks...

The big question is then - where should I go now? Back to the SE M600i is not an option, as it is still not supported very well on MacOSX. That throws out the rest of the SE smartphones as well. And I do not want a Microsoft WM5 or WM6 device. That rules out most of the other smartphones on the market, at least with a qwerty keyboard, which is one of my requirements. And as you all know, iPhone is not out yet. And it will not have a real keyboard anyway. But Nokia have something - the revised version E61i which has a full keyboard, all the connectivity I need but the HSDPA, which is not that important yet anyway, since it is in general not available. MacOSX support also seems to be quite ok for Nokia S60 phones, and there are ssh client software available.

I have therefore ordered a Nokia E61i today. As it is on stock, it should appear already tomorrow or on monday. A report will appear here shortly after that.

So long folks, take care.

Monday, April 16, 2007

If you ever make my mistakes!

Recently, I created a quick and dirty webapplication using Turbogears and SQLObject. During the initial phase, I had some problems with unicode strings, but figured out that I could use UnicodeCol in SQLObject, and append '?sqlobject_encoding=latin1' to the dburi setting for the turbogears project.

Later on, a new requirement for the project came up. Someone had to be able to download a file with infomation in an excel file. From before I had created excel files from mysql data in PHP and Perl using the SpreadSheet::Writer module (and the PHP equivalent). I just assumed this to be a walk in the park, recreating the same functionallity in my turbogears site. As you might expect (or even know), I was wrong. To this date, I can not find the same or a similar well-working module for Python. As an old (not that old really) Perl hacker, I have at least some amounts of the right lazyness. I can of course just reuse my old PHP solution, using some suitable rewrite rules in the apache2 config for the turbogears site. And this is where my problems begin. Getting things up and running is easy enough, we are only talking reading mysql data here, and figuring out the tables in mysql that the SQLObject based model is using is simple. But, and this was the hard part, I figured out that I had done something stupied. The mysql-tables is actually latin1, as I have told SQLObject in the dburi setting. But the texts inside these latin1 tables is encoded by Python in some unicode form, using latin1 characters. Which mean that when I read mysql data in PHP and feed into an excel file, I don't get the right thing. Using default values, I get garbage. Trying to set either latin1, iso-8859-1, or utf-8 as character set for the excel file also yields garbage.

Somehow, I have to translate the encoded unicode strings (by Python) into something that at least works in PHP, which in the next step can be put into an excel file and still be readable.

And then, by accident, I stumbled upon the solution. There is a function in PHP called utf8_decode. It's purpose is to convert a iso-8859-1 encoded unicode-string into single-byte iso-8859-1. Which happens to be exactly what I was looking for.

It took me a couple of hours of googling and experimenting before I ended up there. Now that I know the solution the whole thing is of course obvious. But if you make the same mistakes as me, you may like to read this, and save a few hours.

The right solution, of course, is to use utf-8 all the way. If the unicode data have been stored in unicode mysql tables as unicode, the whole thing should have worked right out of the box. So doing that may save you from the whole problem. Good luck!

Thursday, April 12, 2007

Truffet av en bil!

For all my faithful english readers. This is about the crach I had today. On my motorcycle. And I keep it in Norwegian this time. Sorry. You can just learn Norwegian, though. Right.

På vei hjem fra jobb i dag skjedde det som ikke skal skje. Jeg ble truffet. Truffet ganske så brutalt. Rett bakfra. Litt bakgrunns-informasjon er nok på sin plass. Jeg kjører motorsykkel. Og som alle andre motorsyklister liker jeg veldig dårlig at noen
He killed my bike!får lyst til å kjøre i meg. Det kan nemlig gjøre vondt. Veldig vondt. Vondt for sykkelen, og vondt for meg. En sykkel skal kjøres når det er vår, den skal kjøres når det er sommer, og den skal kjøres når det er høst. Den skal ikke stå på verkstedet. Når den får vondt må den på verkstedet. Derfor liker vi veldig dårlig at den får vondt.
Og så var det føreren da. Han får også vondt. Ryggen verker, er øm og er stiv. Han får slenge innpå noen piller som legen har gitt. Så får han ta en tur på røntgenstua. Der sier de forhåpentligvis at alt er bra. Men om det skulle bli plager i etterkant er det fint å ha noen papirer å vise frem, om at man ble undersøkt. Forsikringsselskapene vil nok like det.

Nå lurer du veldig på hva som egentlig skjedde. Denne syklisten er for lite EBS. Det var det som skjedde. Hadde han vært skikkelig EBS hadde han nok kjørt på det grøde lyset. Men han var rolig idag, var på vei hjem fra jobb. Solen skinte, det var vakkert vær å kjøre i, og han stresset ikke. Utover Mosseveien. Der hvor Ljabruveien tar av er det et lyskryss. Han kjører her hver dag, så han vet det. Før han kommer til lyskrysset møter han noen blinkende oransje lys. De blinker ikke hver dag, bare av og til. Og idag gjør de det. Lyskrysset like der fremme, rundt svingen, er i ferd med å skifte fra grønt til rødt. Han bremser. På høyre side av veien står det noen fotgjengere. De vil over, og har trykket på knappen. Motorsyklisten gløtter i speilet, ingen der, bremser greit raskt ned, og stopper. Beina settes i bakken. Da hviner det, før det smeller, før han ligger der. Hva skjedde, tenker han. Setter seg fortumlet opp, ser på sykkelen som ligger slengt. Glass rundt omkring. En bil veldig nær. En fin bil er det, men ikke nå lengre. Sykkelen var også fin, men ikke nå lengre den heller. Ikke starter den engang. Og skjermen bak og setedelen er ødelagt. Er hele sykkelen blitt skjev? Det kan se sånn ut, men det gjenstår å se. Og hva med han bilføreren da? Så han ikke lyset? Nei, han gjorde vist ikke det. Han så noe annet, eller satt i andre tanker og så ingen ting. Han så ihvertfall ikke den sinna Hornet'en som sto der, med en not-EBS som tar seg bryet med å stoppe for rødt lys, oppå. Sånt kan skje en vakker vår dag.

Så nå sitter jeg her da. Sykkelen er satt på verkstedet. Der har de vår-kjør med vår-puss av syklene til alle de som er alt for sent ute. 3-4uker sa han, det vil det minst ta før han kan begynne på min. Så der ryker April. Kanskje litt av Mai også. Ikke rart sykkelen er lei seg, den vil jo være der ute på veien. Der det skjer. Ikke stå inne i en mørk garasje.

Mens sykkelen står inne skal nok jeg skaffe seg ryggskinne. Det hadde jeg nemling ikke. Jeg hadde ryggsekk med en Macbook Pro oppi, men det er dumt å la den være ryggskinne for mange ganger. Kanskje oppgradere forsikringen litt også, det var vist ikke noe veihjelp med der. Og så må jeg vel ringe med forsikringsselskapet og mase om oppgjør, sende regninger for bilberging, konsultasjoner og medisiner. Og håpe at alt går glatt. Tross alt sto jeg stille på rødt lys, så det skulle være enkelt for dem dette. Håper jeg.

Det var dagens historie. Jeg får komme tilbake til saken når jeg vet noe mer. Om sykkelen som står der i den mørke garasjen. Om forsikringen. Om skrotten min, om den er like hel og fin, bare den får slappet av litt. Og om bilisten, stakkars, som fikk ødelagt sin fine bil. En spesiell bil var det. Jeg kan ikke si mye om den, det blir alt for identifiserende. I guttedagene var det en slags drømmebil det der, bare synd at jeg skulle stifte bekjentskap med den på nært hold på den måten. Men jeg er jo ikke noen guttunge lengre heller, og tross alt var det bare et bur. Som alle andre bur.

Wednesday, April 11, 2007

Programming GPU!

I'm attending a short introductory course on parallel programming on graphics processors (GPGPU) today. There is a writeup of some of the stuff I learned over at my tumbler-page.I keep it over at tumblr as it needs to be cleaned up a lot to make it reasonably interesting for other people. But if you read and think like me you may find it interesting!

If I ever do some real GPGPU my self, I may write up something here :)

Sunday, April 01, 2007

iPhone release date

As reported "all over" the net now, Apple will go public with iPhone on 11. June. And that is not a coincidence, as that's the same day Apples developer conference WWDC starts.

And guess what - I ordered my tickets for WWDC yesterday - I will be there in the middle of the buzz, and report back right here on the blog on what's going on. I also figured out that Usenix Annual Tech will be the following week in Santa Clara. It is high time I go to the Annual Tech, so I will probably rent a car and drive down there, at least for a few days.

I'm looking forward to it already - it is always nice to be in San Francisco.

Btw, I don't think I will buy an iPhone. Really. It's probably not usable over here in Norway anyway, and it will lack a few things I really need. We'll see what happens if I get to hold it in my hands....