Skip to content

Commit

Permalink
Merge pull request #7 from Kudaraidee/JayDDee-master
Browse files Browse the repository at this point in the history
import v3.19.6 form JayDDee
  • Loading branch information
xiaolin1579 authored Mar 5, 2022
2 parents 9da6b97 + c8e1c36 commit b233397
Show file tree
Hide file tree
Showing 167 changed files with 19,407 additions and 10,446 deletions.
22 changes: 17 additions & 5 deletions INSTALL_LINUX
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,26 @@ but different package names.
$ sudo apt-get install build-essential automake libssl-dev libcurl4-openssl-dev libjansson-dev libgmp-dev zlib1g-dev git

SHA support on AMD Ryzen CPUs requires gcc version 5 or higher and
openssl 1.1.0e or higher. Add one of the following to CFLAGS for SHA
support depending on your CPU and compiler version:
openssl 1.1.0e or higher.

"-march=native" is always the best choice
znver1 and znver2 should be recognized on most recent version of GCC and
znver3 is expected with GCC 11. GCC 11 also includes rocketlake support.
In the meantime here are some suggestions to compile with new CPUs:

"-march=znver1" for Ryzen 1000 & 2000 series, znver2 for 3000.
"-march=native" is usually the best choice, used by build.sh.

"-msha" Add SHA to other tuning options
"-march=znver2 -mvaes" can be used for Ryzen 5000 if znver3 is not recongized.

"-mcascadelake -msha" or
"-mcometlake -mavx512 -msha" can be used for Rocket Lake.

Features can also be added individually:

"-msha" adds support for HW accelerated sha256.

"-mavx512" adds support for 512 bit vectors

"-mvaes" add support for parallel AES

Additional instructions for static compilalation can be found here:
https://lxadm.com/Static_compilation_of_cpuminer
Expand Down
132 changes: 59 additions & 73 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.
respected download locations, copy them to $HOME/usr/lib/ and uncompress them.

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

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

openssl
curl
gmp
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,63 +111,48 @@ https://github.com/JayDDee/cpuminer-opt/releases

Decompress and change to the cpuminer-opt directory.



6. Prepare to compile
6. compile

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

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

Edit configure.ac to fix lipthread package name.

sed -i 's/"-lpthread"/"-lpthreadGC2"/g' configure.ac

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

7. Compile
$ ./autogen.sh

you can use the default compile if you intend to use cpuminer-opt on the
same CPU and the virtual machine supports that architecture.
Configure the compiler for the CPU architecture of the host machine:

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

Otherwise you can compile manually while setting options in CFLAGS.
or cross compile for a specific CPU architecture:

Some common options:

To compile for a specific CPU architecture:

CFLAGS="-O3 -march=znver1 -Wall" ./configure --with-curl
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:
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 --with-curl
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 build-allarch.sh
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:
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
"-D_WIN32_WINNT=0x0601"

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

make -j n
$ 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.
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:
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.
Command options are specific to where you mine. Refer to the pool's instructions on how to set them.


