mersenneforum.org > YAFU YAFU 2.0
 Register FAQ Search Today's Posts Mark Forums Read

2022-08-17, 16:35   #408
kotenok2000

Mar 2018

2×52 Posts

Can you tell me why doesn't siqs output show on screen when using this perl script?

Code:
==== sieving in progress (8 threads):  101408 relations needed ====
====           Press ctrl-c to abort and save state           ====
2789 rels found: 2583 full + 206 from 172505 partial, (9836.93 rels/sec)))
When running through ali.pl i only see this:
Code:
==== sieving in progress (8 threads):  101408 relations needed ====
====           Press ctrl-c to abort and save state           ====
Attached Files
 ali.pl.txt (3.6 KB, 11 views)

Last fiddled with by kotenok2000 on 2022-08-17 at 16:37

 2022-08-17, 18:09 #409 EdH     "Ed Hall" Dec 2009 Adirondack Mtns 114558 Posts It looks like if I compile Msieve with CUDA support, it doesn't make its way into YAFU. I get CUDA errors. I would have to run down everything one-by-one, which I can't currently see myself doing real soon. I might play at it again at some point, but not for now. Thanks for all.
2022-08-18, 00:54   #410
James Heinrich

"James Heinrich"
May 2004
ex-Northern Ontario

F0616 Posts

Quote:
 Originally Posted by James Heinrich I wrote a PHP script to convert factor.log to factor.json
In case it's useful to anyone else, I wrote a small PHP script to convert factor.json to simple composite=factor1*factor2 style for submission to factordb.com (which doesn't currently support the new YAFU factor.json format).
Code:
<?php
// parse YAFU factor.json lines into COMPOSITE=FACTOR*FACTOR result lines for factordb.com

if ((count($_SERVER['argv']) != 2) || !preg_match('#\\.json$#i', $_SERVER['argv'][1])) { echo 'Usage: php '.basename(__FILE__).' factor.json'."\n"; } elseif (!file_exists($_SERVER['argv'][1])) {
echo $_SERVER['argv'][1].' does not exist'."\n"; }$result_lines = '';
foreach (explode("\n", file_get_contents($_SERVER['argv'][1])) as$linecounter => $line) { if ($line = trim($line)) { if ((substr($line, 0, 1) == '{') && (substr($line, -1, 1) == '}')) { if ($JSON = json_decode($line, true)) {$result_lines .= $JSON['input-decimal'].'='.implode('*',$JSON['factors-prime']).(!empty($JSON['factors-composite']) ? '*'.implode('*',$JSON['factors-composite']) : '')."\n";
} else {
echo 'error '.__LINE__.': json_decode() failed on line '.($linecounter + 1).' of '.$json_filename.':'."\n".$line."\n\n"; exit(1); } } else { echo 'error '.__LINE__.': unexpected line '.($linecounter + 1).' in '.$json_filename.':'."\n".$line."\n\n"; exit(1);
}
}
}
echo $result_lines."\n"; 2022-08-18, 15:42 #411 chris2be8 Sep 2009 45278 Posts Quote:  Originally Posted by kotenok2000 Can you tell me why doesn't siqs output show on screen when using this perl script? From ali.pl.txt: Code:  open(YAFU, "./yafu \"factor($composite)\" -threads $yafuthreads|") or die "Couldn't start yafu!"; while (<YAFU>) { print "$_";
AFAIK output from yafu get's buffered somewhere, it will only be passed to your script when yafu has output a complete line. But the progress will be output by yafu as some text, without a newline, then control chars to get back to the start of the *same* line on screen. So your script won't get anything to print until yafu has finished sieving.

I don't know any way round this though.

2022-08-18, 15:52   #412
kotenok2000

Mar 2018

5010 Posts

But gnfs output is displayed correctly.
Maybe some output is send to stderr and some to stdout and perl relays only stdout?
Attached Files
 bandicam 2022-08-18 18-48-40-848.mp4.zip (600.7 KB, 8 views)

 2022-08-18, 16:49 #413 bsquared     "Ben" Feb 2007 2×11×167 Posts gnfs output contains newlines. siqs progress output does not... only carriage returns (\r)
 2022-08-18, 16:51 #414 kotenok2000   Mar 2018 2·52 Posts Can yafu be modified so siqs output also contains newlines?
2022-08-18, 17:50   #415
EdH

"Ed Hall"
Dec 2009

10011001011012 Posts

Quote:
 Originally Posted by kotenok2000 Can yafu be modified so siqs output also contains newlines?
You can modify the YAFU code, but your output would scroll everything continuously. I don't have time to search right now, but there is a way to empty the buffer periodically with either Python or Perl. I don't remember which I was working with for that at the time. That is where you should look for a solution. If I can, I'll try to find more info later. I'm kind of tied up right now.

Another option you might consider is calling YAFU via a system call rather than a Perl call. That should give you the standard YAFU output. You may need to handle the results a bit differently, though.

ETA: You could look at "Perl STDOUT->autoflush(1)" to see if it might help.

Last fiddled with by EdH on 2022-08-18 at 17:59

 2022-08-19, 10:28 #416 kotenok2000   Mar 2018 628 Posts Does yafu 2 still support old cpus without avx?
 2022-08-19, 15:43 #417 chris2be8     Sep 2009 3·797 Posts Your best option is probably to call yafu as system("./yafu \"factor($composite)\" -threads$yafuthreads -logfile yafu.log");, then parse yafu.log to find the factors once it has finished. Then delete yafu.log etc to tidy up. That's basically what my scripts to factor small composites in factordb do.
2022-08-19, 22:50   #418
BudgieJane

"Jane Sullivan"
Jan 2011
Beckenham, UK

4738 Posts

Quote:
 Originally Posted by bsquared For me, either of the following work in yafu.ini: Code: jsonpretty jsonpretty=1 Things to check: 1) make sure you have the latest .exe. I updated the executable without tweaking the version number, so you'd have needed to re-download it. 2) If the statement is the last line of the file, make sure it has a newline/carriage return. 3) I have only tested on linux and windows. I have no idea how something different could change the results but stranger things have happened.
I have the latest .exe: if I put -jsonpretty on the command line it works.
The statement is not the last line of the .ini file.
I'm using windows.

[Edited at quarter past midnight.]
Because I'm running this by means of a system call from another program, the yafu.ini I need to amend is the one in the other program's home directory and not the one in yafu-2.09. As soon as I add jsonpretty to that file, all works as it should.

How can I tell yafu-2.09 to use its own yafu.ini file instead of the yafu.ini file in the current directory?

Last fiddled with by BudgieJane on 2022-08-19 at 23:24 Reason: It's amazing what forty winks will do to help you remember things.

 Similar Threads Thread Thread Starter Forum Replies Last Post chris2be8 YAFU 9 2022-02-17 17:52 EdH YAFU 8 2018-03-14 17:22 bsquared YAFU 119 2015-11-05 16:24 storflyt32 YAFU 2 2015-06-29 05:19 bsquared YAFU 28 2012-07-20 16:17

All times are UTC. The time now is 20:16.

Sun Oct 2 20:16:12 UTC 2022 up 45 days, 17:44, 0 users, load averages: 0.99, 1.08, 1.14