mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > YAFU

Reply
 
Thread Tools
Old 2011-03-11, 00:34   #1
ThomRuley
 
ThomRuley's Avatar
 
May 2003

2×3×72 Posts
Default Yafu batch running

I'm having a really hard time getting the batch processing to work in yafu. Any suggestions? Already tried the docfile method, but maybe I'm misunderstanding it. Any help would be appreciated.

Thanks

Thom
ThomRuley is offline   Reply With Quote
Old 2011-03-11, 02:49   #2
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

22·941 Posts
Default

Quote:
Originally Posted by ThomRuley View Post
I'm having a really hard time getting the batch processing to work in yafu. Any suggestions? Already tried the docfile method, but maybe I'm misunderstanding it. Any help would be appreciated.

Thanks

Thom
Here are a couple examples:

With these contents in a batchfile called worktodo.bat
Code:
factor(rand(60))
siqs(rsa(200))
ecm(rsa(256),100)
factor(rand(80))
you could do, e.g.
Code:
yafu-64k-x64.exe -batchfile worktodo.bat -threads 4 -v
Alternatively, if you wanted to do the same thing over and over, for instance with a batchfile with these contents:
Code:
10^53+53
10^59+59
10^61+61
you could do the following:
Code:
yafu-64k-x64.exe "siqs(@)" -batchfile worktodo.bat
Does that help? If you post examples of what's not working I could try to see what's going wrong.

Last fiddled with by bsquared on 2011-03-11 at 02:50 Reason: repeated redundant question...
bsquared is offline   Reply With Quote
Old 2011-03-11, 03:54   #3
ThomRuley
 
ThomRuley's Avatar
 
May 2003

2·3·72 Posts
Default

Thanks bsquared,

I figured it out -- I was trying to run the command from within yafu. Once I ran it outside yafu, things went fine. Batches are now running on two computers.
ThomRuley is offline   Reply With Quote
Old 2011-06-10, 04:38   #4
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

24×643 Posts
Default

hi b2, just discovered yafu few days ago, and I think this is a brilliant toy! Congratulations, and keep up the good work!
My question would be if there are any chances we run some "loops" (repeat, while, do, for) in yafu, or if there is any chance to use an "if". Well, the "if" is not really necessary, as it can be simulated by some calculus (like "b=a*expression1+(1-a)*expression2" where a is a precomputed expression that takes values in (0, 1), or so), but the loops would be a really kick on!
For example I would like to give to yafu something to do in 3 lines of input, like:

Code:
a=<init_expression>
b=<init_counter>
while (b!=0) do (a=<complicate_expression>; b=<simple_expression>)
of course the while could be on the same line or not, and it could include some "echo" settings to print out the result or not, to speed the things up:

Code:
a=<init_expression>
b=<init_counter>
echo off   //or "noecho"
while (b!=0) do (a=<complicate_expression>; b=<simple_expression>)
echo on   //or just echo, print, etc
a            //this to show the result
any repetitive structure would be highly appreciated by all the community, I am sure...
Anyhow, this is a brilliant program, with or without it.
GL there and happy factoring!
LaurV is offline   Reply With Quote
Old 2011-06-12, 02:21   #5
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

376410 Posts
Default

Quote:
Originally Posted by LaurV View Post
hi b2, just discovered yafu few days ago, and I think this is a brilliant toy! Congratulations, and keep up the good work!
My question would be if there are any chances we run some "loops" (repeat, while, do, for) in yafu, or if there is any chance to use an "if". Well, the "if" is not really necessary, as it can be simulated by some calculus (like "b=a*expression1+(1-a)*expression2" where a is a precomputed expression that takes values in (0, 1), or so), but the loops would be a really kick on!
For example I would like to give to yafu something to do in 3 lines of input, like:

Code:
a=<init_expression>
b=<init_counter>
while (b!=0) do (a=<complicate_expression>; b=<simple_expression>)
of course the while could be on the same line or not, and it could include some "echo" settings to print out the result or not, to speed the things up:

Code:
a=<init_expression>
b=<init_counter>
echo off   //or "noecho"
while (b!=0) do (a=<complicate_expression>; b=<simple_expression>)
echo on   //or just echo, print, etc
a            //this to show the result
any repetitive structure would be highly appreciated by all the community, I am sure...
Anyhow, this is a brilliant program, with or without it.
GL there and happy factoring!
Sorry, I didn't see this thread right away.

I've thought about doing what you're asking for before, but as of now I don't have any plans to work on it. I think it would be a fun challenge, but there are other factorization improvements I'd like to get done first. If I had more time...

Thanks for the suggestion, and I'm glad you like the tool!
bsquared is offline   Reply With Quote
Old 2011-06-12, 09:17   #6
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

305310 Posts
Default

Quote:
Originally Posted by LaurV View Post
any repetitive structure would be highly appreciated by all the community, I am sure...
For a loop in WIN (DOS-batch) you can use something like this:

Code:
@echo off
set /a b=10

:begin
<do what ever you want>

set /a b=%b%-1
if %b% NEQ 0 goto begin
to call a command 10 times.
kar_bon is offline   Reply With Quote
Old 2011-06-12, 11:38   #7
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

