Skip to content

Commit

Permalink
version: add compiler and pthreads version
Browse files Browse the repository at this point in the history
fix also some remaining aligned attributes for VC++

TODO: support ASM linkage in VC2013 (USE_ASM define)
  • Loading branch information
unknown authored and unknown committed Oct 31, 2014
1 parent 3967e06 commit ccccf3b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 32 deletions.
29 changes: 20 additions & 9 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ static void share_result(int result, struct work *work, const char *reason)
100. * accepted_count / (accepted_count + rejected_count), s,
(((double) 0xffffffff) / (work ? work->target[7] : rpc2_target)),
use_colors ?
(result ? CL_GRN "(yay!!!)" : CL_RED "(booooo)")
(result ? CL_GRN "yay!!!" : CL_RED "booooo")
: (result ? "(yay!!!)" : "(booooo)"));
break;
default:
Expand Down Expand Up @@ -2078,7 +2078,15 @@ static void *stratum_thread(void *userdata)

static void show_version_and_exit(void)
{
printf(PACKAGE_STRING "\n built on " __DATE__ "\n features:"
printf("\n built on " __DATE__
#ifdef _MSC_VER
" with VC++ 2013\n");
#elif defined(__GNUC__)
" with GCC");
printf(" %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif

printf(" features:"
#if defined(USE_ASM) && defined(__i386__)
" i386"
#endif
Expand Down Expand Up @@ -2113,12 +2121,19 @@ static void show_version_and_exit(void)
" NEON"
#endif
#endif
"\n");
"\n\n");

/* dependencies versions */
printf("%s\n", curl_version());
#ifdef JANSSON_VERSION
printf("libjansson %s\n", JANSSON_VERSION);
printf("libjansson/%s ", JANSSON_VERSION);
#else
printf("libjansson/1.3 "); /* windows */
#endif
#ifdef PTW32_VERSION
printf("pthreads/%d.%d.%d.%d ", PTW32_VERSION);
#endif
printf("\n");
exit(0);
}

Expand Down Expand Up @@ -2525,11 +2540,7 @@ static bool has_aes_ni()
static void show_credits()
{
printf(PROGRAM_NAME " by Lucas Jones and Tanguy Pruvot\n");
#ifdef _MSC_VER
printf(CL_GRY " This is version " PACKAGE_VERSION ", built with VC++ 2013" CL_N "\n");
#else
printf(CL_GRY " This is version " PACKAGE_VERSION CL_N "\n");
#endif
printf(CL_GRY " based on pooler cpuminer 2.4" CL_N "\n");
}

Expand Down Expand Up @@ -2713,7 +2724,7 @@ int main(int argc, char *argv[]) {
/* main loop - simply wait for workio thread to exit */
pthread_join(thr_info[work_thr_id].pth, NULL);

applog(LOG_INFO, "workio thread dead, exiting.");
applog(LOG_WARNING, "workio thread dead, exiting.");

return 0;
}
12 changes: 7 additions & 5 deletions cpuminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;USE_AVX;USE_AVX2;USE_XOP;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;compat;compat\curl-for-windows\curl\include;compat\jansson;compat\getopt;compat\pthreads;compat\curl-for-windows\openssl\openssl\include;compat\curl-for-windows\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
Expand All @@ -98,7 +99,8 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;USE_AVX;USE_AVX2;USE_XOP;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;compat;compat\curl-for-windows\curl\include;compat\jansson;compat\getopt;compat\pthreads;compat\curl-for-windows\openssl\openssl\include;compat\curl-for-windows\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
Expand All @@ -120,7 +122,7 @@
<CompileAsManaged>false</CompileAsManaged>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;MAXWELL_OR_FERMI=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;USE_AVX;USE_AVX2;USE_XOP;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;compat;compat\curl-for-windows\curl\include;compat\jansson;compat\getopt;compat\pthreads;compat\curl-for-windows\openssl\openssl\include;compat\curl-for-windows\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>SyncCThrow</ExceptionHandling>
</ClCompile>
Expand All @@ -142,11 +144,11 @@
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<CompileAsManaged>false</CompileAsManaged>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;MAXWELL_OR_FERMI=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;USE_AVX;USE_AVX2;USE_XOP;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;compat;compat\curl-for-windows\curl\include;compat\jansson;compat\getopt;compat\pthreads;compat\curl-for-windows\openssl\openssl\include;compat\curl-for-windows\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
Expand Down
1 change: 0 additions & 1 deletion miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void *alloca (size_t);
#endif

