jeudi 27 juillet 2006

Choix de Blender

 Ma première image 3D avec Blender http://www.blender.org/, que je présente ici avec un sourire gêné: il faut bien savoir rire de ses premiers essais! Pour suggérer un peu ce micro que j'ai devant les yeux, j'ai dû apprendre à couper dans le haut d'une sphère pour fabriquer la base, à étirer et à courber un tube pour faire le capte-voix, à imiter l'éclairage de l'écran par derrière et l'effet du voyant qui se trouve dans la base, et à refaire le reflet du capte-voix sur la base. Mais il y manque encore une tonne de détails.

Le texte qui suit est extrait d'une lettre à mon frère Gilles, écrite le 2005-04-23. L'image accompagnant ce texte date d'ailleurs du même moment.

Depuis toujours, je suis demeuré vaguement curieux de la manière de modéliser des images en 3D dans le domaine du logiciel libre. Après avoir examiné toutes sortes d'avenues, je me suis pendant un bon moment concentré sur Sced (scene editor) pour la fabrication des modèles 3d et sur PovRay (Point-of-view Raytracer) pour les modèles d'éclairage, la texturation et le rendering lui-même. Mais Sced vieillit mal, et à plusieurs reprises, j'ai cherché des outils de remplacement pour la modélisation.

J'ai décidé de faire un bon nettoyage dans toutes mes notes à ce sujet, et après examen, me suis senti prêt à choisir Blender (ou Maya peut-être) pour modéliser, compromis bien raisonnable, sachant que je ne retournerai probablement jamais au niveaux de qualité que la production de vrais films demande. Eh bien, ce Blender est assez étonnant. De la même manière que Gimp (ou PhotoShop) sont excellents pour le 2D, Blender vaut la peine pour le 3D (et l'animation, que je n'ai pas vraiment essayée au moment du choix). Je suis plutôt convaincu que cet outil, une fois l'habitude prise de son interface usager, me permettra de construire, sculpter et pétrir rapidement tout objet 3D. Il intègre aussi un textureur et un renderer bien devisés, versatiles et rapides.

Ce Blender tire bon avantage, pour fonctionner agréablement, de ces cartes graphiques accélérées pour le 3D. Plus j'avance dans Blender, plus je me sens enthousiaste. Absents des tutoriels, je découvre quelques outils puissants, par exemple pour la coloration ou le pétrissage d'objets de structure possiblement touffue.

mercredi 26 juillet 2006

Control Data times

 In another life, I was asked to create visit cards for Odyssée Recherches Appliquées in Montréal (a long extinct subsidiary of Odyssey Research Associates in Ithaca). One of the difficulty was computing Bezier curves coefficients, I vaguely remember I wrote a Turbo Pascal helper for this. Shift-click on the image instead of clicking, at least for some Web browsers, to get to the PostScript source without launching a PostScript viewer. I have only little experience with writing PostScript directly, and honestly, I do not wish to extend it ☺. So despite diacritics do not show anymore, I do not intend to debug this.



Université de Montréal

I find myself very lucky of being appointed as a "systems analyst" for the very first job I got in my life (this might be worth the tale, one of these days!) The small team of people (five or six) were taking care of the CDC mainframes of the computing center, at Université de Montréal. Personal computers did not exist yet, it was only natural that hundreds of users had to split the power of a single machine.

Those CDC mainframes, while among the biggest computers available in their time, are tiny by nowadays standards. So, having these machines handle job requests from hundreds of users was quite an achievement. Every second was precious, and charged as such: CPU time and IO time were sold. We were doing strong accounting. Moreover, there was absolutely no kind of ethical problem, at the time, for our team to routinely study how various users were using the mainframe, and pointing them to possible improvements. So, users were educated at being good citizens and sparing resources as much as they could. Merely fooling around or random exploring was not very welcome, offenders could even be expelled and loose their computing privileges.

