Skip to content

Commit

Permalink
cpuminer-opt-3.1.10.tar.gz
Browse files Browse the repository at this point in the history
  • Loading branch information
hmage committed Apr 7, 2016
1 parent 8ef6220 commit 4e1cf47
Show file tree
Hide file tree
Showing 43 changed files with 6,070 additions and 178 deletions.
15 changes: 13 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ dist_man_MANS = cpuminer.1
cpuminer_SOURCES = \
cpu-miner.c \
util.c \
uint256.cpp \
api.c \
sysinfos.c \
uint256.cpp \
algo-gate-api.c\
algo/groestl/sph_groestl.c \
algo/skein/sph_skein.c \
Expand Down Expand Up @@ -75,6 +75,17 @@ cpuminer_SOURCES = \
algo/groestl/aes_ni/hash-groestl.c \
algo/haval/haval.c\
algo/heavy/heavy.c \
algo/hodl/hodl.cpp \
algo/hodl/hodl-gate.c \
algo/hodl/hodl_arith_uint256.cpp \
algo/hodl/hodl_uint256.cpp \
algo/hodl/hash.cpp \
algo/hodl/hmac_sha512.cpp \
algo/hodl/sha256.cpp \
algo/hodl/sha512.cpp \
algo/hodl/utilstrencodings.cpp \
algo/hodl/hodl-wolf.c \
algo/hodl/aes.c \
algo/luffa/luffa.c \
algo/luffa/sse2/luffa_for_sse2.c \
algo/lyra2/lyra2.c \
Expand Down Expand Up @@ -133,7 +144,7 @@ if HAVE_WINDOWS
endif

cpuminer_LDFLAGS = @LDFLAGS@
cpuminer_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@
cpuminer_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@ -lssl -lcrypto -lboost_thread -lboost_system
cpuminer_CPPFLAGS = @LIBCURL_CPPFLAGS@ $(ALL_INCLUDES)
cpuminer_CFLAGS = -Wno-pointer-sign -Wno-pointer-to-int-cast $(disable_flags)

Expand Down
59 changes: 41 additions & 18 deletions RELEASE_ANNOUNCEMENT
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,49 @@

All users are encouraged to upgrade.

New in v3.1.9
New in 3.1.10

- added decred (blake256r14)
- myr-gr optimized for AES_NI, marginal increase in hashrate
- groestl, keccak & blakecoin fixed.
- x11gost is added as an alias for sib
- HOdl algo added with support for CPUs with or without AES_NI
such as the core2 and many AMD CPUs.
HOdl is a new CPU advantaged algo. at this time there is no GPU
miner available.
This implementation merges hodlminer and hodlminer-wolf with
cpuminer-opt.
Compiling requires some additional libraries not included in the
default instalation of most Linux distributions: libboost-dev,
libboost-system-dev, libboost-thread-dev.

Other recently added or improved algos
Errata: The miner reports an inflated hashrate when mining hodl.
The actual hashrate is around .6 the reported rate, but
this is just an approximation. It is expected this implentation
performs to the same level as their ancestors as I have
made no changes to the code. The issue will be addressed in
a future release.

- pluck and drop added, benchmark only
- minor bug fixes, code cleanup and reduction in compiler warnings

Recently added algos:

- decred (blake256r14)
- vanilla (blake256r8vnl)
- x14 added with AES_NI and SSE2 optimisations
- blake added
- blake2s added
- vanilla (blake256r8vnl) added
- sib algo optimised:
- blake
- blake2s

Recently improved algos:

- sib optimised:
+116% AES_NI + SSE2
+63% SSE2
- nist5 algo SSE optimised, in addition to previous AES_NI optimizations
- nist5 optimised tor AES_NI & SSE2
+111% AES_NI + SSE2
+68% SSE2
- c11 algo +57% optimized for AES_NI & SSE2
- zr5 algo optimized for AES_NI and SSE2
- c11 +57% optimized for AES_NI & SSE2
- zr5 optimized for AES_NI and SSE2
+98% AES_NI + SSE2
+45% SSE2
- myr-gr optimized for AES_NI, marginal increase in hashrate

