mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   GPU Computing (https://www.mersenneforum.org/forumdisplay.php?f=92)
-   -   CUDALucas (a.k.a. MaclucasFFTW/CUDA 2.3/CUFFTW) (https://www.mersenneforum.org/showthread.php?t=12576)

apsen 2012-07-03 02:12

Crashed again. Looks like it's 100% reproducible.

apsen 2012-07-03 03:55

Guys, do you close the lock file before trying to delete it?

I didn't look at the code but I think you are forgetting to close the file and then do something uncosher when you try to create it again.

Dubslow 2012-07-03 04:39

[QUOTE=apsen;303913]Guys, do you close the lock file before trying to delete it?

I didn't look at the code but I think you are forgetting to close the file and then do something uncosher when you try to create it again.[/QUOTE]

Like I posted above:
[code] //[URL="http://sourceforge.net/p/cudalucas/code/35/tree/trunk/parse.c"]parse.c[/URL], line 86
#include <winsock2.h>

#include <io.h>

#include <share.h> //used for _sopen_s

#undef close

#define close _close

#define sched_yield SwitchToThread

#define MODE _S_IREAD | _S_IWRITE

#define strncasecmp _strnicmp



/* Everything from here to the next include is to make MSVS happy. */

#define sscanf sscanf_s /* This only works for scanning numbers, or strings with a defined length (e.g. "%131s") */



void strcopy(char* dest, char* src, size_t n)

{

strncpy_s(dest, MAX_LINE_LENGTH+1, src, n);

}

FILE* _fopen(const char* path, const char* mode)

{

FILE* stream;

errno_t err = fopen_s(&stream, path, mode);

if(err) return NULL;

else return stream;

}

void _sprintf(char* buf, char* frmt, const char* string)

{ // only used in filelocking code

sprintf_s(buf, 251, frmt, string);

}

int open_s(const char *filename, int oflag, int pmode)

{

int file_handle;

errno_t err = _sopen_s( &file_handle, filename, oflag, _SH_DENYNO, pmode);

if (err)

{

close (file_handle);

return -1;

}

else return 0;

}

void _strcpy(char *dest, const char *src)

{

strcpy_s (dest, _countof(dest), src);

}
[/code]
[code]//[URL="http://sourceforge.net/p/cudalucas/code/35/tree/trunk/parse.c"]parse.c[/URL] line 728
/*****************************************************************************/

/* mfakto's file locking code */



#define MAX_LOCKED_FILES 3



typedef struct _lockinfo

{

int lockfd;

FILE * open_file;

char lock_filename[256];

} lockinfo;



static unsigned int num_locked_files = 0;

static lockinfo locked_files[MAX_LOCKED_FILES];

int unlock_and_fclose(FILE *f)

{

unsigned int i, j;

int ret = 0;

#ifdef EBUG

printf("unlock() called\n");

#endif



if (f == NULL) return -1;



for (i=0; i<num_locked_files; i++)

{

if (locked_files[i].open_file == f)

{

ret = fclose(f);

f = NULL;

[B] if (close(locked_files[i].lockfd) != 0) perror("Failed to close lockfile");

if (remove(locked_files[i].lock_filename)!= 0) perror("Failed to delete lockfile");[/B]

for (j=i+1; j<num_locked_files; j++)

{

locked_files[j-1].lockfd = locked_files[j].lockfd;

locked_files[j-1].open_file = locked_files[j].open_file;

_strcpy(locked_files[j-1].lock_filename, locked_files[j].lock_filename);

}

num_locked_files--;

break;

}

}

if (f)

{

fprintf(stderr, "File was not locked!\n");

ret = fclose(f);

}

#ifdef EBUG

printf("successfully unlocked\n");

#endif

return ret;

}
[/code]
I know that flash changed it from what Bdot (the original developer of this code) had to make MSVS warnings go away. The most likely thing, it seems to me, is that somehow the changes broke it. I'll take a look through MSFT's library and see if I can spot something going wrong somewhere.

flashjh 2012-07-04 03:42

To eliminate code change problems, if we can get a set of code without the changes to make MSVS happy, I can get it to compile so we can test the original code.

Dubslow 2012-07-04 04:28

[QUOTE=flashjh;303999]To eliminate code change problems, if we can get a set of code without the changes to make MSVS happy, I can get it to compile so we can test the original code.[/QUOTE]
[url]https://github.com/Bdot42/mfakto/blob/master/src/filelocking.c[/url]

Alternately, try checking out r32, my initial Beta commit.
svn checkout svn://svn.code.sf.net/p/cudalucas/code/trunk -r 32

Bdot 2012-07-04 08:09

[QUOTE=apsen;303910]Crashed again. Looks like it's 100% reproducible.[/QUOTE]

If it is reproducible, could you attach a debugger to it before it crashes? Or start it right out of a debugger? A stacktrace would certainly be of great help. If you can get the debug symbols for your build, then you can even look at the data / variables ...

flashjh 2012-07-04 13:58

I [URL="https://sourceforge.net/projects/cudalucas/files/2.04%20Beta/"]uploaded[/URL] a 3.2 x64 version with dubug info (hopefully). If someone could test the debug and let me know, I would appreciate it.

Bdot 2012-07-04 14:40

[QUOTE=flashjh;304029]I [URL="https://sourceforge.net/projects/cudalucas/files/2.04%20Beta/"]uploaded[/URL] a 3.2 x64 version with dubug info (hopefully). If someone could test the debug and let me know, I would appreciate it.[/QUOTE]
I can try.

apsen, can you give me the command line you used and your .ini / worktodo contents (if any)?

Bdot 2012-07-04 15:45

[QUOTE=Bdot;304032]I can try.

apsen, can you give me the command line you used and your .ini / worktodo contents (if any)?[/QUOTE]

I can reproduce the abort - no need to send any ini/worktodo files.

The "debug" binary, unfortunately, contains no debug information that any of my debuggers could identify.

I tried downloading the source, but my svn client fails to pass the firewall for svn:// links, only http[s] works (via proxy). However, for all http requests to SF, all I get is "200 OK" instead of any file ...

flashjh 2012-07-04 15:59

[QUOTE=Bdot;304033]I can reproduce the abort - no need to send any ini/worktodo files.

The "debug" binary, unfortunately, contains no debug information that any of my debuggers could identify.

I tried downloading the source, but my svn client fails to pass the firewall for svn:// links, only http[s] works (via proxy). However, for all http requests to SF, all I get is "200 OK" instead of any file ...[/QUOTE]
When you build, what do you use to include debugging info? I use MSVS command line, so the /DEBUG doesn't work.

I've been trying to move the projects to the full MSVS, but I haven't spent a lot of time getting it to work yet.

flashjh 2012-07-04 16:07

I posted a new version I compiled with /Zi for cl.exe. I'm using [URL="http://msdn.microsoft.com/en-us/library/19z1t1wy(v=vs.90).aspx"]this page [/URL]for the examples. Let me know if that one has debugging info.

I found that the original debugging info I incuded is for [URL="http://developer.nvidia.com/cuda-gdb"]CUDA-GDB[/URL] (and it's still there for now).


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

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