I immensely enjoyed having to relate with hundreds of researchers, and I guess many liked me as well: the exchanges were surely diverse, fascinating and fruitful. Very often, people stood in my office, enthusiastically teaching me about their work, entertaining me, often with the hope that we can find ways to somehow optimize ther works. No one was really counting his time, we were working nights and days, weekends did not exist (surely weekends existed for many, yet the computing centre was so crowded at all times that, all naive that I was then, this was the impression I got).

Everything was batch on such computers: input from punched cards, output on printed listing (or more rarely, on punched cards), with big magnetic tapes for long term storage (disk storage systems, despite physically huge, were too small and too fragile for that). Interactive work was requiring so much more precious resources than batch processing that it was introduced reluctantly, with circumspection and extreme care. Many computing centre wrote their editor, meant to do appropriate compromises. Ours was called ED, and part of TELUM, a locally developed full telecommunication system for SCOPE, which had none. ED was more an interactive programming shell with an embedded (powerful) editor and a batch submission interface, than a mere editor. TELUM was involving PP programming, of course, but also, PDP-11 code. Two people created a hardware interface between a PP channel and the PDP. Besides participating in the design discussion, my main involvement in it was to create programs to produce hardware cabling diagrams and recipes, and also, a full PDP-11 macro assembler, written in CPU COMPASS. Later, I wrote BONJOUR, which was an alternative shell for ED under TELUM, yet able to collaborate with ED. Hmph! This was one project among a lot of others. I realise that we were doing a lot of things at that time.

Optimization concerns

The nanosecond (which was really a short time interval in these eons) was really deified. I remember having spent three full days optimising about 25 lines of CPU assembler (yet I also remember, many years after, that I was very tired). It was the chore of a relocating loop for a LISP loader a friend and I were writing, and the idea was to be able to fully process the tables at least as fast as they were delivered from disk by the PPU. Some might remember all attention that was given, at the time, to not loose disk revolutions.

The problems to ponder, for a good assembler coder, were to keep busy as many arithmetic units as simultaneously possible, to resolve register allocation conflicts (three types for them) that would prevent the scoreboard from issuing instructions, to tighten loops enough so they fit in the small instruction stack, to minimise the number of no-ops for realigning jump goals, to re-equilibrate code between jumps and flow through tests so RNI is more efficient, to properly "wrap" code around the entry/exit point. Maniacs were considering memory bank conflicts, but this, I usually did not.

The FTN compiler (an optimizing FORTRAN) was taking care of many of these tasks automatically, and was also generating clever code in many circumstances, often to minimise the number of conditional jump instructions and to normalise arithmetic. FTN was a wonder. Many assembler hand coders would not easily outperform FTN generated-code, speed-wise.

Very few people considered or praised the other compilers, but I guess I studied the code generated by everything available. Nobody knows how absolutely clever the COBOL compiler was at doing decimal arithmetic, on a machine not meant for that. So clever, in fact, that I wondered if Seymour Cray did not know it all in advance when he designed the machine. The Pascal compiler, later, was astonishingly sharp generating code avoiding multiplications and divisions, especially while indexing packed structures.

When I see myself programming Python, nowadays, and caring so little about CPU cycles, I sometimes feel I lived many lives ☺.

PPU programming

As one of the very few allowed to do PP programming, I had to be very careful. Any PP bug would usually fully throw the system down, needing a deadstart, and then disturbing a lot of users. Deadstart was sometimes needed to reload new versions of PP code as well (depending on the situation). Always scheduled late in the night, so they less impact users. And lastly, PP bugs could also physically damage the hardware (like PP core memory, or the display tubes of the console, for example). So, this was less fun, and I always have been nervous while performing tests.

Hardware

We got the whole hardware schematics for the CDC machines, as well. I have a funny story about this, where I play the hero! ☺

After the CDC 6000 series, and after Seymour left the company, CDC created the Cyber 70 series. If I remember well, the designer was named Gary Tom — and also a bit known for having an extraordinarily beautiful wife! ☺.