Starting in release 3.1 a CPU with a minimum of SSE2 is required.
This includes core2 and newer CPUs. Some algos also require AES_NI,
Expand Down Expand Up @@ -56,22 +76,25 @@ sib 540 404 0.73
c11 733 475 0.99
myr-gr 1572 1560 2.12
cryptonight 290 H (3) 0.00039
neoscrypt (4) 32 K 0.043
neoscrypt (4) 32 0.043
lyra2re (4) 930 1.25
lyra2rev2 (4) 495 0.65
blake (4) 22.4 M 30.4
blake2s (4) 17.5 M 23.6
vanilla (4) 33 M 44.6
decred (4) 22.6 M 30.5
blake2s (4) 17.5 23.6
vanilla (4) 33.0 44.6
decred (4) 22.6 30.5
pentablake (4) 3960 K 5.35
keccak (4) 7790 K 10.5
keccak (4) 7790 10.5
axiom (4) 72 H 0.098
groestl (4) 931 1.26
skein (4) 5747 7.77
skein2 (4) 8675 11.7
blakecoin(2) (4) 33.9 M 45.8
fresh(2) (4) 528 K 0.71
cryptolight(2) (4) 685 H 0.00093
pluck(2) (4) 1925 0.0026
drop(2) (4) 934 K 1.26
hodl(6) 440 400 H 0.00054

Footnotes:
(1) SSE2 rates are simulated in software.
Expand Down
86 changes: 76 additions & 10 deletions algo-gate-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,31 @@
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include <memory.h>
#include "miner.h"
#include "algo-gate-api.h"

// define null functions

// null vs default: strictly speaking a null function should do nothing
// and a default function should do what satisfies the most clients (algos).
// This distinction is blurred and the two function types are combined.
// A null function is either a true do-nothing or it is the default
// action. The only rule is that if even a single client requires a do-nothing
// function it must be the null function. This will require every other
// client to define and register a custom function. In some cases where
// many clients require the same action it may be desireable to define
// an explicit default do-something function here that will eliminate
// the need for those clients to each define their own. The must still
// register the default.
// As algo-gate evolves some function are taking on multiple personalities.
// The same function could perform completely unrelated actions for
// different algos, they jut happen to require that action at the same
// point. The function names could become confusing.
// TODO: make names more generic. Determine a plan forward for the evolution
// of aggo-gate, whether to have many smaller, unique gate functions or
// fewer, larger functions with more code duplication.

void null_init_ctx()
{};

Expand Down Expand Up @@ -92,6 +112,14 @@ void null_set_data_and_target_size( int *data_size, int *target_size,
void null_wait_for_diff( struct stratum_ctx* stratum )
{}

void null_build_stratum_request( char* req, struct work* work,
unsigned char *xnonce2str, char* ntimestr, char* noncestr )
{
snprintf( req, JSON_BUF_LEN,
"{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}",
rpc_user, work->job_id, xnonce2str, ntimestr, noncestr );
}

void null_reverse_endian ( struct work* work )
{}

Expand All @@ -108,7 +136,6 @@ void null_calc_network_diff ( struct work* work )
// sample for diff 43.281 : 1c05ea29
// todo: endian reversed on longpoll could be zr5 specific...
uint32_t nbits = have_longpoll ? work->data[18] : swab32(work->data[18]);
// if (opt_algo == ALGO_DECRED) nbits = work->data[29];
uint32_t bits = (nbits & 0xffffff);
int16_t shift = (swab32(nbits) & 0xff); // 0x1c = 28

Expand All @@ -118,10 +145,6 @@ void null_calc_network_diff ( struct work* work )
net_diff *= 256.0;
for (int m=29; m < shift; m++)
net_diff /= 256.0;
// if ( shift == 28 )
// net_diff *= 256.0; // testnet
// if (opt_debug_diff)
// applog(LOG_DEBUG, "net diff: %f -> shift %u, bits %08x", d, shift, bits);
}

unsigned char* null_get_xnonce2str( struct work* work, size_t xnonce1_size )
Expand Down Expand Up @@ -151,32 +174,72 @@ bool null_prevent_dupes( uint32_t* nonceptr, struct work* work,
return false;
}

void null_thread_barrier_init()
{}

void null_thread_barrier_wait()
{}

