mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > kriesel

Closed Thread
 
Thread Tools
Old 2019-12-05, 21:58   #1
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

3·1,579 Posts
Default Factor5

This is a reference thread about Factor5. Post comments in the reference discussion thread. Comments posted here may be moved or removed without recourse or notice.

Factor5 is a cpu-based multithreaded Mersenne trial factoring program that can exceed the 232 exponent limit of Mfaktc and mfakto. The only time Factor5 should be used is for TF that can't be done by gpu programs mfaktc or mfakto or mmff, and Mfactor is not available. This is because of substantial speed differences. The cpu is better used for PRP, or P-1 factoring. Factor5 is several times slower than Mfactor on the same work and hardware; see the next post.
See https://www.rieselprime.de/ziki/Factor5 and https://download.mersenne.ca/factor5

It saves status in very readable text in status.txt, a nice feature. The name is apparently fixed, and it checks for its existence on startup, so starting a different assignment requires removing or renaming the status file.

Continue with one of these with factor5 --resume.
If an incorrect parameter is entered, it prints help:
Code:
Usage: factor5 exponent bit_start bit_stop num_threads

factor5 --resume
factor5 --version

num_threads must be 1, 2, 4, 8, 16
So I can not try using 32 threads to ensure two threads on some physical cores as a test.


Thread table of contents:
  1. This post
  2. Benchmark and cost https://www.mersenneforum.org/showpo...27&postcount=2
  3. Status file format https://www.mersenneforum.org/showpo...28&postcount=3
  4. Results file https://www.mersenneforum.org/showpo...42&postcount=4
  5. Console output https://www.mersenneforum.org/showpo...43&postcount=5
  6. etc tbd
Other threads specific to Factor5 include
https://www.mersenneforum.org/showthread.php?t=22463
https://www.mersenneforum.org/showthread.php?t=14515
https://www.mersenneforum.org/showthread.php?t=7283
https://www.mersenneforum.org/showthread.php?t=9744

Factor5 is not recommended for new work. Use mfaktx or mmff when possible, otherwise use Ernst Mayer's mfactor, which is faster and has more options and capability.


Top of reference tree: https://www.mersenneforum.org/showpo...22&postcount=1

Last fiddled with by kriesel on 2020-11-27 at 16:49
kriesel is online now  
Old 2019-12-05, 22:00   #2
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

3×1,579 Posts
Default Benchmark and cost

On a dual E5-2697-V2 Xeon system, I made a brief test run of 0.2% of
Code:
Factor5 39845887 73 74 16
It indicated completion in 145. hours occupying 16 cores of the 24-core system (48 counting hyperthreading).
Task Manager shows it using 38% of available cpu, with prime95 temporarily stopped.
HWMonitor shows it using 80w on one cpu package, 100W on the other.
Electrical cost at $0.12/kwhr: 145 hours x 180 W * $0.12/(1000 watt hours) = $3.132.

For comparison, an RX550 running mfakto on
Factor=39845887,73,74
indicates 8.55 hours.
The RX550 indicates using 30 watts.
Electrical cost at $0.12/kwhr: 8.55 hours x 30 watts * $0.12/(1000 watt hours) = $0.03078.

Time ratio: 145/8.55 =~ 16.96
Electrical cost ratio: 3.132/.03078 =~ 101.8
Clearly it is not competitive with gpu factoring on even a low power old gpu, for exponents in the gpu supported range. But it could be useful for exponents above 2^32, beyond the current capability of gpu trial factoring.

A quick test with 8 threads instead gave an estimated run time of 278. hours.

A head to head comparison, Factor5 to Mfactor follows for trial factoring MM31 from 67 to 68 bits, while prime95 runs full tilt. Prime95 iteration times are seen to increase by ~15% during the Factor5 16-thread run. Factor5 uses 16 hyperthreads, 36% cpu indicated in Task Manager for the 359 second indicated duration.
Code:
factor5 2147483647 67 68 16

Factor5 v. 5.01 - December 27th, 2007 - AMD64/Win64 compile - GMP 4.2.1_MPIR_1.0.0

Current date Fri Aug 28 13:23:38 2020