Our Cyber 74 was the fourth or fifth of the series. Even if we had all the schematics, the series was new and the tutorial documentation for technicians was still sketchy and incomplete. The machine suddenly became quite unstable, it deadstarted spontaneously many times a day (we had a bit more than 600 such deadstarts in one month, that makes 20 a day!) and the technicians were just unable to isolate the cause. It lasted for nearly half a year. CDC was a bit desperate, flying in new teams every week, on the premise that if a team does not find quickly what is wrong, they need new blood to try other thinking avenues. They had teams of specialists to study ambient electro-magnetic radiations. All cabling was multiply shielded. Coincidence patterns were tried with the operation of the nuclear laboratory in the university, usage of big machinery in nearby hospitals, etc. The machine was cooked a great deal (that is, the length of the cables were adjusted to augment the synchronicity of transmitted signals). I have a lot of almost incredible tales from that period. One of these nights, for a single example, I surprised the EIC, running out of avenues after having been under sustained pressure for months, with a radiasthesist's device around the machine, in hope the pendulum would hint him at were the problem could be…

At last, Gary Tom himself was flown in to defend the reputation of his design. This is how I met and knew him, and we spent a lot of time together, working and eating on as coincident schedules as possible, and he explained good parts of his design to me, rather thoroughly. Being a software guy, I was fascinated by all this new knowledge. We surely had a lot of fun! After many days peeking around with diagnostics programs and oscilloscopes, Gary went away of the machine, and started studying the detail of how the machine has been cooked for the last months (any change in the length of any cable had to be reported in the cookbook). Gary found the problem by pure thinking, and I was much impressed. It turned out to be one of the transistors, serving as an amplifier for one of the phase clocks, which was very progressively becoming slow (how this was triggering a deadstart sequence, which is a fairly complex process, is fascinating in itself, but would make this blog entry a bit too technical). This slowdown was masked out by all the cable cooking, which had the unrecognized effect of counterbalancing it.

A good while later, long after Gary's visit, one physicist came to us with a strange problem, in which he was telling that one of his eigenvalues was wrong. He took us many days to figure out that at one step of the computation, x = y*z was in fact computed as x = y*z^2. It was not bad code from some compiler bug. The hardware was indeed spontaneously squaring one of the floating operands, without being instructed to do so. Something far from trivial in the opinion of everybody.

After many days, technicians still had no clue for this astonishing mystery, so I decided to get with them and study enough maintenance software to become useful. They were a bit reluctant at first, but finally accepted me. Using better testing tools, I finally found out that the double multiplication occurred if the multiplication instruction was located in a particular spot in the instruction stack (a small hardware cache for tight loops), and only when the first multiply unit was already busy (there were two such units). Then, remembering Gary, I went away from the computer, and started to follow the circuit diagrams carefully (not being used to them). It came to my intuition that the second multiply unit was probably receiving its trigger twice instead of once, maybe because of some pulse reflexion, somewhere. I made the hypothesis that one of the cable was probably not punched in correctly. From the diagrams, there were three possibilities, which I submitted to the technicians (they were not allowing me to handle the thick mass of cables myself). They found a floating cable as predicted.

From that time on, and for many years, I enjoyed a lot of respect and collaboration from the technicians, and from all neighboring sites! ☺

Other anecdotes

Some users never entered a machine room, and for some of them, it was really all mysterious. On CDC-6600 running SCOPE, the command REWIND(file) on punched cards was usable to bring a magnetic tape back to its beginning, and either UNLOAD(file) or EJECT(file) could be used to fully unwind the tape from the vacuum columns and open the protective door. Unbelievable but true, a user once asked me if using the EJECT command was representing a potential hazard for appointed operators…

CDC changed a convention in the naming of files, and a few of specialised applications failed. My boss asked me to write the PSR (programming summary report), euphemism for bug report at the time. He told me the exercise would help me to learn English and get acquainted with the problem submission mechanism, but told he wanted to revise my text before it goes out. So, I took a dictionary for looking up words one by one (using the usual way: seek for French, take English, seek that English to cross-check French, iterating a few times until you think you get a stable meaning among all those being offered). In one introductory sentence, I just wanted to say that the strange file names could not be handled in various ways by the group of applications. I was quite proud to find that fiddle means handling, staying vague on the precise operations being performed. Trying to translate strange yielded queer. After revising the text, once typed on the proper forms by the local secretaries, my boss told me that it could not let my report go, as in English, one should never use those two words in the same sentence. A bit annoyed to start the cycle over, I tried to assimilate yet another English rule. This is only later that I figured out the meaning of what I wrote.

