mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Hardware > GPU Computing

Reply
 
Thread Tools
Old 2012-07-01, 06:03   #1453
flashjh
 
flashjh's Avatar
 
"Jerry"
Nov 2011
Vancouver, WA

1,123 Posts
Default

Quote:
Originally Posted by Dubslow View Post
Sometimes Windows will detect programs going into infinite loops, and report that the program is not responding. That's not what happened?

Here's the relevant code:
...
I can't create Windows executables, and I don't know much about MSVS; you'll have to tell flash how to compile it with debugging symbols in Windows.

Edit: Flash! The fix to open_s() never made it into r35! (It should return file_handle, not 0!)
Yes, I see. I'll fix and repost everything in the morning.

EDIT: When quoting the immediately previous message, including the whole thing is unnecessary and only makes thread hard to read. SB

Last fiddled with by Batalov on 2012-07-01 at 11:40 Reason: (brief quote)
flashjh is offline   Reply With Quote
Old 2012-07-01, 06:09   #1454
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

226658 Posts
Default

Version 2.04 beta, standard (this means I did not get yet any fix you are talking here about):
For me it is not really a crash, but it fails to delete the lck file. I used to delete them by hand, as a "routine clearing" process (I have multiple cudalucas folders, for each instance I run, I do all reports by hand and clear the folders after that, by deleting all checkpoints and files except the exe, ini, and worktodo in each folder, this is done by a batch file outside of the folder, in the parent). I will try to let it there to see what it will happen.

Last fiddled with by LaurV on 2012-07-01 at 06:14
LaurV is online now   Reply With Quote
Old 2012-07-01, 07:24   #1455
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

160658 Posts
Default

Quote:
Originally Posted by LaurV View Post
Version 2.04 beta, standard (this means I did not get yet any fix you are talking here about):
For me it is not really a crash, but it fails to delete the lck file. I used to delete them by hand, as a "routine clearing" process (I have multiple cudalucas folders, for each instance I run, I do all reports by hand and clear the folders after that, by deleting all checkpoints and files except the exe, ini, and worktodo in each folder, this is done by a batch file outside of the folder, in the parent). I will try to let it there to see what it will happen.
You don't get any error messages either, like "Failed to close lockfile" in the code?

And it doesn't crash, but just fails to delete the lock file?
Dubslow is offline   Reply With Quote
Old 2012-07-01, 11:28   #1456
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

2·47·101 Posts
Default

