Skip to content

Commit

Permalink
v3.15.7
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDDee committed Mar 9, 2021
1 parent dc6b007 commit 4008942
Show file tree
Hide file tree
Showing 26 changed files with 598 additions and 2,161 deletions.
141 changes: 101 additions & 40 deletions INSTALL_WINDOWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Instructions for compiling cpuminer-opt for Windows.

Thwaw intructions nay be out of date. Please consult the wiki for
the latest:

https://github.com/JayDDee/cpuminer-opt/wiki/Compiling-from-source

Windows compilation using Visual Studio is not supported. Mingw64 is
used on a Linux system (bare metal or virtual machine) to cross-compile
Expand All @@ -24,79 +28,76 @@ Refer to Linux compile instructions and install required packages.

Additionally, install mingw-w64.

sudo apt-get install mingw-w64
sudo apt-get install mingw-w64 libz-mingw-w64-dev


2. Create a local library directory for packages to be compiled in the next
step. Suggested location is $HOME/usr/lib/

$ mkdir $HOME/usr/lib

3. Download and build other packages for mingw that don't have a mingw64
version available in the repositories.

Download the following source code packages from their respective and
respected download locations, copy them to ~/usr/lib/ and uncompress them.

openssl
curl
gmp
openssl: https://github.com/openssl/openssl/releases

curl: https://github.com/curl/curl/releases

gmp: https://gmplib.org/download/gmp/

In most cases the latest vesrion is ok but it's safest to download
the same major and minor version as included in your distribution.
In most cases the latest version is ok but it's safest to download the same major and minor version as included in your distribution. The following uses versions from Ubuntu 20.04. Change version numbers as required.

Run the following commands or follow the supplied instructions.
Do not run "make install" unless you are using ~/usr/lib, which isn't
recommended.
Run the following commands or follow the supplied instructions. Do not run "make install" unless you are using /usr/lib, which isn't recommended.

Some instructions insist on running "make check". If make check fails
it may still work, YMMV.
Some instructions insist on running "make check". If make check fails it may still work, YMMV.

You can speed up "make" by using all CPU cores available with "-j n" where
n is the number of CPU threads you want to use.
You can speed up "make" by using all CPU cores available with "-j n" where n is the number of CPU threads you want to use.

openssl:

./Configure mingw64 shared --cross-compile-prefix=x86_64-w64-mingw32
make
$ ./Configure mingw64 shared --cross-compile-prefix=x86_64-w64-mingw32-
$ make

Make may fail with an ld error, just ensure libcrypto-1_1-x64.dll is created.

curl:

./configure --with-winssl --with-winidn --host=x86_64-w64-mingw32
make
$ ./configure --with-winssl --with-winidn --host=x86_64-w64-mingw32
$ make

gmp:

./configure --host=x86_64-w64-mingw32
make


$ ./configure --host=x86_64-w64-mingw32
$ make

4. Tweak the environment.

This step is required everytime you login or the commands can be added to
.bashrc.
This step is required everytime you login or the commands can be added to .bashrc.

Define some local variables to point to local library.
Define some local variables to point to local library.

export LOCAL_LIB="$HOME/usr/lib"
$ export LOCAL_LIB="$HOME/usr/lib"

export LDFLAGS="-L$LOCAL_LIB/curl/lib/.libs -L$LOCAL_LIB/gmp/.libs -L$LOCAL_LIB/openssl"
$ export LDFLAGS="-L$LOCAL_LIB/curl/lib/.libs -L$LOCAL_LIB/gmp/.libs -L$LOCAL_LIB/openssl"

export CONFIGURE_ARGS="--with-curl=$LOCAL_LIB/curl --with-crypto=$LOCAL_LIB/openssl --host=x86_64-w64-mingw32"
$ export CONFIGURE_ARGS="--with-curl=$LOCAL_LIB/curl --with-crypto=$LOCAL_LIB/openssl --host=x86_64-w64-mingw32"