24×643 Posts
Default

yes, but you can't pass the variables (dos strings are limited, and files are out of discussion, as being bloody slow!)

just imagine you want to find the order of 3 in 2^x-1 (at least 4 decimal digits in x), with the "snail" algorithm like

Code:
a=3
b=1
m=2^x-1 //some known x, precalculated, not a variable
noecho
while a!=1 
{ 
    a=(3*a)%m
    b=b+1
}
echo 
b
or imagine you want to find the smallest number q for which a given odd p divides 2^q-1, also with a "snail" algorithm like

Code:
b=0
t=1
do with noecho
{    t=t+p
      while !(t&1)   //binary AND, check if t is even
      {  t>>=1       //divide t by 2
          b++
      }
} until t=1
echo b
(this number always exists for an odd p, not necessary prime, and it is a factor of p-1, example: for p=1103, this will very fast produce 29, for 11 will produce 10, for 341=11*31 will produce 10 too, etc, but for high numbers is quite slow, as it has to generate at most p-1 zeros on the tail of t, doing at most p-1 additions and p-1 shifts)

In this cases there is impossible to transfer the parameter "t", or "a" to dos/win and back, you deal with strings of hundreds/thousands characters that can't be stored in environment variables, letting apart the extreme low speed of transferring or printing them at each step.

Let's say that the motivation behind this request is the fact that a guy like me could believe he have found some much faster way to do the things above and he wanna test it.

Last fiddled with by LaurV on 2011-06-12 at 11:55
LaurV is offline   Reply With Quote
Old 2011-06-12, 13:07   #8
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

1101111011012 Posts
Default

In that case the best approach (though it would be staggering amounts of work) would be to integrate YAFU into a much larger computational package like PARI or Sage. Sage at least is geared to streamline the process of integrating the code of others, plus it has a huge developer community.
jasonp is offline   Reply With Quote
Old 2011-06-12, 16:56   #9
Christenson
 
Christenson's Avatar
 
Dec 2010
Monticello

5·359 Posts
Default

Quote:
Originally Posted by jasonp View Post
In that case the best approach (though it would be staggering amounts of work) would be to integrate YAFU into a much larger computational package like PARI or Sage. Sage at least is geared to streamline the process of integrating the code of others, plus it has a huge developer community.
There's an easier way....change batch languages to Perl or something similar.

Let's assume you want to run a bunch of cases, and Yafu will do something that takes a few seconds each time it is given a command line. Then the overhead of perl (which is interpreted) and the system call will be quite small compared to the running time of yafu. Perl is a complete programming language, with all the ifs, do's, whiles, and data structures you might want.

Perl, for what it is worth, seems to be written to minimize the time spent by the programmer writing the program. All the "natural" (common) datastructures like lists and hashes are built into the language, and variables hold strings that might be interpreted as numbers. Want multiple return values from a function? Just have it return a list of length 2, and write
(modulus, exponent) = function(whatever)

Good luck, let us know how it goes.
Christenson is offline   Reply With Quote
Old 2011-06-12, 19:35   #10
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

22·941 Posts
Default

Quote:
Originally Posted by LaurV View Post
In this cases there is impossible to transfer the parameter "t", or "a" to dos/win and back, you deal with strings of hundreds/thousands characters that can't be stored in environment variables, letting apart the extreme low speed of transferring or printing them at each step.
For these types of things you'd probably be better off using PARI/GP. Or coding it yourself in python, java, or (for best performance) C with GMP.

YAFU's arbitrary integer arithmetic isn't anything special anyway. If you wanted to design a loop to factor some custom sequence of integers, then maybe having those constructs within YAFU would be beneficial. But on the other hand, it would be almost as easy to generate a list with some other tool and feed it to YAFU via a batchfile.
bsquared is offline   Reply With Quote
Old 2011-06-13, 02:25   #11
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

24×643 Posts
Default

Quote:
Originally Posted by bsquared View Post
But on the other hand, it would be almost as easy to generate a list with some other tool and feed it to YAFU via a batchfile.
not when each entry in the list (input for yafu call number k) is a function of yafu output number k-1, or even worse, k-1, k-2.... Think about printing 500 or more fibo numbers, or factorials, with that method...

Anyhow, I still like yafu, with no loops and with its... how did you said? "ordinary math" and "nothing special anyway". It is the bloodiest fastest thing I ever saw of this type for what I need to do (and believe me, I tested it!).

Lots of congrats for it!
LaurV is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running YAFU via Aliqueit doesn't find yafu.ini EdH YAFU 8 2018-03-14 17:22
Batch jobs using AWS Batch GP2 Cloud Computing 1 2016-12-07 11:31
14e batch of WU's pinhodecarlos NFS@Home 25 2015-07-25 17:50
Got first batch of TF to 75 Chuck GPU to 72 23 2015-05-10 20:34
Running YAFU lorgix YAFU 9 2012-03-28 03:37

All times are UTC. The time now is 11:18.


Fri Jun 9 11:18:41 UTC 2023 up 295 days, 8:47, 0 users, load averages: 1.31, 1.04, 0.85

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.

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