mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > YAFU

Reply
 
Thread Tools
Old 2022-08-17, 16:35   #408
kotenok2000
 
Mar 2018

2·52 Posts
Default

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
File Type: txt ali.pl.txt (3.6 KB, 9 views)

Last fiddled with by kotenok2000 on 2022-08-17 at 16:37
kotenok2000 is offline   Reply With Quote
Old 2022-08-17, 18:09   #409
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

25×32×17 Posts
Default

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.
EdH is offline   Reply With Quote
Old 2022-08-18, 00:54   #410
James Heinrich
 
James Heinrich's Avatar
 
"James Heinrich"
May 2004
ex-Northern Ontario

11·349 Posts
Default

Quote:
Originally Posted by James Heinrich View Post
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";
James Heinrich is offline   Reply With Quote
Old 2022-08-18, 15:42   #411
chris2be8
 
chris2be8's Avatar
 
Sep 2009

22·3·199 Posts
Default

Quote:
Originally Posted by kotenok2000 View Post
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.
chris2be8 is offline   Reply With Quote
Old 2022-08-18, 15:52   #412
kotenok2000
 
Mar 2018

2×52 Posts
Default

But gnfs output is displayed correctly.
Maybe some output is send to stderr and some to stdout and perl relays only stdout?
Attached Files
File Type: zip bandicam 2022-08-18 18-48-40-848.mp4.zip (600.7 KB, 8 views)
kotenok2000 is offline   Reply With Quote
Old 2022-08-18, 16:49   #413
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

3,671 Posts
Default

gnfs output contains newlines.

siqs progress output does not... only carriage returns (\r)
bsquared is offline   Reply With Quote
Old 2022-08-18, 16:51   #414
kotenok2000
 
Mar 2018

2×52 Posts
Default

Can yafu be modified so siqs output also contains newlines?
kotenok2000 is offline   Reply With Quote
Old 2022-08-18, 17:50   #415
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

25·32·17 Posts
Default

Quote:
Originally Posted by kotenok2000 View Post
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
EdH is offline   Reply With Quote
Old 2022-08-19, 10:28   #416
kotenok2000
 
Mar 2018

1100102 Posts
Default

Does yafu 2 still support old cpus without avx?
kotenok2000 is offline   Reply With Quote
Old 2022-08-19, 15:43   #417
chris2be8
 
chris2be8's Avatar
 
Sep 2009

95416 Posts
Default

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.
chris2be8 is offline   Reply With Quote
Old 2022-08-19, 22:50   #418
BudgieJane
 
BudgieJane's Avatar
 
"Jane Sullivan"
Jan 2011
Beckenham, UK

1001110112 Posts
Default

Quote:
Originally Posted by bsquared View Post
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.
BudgieJane is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
yafu ignoring yafu.ini chris2be8 YAFU 9 2022-02-17 17:52
Running YAFU via Aliqueit doesn't find yafu.ini EdH YAFU 8 2018-03-14 17:22
YAFU-1.34 bsquared YAFU 119 2015-11-05 16:24
Yafu bug. storflyt32 YAFU 2 2015-06-29 05:19
yafu 1.32 bsquared YAFU 28 2012-07-20 16:17

All times are UTC. The time now is 04:42.


Sat Oct 1 04:42:31 UTC 2022 up 44 days, 2:11, 0 users, load averages: 0.79, 0.89, 1.08

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, 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.

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