Create a release directory and copy some dll files previously built.
This can be done outside of cpuminer-opt and only needs to be done once.
If the release directory is in cpuminer-opt directory it needs to be
recreated every a source package is decompressed.
Adjust for gcc version:

mkdir release
cp /usr/x86_64-w64-mingw32/lib/zlib1.dll release/
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll release/
cp /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/libstdc++-6.dll release/
cp /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/libgcc_s_seh-1.dll release/
cp $LOCAL_LIB/openssl/libcrypto-1_1-x64.dll release/
cp $LOCAL_LIB/curl/lib/.libs/libcurl-4.dll release/
$ export GCC_MINGW_LIB="/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32"

Create a release directory and copy some dll files previously built. This can be done outside of cpuminer-opt and only needs to be done once. If the release directory is in cpuminer-opt directory it needs to be recreated every time a source package is decompressed.

$ mkdir release
$ cp /usr/x86_64-w64-mingw32/lib/zlib1.dll release/
$ cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll release/
$ cp $GCC_MINGW_LIB/libstdc++-6.dll release/
$ cp $GCC_MINGW_LIB/libgcc_s_seh-1.dll release/
$ cp $LOCAL_LIB/openssl/libcrypto-1_1-x64.dll release/
$ cp $LOCAL_LIB/curl/lib/.libs/libcurl-4.dll release/

The following steps need to be done every time a new source package is
opened.
Expand All @@ -110,13 +111,73 @@ https://github.com/JayDDee/cpuminer-opt/releases

Decompress and change to the cpuminer-opt directory.

6. compile

Create a link to the locally compiled version of gmp.h

$ ln -s $LOCAL_LIB/gmp-version/gmp.h ./gmp.h

$ ./autogen.sh

Configure the compiler for the CPU architecture of the host machine:

CFLAGS="-O3 -march=native -Wall" ./configure $CONFIGURE_ARGS

or cross compile for a specific CPU architecture:

CFLAGS="-O3 -march=znver1 -Wall" ./configure $CONFIGURE_ARGS

This will compile for AMD Ryzen.

You can compile more generically for a set of specific CPU features if you know what features you want:

CFLAGS="-O3 -maes -msse4.2 -Wall" ./configure $CONFIGURE_ARGS

This will compile for an older CPU that does not have AVX.

You can find several examples in README.txt

If you have a CPU with more than 64 threads and Windows 7 or higher you can enable the CPU Groups feature by adding the following to CFLAGS:

"-D_WIN32_WINNT=0x0601"

Once you have run configure successfully run the compiler with n CPU threads:

$ make -j n

Copy cpuminer.exe to the release directory, compress and copy the release directory to a Windows system and run cpuminer.exe from the command line.

Run cpuminer

In a command windows change directories to the unzipped release folder. to get a list of all options:

cpuminer.exe --help

Command options are specific to where you mine. Refer to the pool's instructions on how to set them.




















6. Prepare to compile

Create a link to the locally compiled version of gmp.h

ln -s $LOCAL_LIB/gmp-version/gmp.h ./gmp.h
$ ln -s $LOCAL_LIB/gmp-version/gmp.h ./gmp.h

Edit configure.ac to fix lipthread package name.

Expand Down
8 changes: 8 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ If not what makes it happen or not happen?
Change Log
----------

v3.15.7

Added accepted/stale/rejected percentage to summary log report.
Added warning if share counters mismatch which could corrupt stats.
Linux: CPU temperature reporting is more responsive to rising temperature.
A few AVX2 & AVX512 tweaks.
Removed some dead code and other cleanup.

v3.15.6