void null_copy_workdata ( struct work* work, struct work* g_work,
uint32_t **nonceptr, int wkcmp_offset, int wkcmp_sz, int nonce_oft,
int thr_id )
{
// nonceptr s a clone of the parent. It doesn't get modified in
// this function, only the data it points to is modified.
// WRONG, it does get updated from new work.
// uint32_t *nonceptr = (uint32_t*)( ( (char*)work->data ) + nonce_oft );

if ( memcmp( &work->data[wkcmp_offset], &g_work->data[wkcmp_offset],
wkcmp_sz )
|| jsonrpc_2 ? memcmp( ( (uint8_t*) work->data ) + 43,
( (uint8_t*) g_work->data ) + 43, 33 ) : 0 )
{
work_free( work );
work_copy( work, g_work );
*nonceptr = (uint32_t*)( ( (char*)work->data ) + nonce_oft );
*nonceptr[0] = 0xffffffffU / opt_n_threads * thr_id;
if ( opt_randomize )
*nonceptr[0] += ( (rand() *4 ) & UINT32_MAX ) / opt_n_threads;
}
else
++(*nonceptr[0]);
}

void null_get_pseudo_random_data ( struct work* work, char* scratchbuf,
int thr_id )
{}

// initialise all functions to null

init_null_algo_gate( algo_gate_t* gate )
void init_null_algo_gate( algo_gate_t* gate )
{
gate->scanhash = (void*)&null_scanhash;
gate->hash = (void*)&null_hash;
gate->hash_alt = (void*)&null_hash_alt;
gate->hash_suw = (void*)&null_hash_suw;
gate->init_ctx = (void*)&null_init_ctx;
gate->ignore_pok = (void*)&null_ignore_pok;
gate->display_pok = (void*)&null_display_pok;
gate->wait_for_diff = (void*)&null_wait_for_diff;
gate->get_max64 = (void*)&null_get_max64;
gate->get_scratchbuf = (void*)&null_get_scratchbuf;
gate->gen_merkle_root = (void*)&null_gen_merkle_root;
gate->build_stratum_request = (void*)&null_build_stratum_request;
gate->set_target = (void*)&null_set_target;
gate->ignore_pok = (void*)&null_ignore_pok;
gate->display_pok = (void*)&null_display_pok;
gate->use_rpc2 = (void*)&null_use_rpc2;
gate->set_data_size = (void*)&null_set_data_size;
gate->set_data_and_target_size = (void*)&null_set_data_and_target_size;
gate->wait_for_diff = (void*)&null_wait_for_diff;
gate->reverse_endian = (void*)&null_reverse_endian;
gate->reverse_endian_17_19 = (void*)&null_reverse_endian_17_19;
gate->calc_network_diff = (void*)&null_calc_network_diff;
gate->get_xnonce2str = (void*)&null_get_xnonce2str;
gate->set_benchmark_work_data = (void*)&null_set_benchmark_work_data;
gate->build_extraheader = (void*)&null_build_extraheader;
gate->build_extraheader = (void*)&null_build_extraheader;
gate->prevent_dupes = (void*)&null_prevent_dupes;
gate->thread_barrier_init = (void*)&null_thread_barrier_init;
gate->thread_barrier_wait = (void*)&null_thread_barrier_wait;
gate->copy_workdata = (void*)&null_copy_workdata;
gate->get_pseudo_random_data = (void*)&null_get_pseudo_random_data;
}

