mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > No Prime Left Behind

Reply
 
Thread Tools
Old 2008-03-09, 19:51   #1
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

33·113 Posts
Default LLRnet enhancements

i looked around the LLRnet sources (*.lua files) and wonder if there is a way to print the date/time in the lresults-file like on the LLRnet-server results.
and i found a way!
it's not the best way but it works fine!

insert the following lines (in red) in the "llrnet.lua" in the function Work() (little above the end of the function, around line 229):
Code:
(...)
      else
	 ClearWorkfile()
      end

   local file = openfile("lresults.txt", "a")
   write(file, format("[%s] ", date("%c")))
   closefile(file)

      if not asynchronous then
	 SendAllResults((sendRetries or 0) + 1)
      end

      SendStructureToAllGUIs("tosend", tosend, 1)
(...)
the output in the "lresults.txt" without these lines:

Code:
329*2^387216-1 is not prime.  Res64: 471878A4A7F58281  Time : 160.390 sec.
Result 329/387216 succesfully sent to the server.
and with these lines:

Code:
329*2^387216-1 is not prime.  Res64: 471878A4A7F58281  Time : 160.390 sec.
[03/09/08 20:37:46] Result 329/387216 succesfully sent to the server.
please make copies of "llrnet.lua" and "lresults.txt" before changes and stop the client.

the time in the result-file and on the client console differ by 2 seconds (result-file minus 2 seconds from console)!

if there're any issues please post them here!

karsten

Last fiddled with by kar_bon on 2008-03-09 at 19:52
kar_bon is offline   Reply With Quote
Old 2008-03-26, 00:45   #2
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

33·113 Posts
Default

here is another enhancement for LLRnet:

