mersenneforum.org > YAFU Yafu batch running
 Register FAQ Search Today's Posts Mark Forums Read

 2011-03-11, 00:34 #1 ThomRuley     May 2003 3678 Posts 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
2011-03-11, 02:49   #2
bsquared

"Ben"
Feb 2007

25·3·5·7 Posts

Quote:
 Originally Posted by ThomRuley 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...

 2011-03-11, 03:54 #3 ThomRuley     May 2003 13·19 Posts 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.
 2011-06-10, 04:38 #4 LaurV Romulan Interpreter     Jun 2011 Thailand 24·571 Posts 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= b= while (b!=0) do (a=; b=) 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= b= echo off //or "noecho" while (b!=0) do (a=; b=) 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!
2011-06-12, 02:21   #5
bsquared

"Ben"
Feb 2007

64408 Posts

Quote:
 Originally Posted by LaurV 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= b= while (b!=0) do (a=; b=) 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= b= echo off //or "noecho" while (b!=0) do (a=; b=) 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!

2011-06-12, 09:17   #6
kar_bon

Mar 2006
Germany

1011001100102 Posts

Quote:
 Originally Posted by LaurV 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.

 2011-06-12, 11:38 #7 LaurV Romulan Interpreter     Jun 2011 Thailand 24·571 Posts 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
 2011-06-12, 13:07 #8 jasonp Tribal Bullet     Oct 2004 2·3·19·31 Posts 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.
2011-06-12, 16:56   #9
Christenson

Dec 2010
Monticello

5·359 Posts

Quote:
 Originally Posted by jasonp 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.

2011-06-12, 19:35   #10
bsquared

"Ben"
Feb 2007

25·3·5·7 Posts

Quote:
 Originally Posted by LaurV 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.

2011-06-13, 02:25   #11
LaurV
Romulan Interpreter

Jun 2011
Thailand

24·571 Posts

Quote:
 Originally Posted by bsquared 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!

 Similar Threads Thread Thread Starter Forum Replies Last Post EdH YAFU 8 2018-03-14 17:22 GP2 Cloud Computing 1 2016-12-07 11:31 pinhodecarlos NFS@Home 25 2015-07-25 17:50 Chuck GPU to 72 23 2015-05-10 20:34 lorgix YAFU 9 2012-03-28 03:37

All times are UTC. The time now is 00:00.

Sun Jan 17 00:00:58 UTC 2021 up 44 days, 20:12, 0 users, load averages: 2.32, 1.79, 1.61