Factoring M2147483647 from 2^67 to 2^68   0.000% completed.
Factoring M2147483647 from 2^67 to 2^68   0.000% completed.
Factoring M2147483647 from 2^67 to 2^68  10.317% completed.
Factoring M2147483647 from 2^67 to 2^68  20.920% completed.
Factoring M2147483647 from 2^67 to 2^68  31.285% completed.
Factoring M2147483647 from 2^67 to 2^68  41.412% completed.
Factoring M2147483647 from 2^67 to 2^68  51.919% completed.
Factoring M2147483647 from 2^67 to 2^68  62.331% completed.
M2147483647 has a factor: 242557615644693265201 - Program: L5.0x
Factoring M2147483647 from 2^67 to 2^68  72.696% completed.
Factoring M2147483647 from 2^67 to 2^68  82.823% completed.
Factoring M2147483647 from 2^67 to 2^68  93.331% completed.
Factoring M2147483647 from 2^67 to 2^68  91.999% completed.
1 factor found

Performed   1179126821 powmod operations since last restart.
Used 970704 primes, max. prime = 14999981
Current date Fri Aug 28 13:29:37 2020
The Mfactor run is a single-threaded session run on WSL2, and indicates in Windows Task Manager as 2.3% cpu usage, corresponding to one out of the 48 logical cores.
Code:
time ./Mfactor -m 2147483647 -bmin 67 -bmax 68
INFO: testing qfloat routines...
CPU Family = x86_64, OS = Linux, 64-bit Version, compiled with Gnu C [or other compatible], Version 7.5.0.
INFO: CPU supports SSE2 instruction set, but using scalar floating-point build.
INFO: Using inline-macro form of MUL_LOHI64.
INFO: MLUCAS_PATH is set to ""
INFO: using 64-bit-significand form of floating-double rounding constant for scalar-mode DNINT emulation.
Setting DAT_BITS = 10, PAD_BITS = 2
INFO: testing IMUL routines...
Mfactor build flags:
TRYQ = 4
NUM_SIEVING_PRIME = 100000
MULH64_FAST = true
FACTOR_STANDALONE = true
NOBRANCH = true
USE_128x96 = true
Mfactor self-tests:
Apr2015 mi64_div quicktest passes.
mi64_div quicktest passes.
Base-2 PRP test of M127 passed: Time = 00:00:00.000
Base-2 PRP test of M607 passed: Time = 00:00:00.000
Base-3 PRP test of M607 passed: Time = 00:00:00.000
Base-2 PRP test of M4423 passed: Time = 00:00:00.093
Base-3 PRP test of M4423 passed: Time = 00:00:00.343
Testing 64-bit Fermat factors...
Testing 128-bit Fermat factors...
Testing 192-bit Fermat factors...
Testing 256-bit Fermat factors...
Testing > 256-bit Fermat factors...
Testing 63-bit factors...
Testing 64-bit factors...
Testing 65-bit factors...
Testing 96-bit factors...
Factoring self-tests completed successfully.
INFO: No factoring savefile t2147483647 found ... starting from scratch.
Allocated 255255 words in master template, 4255 in per-pass bit_map [16 x that in bit_atlas]
Generating difference table of first 100000 small primes
Using first 100000 odd primes; max gap = 114
max sieving prime = 1299721
Searching in the interval k=[34355280960, 68726898240], i.e. q=[1.475548e+20, 2.951798e+20]
Each of  16 (p mod 60) passes will consist of 2104 intervals of length 272272
2949120 ones bits of 16336320 in master sieve template.
TRYQ = 4, max sieving prime = 1299721
Time to set up sieve = 00:00:00.062
pass = 0................
pass = 1................
pass = 2................
pass = 3................
pass = 4................
pass = 5................
pass = 6................
pass = 7................
pass = 8................
pass = 9................
pass = 10................
pass = 11................
pass = 12................
pass = 13................
pass = 14................
pass = 15...........
        Factor with k = 56474845800. This factor is a probable prime.
.....
M(2147483647) has 1 factors in range k = [34355280960, 68726898240], passes 0-15
Performed 1369664700 trial divides
Clocks = 00:12:57.140

