View Single Post
Old 2012-05-31, 05:30   #1318
flashjh
 
flashjh's Avatar
 
"Jerry"
Nov 2011
Vancouver, WA

46316 Posts
Default

Quote:
Originally Posted by Dubslow View Post
http://mersenneforum.org/mfaktc/ (The unqualified 0.18 would be the source.)

I don't see anywhere in the mfatkc source about strcpy_s, but I'll keep looking, and you certainly know better than me about MSVC
Edit: http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx

strcpy_s has a different definition, requiring a third size argument; it's just meant to be a "catch stupid programmer error" thing. Since the code does a check for a long line anyways, the extra functionality is unnecessary.
Code:
bill@Gravemind:~/CUDALucas/test∰∂ cat parse.c
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
 
#ifdef _MSC_VER
#define strncasecmp _strnicmp
#define _CRT_SECURE_NO_WARNINGS
#endif
 
int isprime(unsigned int n)
/*
returns
0 if n is composite
1 if n is prime
*/
{
  unsigned int i;
 
  if(n<=1) return 0;
  if(n>2 && n%2==0)return 0;
 
  i=3;
  while(i*i <= n && i < 0x10000)
  {
    if(n%i==0)return 0;
    i+=2;
  }
  return 1;
}
Oh, that's just a while(1), that warning can be ignored. (Perhaps deleting the 1 and leaving the conditional blank will work?) Edit: Actually, in further looking, I actually have no clue why that loop is there at all. If the func finds a too-long line, then it reads in the characters until a control character then breaks? Wtf?


PS I forgot to mention above, but the help message was moved from no-args to the -h arg.
PPS Here's a slightly larger .ini file:
Code:
# Polite is the same as the -polite option. If it's 1, each iteration is
# polite. If it's (for example) 12, then every 12th iteration is polite. Thus
# the higher the number, the less polite the program is. Set to 0 to turn off
# completely. Polite!=0 will incur a slight performance drop, but the screen 
# should be more responsive. Trade responsiveness for performance. (Note:
# polite=0 is known to cause CUDALucas to use some extra CPU time; Polite=64 or
# higher is a good compromise.)
Polite=1
flash, could you add this to your copy before you bundle the executable?

The attached archive contains the modified parse.c and CUDALucas.ini.
Attached is CUDALucas 2.02 - UNTESTED. I included all the source files and the MAKEFILE for windows. I modified to 'safe' functions so MSVC would not complain**. The two while(1) lines cause a warning, but they're safe to ignore. No CUDA 3.2 because there were too many errors during compile for me to fix tonight.

@Dubslow: This build is based on your newest archive from earlier this afternoon. **I can't test the changes because I remoted into my system to do the build and CuLu doesn't detect my nVidia card while in a remote session.

I'll test it tomorrow; if anyone else can test it and let me know if it performs as expected, that would be great -- thanks.
Attached Files
File Type: zip CUDALucas2.02x64.zip (184.0 KB, 92 views)

Last fiddled with by flashjh on 2012-05-31 at 05:32
flashjh is offline   Reply With Quote