A few years ago, a guy said he found C, as a novice, easier to grasp than Python. Pondering his arguments thrown me into the past and reminded me of Pierre Garneau, an architect (someone who design houses) who was using these CDC machines. Pierre was then giving into FORTRAN programming, with a bit of assembler. Since he had a lot of energy, dynamism and enthusiasm, I had a lot of pleasure diving into various discussions with him. To my surprise, he was pretty reluctant to any form of higher abstractions, like those found in Pascal, LISP or Simula (all popular at the time). He explained to me that whenever using these abstractions, he just could never stop his own mind from translating these into more machine oriented paradigms all along, and this constant translation was more burdening than helpful. So, for him at least, these abstractions were encumbrances. So yes, everything is possible, and it helps me to understand that some people are hardwired so strangely that they might, even today, prefer C to Python! ☺

Opening to the world

My main regret of that time is that it was mostly closed and local. All that work invested in the international networking community could have been pretty useful, and while some was getting through and widespread, most was humble. The time for planetary exchanges, as we know it today, was far from having come yet. People were mainly writing for themselves or for their neighbouring collaborators, it was fairly humble on average. And even when not so humble, as the not invented here syndrome was still strong, this was another reason for wider exchanges to not occur frequently.

From my own little selfish viewpoint, I started what later became Recode in such times. It has been successively written in CDC FORTRAN, COMPASS and Pascal, or a mix thereof. (Overall, Recode has been a long adventure. From Pascal, it was later ported to Turbo Pascal on Apple ][, then IBM-PC, and only later, to Microsoft C. When I learned Unix, I brought Recode there, and adapted it to GNU standards, just for learning them. Someone from GNU discovered it, and liked it enough to make it available there. Only then, Recode became known outside my circle of friends or local CDC users.)

lundi 24 juillet 2006

Français sur ce blog?

 Le drapeau du Québec, ou fleurdelisé, a-t-il été dessiné par un artiste doublé d'un géomètre? ☺ L'histoire du temps aura perdu plusieurs des noms de ceux qui ont participé à son évolution. Quant aux indications chiffrées des proportions de chaque fleur de lysée, absentes de ce schéma, elles font peut-être partie du standard gouvernemental.

Un confrère de travail, Marc Dagenais, me demande pourquoi donc j'ai rédigé les premiers articles de ce blogue en anglais! C'est une bonne question, et comme j'ai toujours beaucoup écrit en anglais, il est bon que je me la repose à moi-même de temps en temps. Comme au tout premier jour de ce blogue, d'ailleurs.

Le fait est que la très grande majorité de mes correspondants (il y en eu plusieurs milliers au cours de toutes ces années), et d'un peu partout sur la planète, se sont généralement exprimés en anglais, quelle que soit leur langue véritable. Bon, il y a bien quelques français, belges, suisses ou québécois qui ont correspondu en langue française (et exceptionnellement, des américains, des russes, des allemands, etc. bien plus cultivés que la moyenne des gens et que moi-même). Il semble qu'en règle générale, l'anglais soit l'esperanto ou le latin de l'Internet. Depuis quelques années, le volume quotidien de ma correspondance a considérablement diminué, et l'anglais est probablement moins nécessaire qu'avant. Est-ce par habitude? Ou y a-t-il d'autres raisons?