// called by each thread that uses the gate
Expand Down Expand Up @@ -244,6 +307,9 @@ bool register_algo_gate( int algo, algo_gate_t *gate )
case ALGO_GROESTL:
register_groestl_algo( gate );
break;
case ALGO_HODL:
register_hodl_algo( gate );
break;
case ALGO_LUFFA:
register_luffa_algo( gate );
break;
Expand Down
44 changes: 32 additions & 12 deletions algo-gate-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//
//
//
// So you want o add an algo. Well it is a little easier now.
// So you want to add an algo. Well it is a little easier now.
// Look at existing algos for guidance.
//
// 1. Define the algo, miner.h, previously in cpu-miner.c
Expand Down Expand Up @@ -95,22 +95,30 @@ void *( *display_pok ) ( struct work*, uint64_t* );
void *( *wait_for_diff ) ( struct stratum_ctx* );
double *( *get_max64 ) ();
void *( *set_target) ( struct work*, double );
bool *( *get_scratchbuf ) ( char**, double );
bool *( *get_scratchbuf ) ( unsigned char** );
//deprecated
bool *( *use_rpc2 ) ();
void *( *set_data_size ) ( uint32_t*, uint32_t* );
void *( *set_data_size ) ( uint32_t*, uint32_t*, struct work* );
int *( *set_data_and_target_size ) ( int*, int*, int*, int*, bool* );
void *( *gen_merkle_root) ( char*, struct stratum_ctx*, int*,
void *( *gen_merkle_root ) ( char*, struct stratum_ctx*, int*,
uint32_t*, int );
void *( *reverse_endian ) ( struct work* );
void *( *build_stratum_request ) ( char*, struct work*, unsigned char*,
char*, char* );
void *( *reverse_endian ) ( struct work* );
// reverse_endian_34_35 for decred
void *( *reverse_endian_17_19 ) ( uint32_t*, uint32_t*, struct work* );
void *( *calc_network_diff ) ( struct work* );
void *( *reverse_endian_17_19 ) ( uint32_t*, uint32_t*, struct work* );
void *( *calc_network_diff ) ( struct work* );
unsigned char* *( *get_xnonce2str ) ( struct work*, size_t );
void *( *set_benchmark_work_data ) ( struct work* );
void *( *build_extraheader ) ( struct work*, struct stratum_ctx*, uint32_t*,
int );
bool *( *prevent_dupes ) ( uint32_t*, struct work*, struct stratum_ctx*,
int );
void *( *build_extraheader ) ( struct work*, struct stratum_ctx*,
uint32_t*, int );
bool *( *prevent_dupes ) ( uint32_t*, struct work*,
struct stratum_ctx*, int );
void *( *thread_barrier_init ) ();
void *( *thread_barrier_wait ) ();
void *( *copy_workdata ) ( struct work*, struct work*, uint32_t**,
int, int, int, int );
void ( *get_pseudo_random_data ) ( struct work*, char*, int );
} algo_gate_t;

// Declare null instances
Expand Down Expand Up @@ -138,6 +146,8 @@ bool null_use_rpc2 ();
void null_set_data_size ( uint32_t* data_size, uint32_t* adata_sz );
void null_set_data_and_target_size ( int *data_size, int *target_size,
int *adata_sz, int *atarget_sz, bool* allow_mininginfo );
void null_build_stratum_request( char* req, struct work* work,
unsigned char *xnonce2str, char* ntimestr, char* noncestr );
void null_reverse_endian( struct work* work );
void null_reverse_endian_17_19( uint32_t* ntime , uint32_t* nonce,
struct work* work );
Expand All @@ -148,10 +158,20 @@ void null_build_extraheader( struct work* work, struct stratum_ctx* sctx,
uint32_t* extraheader, int headersize );
bool null_prevent_dupes( uint32_t* nonceptr, struct work* work,
struct stratum_ctx* stratum, int thr_id );
void null_thread_barrier_init ();
void null_thread_barrier_wait ();
void null_copy_workdata ( struct work* work, struct work* g_work,
uint32_t **nonceptr, int wkcmp_offset, int wkcmp_sz, int nonce_oft,
int thr_id );
void null_get_pseudo_random_data ( struct work*, char* scratchbuf,
int thr_id );
char* null_get_nonce2str ( struct work* work );


bool register_algo( algo_gate_t *gate );

// use this to call the hash function of an algo directly
void exec_hash_function( int algo, void *output, const void *pdata );

char* null_get_nonce2str ( struct work* work );
void get_algo_alias( char** algo_or_alias );

6 changes: 2 additions & 4 deletions algo/bmw/bmw256.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ int scanhash_bmw(int thr_id, struct work *work,
bool register_bmw256_algo( algo_gate_t* gate )
{
// gate->init_ctx = &init_bmw_ctx;
gate->scanhash = &scanhash_bmw;
gate->hash = &bmwhash;
// gate->get_max64 = bmw256_get_max64;
// gate->custom_opt = bmw256_custom_opt
gate->scanhash = (void*)&scanhash_bmw;
gate->hash = (void*)&bmwhash;
return true;
};

2 changes: 1 addition & 1 deletion algo/groestl/groestl.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ bool register_groestl_algo( algo_gate_t* gate )
gate->hash = (void*)&groestlhash;
gate->hash_alt = (void*)&groestlhash;
gate->set_target = (void*)&groestl_set_target;
gate->gen_merkle_root = &groestl_gen_merkle_root;
gate->gen_merkle_root = (void*)&groestl_gen_merkle_root;
return true;
};

Loading

0 comments on commit 4e1cf47

Please sign in to comment.