[KSB] Why don't you try it and see? What are you afraid of? Make
sure you have enough disk. In the worst case you will have to take
control of your computer by powering it down. If you afraid of
powering down your computer try it in a virtual machine (you can get
one with GT.M pre-instlaled at http://downloads.sourceforge.net/fis-gtm/Ubuntu804JeosGTMV53002.zip
with instructions at http://downloads.sourceforge.net/fis-gtm/080903-1GTMV53002VirtualMachineInstructions.html).
Tell us how it works.
Regards
-- Bhaskar
Thanks, Bhaskar!
You are right. Now is a time to start. And excuse me for my mistake in
the former code.
The right code is follows:
sample ;
;creates row of simple numbers(1,2,3,5,7,11...)
;and rows of dividers of first simple number(2,4,6...)
;from 1 to Lim
set Lim=1000000
for i=1:1:Lim set ^a(i)=i ;create a row from numbers
s i=1 for set i=$o(^a(i)) q:i="" job a^sample(i,Lim) ;that's it!
quit
a(i,Lim) for j=i:i:Lim kill ^a(j) set ^b(i,j)=j
quit
With do a^sample it is trivial. But with job...
My reasons to afraid:
1)All former mumpses had fixed quality of jobs
2)I was not sure in $order for that case
3)So simple, powerful and elegant things I wrote twice in my practice.
Also I happy to tell you that the problems with my site seems have
coming to the finish.
The new provider now is registering me url for it.
I am waiting for result and after testing will post a new messages.
Alexander.
example1 ;good for initialising the database for future use
;after such operation database answers faster
;select Your Lim value for that
k ^a,^b,^pid
s Lim=1000000,^pid=0,h1=$h
f i=1:1:Lim s ^a(i)=i
f j=1:1:Lim d
.j a(j,Lim)::0 i d c
.e d a(j,Lim) w "L ",j,!
s h2=$h zwr q
a(v1,v2) s ^pid($j)=""
f n=v1:v1:v2 k ^a(n) s ^b(v1,n)=n
k ^pid($j) q
c k p m p=^pid
s c="" f s=0:1 s c=$o(p(c)) q:c=""
s c=p s:c<s ^pid=s w "P ",j," ",s," ",c,!
q
example2 ;
;useful rows of numbers a,b,c
;a is row of simple numbers (1,2,3,5,7,11 ... )
;b is rows with multipliers of natural numbers (2,4,6,8,10 ...)
;c is row of natural numbers (1,2,3,4,5,6 ... )
;ariphmetical task without calculations!
;
k ^a,^b,^c,^pid s Lim=1000000,^p=0,h1=$h
f i=1:1:Lim s ^a(i)=i
s i=1
f s i=$o(^a(i)) q:i="" d
.j a(i,Lim)::0 i d c
.e d a(i,Lim) w "L ",i,!
s h2=$h zwr q
a(v1,v2) s ^pid($j)="",(^b(v1,v1),^c(v1))=v1,c=v1+v1
i c<v2 f n=c:v1:v2 k ^a(n) s (^b(v1,n),^c(n))=n
k ^pid($j) q
c k p m p=^pid s c=""
f s=0:1 s c=$o(p(c)) q:c=""
s c=$g(p) s:c<s ^pid=s w "P ",i," ",s," ",c,!
q
The story about testing and some statistics follows in the next post.
Some statistics:
1) in both examples subroutine a^example* did not called no once as
subroutine
- all the job calls were successful!
2) size of database increased from 477 KBytes to 527195 Kbytes.
3) example1 ran 116 min, max jobs=357, processor load->100%, memory
load->100%.
4) example2 ran 33 min 18 sec, max jobs=293, processor load->100%,
memory load->80%.
As for HP Compaq nc8000 (1700Mhz/512Mb RAM/40GB HDD) is not bad.
I think, it would run too much faster on the multiprocessor compruter,
for these tasks processor is the most critical thing.
Welcome to parallel spaces with GT.M !)
Thanks, Bhaskar, for GT.M and Your advices!