![]() |
|
|
#1365 | ||
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3×29×83 Posts |
Quote:
Code:
errno_t strcpy_s( char *strDestination, size_t numberOfElements, const char *strSource ); Code:
void strcopy(char* dest, char* src, size_t n)
{
#ifdef linux
strncpy(dest, src, n);
#else
strcpy_s(dest, n, src);
#endif
}
Quote:
Edit: Sadly, it still worked fine. I'll run it through the debugger though. Code:
bill@Gravemind:~/CUDALucas∰∂ unix2dos worktodo.txt unix2dos: converting file worktodo.txt to DOS format ... bill@Gravemind:~/CUDALucas∰∂ CUDALucas Starting M25994671 fft length = 1474560 Last fiddled with by Dubslow on 2012-06-04 at 19:50 |
||
|
|
|
|
|
#1366 |
|
Apr 2012
Berlin Germany
3·17 Posts |
got a big performance increase with 2.02. 4.1 with my gtx 680
on a 65xxxxxx exponent 2.01 gives me 7.6ms/iteration this version 6.6ms/itereation was that expected??? Last fiddled with by Redarm on 2012-06-05 at 08:14 |
|
|
|
|
|
#1367 | |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3×29×83 Posts |
Quote:
PS: Are you in Windows, and if so, does it crash for you like above? Last fiddled with by Dubslow on 2012-06-05 at 09:23 |
|
|
|
|
|
|
#1368 | ||
|
Jun 2005
3·43 Posts |
Quote:
Quote:
strcopy(assignment->assignment_key,ptr,1+(strstr(ptr,",")-ptr) ); // copy the comma.. You can add a check in strcopy to see the problem in Linux. Print n and strlen(src) and then dereference a NULL pointer if n is smaller. You'll see a crash in basically the same place as you would on Windows. Or just use strncpy() in Windows as well as Linux, and add in the dest[n-1] = '\0'; line recommended earlier. Last fiddled with by kjaget on 2012-06-05 at 12:29 |
||
|
|
|
|
|
#1369 | ||
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
160658 Posts |
Quote:
Leave it to Microsoft to complicate everything Code:
void strcopy(char* dest, char* src, size_t n)
{
#ifdef linux
strncpy(dest, src, n);
#else
strncpy_s(dest, MAX_LINE_LENGTH+1, src, n);
#endif
}
Quote:
Btw, sorry about being so snippety in my first reply For whatever reason in my version of the file that line is 269, not 23x, so I had no idea what you were talking about. Thanks though for the pointer ( ! ...On that note, it's quite fun to increment a char pointer named "C"... )Okay, let's test this ASAP. I've upped the version to 2.03, pending confirmation of bug destroyed. While this has been going on, I've still been fiddling with the code here and there, in platform-independent manners, and it works here, but of course testing still required. By the way, if this was in fact the bug, then something like "Test=25994671" should have worked just fine. Did anybody try something like that, or just a valid expo with >=2 commas? (Again, the included .ini should be shipped with all binaries )Edit: ToDo list: 1) Clean up FFT selection. Before the bug was reported I had made some progress in this front, and it should turn out easier than I had first thought. 2) To complement that, get exponent-by-exponent FFT specification ability, again probably via some field in the worktodo.txt line. Any ideas on how to actually do that? (The way Prime95 does it is kind of a pain in the butt to parse.) 3) If anyone would like a different way of determining whether or not there is an assignment key other than by comma count, please let me know. [SUP][SUP][SUP][SUP][SUP][SUP][SUP][SUP][SUP][SUP][SUP][SUP][SUP][SUP][COLOR="White"]4) Bit shift? 0_o[/COLOR][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP][/SUP] Last fiddled with by Dubslow on 2012-06-05 at 13:50 |
||
|
|
|
|
|
#1370 | |
|
Romulan Interpreter
Jun 2011
Thailand
72·197 Posts |
Quote:
Code:
e:\CudaLucas>cl2024020x64 -d 0 ------- DEVICE 0 ------- <snip> Continuing work from a partial result of M216091 fft length = 12288 iteration = 110001 Iteration 120000 M( 216091 )C, 0x3981b56788b529e2, n = 12288, CUDALucas v2.02 err = 0.00415 (0:03 real, 0.2775 ms/iter, ETA 0:24) Iteration 130000 M( 216091 )C, 0x80438af231f8fccd, n = 12288, CUDALucas v2.02 err = 0.004822 (0:02 real, 0.2792 ms/iter, ETA 0:22) Iteration 140000 M( 216091 )C, 0x669382faea06df89, n = 12288, CUDALucas v2.02 err = 0.004822 (0:03 real, 0.2706 ms/iter, ETA 0:18) edit2: next cosmetic thing would be to use a fixed format (6, 5, even 4 decimals would be enough) for error display, and 4 decimals for ETA. I mean to display the trailing zeroes. It looks ugly (misaligned) when there are trailing zeroes, all row is shifted left. You can do that in v2.03, is not difficult. Last fiddled with by LaurV on 2012-06-05 at 13:26 |
|
|
|
|
|
|
#1371 | |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
11100001101012 Posts |
Quote:
Edit: Well, that didn't work, but changing from g to f worked, so now the iteration time and round off share the same formatting of "%4.4f". Edited into previous post. Code:
bill@Gravemind:~/CUDALucas∰∂ CUDALucas -t -k -c 200 Continuing work from a partial result of M25994671 fft length = 1474560 iteration = 11819502 Iteration 11819600 M( 25994671 )C, 0xda2bc6c08cb012d2, n = 1474560, CUDALucas v2.03 err = 0.0000 (0:02 real, 10.5765 ms/iter, ETA 41:38:42) Iteration 11819800 M( 25994671 )C, 0x7a57b790bf30c653, n = 1474560, CUDALucas v2.03 err = 0.0820 (0:02 real, 5.8363 ms/iter, ETA 22:58:49) Iteration 11820000 M( 25994671 )C, 0x5b7a72e76b58eff7, n = 1474560, CUDALucas v2.03 err = 0.0820 (0:01 real, 5.7476 ms/iter, ETA 22:37:50) Iteration 11820200 M( 25994671 )C, 0x803f4a72d574de89, n = 1474560, CUDALucas v2.03 err = 0.0820 (0:01 real, 5.7128 ms/iter, ETA 22:29:35) ^C caught. Writing checkpoint. Code:
//From apsen
void
print_time_from_seconds (int sec)
{
if (sec > 3600)
{
printf ("%d", sec / 3600);
sec %= 3600;
printf (":%02d", sec / 60);
}
else
printf ("%d", sec / 60);
sec %= 60;
printf (":%02d", sec);
}
Code:
printf("%02d", sec / 3600);
sec %= 3600;
printf(":%02d", sec / 60);
printf(":%02d", sec % 60);
/* No ifs, elses, thens, or buts about it */
(PS Thanks again Mr. Jaget )
Last fiddled with by Dubslow on 2012-06-05 at 14:42 |
|
|
|
|
|
|
#1372 |
|
Romulan Interpreter
Jun 2011
Thailand
72×197 Posts |
I may talked to early... I am getting random "caught. Writing checkpoint." without pressing any ctrl c (and the mesage is not "^C caught.", just "caught."), and in case I get it to the end without any interruption, it will always "cannot move tmp workfile to regular workfile" and crash. Subsequent launches can't find worktodo (which is now __woktodo).
|
|
|
|
|
|
#1373 | |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
Quote:
The way CUDALucas (and mfaktc, from which its derived) clear assignments is by writing all the assignments except the one to be cleared to "__worktodo__.tmp", and then overwrite the regular work file with that. Code:
if(remove(filename) != 0)
return CANT_RENAME;
if(rename("__worktodo__.tmp", filename) != 0)
return CANT_RENAME;
return OK;
Code:
signal (SIGTERM, SetQuitting); signal (SIGINT, SetQuitting); Last fiddled with by Dubslow on 2012-06-05 at 15:04 |
|
|
|
|
|
|
#1374 |
|
Romulan Interpreter
Jun 2011
Thailand
226658 Posts |
well, the temp file is just "__worktodo.tmp". No "__" at the end. I did not look in the source yet (no time!) but are you sure you use the same name in both directions?
![]() (don't get me wrong, I really appreciate what you are doing and the fact that you are learning very fast, but if we continue like this, I may put my nose into the source code too, and fix it by myself, maybe I can find some time during the weekend). |
|
|
|
|
|
#1375 | |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
Quote:
The CUDALucas code I have: Code:
/************************************************************************************************************
* Function name : clear_assignment *
* *
* INPUT : char *filename *
* int exponent *
* OUTPUT : *
* *
* 0 - OK *
* 3 - clear_assignment : cannot open file <filename> *
* 4 - clear_assignment : cannot open file "__worktodo__.tmp" *
* 5 - clear_assignment : assignment not found *
* 6 - clear_assignment : cannot rename temporary workfile to regular workfile *
* *
************************************************************************************************************/
enum ASSIGNMENT_ERRORS clear_assignment(char *filename, int exponent)
{
int found = 0;
FILE *f_in, *f_out;
LINE_BUFFER line; // line buffer
char *tail = NULL; // points to tail material in line, if non-null
enum PARSE_WARNINGS value;
unsigned int line_to_drop = UINT_MAX;
unsigned int current_line;
struct ASSIGNMENT assignment; // the found assignment....
f_in = _fopen(filename, "r");
if (NULL == f_in)
return CANT_OPEN_WORKFILE;
f_out = _fopen("__worktodo__.tmp", "w");
if (NULL == f_out)
{
fclose(f_in);
return CANT_OPEN_TEMPFILE;
}
current_line =0;
while (END_OF_FILE != (value = parse_worktodo_line(f_in,&assignment,&line,&tail)) )
{
current_line++;
if (NO_WARNING == value)
{
if( (exponent == assignment.exponent) ) // make final decision
{
if (line_to_drop > current_line)
line_to_drop = current_line;
break;
}
else
{
line_to_drop = current_line+1; // found different assignment, can drop no earlier than next line
}
}
else if ((BLANK_LINE == value) && (UINT_MAX == line_to_drop))
line_to_drop = current_line+1;
}
errno = 0;
if (fseek(f_in,0L,SEEK_SET))
{
fclose(f_in);
f_in = _fopen(filename, "r");
if (NULL == f_in)
{
fclose(f_out);
return CANT_OPEN_WORKFILE;
}
}
found = 0;
current_line = 0;
while (END_OF_FILE != (value = parse_worktodo_line(f_in,&assignment,&line,&tail)) )
{
current_line++;
if ((NO_WARNING != value) || found)
{
if ((found) || (current_line < line_to_drop))
fprintf(f_out, "%s", line);
}
else // assignment on the line, so we may need to print it..
{
found = (exponent == assignment.exponent);
if (!found)
{
fprintf(f_out,"%s",line);
}
else // we have the assignment...
{
// Do nothing; we don't print this to the temp file, 'cause we're trying to delete it :)
}
}
} // while.....
fclose(f_in);
fclose(f_out);
if (!found)
return ASSIGNMENT_NOT_FOUND;
if(remove(filename) != 0)
return CANT_RENAME;
if(rename("__worktodo__.tmp", filename) != 0)
return CANT_RENAME;
return OK;
}
Code:
/************************************************************************************************************
* Function name : clear_assignment *
* *
* INPUT : char *filename *
* unsigned int exponent *
* int bit_min - from old assignment file *
* int bit_max *
* int bit_min_new - new bit_min,what was factored to--if 0,reached bit_max *
* OUTPUT : *
* *
* 0 - OK *
* 3 - clear_assignment : cannot open file <filename> *
* 4 - clear_assignment : cannot open file "__worktodo__.tmp" *
* 5 - clear_assignment : assignment not found *
* 6 - clear_assignment : cannot rename temporary workfile to regular workfile *
* *
* If bit_min_new is zero then the specified assignment will be cleared. If bit_min_new is greater than *
* zero the specified assignment will be modified *
************************************************************************************************************/
enum ASSIGNMENT_ERRORS clear_assignment(char *filename, unsigned int exponent, int bit_min, int bit_max, int bit_min_new)
{
int found = FALSE;
FILE *f_in, *f_out;
LINE_BUFFER line; // line buffer
char *tail = NULL; // points to tail material in line, if non-null
enum PARSE_WARNINGS value;
unsigned int line_to_drop = UINT_MAX;
unsigned int current_line;
struct ASSIGNMENT assignment; // the found assignment....
f_in = fopen(filename, "r");
if (NULL == f_in)
return CANT_OPEN_WORKFILE;
f_out = fopen("__worktodo__.tmp", "w");
if (NULL == f_out)
{
fclose(f_in);
return CANT_OPEN_TEMPFILE;
}
if ((bit_min_new > bit_min) && (bit_min_new < bit_max)) // modify only
line_to_drop = UINT_MAX;
else
{
current_line =0;
while (END_OF_FILE != (value = parse_worktodo_line(f_in,&assignment,&line,&tail)) )
{
current_line++;
if (NO_WARNING == value)
{
if( (exponent == assignment.exponent) && (bit_min == assignment.bit_min) && (bit_max == assignment.bit_max)) // make final decision
{
if (line_to_drop > current_line)
line_to_drop = current_line;
break;
}
else
{
line_to_drop = current_line+1; // found different assignment, can drop no earlier than next line
}
}
else if ((BLANK_LINE == value) && (UINT_MAX == line_to_drop))
line_to_drop = current_line+1;
}
}
errno = 0;
if (fseek(f_in,0L,SEEK_SET))
{
fclose(f_in);
f_in = fopen(filename, "r");
if (NULL == f_in)
{
fclose(f_out);
return CANT_OPEN_WORKFILE;
}
}
found = FALSE;
current_line = 0;
while (END_OF_FILE != (value = parse_worktodo_line(f_in,&assignment,&line,&tail)) )
{
current_line++;
if ((NO_WARNING != value) || found)
{
if ((found) || (current_line < line_to_drop))
fprintf(f_out, "%s", line);
}
else // assignment on the line, so we may need to print it..
{
found =( (exponent == assignment.exponent) && (bit_min == assignment.bit_min) && (bit_max == assignment.bit_max) );
if (!found)
{
fprintf(f_out,"%s",line);
}
else // we have the assignment...
{
if ((bit_min_new > bit_min) && (bit_min_new < bit_max))
{
fprintf(f_out,"Factor=" );
if (strlen(assignment.assignment_key) != 0)
fprintf(f_out,"%s,", assignment.assignment_key);
fprintf(f_out,"%u,%u,%u",exponent, bit_min_new, bit_max);
if (tail != NULL)
fprintf(f_out,"%s",tail);
}
}
}
} // while.....
fclose(f_in);
fclose(f_out);
if (!found)
return ASSIGNMENT_NOT_FOUND;
if(remove(filename) != 0)
return CANT_RENAME;
if(rename("__worktodo__.tmp", filename) != 0)
return CANT_RENAME;
return OK;
}
Last fiddled with by Dubslow on 2012-06-05 at 15:14 |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Don't DC/LL them with CudaLucas | LaurV | Data | 131 | 2017-05-02 18:41 |
| CUDALucas / cuFFT Performance on CUDA 7 / 7.5 / 8 | Brain | GPU Computing | 13 | 2016-02-19 15:53 |
| CUDALucas: which binary to use? | Karl M Johnson | GPU Computing | 15 | 2015-10-13 04:44 |
| settings for cudaLucas | fairsky | GPU Computing | 11 | 2013-11-03 02:08 |
| Trying to run CUDALucas on Windows 8 CP | Rodrigo | GPU Computing | 12 | 2012-03-07 23:20 |