Having got OVMS 8.3 installed, TCPIP and MOTIF in a useable state on the Alpha 4000 and 4100 (after some kind generosity and help) I've started thinking about how to use the systems.
Four CPUs looked like a good opportunity to make life more complicated and maybe learn something new, whilst getting back-into programming, perhaps.
I wrote a small Fortran Program .F90 (I hope it has some future) in my base priv. user account and tried the 'intrinsic', NUMBER_OF_PROCESSORS which returned '1'
I was expecting to see '4'. $SHOW CPU reveals 4 active cpu's.
I wondered if I need the SMP license to use more than 1 processor, selectively. In general there seem to be several ways of approaching multiprocessing, eg : SYSTEM routine CREPRC and RTL PPL routines - though looking at these it doesn't look like one can select a particular CPU (ie:0 - 3) and the alien - to me - POSIX threads interface routines (kthreads and pthreads?) I believe the HP Fortran with its extensions provides for parallel multiprocessing.
I think i read somewhere that one would normally let the system work out how to best use the CPUs available but I was wondering if there are problems which are ideally suited to having >1 CPU. I did some work many years ago on FPS array processors which I vaguely remember required using parallel programming techniques.
Edited by somersdave on May 11 2009 10:44
Thanks for the pointers. I think I’m starting to ‘get a handle’ on the subject of parallel processing threads and OVMS. The programming concepts manual seems a good starting point and has lots! of info. and some program examples. Plus, the ideas presented by the OpenMP video – as far as I watched it – seemed straightforward. The crucial concept seems to be the ‘Kernel thread’ – prior to which the ‘program context’ (hope I’m getting the terms right) could only relate to a single CPU.
“…, only one of those application threads was running at any one time. If this multithreaded application was running on a multiprocessor system, the application could not make use of more than a single CPU. “
Despite other’s assurances (as Martin above), I had some concern that the system would not use all 4 CPU’s – even though they are declared active (in the light of my question as to whether I might need some special SMP or SMP extensions license). In order to run a simple test, I wrote a little Fortran Program to do some in itself pointless, yet time consuming, CPU intensive sum.
This HP forums question (if i could make the link work) gives some relevant observations:
Each program ran in its own Decterm window. I used the ‘Monitor> monitor system’ and ‘Monitor Proc/TOPCPU’ facilities to observe what happened. Monitor System increases in steps of about 100 (suggesting that each process is takng one CPU) up to the value of 400 for the (misleading?) CPU 0 display. Mon proc/topcpu also showed up to 400 (%?) CPU – so it looks like the all CPUs are being used. I tried adding another concurrent program run (total 5) – result 70 -> 80% CPU per program (that’s perhaps interesting, in respect of how the ‘work’ is shared with the CPUs). I’ll repeat the exercise, adding some calls to timing routines to check elapsed times, in order to see the effect of running single or multiple processes.
I tried to use the ‘set process/affinity’ command but got an ‘insufficient priv.’ error even though I gave the user account ALTPRI and GROUP priv, for good measure. Perhaps I needed to log out and in again.
As I try to avoid booting and powering down the machine other than when I’m ready to try something, I tend to do a lot of reading (and as it’s a hobby activity I tend to get sidetracked a little when interesting items and links, catch my eye) But I’m learning some stuff.