Il m'arrive de me dire, à tous les cinq ou dix ans peut-être, que je devrais davantage participer à la vie informatique communautaire de mes milieux plus naturels: Montréal, le Québec, ou plus peut-être plus vastement la francophonie. J'ai essayé plusieurs fois d'ailleurs, mais le peu de respect que je vois de ma langue sur les forums appropriés, me rebute et m'indispose. Les choses ont probablement changé depuis mon dernier essai (je n'ai pas vérifié récemment), mais de mon souvenir, d'un peu partout dans la francophonie, trop de gens émasculent le français de ses nécessaires accents, et au Québec plus spécialement, certains joualisent leur langue autant que faire se peut, d'autres s'amusent du mauvais sort qu'ils font subir à l'orthographe, allant jusqu'à prétendre protéger ainsi une culture pittoresque. Devant mes remontrances, beaucoup de malheureux électrons ont été bousculés par certains, pour justifier leur total manque de bonne volonté, ou pour maquiller une paresse coupable. Bon, évidemment, plusieurs correspondants francophones se comportent très correctement, mais les moutons noirs bêlent suffisamment fort et faux pour rendre mon expérience de participation assez désagréable. Tout le monde peut accidentellement produire de fausses notes, moi le premier. Je me crois tolérant et doux, mais j'ai choisi de ne pas tolérer ceux qui, devant moi, s'en foutent totalement, et qui manifestement, hormis pour créer des panoplies d'excuses échevelées, ne font absolument aucun effort.

De plus, mon franc parler, ou le seul fait d'avoir des opinions, me crée quelques ennemis chez les francophones du coin, et une atmosphère désagréable s'ensuit pour tout le monde. À mes propos, on voit quelques réactions irrationnelles, à la fois féroces et disproportionnées, comme si une simple opinion avait le pouvoir d'atteindre l'intégrité physique de certains, ou de restreindre leur liberté. Suffit-il d'une opinion un peu plus affirmée, colorée, pour déstabiliser la terne grisaille à laquelle ces gens-là sont habitués? Dans cette espèce de rectitude ennuyeuse, prudente, voire frileuse, dans laquelle ils semblent baigner, sont-ils pris de panique dès la moindre vague? J'ai souvent lu des invectives en-dessous de l'élégance, et diverses menaces. Oh, rien qui ne m'effraie. Mais néanmoins, assez fréquemment pour détruire le plaisir du partage. Donc, à moins d'une juste cause à promouvoir, je ne vois pas trop pourquoi j'irais volontairement patauger dans ces eaux désagréables. Il y a tellement d'endroits sympathiques et accueillants un peu partout : il m'est facile de simplement oeuvrer ailleurs.

Oh, bien sûr, la plupart des milieux sont entachés de gens désagréables. Dans une communauté plus vaste, leur influence est davantage diluée, on les sent moins, on les ignore plus facilement. Partout, j'ai rencontré beaucoup de gens intéressants, certains sont extraordinaires, fascinants ou attachants. Dans le fond, le cercle restreint de l'informatique locale est peut-être un peu trop petit, dans les deux sens que l'on accorde à ce mot.

En bref, pour revenir au coeur du propos, et sans l'ombre d'un doute, je préfère lire et écrire en français! Malgré cela, l'usage de l'anglais (et toute boiteuse que soit ma façon de l'utiliser) me donne accès à une vaste communauté de gens agréables, et c'est probablement pour cette raison que j'y recours si souvent. Il est bien possible que j'écrive quelques articles de ce blogue en français de temps en temps, un peu avec l'impression de m'y reposer, pour des gens proches peut-être, ou pour m'écrire à moi-même. Ces tergiversations-ci, par exemple?

vendredi 21 juillet 2006

Trigonometry, revisited

 Four generations in a single picture! From left to right: my sister Claire, her son Jean-Philippe, my father Lucien and his grand-grand-daughter Noémie. (Circa 2004-04)

Many years ago, my younger brother Gilles told me he wanted to learn trigonometry, and merely to help him at doing so, I wrote a fairly compact trigonometry course, yet with an unusual approach: I avoided geometry drawings, sticked to bare essentials, and tried to sketch reasonable proofs. That course succinctly covers exponentials and complex numbers, as well as circular and hyperbolic trigonometry. And besides, this was a good LaTeX exercise for me!

The truth is that, this morning, I needed to check a derivation which I remembered was in that document, so I went for it. Why not take this as an opportunity for making it available? Quickly done! So, here is Trigonométrie revisitée, as well as the equivalent LaTeX sources. I prepared the document with:


  recode -d u8..tex trigo.tex
  pdflatex trigo.tex
  pdflatex trigo.tex


Be warned, however, that this trigonometry course is written in French.

mercredi 19 juillet 2006

Computing with huge arrays

 An amusing optical illusion: while intersections you look at are seen as white dots, the others in peripheral vision are seen as black dots for a small while. Mach's bands? Retinian fatigue? I'm not sure…

In a message to the R mailing list, Thomas Lumley was recently pointing to a Summer of Code project meant to use an SQLite database, for seamlessly accessing a big array from the R Language, that is, much more transparently than with RSQLite. Thomas also said there are only few such projects as a consequence of Moore's law.

This is an intriguing project indeed! However, if R requires uses more swapping because arrays do not all fit in physical memory, crudely replacing swapping with database accesses is not necessarily going to buy a drastic speed improvement: the paging gets done in user space instead of being done in the kernel.

Long ago, while working on CDC mainframes, astonishing machines at the time but tiny by nowadays standards, there was a program (named APEX if I remember well) able to invert or do simplexes on very big matrices. I never studied it but superficially (I was in computer support for researchers, but not a researcher myself). The program was documented as being extremely careful at organising accesses to rows and columns (or parts thereof) in such a way that real memory was best used. In other words, at the core of this program was a paging system very specialised and cooperative with the problems meant to be solved.

However, the source of this program was just plain huge (let's say from memory, about three or four times the size of the sources for the optimizing FORTRAN compiler, which I already knew better as an impressive algorithmic undertaking). So, good or wrong, the prejudice stuck solidly in me at the time, if nothing else, that handling big arrays the right way, speed-wise, ought to be very difficult.

On the other hand, the computational needs for scientific problems grow fairly quickly to the size of our ability to solve them. Let me take weather forecasting for example. 3-D geographical grids are never fine enough for the resolution meteorologists would like to get, and the time required for each prediction step grows very rapidly, to increase precision by not so much. By merely tuning a few parameters, these people may easily pump nearly all the available cycles out the supercomputers given to them, and they do so without hesitation. Moore's Law will never succeed at calming their starving hunger! ☺.

mardi 18 juillet 2006

Welcome to my new Blog!

 This image of a tunnel is really a classic for me. I saved it out as a curiosity, long ago: it was breaking one the GIF colour quantizers of the time. Along the years, I often used it, like a fetish or a mascot, for experimenting with image processors or tools I wrote.

Feeling a bit like experimenting with blogs, I perceive them as a way to quickly push thoughts and ideas out through the door, without necessarily having to overly formalize them right away, if ever. We'll see if this new toy is fruitful or not. Nothing prevents me, anyway, to later move parts of this blog within more formal documents…

Writing English or French? I'm a bit torn, here. My long years of maintenance brought me to write English most of the time. Yet using French is so refreshing! I guess I'll probably do a bit of both, still not sure about how to best sort out the mix, visually.

In any case, I looked around for some blogger which would be at the same time: simple, powerful enough, widely used already, and Pythonesque if possible. Not relying on Web browsers to edit pages is a very strong requirement for me. reStructuredText support was also to be welcome. This is how I picked PyBlosxom as my best bet, to start somewhere.

The initial difficulty, which required a few hours to solve, was to make it work within CherryPy. This Web server seduced me not so long ago, being elegant and simple, while being powerful and Pythonesque, enough for me to ditch my own Web server. Yet, doing so, I was even able to salvage and reuse my templating system, for which many pages have been written already.

It was also easy to kludge things within the blogger so it keeps the overall style of my own web sites. Doing it neatly, however, will require more work: I'll postpone until I get a bit more experience with the beast. Oh joy: the reST parser plugin worked immediately! As for the calendar, seeing that the links are improper, I dummied them for now, and kept the calendar displayed.