mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   GPU Computing (https://www.mersenneforum.org/forumdisplay.php?f=92)
-   -   mfaktc: a CUDA program for Mersenne prefactoring (https://www.mersenneforum.org/showthread.php?t=12827)

mattmill30 2016-07-30 13:55

FYI, I have completed the lost TF work and the checkpoint reads:
[CODE]M332347303 77 81 4620 0.21: 1808 0 5FCDA1FC[/CODE]

LaurV 2016-08-02 03:44

Ok, sorry I didn't have time to revisit this topic, in fact I didn't consider it priority anymore, because I saw you redone the work anyhow. Just to do a knot on the lose ends, here is the code that does the checksum for version 0.21, also copied from Oliver's code which is available on web, I only replaced scanf/open/etc with their "safe" versions to avoid vc++ making a big scandal of it...

Version 0.21 added that "M" in front, to distinguish from "W" when mfaktc is used for Wagstaff numbers. Therefore the difference in the file. This code [U]does[/U] generate checksums as you expect (and matching what you posted here, I tested it). To generate checksums for wagstaff numbers, you have to modify the define (or define WAGSTAFF).

[CODE]
#include "stdafx.h"

#define NUM_CLASSES 4620
#define MFAKTC_VERSION "0.21"

#ifdef WAGSTAFF
#define NAME_NUMBERS "W"
#else /* Mersennes */
#define NAME_NUMBERS "M"
#endif

unsigned int checkpoint_checksum(char *string, int chars)
/* generates a CRC-32 like checksum of the string */
{
unsigned int chksum = 0;
int i, j;

for (i = 0; i<chars; i++)
{
for (j = 7; j >= 0; j--)
{
if ((chksum >> 31) == (((unsigned int)(string[i] >> j)) & 1))
{
chksum <<= 1;
}
else
{
chksum = (chksum << 1) ^ 0x04C11DB7;
}
}
}
return chksum;
}

// writes the checkpoint file
void checkpoint_write(unsigned int exp, int bit_min, int bit_max, int cur_class, int num_factors)
{
FILE *f;
char buffer[100], filename[20];
unsigned int i;

sprintf_s(filename, "%s%u.ckp", NAME_NUMBERS, exp);

fopen_s(&f, filename, "w");
if (f == NULL)
{
printf("WARNING, could not write checkpoint file \"%s\"\n", filename);
}
else
{
sprintf_s(buffer, "%s%u %d %d %d %s: %d %d", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, cur_class, num_factors);
i = checkpoint_checksum(buffer, strlen(buffer));
fprintf(f, "%s%u %d %d %d %s: %d %d %08X", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, cur_class, num_factors, i);
fclose(f);
}
}

//=======================================================
int _tmain(int argc, _TCHAR* argv[])
{
unsigned int exp;
int bmin, bmax, cls;
char ch;

printf("Exponent : "); scanf_s("%u", &exp);
printf("From bitlevel : "); scanf_s("%d", &bmin);
printf("To bitlevel : "); scanf_s("%d", &bmax);
printf("Current class : "); scanf_s("%d", &cls);
checkpoint_write(exp, bmin, bmax, cls, 0); //assume no factors were found by former runs
printf("\nDone. Use it at your own risk...\nPress a key to exit.");
ch=_getch();
return 0;
}
[/CODE]

[CODE]M332347303 77 81 4620 0.21: 1808 0 5FCDA1FC[/CODE]

mattmill30 2016-08-13 22:11

Feature request: -tf extention, resume bit-range from particular class
 
Feature request:
Expansion of -tf switch to include support for beginning from a particular class.

This feature has at least two real world applications:[LIST=1][*]Resuming from the last checked class following a checksum write error [*]Resuming from a particular class following the successful discovery of a factor, in order to complete the bit-range[/LIST]
Additionally, if it is trivial to implement, then the ability to resume from the bit-range and class in which a factor exists. I'm not sure how this would work along-side compound factors. An example for this usage would be when attempting to complete any remaining factorisation of an exponent such as [URL="http://www.mersenne.org/report_exponent/?exp_lo=9100919&full=1"]M9100919[/URL], where no bit-ranges have been included with factor submissions.

TheJudger 2016-08-13 22:23

Hi,

[QUOTE=mattmill30;439953]
Resuming from a particular class following the successful discovery of a factor, in order to complete the bit-range[/QUOTE]

Short: not possible!
Long: not possible, because we don't know which application reported the factor, which settings where used, etc. Prime95 splits the search space in residue classes mod 96(?) over the factor candidates (FCs) while mfaktc can do residue classes mod 420 or 4620 over the k in FC = 2kp+1.

Oliver

Prime95 2016-08-13 22:43

[QUOTE=TheJudger;439954]Prime95 splits the search space in residue classes mod 96(?)[/QUOTE]

mod 120

TheJudger 2016-08-14 12:10

Thank you for correction. It was too late yesterday. I know the numbers for mfaktc and I know Prime95 uses somewhat less residues classes but had the wrong number in my mind.

ji2my 2016-09-09 06:57

ERROR: cudaGetLastError() returned 8: invalid device function
 
Hi,

I've encounter a error, can anyone help me to solve it?

Thanks!


D:\mfaktc>mfaktc-win-64.exe
mfaktc v0.21 (64bit built)

Compiletime options
THREADS_PER_BLOCK 256
SIEVE_SIZE_LIMIT 32kiB
SIEVE_SIZE 193154bits
SIEVE_SPLIT 250
MORE_CLASSES enabled

Runtime options
SievePrimes 25000
SievePrimesAdjust 1
SievePrimesMin 5000
SievePrimesMax 100000
NumStreams 3
CPUStreams 3
GridSize 3
GPU Sieving enabled
GPUSievePrimes 82486
GPUSieveSize 64Mi bits
GPUSieveProcessSize 16Ki bits
Checkpoints enabled
CheckpointDelay 30s
WorkFileAddDelay 600s
Stages enabled
StopAfterFactor bitlevel
PrintMode full
V5UserID (none)
ComputerID (none)
AllowSleep no
TimeStampInResults no

CUDA version info
binary compiled for CUDA 6.50
CUDA runtime version 6.50
CUDA driver version 8.0

CUDA device info
name GeForce GTX 1070
compute capability 6.1
max threads per block 1024
max shared memory per MP 98304 byte
number of multiprocessors 15
clock rate (CUDA cores) 1708MHz
memory clock rate: 4004MHz
memory bus width: 256 bit

Automatic parameters
threads per grid 983040
GPUSievePrimes (adjusted) 82486
GPUsieve minimum exponent 1055144

running a simple selftest...
ERROR: cudaGetLastError() returned 8: invalid device function

D:\mfaktc>

KaptainBlaZzed 2016-09-09 18:21

i tried this on my 1080 and i get the error
"ERROR: Cudagetlasterror() returned: 8 invalid device function"

Can you upgrade the program to function with pascal and the new CUDA architecture?

airsquirrels 2016-09-09 19:27

You must compile for the specific compute version and CUDA version of the card you are using. In this case the 8.0 RC and compute 6.1. Each generation of GPUs requires a separate build

henryzz 2016-09-09 19:43

[QUOTE=airsquirrels;442058]You must compile for the specific compute version and CUDA version of the card you are using. In this case the 8.0 RC and compute 6.1. Each generation of GPUs requires a separate build[/QUOTE]

???
I have used old binaries with my 750Ti

airsquirrels 2016-09-09 20:59

[QUOTE=henryzz;442060]???
I have used old binaries with my 750Ti[/QUOTE]

Some of the older cards/CUDA versions supported multiple compute versions and architectures, but Maxwell and Pascal both seem to required specific builds.


All times are UTC. The time now is 23:11.

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