Implement keccak pre-hash optimization for x16* algos.
Expand Down
4 changes: 2 additions & 2 deletions algo/echo/aes_ni/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ MYALIGN const unsigned int mul2ipt[] = {0x728efc00, 0x6894e61a, 0x3fc3b14d, 0x2

#define ECHO_SUBBYTES(state, i, j) \
state[i][j] = _mm_aesenc_si128(state[i][j], k1);\
state[i][j] = _mm_aesenc_si128(state[i][j], M128(zero));\
k1 = _mm_add_epi32(k1, M128(const1))
k1 = _mm_add_epi32(k1, M128(const1));\
state[i][j] = _mm_aesenc_si128(state[i][j], M128(zero))

#define ECHO_MIXBYTES(state1, state2, j, t1, t2, s2) \
s2 = _mm_add_epi8(state1[0][j], state1[0][j]);\
Expand Down
17 changes: 9 additions & 8 deletions algo/echo/echo-hash-4way.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ static const unsigned int mul2ipt[] __attribute__ ((aligned (64))) =
0xfd5ba600, 0x2a8c71d7, 0x1eb845e3, 0xc96f9234
};
*/
// do these need to be reversed?

#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__)


#define mul2mask \
m512_const2_64( 0, 0x00001b00 )
//#define mul2mask m512_const2_64( 0, 0x00001b00 )
//_mm512_set4_epi32( 0, 0, 0, 0x00001b00 )
// _mm512_set4_epi32( 0x00001b00, 0, 0, 0 )
//_mm512_set4_epi32( 0x00001b00, 0, 0, 0 )

#define lsbmask m512_const1_32( 0x01010101 )
//#define lsbmask m512_const1_32( 0x01010101 )

#define ECHO_SUBBYTES( state, i, j ) \
state[i][j] = _mm512_aesenc_epi128( state[i][j], k1 ); \
state[i][j] = _mm512_aesenc_epi128( state[i][j], m512_zero ); \
k1 = _mm512_add_epi32( k1, m512_one_128 );
k1 = _mm512_add_epi32( k1, one ); \
state[i][j] = _mm512_aesenc_epi128( state[i][j], m512_zero );

#define ECHO_MIXBYTES( state1, state2, j, t1, t2, s2 ) do \
{ \
Expand Down Expand Up @@ -140,6 +138,9 @@ void echo_4way_compress( echo_4way_context *ctx, const __m512i *pmsg,
unsigned int r, b, i, j;
__m512i t1, t2, s2, k1;
__m512i _state[4][4], _state2[4][4], _statebackup[4][4];
__m512i one = m512_one_128;
__m512i mul2mask = m512_const2_64( 0, 0x00001b00 );
__m512i lsbmask = m512_const1_32( 0x01010101 );

_state[ 0 ][ 0 ] = ctx->state[ 0 ][ 0 ];
_state[ 0 ][ 1 ] = ctx->state[ 0 ][ 1 ];
Expand Down Expand Up @@ -406,8 +407,8 @@ int echo_4way_full( echo_4way_context *ctx, void *hashval, int nHashSize,

#define ECHO_SUBBYTES_2WAY( state, i, j ) \
state[i][j] = _mm256_aesenc_epi128( state[i][j], k1 ); \
k1 = _mm256_add_epi32( k1, m256_one_128 ); \
state[i][j] = _mm256_aesenc_epi128( state[i][j], m256_zero ); \
k1 = _mm256_add_epi32( k1, m256_one_128 );

#define ECHO_MIXBYTES_2WAY( state1, state2, j, t1, t2, s2 ) do \
{ \
Expand Down
6 changes: 5 additions & 1 deletion algo/fugue/fugue-aesni.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
#ifndef FUGUE_HASH_API_H
#define FUGUE_HASH_API_H

#if defined(__AES__)
#if defined(__AES__)

#if !defined(__SSE4_1__)
#error "Unsupported configuration, AES needs SSE4.1. Compile without AES."
#endif

#include "algo/sha/sha3_common.h"
#include "simd-utils.h"
Expand Down
Loading

0 comments on commit 4008942

Please sign in to comment.