#ifdef _MSC_VER
#define strncasecmp(x,y,z) _strnicmp(x,y,z)
#define strncasecmp(x,y,z) _strnicmp(x,y,z)
#define strcasecmp(x,y) _stricmp(x,y)
typedef int ssize_t;
Expand Down
24 changes: 12 additions & 12 deletions scrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static const uint32_t outerpad_4way[4 * 8] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000300, 0x00000300, 0x00000300, 0x00000300
};
static const uint32_t finalblk_4way[4 * 16] __attribute__((aligned(16))) = {
static const uint32_t _ALIGN(16) finalblk_4way[4 * 16] = {
0x00000001, 0x00000001, 0x00000001, 0x00000001,
0x80000000, 0x80000000, 0x80000000, 0x80000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
Expand All @@ -180,8 +180,8 @@ static const uint32_t finalblk_4way[4 * 16] __attribute__((aligned(16))) = {
static inline void HMAC_SHA256_80_init_4way(const uint32_t *key,
uint32_t *tstate, uint32_t *ostate)
{
uint32_t ihash[4 * 8] __attribute__((aligned(16)));
uint32_t pad[4 * 16] __attribute__((aligned(16)));
uint32_t _ALIGN(16) ihash[4 * 8];
uint32_t _ALIGN(16) pad[4 * 16];
int i;

/* tstate is assumed to contain the midstate of key */
Expand All @@ -208,10 +208,10 @@ static inline void HMAC_SHA256_80_init_4way(const uint32_t *key,
static inline void PBKDF2_SHA256_80_128_4way(const uint32_t *tstate,
const uint32_t *ostate, const uint32_t *salt, uint32_t *output)
{
uint32_t istate[4 * 8] __attribute__((aligned(16)));
uint32_t ostate2[4 * 8] __attribute__((aligned(16)));
uint32_t ibuf[4 * 16] __attribute__((aligned(16)));
uint32_t obuf[4 * 16] __attribute__((aligned(16)));
uint32_t _ALIGN(16) istate[4 * 8];
uint32_t _ALIGN(16) ostate2[4 * 8];
uint32_t _ALIGN(16) ibuf[4 * 16];
uint32_t _ALIGN(16) obuf[4 * 16];
int i, j;

memcpy(istate, tstate, 4 * 32);
Expand Down Expand Up @@ -239,7 +239,7 @@ static inline void PBKDF2_SHA256_80_128_4way(const uint32_t *tstate,
static inline void PBKDF2_SHA256_128_32_4way(uint32_t *tstate,
uint32_t *ostate, const uint32_t *salt, uint32_t *output)
{
uint32_t buf[4 * 16] __attribute__((aligned(16)));
uint32_t _ALIGN(16) buf[4 * 16];
int i;

sha256_transform_4way(tstate, salt, 1);
Expand Down Expand Up @@ -531,10 +531,10 @@ static void scrypt_1024_1_1_256(const uint32_t *input, uint32_t *output,
static void scrypt_1024_1_1_256_4way(const uint32_t *input,
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N)
{
uint32_t tstate[4 * 8] __attribute__((aligned(128)));
uint32_t ostate[4 * 8] __attribute__((aligned(128)));
uint32_t W[4 * 32] __attribute__((aligned(128)));
uint32_t X[4 * 32] __attribute__((aligned(128)));
uint32_t _ALIGN(128) tstate[4 * 8];
uint32_t _ALIGN(128) ostate[4 * 8];
uint32_t _ALIGN(128) W[4 * 32];
uint32_t _ALIGN(128) X[4 * 32];
uint32_t *V;
int i, k;

Expand Down
8 changes: 4 additions & 4 deletions sha2.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ void sha256d_ms_4way(uint32_t *hash, uint32_t *data,
static inline int scanhash_sha256d_4way(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce, uint64_t *hashes_done)
{
uint32_t data[4 * 64] __attribute__((aligned(128)));
uint32_t hash[4 * 8] __attribute__((aligned(32)));
uint32_t midstate[4 * 8] __attribute__((aligned(32)));
uint32_t prehash[4 * 8] __attribute__((aligned(32)));
uint32_t _ALIGN(128) data[4 * 64];
uint32_t _ALIGN(32) hash[4 * 8];
uint32_t _ALIGN(32) midstate[4 * 8];
uint32_t _ALIGN(32) prehash[4 * 8];
uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7];
Expand Down
2 changes: 1 addition & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void applog(int prio, const char *fmt, ...)
case LOG_WARNING: color = CL_YLW; break;
case LOG_NOTICE: color = CL_WHT; break;
case LOG_INFO: color = ""; break;
case LOG_DEBUG: color = ""; break;
case LOG_DEBUG: color = CL_GRY; break;

case LOG_BLUE:
prio = LOG_NOTICE;
Expand Down

0 comments on commit ccccf3b

Please sign in to comment.