insert the following red lines into 'llrnet.lua' (around line# 187, function 'Work()') and all found primes will be written in a seperate file called 'primes.txt':

Code:
(...)
	 -- check user interruption
	 if stopCheck() then
	    return -- return with no error
	 end
      end

   if result == 0  then
     local file = openfile("primes.txt", "a")
     write(file, format("%s %s\n", k, n))
     closefile(file)
   end

      SemaWait(semaphore)

      -- add the result in tosend table and file
      local tbl = { t = t, k = k, n = n, 
(...)
the primes in this file are formatted as one prime per line with 'k n' values.

karsten
kar_bon is offline   Reply With Quote
Old 2008-03-26, 01:09   #3
IronBits
I ♥ BOINC!
 
IronBits's Avatar
 
Oct 2002
Glendale, AZ. (USA)

3·7·53 Posts
Default

I have used that and it works fine listing out just the primes.
I'd like it to report the user that found it and the date to.
Anyway to make it do all that?
IronBits is offline   Reply With Quote
Old 2008-03-26, 03:07   #4
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA

22×112×13 Posts
Default

Quote:
Originally Posted by IronBits View Post
I have used that and it works fine listing out just the primes.
I'd like it to report the user that found it and the date to.
Anyway to make it do all that?
I think Karsten's modification is for the client, not the server, right?
mdettweiler is offline   Reply With Quote
Old 2008-03-26, 03:28   #5
IronBits
I ♥ BOINC!
 
IronBits's Avatar
 
Oct 2002
Glendale, AZ. (USA)

45916 Posts
Default

This is what I use on the Server.
Code:
function OnPrime(t, k, n, job)
   local fileprime = openfile("primes.txt", "a")
   if fileprime then
      write(fileprime, format("[%s]\n", job.resultdate))
      write(fileprime, format(displayFormat.." is prime!  Time : %d.0 sec.\n",
                  k, n,
                  Seconds() - job.seconds))
      closefile(fileprime)
   end
end

Last fiddled with by IronBits on 2008-03-26 at 03:29
IronBits is offline   Reply With Quote
Old 2008-03-26, 03:34   #6
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA

22×112×13 Posts
Default

Quote:
Originally Posted by IronBits View Post
This is what I use on the Server.
Code:
function OnPrime(t, k, n, job)
   local fileprime = openfile("primes.txt", "a")
   if fileprime then
      write(fileprime, format("[%s]\n", job.resultdate))
      write(fileprime, format(displayFormat.." is prime!  Time : %d.0 sec.\n",
                  k, n,
                  Seconds() - job.seconds))
      closefile(fileprime)
   end
end
Hmm. Though I don't know squat about the LUA programming language, it looks like the OnPrime function isn't even being fed the username--so it might be technically impossible to have it output the user for each prime without actually modifying the one of the .lua files (rather than just using the built in OnPrime function thing in the llr-serverconfig.txt file).
mdettweiler is offline   Reply With Quote
Old 2008-03-26, 14:42   #7
AES
 
Jul 2007
Tennessee

25×19 Posts
Default

Isn't "job" the array from the joblist file?

You could just add:
Code:
write(fileprime, format("user=%s\n", job.user))
Function OnPrime:
Code:
function OnPrime(t, k, n, job)
   local fileprime = openfile("primes.txt", "a")
   if fileprime then
      write(fileprime, format("user=%s\n", job.user))
      write(fileprime, format("[%s]\n", job.resultdate))
      write(fileprime, format(displayFormat.." is prime!  Time : %d.0 sec.\n",
                  k, n,
                  Seconds() - job.seconds))
      closefile(fileprime)
   end
end
AES is offline   Reply With Quote
Old 2008-03-26, 15:00   #8
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA

22·112·13 Posts
Default

Quote:
Originally Posted by AES View Post
Isn't "job" the array from the joblist file?

You could just add:
Code:
write(fileprime, format("user=%s\n", job.user))
Function OnPrime:
Code:
function OnPrime(t, k, n, job)
   local fileprime = openfile("primes.txt", "a")
   if fileprime then
      write(fileprime, format("user=%s\n", job.user))
      write(fileprime, format("[%s]\n", job.resultdate))
      write(fileprime, format(displayFormat.." is prime!  Time : %d.0 sec.\n",
                  k, n,
                  Seconds() - job.seconds))
      closefile(fileprime)
   end
end
Ah, I see, I didn't notice that job was an array. Looked like a scalar to me. (since LUA, unlike most other programming languages, doesn't have an easy way to distinguish between scalars and arrays at a glance).
mdettweiler is offline   Reply With Quote
Old 2008-03-26, 23:00   #9
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

1011111010112 Posts
Default

to print all found primes in a seperate file (like Adams version) you can edit 'llrserver.lua' too.
the function 'WriteResultToFile' does such a thing (line 108):

Code:
function WriteResultToFile(job, filename)
   -- write result into lresults file
   local file = openfile(filename, "a")
   if file then
      write(file, format("user=%s\n", job.user))
      write(file, format("[%s]\n", job.resultdate))
      if job.result ~= "0" then
	 write(file, format(displayFormat.." is not prime.  Res64: %s  Time : %d.0 sec.\n", 
			    job.k, job.n, job.result, 
			    Seconds() - job.seconds))
      else
	 write(file, format(displayFormat.." is prime!  Time : %d.0 sec.\n", 
			    job.k, job.n, 
			    Seconds() - job.seconds))

         local fileprime = openfile("primes.txt", "a")
         if fileprime then
            write(fileprime, format("%s %s %s\n", job.k, job.n, job.user))
            closefile(fileprime)
         end


      end
      closefile(file)
   end
end
i couldn't check this if it works. try it.

karsten
kar_bon is offline   Reply With Quote
Old 2008-03-27, 01:58   #10
IronBits
I ♥ BOINC!
 
IronBits's Avatar
 
Oct 2002
Glendale, AZ. (USA)

3·7·53 Posts
Default

Thanks, I'll give it a try.
IronBits is offline   Reply With Quote
Old 2008-03-28, 11:21   #11
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

33×113 Posts
Default small edit ti post #2

in post #2 i gave the hint to create a seperate file for found primes (the client version).

for llrnet users like me with several folders of llrnet-ports/servers (i use a Quad so i got four folders for each of the two servers now) here is another hint:
my folders looks like this:
Code:
[LLRnet_A300_1]
[LLRnet_A300_2]
[LLRnet_A300_3]
[LLRnet_A300_4]
[LLRnet_I5000_1]
[LLRnet_I5000_2]
[LLRnet_I5000_3]
[LLRnet_I5000_4]
prim.bat
tests.bat
where [...] are the folders (A-> AES server, I->IronBits server) and the two batches to show me number of done tests and found primes.

now, edit one line from post #2:
Code:

  local file = openfile("..\\primes.txt", "a")
and the file 'primes.txt' will be generated not in the LLRnet-folder but in the folder above.
so every found prime from every server/port will be written there.
another point: if any prime is found the file exists. after checking you can delete this file and go on.

-> [PseudoCode on]
Code:
if exists(primes.txt)
      ALARM("prime found!")
endif

karsten

Last fiddled with by kar_bon on 2008-03-28 at 11:23
kar_bon is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
srsieve/sr2sieve enhancements rogue Software 304 2021-11-06 13:51
Intel announces multi-core enhancements for Haswell chips ixfd64 Hardware 8 2012-02-10 20:32
llrnet 64 bit balachmar Prime Sierpinski Project 4 2008-07-19 08:21
TODO list and suggestions/comments/enhancements Greenbank Octoproth Search 2 2006-12-03 17:28
Suggestions for future enhancements Reboot It Software 16 2003-10-17 01:31

All times are UTC. The time now is 21:40.


Fri Jun 2 21:40:37 UTC 2023 up 288 days, 19:09, 0 users, load averages: 1.24, 1.16, 1.05

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