Skip to content

Commit

Permalink
start v1.7, apply new prototypes to all algos
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Sep 23, 2015
1 parent 4babf37 commit 5308898
Show file tree
Hide file tree
Showing 35 changed files with 348 additions and 372 deletions.
9 changes: 5 additions & 4 deletions Algo256/blake256.cu
Original file line number Diff line number Diff line change
Expand Up @@ -379,17 +379,18 @@ void blake256_cpu_setBlock_16(uint32_t *penddata, const uint32_t *midstate, cons

static bool init[MAX_GPUS] = { 0 };

extern "C" int scanhash_blake256(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, unsigned long *hashes_done, int8_t blakerounds=14)
extern "C" int scanhash_blake256(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done, int8_t blakerounds=14)
{
const uint32_t first_nonce = pdata[19];
uint64_t targetHigh = ((uint64_t*)ptarget)[3];
uint32_t _ALIGN(64) endiandata[20];
#if PRECALC64
uint32_t _ALIGN(64) midstate[8];
#else
uint32_t crcsum;
#endif
uint32_t *pdata = work->data;
uint32_t *ptarget = work->target;
const uint32_t first_nonce = pdata[19];
uint64_t targetHigh = ((uint64_t*)ptarget)[3];
int intensity = (device_sm[device_map[thr_id]] > 500) ? 22 : 20;
uint32_t throughput = device_intensity(thr_id, __func__, 1U << intensity);
throughput = min(throughput, max_nonce - first_nonce);
Expand Down
8 changes: 5 additions & 3 deletions Algo256/bmw.cu
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ static __inline uint32_t swab32_if(uint32_t val, bool iftrue) {
return iftrue ? swab32(val) : val;
}

extern "C" int scanhash_bmw(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, unsigned long *hashes_done)
extern "C" int scanhash_bmw(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done)
{
uint32_t _ALIGN(64) endiandata[20];
uint32_t *pdata = work->data;
uint32_t *ptarget = work->target;
const uint32_t first_nonce = pdata[19];
bool swapnonce = true;
uint32_t throughput = device_intensity(thr_id, __func__, 1U << 21);
Expand All @@ -59,7 +61,6 @@ extern "C" int scanhash_bmw(int thr_id, uint32_t *pdata, const uint32_t *ptarget
init[thr_id] = true;
}

uint32_t endiandata[20];
for (int k=0; k < 20; k++) {
be32enc(&endiandata[k], ((uint32_t*)pdata)[k]);
}
Expand All @@ -80,6 +81,7 @@ extern "C" int scanhash_bmw(int thr_id, uint32_t *pdata, const uint32_t *ptarget
if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) {
*hashes_done = foundNonce - first_nonce + 1;
pdata[19] = swab32_if(foundNonce,!swapnonce);
bn_store_hash_target_ratio(vhash64, ptarget, work);
return 1;
}
else {
Expand Down
9 changes: 5 additions & 4 deletions Algo256/keccak256.cu
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ extern "C" void keccak256_hash(void *state, const void *input)

static bool init[MAX_GPUS] = { 0 };

extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce,
unsigned long *hashes_done)
extern "C" int scanhash_keccak256(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done)
{
uint32_t _ALIGN(64) endiandata[20];
uint32_t *pdata = work->data;
uint32_t *ptarget = work->target;
const uint32_t first_nonce = pdata[19];
uint32_t throughput = device_intensity(thr_id, __func__, 1U << 21); // 256*256*8*4
throughput = min(throughput, max_nonce - first_nonce);
Expand All @@ -55,7 +56,6 @@ extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata,
init[thr_id] = true;
}

uint32_t endiandata[20];
for (int k=0; k < 20; k++) {
be32enc(&endiandata[k], pdata[k]);
}
Expand All @@ -74,6 +74,7 @@ extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata,
keccak256_hash(vhash64, endiandata);

if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) {
bn_store_hash_target_ratio(vhash64, ptarget, work);
pdata[19] = foundNonce;
return 1;
}
Expand Down
13 changes: 9 additions & 4 deletions JHA/jackpotcoin.cu
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ extern "C" unsigned int jackpothash(void *state, const void *input)

static bool init[MAX_GPUS] = { 0 };

extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce,
unsigned long *hashes_done)
extern "C" int scanhash_jackpot(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done)
{
uint32_t _ALIGN(64) endiandata[22];
uint32_t *pdata = work->data;
uint32_t *ptarget = work->target;
const uint32_t first_nonce = pdata[19];

uint32_t throughput = device_intensity(thr_id, __func__, 1U << 20);
Expand Down Expand Up @@ -123,7 +124,6 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata,
init[thr_id] = true;
}

uint32_t endiandata[22];
for (int k=0; k < 22; k++)
be32enc(&endiandata[k], pdata[k]);

Expand Down Expand Up @@ -221,7 +221,12 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata,
if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) {
int res = 1;
uint32_t secNonce = cuda_check_hash_suppl(thr_id, throughput, pdata[19], d_hash[thr_id], 1);
bn_store_hash_target_ratio(vhash64, ptarget, work);
if (secNonce != 0) {
be32enc(&endiandata[19], secNonce);
nist5hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio)
bn_store_hash_target_ratio(vhash64, ptarget, work);
pdata[21] = secNonce;
res++;
}
Expand Down
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ its command line interface and options.
--pstate=0 will force the Geforce 9xx to run in P0 P-State
--plimit=150W set the gpu power limit, allow multiple values for N cards
--keep-clocks prevent reset clocks and/or power limit on exit
--show-diff display submitted block and net difficulty
-B, --background run the miner in the background
--benchmark run in offline benchmark mode
--cputest debug hashes from cpu algorithms
Expand Down Expand Up @@ -226,8 +227,10 @@ features.

