Browse Source

x64: fix some size_t warnings

2upstream
Tanguy Pruvot 10 years ago
parent
commit
d9b0312897
  1. 41
      JHA/cuda_jha_compactionTest.cu
  2. 6
      JHA/jackpotcoin.cu
  3. 7
      api.cpp
  4. 2
      ccminer.vcxproj
  5. 6
      hashlog.cpp
  6. 8
      quark/animecoin.cu
  7. 12
      quark/cuda_quark_compactionTest.cu
  8. 8
      quark/quarkcoin.cu
  9. 4
      stats.cpp
  10. 4
      util.cpp

41
JHA/cuda_jha_compactionTest.cu

@ -4,6 +4,10 @@ @@ -4,6 +4,10 @@
#include "cuda_helper.h"
#include <sm_30_intrinsics.h>
#ifdef __INTELLISENSE__
#define __shfl_up(a,b)
#endif
static uint32_t *d_tempBranch1Nonces[MAX_GPUS];
static uint32_t *d_numValid[MAX_GPUS];
static uint32_t *h_numValid[MAX_GPUS];
@ -56,7 +60,9 @@ __host__ void jackpot_compactTest_cpu_init(int thr_id, uint32_t threads) @@ -56,7 +60,9 @@ __host__ void jackpot_compactTest_cpu_init(int thr_id, uint32_t threads)
#endif
// Die Summenfunktion (vom NVIDIA SDK)
__global__ void jackpot_compactTest_gpu_SCAN(uint32_t *data, int width, uint32_t *partial_sums=NULL, cuda_compactTestFunction_t testFunc=NULL, uint32_t threads=0, uint32_t startNounce=0, uint32_t *inpHashes=NULL, uint32_t *d_validNonceTable=NULL)
__global__
void jackpot_compactTest_gpu_SCAN(uint32_t *data, int width, uint32_t *partial_sums=NULL, cuda_compactTestFunction_t testFunc=NULL,
uint32_t threads=0, uint32_t startNounce=0, uint32_t *inpHashes=NULL, uint32_t *d_validNonceTable=NULL)
{
extern __shared__ uint32_t sums[];
int id = ((blockIdx.x * blockDim.x) + threadIdx.x);
@ -168,7 +174,8 @@ __global__ void jackpot_compactTest_gpu_SCAN(uint32_t *data, int width, uint32_t @@ -168,7 +174,8 @@ __global__ void jackpot_compactTest_gpu_SCAN(uint32_t *data, int width, uint32_t
}
// Uniform add: add partial sums array
__global__ void jackpot_compactTest_gpu_ADD(uint32_t *data, uint32_t *partial_sums, int len)
__global__
void jackpot_compactTest_gpu_ADD(uint32_t *data, uint32_t *partial_sums, int len)
{
__shared__ uint32_t buf;
int id = ((blockIdx.x * blockDim.x) + threadIdx.x);
@ -185,7 +192,9 @@ __global__ void jackpot_compactTest_gpu_ADD(uint32_t *data, uint32_t *partial_su @@ -185,7 +192,9 @@ __global__ void jackpot_compactTest_gpu_ADD(uint32_t *data, uint32_t *partial_su
}
// Der Scatter
__global__ void jackpot_compactTest_gpu_SCATTER(uint32_t *sum, uint32_t *outp, cuda_compactTestFunction_t testFunc, uint32_t threads=0, uint32_t startNounce=0, uint32_t *inpHashes=NULL, uint32_t *d_validNonceTable=NULL)
__global__
void jackpot_compactTest_gpu_SCATTER(uint32_t *sum, uint32_t *outp, cuda_compactTestFunction_t testFunc,
uint32_t threads=0, uint32_t startNounce=0, uint32_t *inpHashes=NULL, uint32_t *d_validNonceTable=NULL)
{
int id = ((blockIdx.x * blockDim.x) + threadIdx.x);
uint32_t actNounce = id;
@ -220,7 +229,8 @@ __global__ void jackpot_compactTest_gpu_SCATTER(uint32_t *sum, uint32_t *outp, c @@ -220,7 +229,8 @@ __global__ void jackpot_compactTest_gpu_SCATTER(uint32_t *sum, uint32_t *outp, c
}
}
__host__ static uint32_t jackpot_compactTest_roundUpExp(uint32_t val)
__host__
static uint32_t jackpot_compactTest_roundUpExp(uint32_t val)
{
if(val == 0)
return 0;
@ -234,9 +244,9 @@ __host__ static uint32_t jackpot_compactTest_roundUpExp(uint32_t val) @@ -234,9 +244,9 @@ __host__ static uint32_t jackpot_compactTest_roundUpExp(uint32_t val)
return mask;
}
__host__ void jackpot_compactTest_cpu_singleCompaction(int thr_id, uint32_t threads, uint32_t *nrm,
uint32_t *d_nonces1, cuda_compactTestFunction_t function,
uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable)
__host__
void jackpot_compactTest_cpu_singleCompaction(int thr_id, uint32_t threads, uint32_t *nrm, uint32_t *d_nonces1,
cuda_compactTestFunction_t function, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable)
{
int orgThreads = threads;
threads = (int)jackpot_compactTest_roundUpExp((uint32_t)threads);
@ -290,9 +300,9 @@ __host__ void jackpot_compactTest_cpu_singleCompaction(int thr_id, uint32_t thre @@ -290,9 +300,9 @@ __host__ void jackpot_compactTest_cpu_singleCompaction(int thr_id, uint32_t thre
}
////// ACHTUNG: Diese funktion geht aktuell nur mit threads > 65536 (Am besten 256 * 1024 oder 256*2048)
__host__ void jackpot_compactTest_cpu_dualCompaction(int thr_id, uint32_t threads, uint32_t *nrm,
uint32_t *d_nonces1, uint32_t *d_nonces2,
uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable)
__host__
void jackpot_compactTest_cpu_dualCompaction(int thr_id, uint32_t threads, uint32_t *nrm, uint32_t *d_nonces1,
uint32_t *d_nonces2, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable)
{
jackpot_compactTest_cpu_singleCompaction(thr_id, threads, &nrm[0], d_nonces1, h_JackpotTrueFunction[thr_id], startNounce, inpHashes, d_validNonceTable);
jackpot_compactTest_cpu_singleCompaction(thr_id, threads, &nrm[1], d_nonces2, h_JackpotFalseFunction[thr_id], startNounce, inpHashes, d_validNonceTable);
@ -329,10 +339,9 @@ __host__ void jackpot_compactTest_cpu_dualCompaction(int thr_id, uint32_t thread @@ -329,10 +339,9 @@ __host__ void jackpot_compactTest_cpu_dualCompaction(int thr_id, uint32_t thread
*/
}
__host__ void jackpot_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, size_t *nrm1,
uint32_t *d_nonces2, size_t *nrm2,
int order)
__host__
void jackpot_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, uint32_t *nrm1, uint32_t *d_nonces2, uint32_t *nrm2, int order)
{
// Wenn validNonceTable genutzt wird, dann werden auch nur die Nonces betrachtet, die dort enthalten sind
// "threads" ist in diesem Fall auf die Länge dieses Array's zu setzen!
@ -342,6 +351,6 @@ __host__ void jackpot_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint @@ -342,6 +351,6 @@ __host__ void jackpot_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint
startNounce, inpHashes, d_validNonceTable);
cudaStreamSynchronize(NULL); // Das original braucht zwar etwas CPU-Last, ist an dieser Stelle aber evtl besser
*nrm1 = (size_t)h_numValid[thr_id][0];
*nrm2 = (size_t)h_numValid[thr_id][1];
*nrm1 = h_numValid[thr_id][0];
*nrm2 = h_numValid[thr_id][1];
}

6
JHA/jackpotcoin.cu

@ -30,8 +30,8 @@ extern void quark_skein512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t st @@ -30,8 +30,8 @@ extern void quark_skein512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t st
extern void jackpot_compactTest_cpu_init(int thr_id, uint32_t threads);
extern void jackpot_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, size_t *nrm1,
uint32_t *d_nonces2, size_t *nrm2,
uint32_t *d_nonces1, uint32_t *nrm1,
uint32_t *d_nonces2, uint32_t *nrm2,
int order);
extern uint32_t cuda_check_hash_branch(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_inputHash, int order);
@ -136,7 +136,7 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata, @@ -136,7 +136,7 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata,
// erstes Keccak512 Hash mit CUDA
jackpot_keccak512_cpu_hash(thr_id, throughput, pdata[19], d_hash[thr_id], order++);
size_t nrm1, nrm2, nrm3;
uint32_t nrm1, nrm2, nrm3;
// Runde 1 (ohne Gröstl)

7
api.cpp

@ -452,7 +452,7 @@ static int send_result(SOCKETTYPE c, char *result) @@ -452,7 +452,7 @@ static int send_result(SOCKETTYPE c, char *result)
n = send(c, "", 1, 0);
} else {
// ignore failure - it's closed immediately anyway
n = send(c, result, strlen(result) + 1, 0);
n = send(c, result, (int) strlen(result) + 1, 0);
}
return n;
}
@ -595,7 +595,7 @@ static int websocket_handshake(SOCKETTYPE c, char *result, char *clientkey) @@ -595,7 +595,7 @@ static int websocket_handshake(SOCKETTYPE c, char *result, char *clientkey)
// WebSocket Frame - Header + Data
memcpy(p, hd, frames);
memcpy(p + frames, result, (size_t)datalen);
send(c, (const char*)data, strlen(answer) + frames + (size_t)datalen + 1, 0);
send(c, (const char*)data, (int) (strlen(answer) + frames + datalen + 1), 0);
free(data);
}
return 0;
@ -724,7 +724,7 @@ static void api() @@ -724,7 +724,7 @@ static void api()
const char *addr = opt_api_allow;
unsigned short port = (unsigned short) opt_api_listen; // 4068
char buf[MYBUFSIZ];
int c, n, bound;
int n, bound;
char *connectaddr;
char *binderror;
char group;
@ -738,6 +738,7 @@ static void api() @@ -738,6 +738,7 @@ static void api()
char *params;
int i;
SOCKETTYPE c;
SOCKETTYPE *apisock;
if (!opt_api_listen && opt_debug) {
applog(LOG_DEBUG, "API disabled");

2
ccminer.vcxproj

@ -223,7 +223,7 @@ @@ -223,7 +223,7 @@
<MaxRegCount>80</MaxRegCount>
<PtxAsOptionV>true</PtxAsOptionV>
<Keep>false</Keep>
<CodeGeneration>compute_50,sm_50;compute_52,sm_52</CodeGeneration>
<CodeGeneration>compute_35,sm_35;compute_50,sm_50;compute_52,sm_52</CodeGeneration>
<Include>
</Include>
<TargetMachinePlatform>64</TargetMachinePlatform>

6
hashlog.cpp

@ -194,7 +194,7 @@ void hashlog_purge_job(char* jobid) @@ -194,7 +194,7 @@ void hashlog_purge_job(char* jobid)
int deleted = 0;
uint64_t njobid = hextouint(jobid);
uint64_t keypfx = (njobid << 32);
uint32_t sz = tlastshares.size();
uint32_t sz = (uint32_t) tlastshares.size();
std::map<uint64_t, hashlog_data>::iterator i = tlastshares.begin();
while (i != tlastshares.end()) {
if ((keypfx & i->first) == keypfx) {
@ -215,7 +215,7 @@ void hashlog_purge_old(void) @@ -215,7 +215,7 @@ void hashlog_purge_old(void)
{
int deleted = 0;
uint32_t now = (uint32_t) time(NULL);
uint32_t sz = tlastshares.size();
uint32_t sz = (uint32_t) tlastshares.size();
std::map<uint64_t, hashlog_data>::iterator i = tlastshares.begin();
while (i != tlastshares.end()) {
if ((now - i->second.tm_sent) > LOG_PURGE_TIMEOUT) {
@ -242,7 +242,7 @@ void hashlog_purge_all(void) @@ -242,7 +242,7 @@ void hashlog_purge_all(void)
*/
void hashlog_getmeminfo(uint64_t *mem, uint32_t *records)
{
(*records) = tlastshares.size();
(*records) = (uint32_t) tlastshares.size();
(*mem) = (*records) * sizeof(hashlog_data);
}

8
quark/animecoin.cu

@ -40,11 +40,11 @@ extern void quark_jh512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t start @@ -40,11 +40,11 @@ extern void quark_jh512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t start
extern void quark_compactTest_cpu_init(int thr_id, uint32_t threads);
extern void quark_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, size_t *nrm1,
uint32_t *d_nonces2, size_t *nrm2,
uint32_t *d_nonces1, uint32_t *nrm1,
uint32_t *d_nonces2, uint32_t *nrm2,
int order);
extern void quark_compactTest_single_false_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, size_t *nrm1,
uint32_t *d_nonces1, uint32_t *nrm1,
int order);
extern uint32_t cuda_check_hash_branch(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_inputHash, int order);
@ -203,7 +203,7 @@ extern "C" int scanhash_anime(int thr_id, uint32_t *pdata, @@ -203,7 +203,7 @@ extern "C" int scanhash_anime(int thr_id, uint32_t *pdata,
do {
int order = 0;
size_t nrm1=0, nrm2=0, nrm3=0;
uint32_t nrm1=0, nrm2=0, nrm3=0;
// erstes BMW512 Hash mit CUDA
quark_bmw512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id], order++);

12
quark/cuda_quark_compactionTest.cu

@ -328,8 +328,8 @@ __host__ void quark_compactTest_cpu_dualCompaction(int thr_id, uint32_t threads, @@ -328,8 +328,8 @@ __host__ void quark_compactTest_cpu_dualCompaction(int thr_id, uint32_t threads,
}
__host__ void quark_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, size_t *nrm1,
uint32_t *d_nonces2, size_t *nrm2,
uint32_t *d_nonces1, uint32_t *nrm1,
uint32_t *d_nonces2, uint32_t *nrm2,
int order)
{
// Wenn validNonceTable genutzt wird, dann werden auch nur die Nonces betrachtet, die dort enthalten sind
@ -340,12 +340,12 @@ __host__ void quark_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32 @@ -340,12 +340,12 @@ __host__ void quark_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32
startNounce, inpHashes, d_validNonceTable);
cudaStreamSynchronize(NULL); // Das original braucht zwar etwas CPU-Last, ist an dieser Stelle aber evtl besser
*nrm1 = (size_t)h_numValid[thr_id][0];
*nrm2 = (size_t)h_numValid[thr_id][1];
*nrm1 = h_numValid[thr_id][0];
*nrm2 = h_numValid[thr_id][1];
}
__host__ void quark_compactTest_single_false_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, size_t *nrm1,
uint32_t *d_nonces1, uint32_t *nrm1,
int order)
{
// Wenn validNonceTable genutzt wird, dann werden auch nur die Nonces betrachtet, die dort enthalten sind
@ -354,5 +354,5 @@ __host__ void quark_compactTest_single_false_cpu_hash_64(int thr_id, uint32_t th @@ -354,5 +354,5 @@ __host__ void quark_compactTest_single_false_cpu_hash_64(int thr_id, uint32_t th
quark_compactTest_cpu_singleCompaction(thr_id, threads, h_numValid[thr_id], d_nonces1, h_QuarkFalseFunction[thr_id], startNounce, inpHashes, d_validNonceTable);
cudaStreamSynchronize(NULL); // Das original braucht zwar etwas CPU-Last, ist an dieser Stelle aber evtl besser
*nrm1 = (size_t)h_numValid[thr_id][0];
*nrm1 = h_numValid[thr_id][0];
}

8
quark/quarkcoin.cu

@ -42,11 +42,11 @@ extern void quark_jh512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t start @@ -42,11 +42,11 @@ extern void quark_jh512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t start
extern void quark_compactTest_cpu_init(int thr_id, uint32_t threads);
extern void quark_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, size_t *nrm1,
uint32_t *d_nonces2, size_t *nrm2,
uint32_t *d_nonces1, uint32_t *nrm1,
uint32_t *d_nonces2, uint32_t *nrm2,
int order);
extern void quark_compactTest_single_false_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *inpHashes, uint32_t *d_validNonceTable,
uint32_t *d_nonces1, size_t *nrm1,
uint32_t *d_nonces1, uint32_t *nrm1,
int order);
extern uint32_t cuda_check_hash_branch(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_inputHash, int order);
@ -175,7 +175,7 @@ extern "C" int scanhash_quark(int thr_id, uint32_t *pdata, @@ -175,7 +175,7 @@ extern "C" int scanhash_quark(int thr_id, uint32_t *pdata,
do {
int order = 0;
size_t nrm1=0, nrm2=0, nrm3=0;
uint32_t nrm1=0, nrm2=0, nrm3=0;
// erstes Blake512 Hash mit CUDA
quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); order++;

4
stats.cpp

@ -133,7 +133,7 @@ void stats_purge_old(void) @@ -133,7 +133,7 @@ void stats_purge_old(void)
{
int deleted = 0;
uint32_t now = (uint32_t) time(NULL);
uint32_t sz = tlastscans.size();
uint32_t sz = (uint32_t) tlastscans.size();
std::map<uint64_t, stats_data>::iterator i = tlastscans.begin();
while (i != tlastscans.end()) {
if (i->second.ignored || (now - i->second.tm_stat) > STATS_PURGE_TIMEOUT) {
@ -160,6 +160,6 @@ void stats_purge_all(void) @@ -160,6 +160,6 @@ void stats_purge_all(void)
*/
void stats_getmeminfo(uint64_t *mem, uint32_t *records)
{
(*records) = tlastscans.size();
(*records) = (uint32_t) tlastscans.size();
(*mem) = (*records) * sizeof(stats_data);
}

4
util.cpp

@ -977,7 +977,7 @@ static const char *get_stratum_session_id(json_t *val) @@ -977,7 +977,7 @@ static const char *get_stratum_session_id(json_t *val)
arr_val = json_array_get(val, 0);
if (!arr_val || !json_is_array(arr_val))
return NULL;
n = json_array_size(arr_val);
n = (int) json_array_size(arr_val);
for (i = 0; i < n; i++) {
const char *notify;
json_t *arr = json_array_get(arr_val, i);
@ -1264,7 +1264,7 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params) @@ -1264,7 +1264,7 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
merkle_arr = json_array_get(params, 4);
if (!merkle_arr || !json_is_array(merkle_arr))
goto out;
merkle_count = json_array_size(merkle_arr);
merkle_count = (int) json_array_size(merkle_arr);
version = json_string_value(json_array_get(params, 5));
nbits = json_string_value(json_array_get(params, 6));
stime = json_string_value(json_array_get(params, 7));

Loading…
Cancel
Save