Regardless of what you are debugging, this line is up to no good:
Code:
      if( AID[0] && strncasecmp(AID, "N/A", 3) ) { // If (AID is not null), AND (AID is NOT "N/A") (case insensitive)
Batalov is offline   Reply With Quote
Old 2012-07-01, 13:55   #1457
flashjh
 
flashjh's Avatar
 
"Jerry"
Nov 2011
Vancouver, WA

1,123 Posts
Default

Quote:
Originally Posted by flashjh View Post
EDIT: When quoting the immediately previous message, including the whole thing is unnecessary and only makes thread hard to read. SB
I understand, but when posting from a mobile phone, it's virtually impossible to edit previous material - the site is not moibile device friendly. As such, when the posts are long, I won't quote anymore from my phone.
Quote:
Yes, I see. I'll fix and repost everything in the morning.
The mentioned fix is posted.

Last fiddled with by flashjh on 2012-07-01 at 14:15
flashjh is offline   Reply With Quote
Old 2012-07-01, 19:08   #1458
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3×29×83 Posts
Default

This is from my phone, which is why the PS doesn't quote the mentioned post


Quote:
Originally Posted by Batalov View Post
Regardless of what you are debugging, this line is up to no good:
Code:
      if( AID[0] && strncasecmp(AID, "N/A", 3) ) { // If (AID is not null), AND (AID is NOT "N/A") (case insensitive)
How so? Do you perhaps mean that AID[0] might not be initialized? While it isn't initialized in the declaration, its first use is in get_next_assignment(), which does this "if (key!=NULL)strcopy(*key, assignment.hex_key, MAX_LINE_LENGTH+1);", where the struct char* is initialized in parse_worktodo_line() to 0: "assignment->hex_key[0] = 0;". Hardly clear I'll be sure to fix that and just initialize to null at declaration time.

I'm not sure what else it could be, except perhaps reverse AID and "N/A"?

Last fiddled with by Dubslow on 2012-07-01 at 19:20
Dubslow is offline   Reply With Quote
Old 2012-07-01, 21:37   #1459
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

100101000101102 Posts
Default

If AID and AID[0] are initialized, then this check is useless because strncasecmp works fine with empty strings, and if AID isn't then you are crashing right away.

Writing a comment that simply repeats the content of the line (and contradicts what is actually written, in this case) is bad.

Thinking that just because it (supposedly) doesn't crash (because today you think that you know exactly what is called and when) it is an acceptable code is worse.

Last fiddled with by Batalov on 2012-07-01 at 21:39
Batalov is offline   Reply With Quote
Old 2012-07-01, 21:49   #1460
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3×29×83 Posts
Default

But I do need to check if it's empty. And as I explained before, the string is always properly initialized (though this isn't clear in the slightest by looking at the code, I admit, and it will be fixed).

If it is empty, yes strncasecmp will handle it fine, but it will compare empty to "N/A" as unequal. Thus just "if(strncasecmp(AID, "N/A", 3))" will end up taking the branch, which I don't want to do with an empty string. That would create "CUDALucas.... AID:" which is silly. If there's no AID, then don't needlessly print "AID:".

Thus the comment is exactly what the code does. Perhaps that's not great practice, but I did it for anyone who's not off-handedly familiar with strncasecmp, which until this discussion, I wasn't.
Edit: Perhaps I meant "if (AID is not EMPTY)", is that what you meant about incorrect comment?

I think it's acceptable code because it's the simplest way to make the program do what I want it to do without causing errors.

And as far as "you think that you know exactly what is called and when", isn't that the whole point of *procedural* programming?

PS I've committed the changes.

Last fiddled with by Dubslow on 2012-07-01 at 22:05
Dubslow is offline   Reply With Quote
Old 2012-07-01, 23:17   #1461
flashjh
 
flashjh's Avatar
 
"Jerry"
Nov 2011
Vancouver, WA

1,123 Posts
Default

2.04 Beta x64 binaries updated here
flashjh is offline   Reply With Quote
Old 2012-07-02, 01:31   #1462
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

949410 Posts
Default

Quote:
Originally Posted by Dubslow View Post
Edit: Perhaps I meant "if (AID is not EMPTY)", is that what you meant about incorrect comment?
Yes, ok, "EMPTY" is the word I can live with, -- not null!

...but even with "EMPTY" this piece of code sounds like
Code:
  if(2+3==5) {  // if two plus three equals five, then
Comments are not for this. Comments should be like
Code:
                               dump_interval = MAX(dump_interval,
                                                   DEFAULT_DUMP_INTERVAL + 1);

                                /* make the dump interval a multiple of
                                   the check interval. If this is not done,
                                   eventually we will perform a check and
                                   then less than three iterations later
                                   will get a dump, which performs another
                                   check. The Lanczos recurrence only
                                   guarantees that check vectors more than
                                   three iterations back will be orthogonal
                                   to the current x, so this will cause 
                                   spurious failures */

                                dump_interval += check_interval -
                                                dump_interval %
                                                check_interval;
and not like
Code:
                               dump_interval = MAX(dump_interval,
                                                   DEFAULT_DUMP_INTERVAL + 1);
// make dump_interval at least DEFAULT_DUMP_INTERVAL + 1

                                dump_interval += check_interval -
                                                dump_interval %
                                                check_interval;
// add check_interval - dump_interval modulo check_interval to dump_interval
Comments are for briefly explaining the reasoning -- and not for retelling the code once again in human words.

That line needs no comment, but rather a preceding line
Code:
assert(AID);
#or, if you prefer
assert(AID != NULL);
Then your conscience is clean and your function can be called in any fashion. (You never program alone. Someone will call your function after the list was all consumed and possibly freed. Or will put it in some callback. In short, you never know.)

Last fiddled with by Batalov on 2012-07-02 at 01:34 Reason: typos fixed. more typos inserted ;-)
Batalov is offline   Reply With Quote
Old 2012-07-02, 17:00   #1463
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

72×197 Posts
Default

Quote:
Originally Posted by Dubslow View Post
You don't get any error messages either, like "Failed to close lockfile" in the code?

And it doesn't crash, but just fails to delete the lock file?
No idea. Right now I have no CL work. I started to TF the 332M range to 70, as per discussion in the gpu272 thread, with all the steam, but I had to stop that one too, as I temporarily need the cards for daily work. Like in the interrupt mode, the higher priority interrupt wins. When this is done I will return to mfaktc and 332M5 (already finished the range to 332M4 inclusive, before interruption) which will be done in few days too. Then back to CL-DC. I'll watch for this error and keep you informed if it pops up (I may be that I missed it in the past, as I said, I used to delete the lock file by hand anytime I saw it and that may be a reason why no error like failed to close/delete files). But now I will watch for it.
LaurV is online now   Reply With Quote
Reply



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

All times are UTC. The time now is 07:44.


Mon Aug 2 07:44:22 UTC 2021 up 10 days, 2:13, 0 users, load averages: 1.59, 1.40, 1.37

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