45 changes: 18 additions & 27 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ cpuminer_SOURCES = \
util.c \
api.c \
sysinfos.c \
algo-gate-api.c \
crypto/oaes_lib.c \
crypto/c_keccak.c \
crypto/c_groestl.c \
crypto/c_blake256.c \
crypto/c_jh.c \
algo-gate-api.c\
malloc-huge.c \
algo/argon2/argon2a/argon2a.c \
algo/argon2/argon2a/ar2/argon2.c \
algo/argon2/argon2a/ar2/opt.c \
Expand Down Expand Up @@ -72,24 +68,11 @@ cpuminer_SOURCES = \
algo/bmw/bmw512-gate.c \
algo/bmw/bmw512.c \
algo/bmw/bmw512-4way.c \
algo/cubehash/sph_cubehash.c\
algo/cubehash/cubehash_sse2.c\
algo/cubehash/cube-hash-2way.c \
algo/echo/sph_echo.c \
algo/echo/echo-hash-4way.c \
algo/echo/aes_ni/hash.c \
algo/gr/cryptonote/crypto/aesb.c \
algo/gr/cryptonote/crypto/hash.c \
algo/gr/cryptonote/crypto/c_skein.c \
algo/gr/cryptonote/cryptonight.c \
algo/gr/cryptonote/cryptonight_dark.c \
algo/gr/cryptonote/cryptonight_dark_lite.c \
algo/gr/cryptonote/cryptonight_fast.c \
algo/gr/cryptonote/cryptonight_lite.c \
algo/gr/cryptonote/cryptonight_soft_shell.c \
algo/gr/cryptonote/cryptonight_turtle.c \
algo/gr/cryptonote/cryptonight_turtle_lite.c \
algo/gr/gr-gate.c \
algo/echo/aes_ni/hash.c\
algo/gost/sph_gost.c \
algo/groestl/groestl-gate.c \
algo/groestl/groestl512-hash-4way.c \
Expand Down Expand Up @@ -126,7 +109,6 @@ cpuminer_SOURCES = \
algo/keccak/sha3d-4way.c \
algo/keccak/sha3d.c \
algo/lanehash/lane.c \
algo/luffa/sph_luffa.c \
algo/luffa/luffa_for_sse2.c \
algo/luffa/luffa-hash-2way.c \
algo/lyra2/lyra2.c \
Expand All @@ -148,7 +130,7 @@ cpuminer_SOURCES = \
algo/lyra2/allium.c \
algo/lyra2/phi2-4way.c \
algo/lyra2/phi2.c \
algo//m7m/m7m.c \
algo/m7m/m7m.c \
algo/m7m/magimath.cpp \
algo/nist5/nist5-gate.c \
algo/nist5/nist5-4way.c \
Expand Down Expand Up @@ -177,14 +159,20 @@ cpuminer_SOURCES = \
algo/ripemd/lbry.c \
algo/ripemd/lbry-4way.c \
algo/scrypt/scrypt.c \
algo/scrypt/scrypt-core-4way.c \
algo/scrypt/neoscrypt.c \
algo/sha/sha256-hash.c \
algo/sha/sph_sha2.c \
algo/sha/sph_sha2big.c \
algo/sha/sha256-hash-4way.c \
algo/sha/sha512-hash-4way.c \
algo/sha/sha256-hash-opt.c \
algo/sha/sha256-hash-2way-ni.c \
algo/sha/hmac-sha256-hash.c \
algo/sha/hmac-sha256-hash-4way.c \
algo/sha/sha256d.c \
algo/sha/sha2.c \
algo/sha/sha256d-4way.c \
algo/sha/sha256t-gate.c \
algo/sha/sha256t-4way.c \
algo/sha/sha256t.c \
Expand All @@ -197,7 +185,6 @@ cpuminer_SOURCES = \
algo/shavite/shavite-hash-2way.c \
algo/shavite/shavite-hash-4way.c \
algo/shavite/shavite.c \
algo/simd/sph_simd.c \
algo/simd/nist.c \
algo/simd/vector.c \
algo/simd/simd-hash-2way.c \
Expand All @@ -212,14 +199,19 @@ cpuminer_SOURCES = \
algo/sm3/sm3-hash-4way.c \
algo/swifftx/swifftx.c \
algo/tiger/sph_tiger.c \
algo/verthash/verthash-gate.c \
algo/verthash/Verthash.c \
algo/verthash/fopen_utf8.c \
algo/verthash/tiny_sha3/sha3.c \
algo/verthash/tiny_sha3/sha3-4way.c \
algo/whirlpool/sph_whirlpool.c \
algo/whirlpool/whirlpool-hash-4way.c \
algo/whirlpool/whirlpool-gate.c \
algo/whirlpool/whirlpool.c \
algo/whirlpool/whirlpoolx.c \
algo/x11/0x10-gate.c \
algo/x11/0x10.c \
algo/x11/0x10-4way.c \
algo/x11/hash0x10-gate.c \
algo/x11/hash0x10.c \
algo/x11/hash0x10-4way.c \
algo/x11/x11-gate.c \
algo/x11/x11.c \
algo/x11/x11-4way.c \
Expand Down Expand Up @@ -282,7 +274,6 @@ cpuminer_SOURCES = \
algo/x16/x21s-4way.c \
algo/x16/x21s.c \
algo/x16/minotaur.c \
algo/x16/minotaurx.c \
algo/x17/x17-gate.c \
algo/x17/x17.c \
algo/x17/x17-4way.c \
Expand Down
Loading

0 comments on commit b233397

Please sign in to comment.