-
Notifications
You must be signed in to change notification settings - Fork 0
SmallapackPortingOnSqueak
Porting the first version of Smallapack on Squeak (in 2006) has not been that easy. Here are a few historical notes taken while porting.
Problems encountered porting Smallapack on Squeak:
first problem: (minor) line end conventions in file.
- I develop under linux where line end convention is LF.
- I found Squeak very tyrannic with its Mac CR convention...
- All my attempts to work around failed and i had to resolve myself converting my files to CR before going to Squeak...
second problem: lack of FFI examples
- How to pass an array of structures? (the Complex Matrix case)
- How to load a library before another? (mostly in Unix environment)
- How to define a specific library path?
All these questions were resolved slowly...
I proposed a new feature to automagically free allocated memory at http://bugs.squeak.org/view.php?id=3692
I did not invent much, this kind of utility exists in VW for a long time.
I also experimented an infinite loop as described at http://bugs.squeak.org/view.php?id=3691
third problem: method can only have 15 arguments
LAPACK have some functions with more than 15...
I circumvent this problem using a trick: pass a single array of arguments.
I implemented Compiler tweak for having this automated (and not crafted by hand...)
This can be found at http://bugs.squeak.org/view.php?id=2918
fourth problem: a strange bug in unix FFI
This bug is described at http://bugs.squeak.org/view.php?id=3929
I remained stuck a long time by this one...
It prevented my SUnit TestCase to work.
I finally solved it and the patch is integrated in Squeak VM. Anyway, Eliot Miranda has totally cleaned FFI on the cog vm
fifth problem: understand Squeak tools Monticello, SqueakMap, ...
Not really a problem, i find Monticello is great.
But as a Newbie, there's always a learning curve...
sixth problem: no Callback framework
I need such framework for example in Schur algorithm (a function for sorting eigenvalues is necessary)
update: it seems now possible with Aliens, but not yet implemented in Smallapack
seventh problem: bugs in Number library
Especially, with floating point arithmetic...
To be fair, most of these bugs are found in major Smalltalk implementations (VW, Squeak, Dolphin, ST/X, gst, ...)
But Squeak had a little bit more bugs than others...
You can see some of my patches at:
http://bugs.squeak.org/view.php?id=3564 , 3568 , 3512 , 3360 , 3504 , 3493 , 3374 , 3373 , 2688 , 3133
What i like in Squeak:
- FFI is somehow more simple than VW DLLCC.
- The ability to work in Smalltalk memory with ByteArray is also simpler than allocating/freeing external heap.
- Squeak community is great.
- Monticello
- Mantis bug database
All in all, porting to Squeak was a very interesting experience!