mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   YAFU (https://www.mersenneforum.org/forumdisplay.php?f=96)
-   -   YAFU 2.0 (https://www.mersenneforum.org/showthread.php?t=26681)

kotenok2000 2022-08-17 16:35

1 Attachment(s)
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)))[/CODE]

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 ====[/CODE]

EdH 2022-08-17 18:09

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.

James Heinrich 2022-08-18 00:54

[QUOTE=James Heinrich;610801]I wrote a PHP script to convert [c]factor.log[/c] to [c]factor.json[/c][/QUOTE]In case it's useful to anyone else, I wrote a small PHP script to convert [c]factor.json[/c] to simple [c]composite=factor1*factor2[/c] 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";[/code]

chris2be8 2022-08-18 15:42

[QUOTE=kotenok2000;611643]Can you tell me why doesn't siqs output show on screen when using this perl script?
[/QUOTE]

From ali.pl.txt:
[code]
open(YAFU, "./yafu \"factor($composite)\" -threads $yafuthreads|") or die "Couldn't start yafu!";
while (<YAFU>) {
print "$_";
[/code]

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.

kotenok2000 2022-08-18 15:52

1 Attachment(s)
But gnfs output is displayed correctly.
Maybe some output is send to stderr and some to stdout and perl relays only stdout?

bsquared 2022-08-18 16:49

gnfs output contains newlines.

siqs progress output does not... only carriage returns (\r)

kotenok2000 2022-08-18 16:51

Can yafu be modified so siqs output also contains newlines?

EdH 2022-08-18 17:50

[QUOTE=kotenok2000;611702]Can yafu be modified so siqs output also contains newlines?[/QUOTE]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.

kotenok2000 2022-08-19 10:28

Does yafu 2 still support old cpus without avx?

chris2be8 2022-08-19 15:43

Your best option is probably to call yafu as [c]system("./yafu \"factor($composite)\" -threads $yafuthreads -logfile yafu.log");[/c], 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.

BudgieJane 2022-08-19 22:50

[QUOTE=bsquared;611633]For me, either of the following work in yafu.ini:
[CODE]jsonpretty
jsonpretty=1[/CODE]

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.[/QUOTE]

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?


All times are UTC. The time now is 03:41.

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