>>> RELEASE HISTORY <<<

Under Dev... v1.6.7
Under Dev... v1.7
Add --cuda-schedule parameter
Add --show-diff parameter, which display shares diff,
and is able to detect real solved blocks on pools.

Aug. 28th 2015 v1.6.6
Allow to load remote config with curl (-c http://...)
Expand Down
149 changes: 45 additions & 104 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1873,165 +1873,106 @@ static void *miner_thread(void *userdata)
/* scan nonces for a proof-of-work hash */
switch (opt_algo) {

case ALGO_HEAVY:
rc = scanhash_heavy(thr_id, work.data, work.target,
max_nonce, &hashes_done, work.maxvote, HEAVYCOIN_BLKHDR_SZ);
break;

case ALGO_KECCAK:
rc = scanhash_keccak256(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;

case ALGO_MJOLLNIR:
rc = scanhash_heavy(thr_id, work.data, work.target,
max_nonce, &hashes_done, 0, MNR_BLKHDR_SZ);
break;

case ALGO_DEEP:
rc = scanhash_deep(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;

case ALGO_LUFFA:
rc = scanhash_luffa(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;

case ALGO_BLAKECOIN:
rc = scanhash_blake256(thr_id, work.data, work.target,
max_nonce, &hashes_done, 8);
rc = scanhash_blake256(thr_id, &work, max_nonce, &hashes_done, 8);
break;

case ALGO_BLAKE:
rc = scanhash_blake256(thr_id, work.data, work.target,
max_nonce, &hashes_done, 14);
rc = scanhash_blake256(thr_id, &work, max_nonce, &hashes_done, 14);
break;

case ALGO_BMW:
rc = scanhash_bmw(thr_id, work.data, work.target, max_nonce, &hashes_done);
rc = scanhash_bmw(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_C11:
rc = scanhash_c11(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_c11(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_DEEP:
rc = scanhash_deep(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_FRESH:
rc = scanhash_fresh(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_FUGUE256:
rc = scanhash_fugue256(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_fugue256(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_GROESTL:
case ALGO_DMD_GR:
rc = scanhash_groestlcoin(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_groestlcoin(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_MYR_GR:
rc = scanhash_myriad(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_myriad(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_HEAVY:
rc = scanhash_heavy(thr_id, &work, max_nonce, &hashes_done, work.maxvote, HEAVYCOIN_BLKHDR_SZ);
break;
case ALGO_MJOLLNIR:
rc = scanhash_heavy(thr_id, &work, max_nonce, &hashes_done, 0, MNR_BLKHDR_SZ);
break;
case ALGO_KECCAK:
rc = scanhash_keccak256(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_JACKPOT:
rc = scanhash_jackpot(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_jackpot(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_LUFFA:
rc = scanhash_luffa(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_QUARK:
rc = scanhash_quark(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_quark(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_QUBIT:
rc = scanhash_qubit(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;

case ALGO_FRESH:
rc = scanhash_fresh(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_qubit(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_LYRA2:
rc = scanhash_lyra2(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_lyra2(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_LYRA2v2:
rc = scanhash_lyra2v2(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_NEOSCRYPT:
rc = scanhash_neoscrypt(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_neoscrypt(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_NIST5:
rc = scanhash_nist5(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_nist5(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_PENTABLAKE:
rc = scanhash_pentablake(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_pentablake(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_SCRYPT:
rc = scanhash_scrypt(thr_id, work.data, work.target, NULL,
max_nonce, &hashes_done, &tv_start, &tv_end);
rc = scanhash_scrypt(thr_id, &work, max_nonce, &hashes_done,
NULL, &tv_start, &tv_end);
break;

case ALGO_SCRYPT_JANE:
rc = scanhash_scrypt_jane(thr_id, work.data, work.target, NULL,
max_nonce, &hashes_done, &tv_start, &tv_end);
rc = scanhash_scrypt_jane(thr_id, &work, max_nonce, &hashes_done,
NULL, &tv_start, &tv_end);
break;

case ALGO_SKEIN:
rc = scanhash_skeincoin(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_skeincoin(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_SKEIN2:
rc = scanhash_skein2(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_skein2(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_S3:
rc = scanhash_s3(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_s3(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_WHIRLPOOLX:
rc = scanhash_whirlpoolx(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_whirlx(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_X11:
rc = scanhash_x11(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_x11(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_X13:
rc = scanhash_x13(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_x13(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_X14:
rc = scanhash_x14(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;

rc = scanhash_x14(thr_id, &work, max_nonce, &hashes_done);
case ALGO_X15:
rc = scanhash_x15(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_x15(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_X17:
rc = scanhash_x17(thr_id, work.data, work.target,
max_nonce, &hashes_done);
rc = scanhash_x17(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_ZR5:
rc = scanhash_zr5(thr_id, &work, max_nonce, &hashes_done);
break;
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([ccminer], [1.6.7-dev])
AC_INIT([ccminer], [1.7-dev])

AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM
Expand Down
6 changes: 3 additions & 3 deletions cpuminer-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
#define PACKAGE_NAME "ccminer"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "ccminer 1.6.6"
#define PACKAGE_STRING "ccminer 1.7-dev"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ccminer"
Expand All @@ -171,7 +171,7 @@
#define PACKAGE_URL "http://github.com/tpruvot/ccminer"

/* Define to the version of this package. */
#define PACKAGE_VERSION "1.6.6"
#define PACKAGE_VERSION "1.7-dev"

/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
Expand All @@ -185,7 +185,7 @@
#define STDC_HEADERS 1

/* Version number of package */
#define VERSION "1.6.6"
#define VERSION "1.7-dev"

/* Define curl_free() as free() if our version of curl lacks curl_free. */
/* #undef curl_free */
Expand Down
Loading

0 comments on commit 5308898

Please sign in to comment.