Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Equihash <144,5> #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 2 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,18 @@ cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # -Wall

## Enable solvers here
#### older slower
option(USE_CPU_TROMP "USE CPU_TROMP" OFF)
option(USE_CUDA_TROMP "USE CUDA_TROMP" OFF)
#### faster
option(USE_CPU_XENONCAT "USE CPU_XENONCAT" ON)
option(USE_CUDA_DJEZO "USE CUDA_DJEZO" ON)
option(USE_CPU_TROMP "USE CPU_TROMP" ON)
option(USE_CUDA_TROMP "USE CUDA_TROMP" ON)

## Add solvers here
if (USE_CPU_TROMP)
add_definitions(-DUSE_CPU_TROMP)
message("-- USE_CPU_TROMP DEFINED")
endif()
if (USE_CPU_XENONCAT)
add_definitions(-DUSE_CPU_XENONCAT)
message("-- USE_CPU_XENONCAT DEFINED")
endif()
if (USE_CUDA_TROMP)
add_definitions(-DUSE_CUDA_TROMP)
message("-- USE_CUDA_TROMP DEFINED")
endif()
if (USE_CUDA_DJEZO)
add_definitions(-DUSE_CUDA_DJEZO)
message("-- USE_CUDA_DJEZO DEFINED")
endif()


########
Expand Down Expand Up @@ -161,17 +149,9 @@ message("-- LIBS: ${LIBS}")
if (USE_CPU_TROMP)
add_subdirectory(cpu_tromp)
endif()
if (USE_CPU_XENONCAT)
add_subdirectory(cpu_xenoncat)
endif()
if (USE_CUDA_TROMP)
add_subdirectory(cuda_tromp)
endif()
if (USE_CUDA_DJEZO)
add_subdirectory(cuda_djezo)
endif()

#add_subdirectory(cpu_xenoncat)

ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCE_FILES})

Expand All @@ -182,17 +162,7 @@ target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} ${LIBS} )
if (USE_CPU_TROMP)
target_link_libraries(${PROJECT_NAME} cpu_tromp)
endif()
if (USE_CPU_XENONCAT)
add_library ( xenoncat_avx1 SHARED IMPORTED GLOBAL )
set_target_properties ( xenoncat_avx1 PROPERTIES IMPORTED_LOCATION "../nheqminer/cpu_xenoncat/asm_linux/equihash_avx1.o" )
add_library ( xenoncat_avx2 SHARED IMPORTED GLOBAL )
set_target_properties ( xenoncat_avx2 PROPERTIES IMPORTED_LOCATION "../nheqminer/cpu_xenoncat/asm_linux/equihash_avx2.o" )
target_link_libraries(${PROJECT_NAME} cpu_xenoncat xenoncat_avx1 xenoncat_avx2)
endif()
if (USE_CUDA_TROMP)
target_link_libraries(${PROJECT_NAME} cuda_tromp)
endif()
if (USE_CUDA_DJEZO)
target_link_libraries(${PROJECT_NAME} cuda_djezo)
endif()

40 changes: 24 additions & 16 deletions LICENSE_MIT
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
The MIT License (MIT)
=====================

Copyright (c) 2016 John Tromp
Copyright 2016 John Tromp,

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software, and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright � 2016-2018 NiceHash,

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Copyright � 2018 The Zclassic Community.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the �Software�), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED �AS IS�, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Windows builds made by us are available here: https://github.com/nicehash/nheqminer/releases

Download and install:
- [CUDA SDK](https://developer.nvidia.com/cuda-downloads) (if not needed remove **USE_CUDA_TROMP** and **USE_CUDA_DJEZO** from **nheqminer** Preprocessor definitions under Properties > C/C++ > Preprocessor)
- [CUDA SDK](https://developer.nvidia.com/cuda-downloads) (if not needed remove **USE_CUDA_TROMP** from **nheqminer** Preprocessor definitions under Properties > C/C++ > Preprocessor)
- Visual Studio 2013 Community: https://www.visualstudio.com/en-us/news/releasenotes/vs2013-community-vs
- [Visual Studio Update 5](https://www.microsoft.com/en-us/download/details.aspx?id=48129) installed
- 64 bit version only
Expand All @@ -17,15 +17,13 @@ Open **nheqminer.sln** under **nheqminer/nheqminer.sln** and build. You will hav

### Enabled solvers:
- USE_CPU_TROMP
- USE_CPU_XENONCAT
- USE_CUDA_TROMP
- USE_CUDA_DJEZO

If you don't wan't to build with all solvlers you can go to **nheqminer Properties > C/C++ > Preprocessor > Preprocessor Definitions** and remove the solver you don't need.

## Linux
Work in progress.
Working solvers CPU_TROMP, CPU_XENONCAT, CUDA_TROMP, CUDA_DJEZO
Working solvers CPU_TROMP, CUDA_TROMP

### General instructions:
- Install CUDA SDK v8 (make sure you have cuda libraries in **LD_LIBRARY_PATH** and cuda toolkit bins in **PATH**)
Expand All @@ -36,19 +34,11 @@ Working solvers CPU_TROMP, CPU_XENONCAT, CUDA_TROMP, CUDA_DJEZO

- Use Boost 1.62+ (if it is not available from the repos you will have to download and build it yourself)
- CMake v3.5 (if it is not available from the repos you will have to download and build it yourself)
- Currently support only static building (CPU_XENONCAT, CUDA_DJEZO are enabled by default, check **CMakeLists.txt** in **nheqminer** root folder)
- Currently support only static building (CUDA_TROMP is enabled by default, check **CMakeLists.txt** in **nheqminer** root folder)
- If not on Ubuntu make sure you have **fasm** installed and accessible in **PATH**
- After that open the terminal and run the following commands:
- `git clone https://github.com/nicehash/nheqminer.git`
- Generating asm object file:
- **On Ubuntu**:
- `cd nheqminer/cpu_xenoncat/asm_linux/`
- `sh assemble.sh`
- **bundeled fasm not compatible**:
- delete/replace (inside **nheqminer/cpu_xenoncat/asm_linux/** directory) with fasm binary compatible with your distro
- `cd nheqminer/cpu_xenoncat/asm_linux/`
- `sh assemble.sh`
- `cd ../../../`
- `cd nheqminer`
- `mkdir build && cd build`
- `cmake ../nheqminer`
- `make -j $(nproc)`
Expand Down
6 changes: 2 additions & 4 deletions cpu_tromp/equi.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Equihash solver
// Copyright (c) 2016-2016 John Tromp


#include "blake2/blake2.h"
#ifdef __APPLE__
#include "osx_barrier.h"
Expand All @@ -26,11 +25,11 @@ typedef unsigned char uchar;
// algorithm parameters, prefixed with W to reduce include file conflicts

#ifndef WN
#define WN 200
#define WN 144
#endif

#ifndef WK
#define WK 9
#define WK 5
#endif

#define PARAMETER_N WN
Expand Down Expand Up @@ -132,4 +131,3 @@ int verify(u32 indices[PROOFSIZE], const char *header, const u32 headerlen, cons
uchar hash[WN/8];
return verifyrec(&ctx, indices, hash, WK);
}

Loading