real    12m58.204s
user    12m56.734s
sys     0m1.109s
The Mfactor hyperthread usage is 12m58.2 sec = 778.2 thread seconds, compared to 16 x359 = 5744 thread-seconds for Factor5, a ratio of 7.38:1 more efficient in Mfactor than Factor5.
This ratio is large compared to the likely effects of running Factor5 on Win10 directly while Mfactor was run on WSL2 atop Win10, and with the efficiency of a single thread. There was not a noticeable impact of Mfactor's one thread on prime95 iteration timings. I have seen impacts of running 16 separate Mfactor processes directly on Win10 via a batch script to do the 16 passes in parallel, similar to the effect of Factor5's 16 threads on prime95 iteration timing.


Top of reference tree: https://www.mersenneforum.org/showpo...22&postcount=1

Last fiddled with by kriesel on 2020-08-28 at 18:53
kriesel is online now  
Old 2019-12-05, 22:02   #3
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

3×1,579 Posts
Default Status file format

The Factor5 save file format seems straightforward.
Here's a snapshot.
Code:
39845887
73
74
118515782641998
118612379302158
237031565283998
0
0
16
0
Later, it contained
Code:
39845887
73
74
118515782641998
118673885546958
237031565283998
0
0
16
0
I think the format is:
Code:
exponent
starting bits
ending bits
starting k (in F=2kp+1)
current k
ending k
(unknown or reserved)
(unknown or reserved)
cores count
(unknown or reserved)

Top of reference tree: https://www.mersenneforum.org/showpo...22&postcount=1

Last fiddled with by kriesel on 2019-12-05 at 22:08
kriesel is online now  
Old 2019-12-06, 00:44   #4
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

112018 Posts
Default Results file

Here is some sample results.txt output. It prints a header line when starting, and if Ctrl-C halts the run, that's all there may be from that run.
Code:
Trial-factoring M39845887 in [2^73, 2^74-1]
Trial-factoring M220600496383 in [2^1, 2^70-1]
M220600496383 has a factor: 40590491334473 - Program: L5.0x
M220600496383 has 1 factors in [2^1, 2^70-1].
Trial-factoring M1049179854847 in [2^1, 2^70-1]
M1049179854847 has 0 factors in [2^1, 2^70-1].
Trial-factoring M1049179854847 in [2^1, 2^76-1]
M1049179854847 has a factor: 22427111252690237692351 - Program: L5.0x
M1049179854847 has 1 factors in [2^1, 2^76-1].


Top of reference tree: https://www.mersenneforum.org/showpo...22&postcount=1

Last fiddled with by kriesel on 2020-08-05 at 20:19
kriesel is online now  
Old 2019-12-06, 00:46   #5
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

3×1,579 Posts
Default Console output

Here's a sample run's console output
Code:
Factor5 v. 5.01 - December 27th, 2007 - AMD64/Win64 compile - GMP 4.2.1_MPIR_1.0.0

Current date Thu Dec 05 18:33:36 2019

Factoring M1049179854847 from 2^1 to 2^76   0.000% completed.
Factoring M1049179854847 from 2^1 to 2^76   9.754% completed.
Factoring M1049179854847 from 2^1 to 2^76  22.866% completed.
M1049179854847 has a factor: 22427111252690237692351 - Program: L5.0x
Factoring M1049179854847 from 2^1 to 2^76  39.834% completed.
Factoring M1049179854847 from 2^1 to 2^76  61.247% completed.
Factoring M1049179854847 from 2^1 to 2^76  78.261% completed.
Factoring M1049179854847 from 2^1 to 2^76  95.319% completed.
Factoring M1049179854847 from 2^1 to 2^76  97.179% completed.
1 factor found

Performed   1226096055 powmod operations since last restart.
Used 970704 primes, max. prime = 14999981
 Current date Thu Dec 05 18:37:16 2019


Top of reference tree: https://www.mersenneforum.org/showpo...22&postcount=1

Last fiddled with by kriesel on 2020-08-05 at 20:19
kriesel is online now  
Closed Thread

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Factor5 revamping ET_ Operation Billion Digits 35 2017-09-25 02:29
Factor5 on Multicore Machines Rodrigo Operation Billion Digits 4 2011-01-02 04:50
Factor5 ! ET_ Operation Billion Digits 60 2009-08-26 08:02
Factor5 source code thread ET_ Operation Billion Digits 10 2008-09-17 12:28

All times are UTC. The time now is 21:26.

Mon Nov 30 21:26:43 UTC 2020 up 81 days, 18:37, 2 users, load averages: 2.79, 2.62, 2.50

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