nicehash / nheqminer

Equihash miner for NiceHash
https://www.nicehash.com
MIT License
768 stars 583 forks source link

gpu mining but cpu not in same instance #155

Open montvid opened 7 years ago

montvid commented 7 years ago

I run the command only the gpu is mining, but the cpu is on full load. I checked the speed on the pool and it shows that only the gpu is mining. Maybe problem with cpu_xenoncat_STUB? Runing the the cpu miner i get cpu_xenoncat_AVX2, cpu mining is working.

./nheqminer_cuda_tromp -l eu1-zcash.flypool.org:3333 -u -t 3 -e 2 -cd 0 -cb 8 -ct 64

==================== www.nicehash.com ====================
    Equihash CPU&GPU Miner for NiceHash v0.4b
Thanks to Zcash developers for providing base of the code.
       Special thanks to tromp, xenoncat, mbevand 
             and eXtremal-ik7 for providing 
      optimized CPU, CUDA and AMD equihash solvers.
==================== www.nicehash.com ====================

Setting log level to 2 [02:51:31][0x00007fd9440c8740] Using SSE2: YES [02:51:31][0x00007fd9440c8740] Using AVX: YES [02:51:31][0x00007fd9440c8740] Using AVX2: YES [02:51:31][0x00007fd940eeb700] stratum | Starting miner [02:51:31][0x00007fd93b7fe700] miner#1 | Starting thread #1 (cpu_xenoncat_STUB) [02:51:31][0x00007fd93bfff700] miner#0 | Starting thread #0 (cpu_xenoncat_STUB) [02:51:31][0x00007fd940eeb700] stratum | Connecting to stratum server eu1-zcash.flypool.org:3333 [02:51:31][0x00007fd93affd700] miner#2 | Starting thread #2 (cpu_xenoncat_STUB) [02:51:31][0x00007fd93a7fc700] miner#3 | Starting thread #3 (CUDA-TROMP) GeForce GT 740M (#0) BLOCKS=8, THREADS=64 [02:51:31][0x00007fd940eeb700] stratum | Connected! [02:51:31][0x00007fd940eeb700] stratum | Subscribed to stratum server [02:51:31][0x00007fd940eeb700] miner | Extranonce is 7b9ef8cbf4 [02:51:31][0x00007fd940eeb700] stratum | Authorized worker [02:51:31][0x00007fd940eeb700] stratum | Target set to 0083126e978d4fdf3b645a1cac083126e978d4fdf3b645a1cac083126e978d4f [02:51:32][0x00007fd940eeb700] stratum | Received new job #c5f7e8ddd531a0fe07b3 [02:51:41][0x00007fd9440c8740] Speed [300 sec]: 0.986291 I/s, 1.97258 Sols/s

chronosek commented 7 years ago

could you try do without -e option? Try run cpu mining and gpu mining seperately. What cpu you have? Did you compile by self or run binary? (btw is -u empty or you just cut it?)

montvid commented 7 years ago

Cpu mining and gpu mining seperately are working. cpu mining i get around 7,5 sol, gpu mining 2.5 sol.

montvid commented 7 years ago

I tried without the -e option, i usualy use -e option just in case. as you see avx2 is detected in my system. I am going to sleep now.

chronosek commented 7 years ago

developers will have to look at that, but for emergency you can run separately

montvid commented 7 years ago

I am running them separately. I compiled on ubuntu 16.04. The devs just need to paste the cpu code into the cuda code i guess :P

montvid commented 7 years ago

Fixed it myself in the cmake file of nheqminer_cuda_tromp, the cpu part was commented out + added one line from the cpu cmake file + added my psecific card compute value and it works wonders! There is a trick first in the command line one has to set the gpu variable and then only the cpu variable or else the gpu crashes. Happy mining!

montvid commented 7 years ago

First do: Open terminal and run the following commands:

sudo apt-get install cmake build-essential libboost-all-dev
git clone -b Linux https://github.com/nicehash/nheqminer.git
cd nheqminer/cpu_xenoncat/Linux/asm/
sh assemble.sh

Then edit /nheqminer/Linux_cmake/nheqminer_cuda_tromp$ CMakeLists.txt

project(nheqminer_cuda_tromp) cmake_minimum_required(VERSION 2.8)

option(ENABLE_CUDA "Enable the cuda build" ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

LINUX

if(CMAKE_COMPILER_IS_GNUCXX)

use native cpu features

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
# optimizations
add_definitions(-O3)

endif()

Common

include_directories(${nheqminer_SOURCE_DIR})

add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK)

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-m64;--std=c++11;--disable-warnings;--ptxas-options=-v;-use_fast_math;-lineinfo)

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--disable-warnings;--ptxas-options=-v;-use_fast_math;-lineinfo)

add_definitions(-DHIST)

add_definitions(-DXINTREE)

add_definitions(-DUNROLL)

list(APPEND CUDA_NVCC_FLAGS_RELEASE -O3)

FIND_PACKAGE(CUDA REQUIRED) if(COMPUTE AND (COMPUTE GREATER 0)) LIST(APPEND CUDA_NVCCFLAGS -gencode arch=compute${COMPUTE},code=sm_${COMPUTE}) else(COMPUTE AND (COMPUTE GREATER 0)) set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};; -gencode arch=compute_20,code=sm_21; -gencode arch=compute_30,code=sm_30; -gencode arch=compute_35,code=sm_35; -gencode arch=compute_50,code=sm_50; -gencode arch=compute_52,code=sm_52; -gencode arch=compute_61,code=sm_61 ) endif(COMPUTE AND (COMPUTE GREATER 0))

include_directories(${CUDA_INCLUDE_DIRS})

find_package(Threads REQUIRED COMPONENTS) find_package(Boost REQUIRED COMPONENTS system log_setup log date_time filesystem thread)

if(CUDA_FOUND) message("CUDA FOUND") else() message("CUDA NOT FOUND") endif()

if (Boost_FOUND)

From the offical documentation:

Add include directories to the build. [...] If the SYSTEM option is given,

the compiler will be told the directories are meant as system include

directories on some platforms (signalling this setting might achieve effects

such as the compiler skipping warnings [...])."

include_directories (SYSTEM ${Boost_INCLUDE_DIR})

From the offical documentation:

"Specify directories in which the linker will look for libraries. [...] Note

that this command is rarely necessary. Library locations returned by

find_package() and find_library() are absolute paths. Pass these absolute

library file paths directly to the target_link_libraries() command. CMake

will ensure the linker finds them."

link_directories (${Boost_LIBRARY_DIRS}) else() message("Boost_FOUND NOT FOUND") endif ()

Add solvers here

add_definitions(-DUSE_CPU_XENONCAT)

add_definitions(-DUSE_CPU_TROMP)

add_definitions(-DUSE_CUDA_TROMP)

add_library ( xenoncat_avx1 SHARED IMPORTED GLOBAL ) set_target_properties ( xenoncat_avx1 PROPERTIES IMPORTED_LOCATION "../../cpu_xenoncat/Linux/asm/equihash_avx1.o" )

add_library ( xenoncat_avx2 SHARED IMPORTED GLOBAL ) set_target_properties ( xenoncat_avx2 PROPERTIES IMPORTED_LOCATION "../../cpu_xenoncat/Linux/asm/equihash_avx2.o" )

include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../nheqminer/)

set(SOURCE_FILES

sources

../../nheqminer/amount.cpp
../../nheqminer/api.cpp
../../nheqminer/arith_uint256.cpp
../../nheqminer/crypto/sha256.cpp
../../nheqminer/json/json_spirit_reader.cpp
../../nheqminer/json/json_spirit_value.cpp
../../nheqminer/json/json_spirit_writer.cpp
../../nheqminer/libstratum/ZcashStratum.cpp
../../nheqminer/main.cpp
../../nheqminer/primitives/block.cpp
../../nheqminer/speed.cpp
../../nheqminer/uint256.cpp
../../nheqminer/utilstrencodings.cpp
# headers
../../nheqminer/amount.h
../../nheqminer/api.hpp
../../nheqminer/arith_uint256.h
../../nheqminer/crypto/sha256.h
../../nheqminer/hash.h
../../nheqminer/json/json_spirit.h
../../nheqminer/json/json_spirit_error_position.h
../../nheqminer/json/json_spirit_reader.h
../../nheqminer/json/json_spirit_reader_template.h
../../nheqminer/json/json_spirit_stream_reader.h
../../nheqminer/json/json_spirit_utils.h
../../nheqminer/json/json_spirit_value.h
../../nheqminer/json/json_spirit_writer.h
../../nheqminer/json/json_spirit_writer_template.h
../../nheqminer/libstratum/StratumClient.cpp
../../nheqminer/libstratum/StratumClient.h
../../nheqminer/libstratum/ZcashStratum.cpp
../../nheqminer/libstratum/ZcashStratum.h
../../nheqminer/primitives/block.h
../../nheqminer/primitives/transaction.h
../../nheqminer/script/script.h
../../nheqminer/serialize.h
../../nheqminer/speed.hpp
../../nheqminer/streams.h
../../nheqminer/support/allocators/zeroafterfree.h
../../nheqminer/tinyformat.h
../../nheqminer/uint252.h
../../nheqminer/uint256.h
../../nheqminer/utilstrencodings.h
../../nheqminer/version.h
../../nheqminer/zcash/JoinSplit.hpp
../../nheqminer/zcash/NoteEncryption.hpp
../../nheqminer/zcash/Proof.hpp
../../nheqminer/zcash/Zcash.h
../../nheqminer/SolverStub.h # just a stub

cpu tromp

../../cpu_tromp/blake2/blake2bx.cpp

../../cpu_tromp/cpu_tromp.cpp

../../cpu_tromp/blake2/blake2-config.h

../../cpu_tromp/blake2/blake2-impl.h

../../cpu_tromp/blake2/blake2-round.h

../../cpu_tromp/blake2/blake2.h

../../cpu_tromp/blake2/blake2b-load-sse2.h

../../cpu_tromp/blake2/blake2b-load-sse41.h

../../cpu_tromp/blake2/blake2b-round.h

../../cpu_tromp/cpu_tromp.hpp

../../cpu_tromp/equi.h

../../cpu_tromp/equi_miner.h

cpu xenocat

../../cpu_xenoncat/cpu_xenoncat.hpp
../../cpu_xenoncat/xenoncat.cpp

# cuda tromp
../../cuda_tromp/cuda_tromp.hpp
../../cuda_tromp/cuda_tromp.cpp
../../cuda_tromp/eqcuda.hpp
../../cuda_tromp/equi_miner.cu
../../cpu_tromp/blake2/blake2bx.cpp
)

add_executable(${PROJECT_NAME} ${SRC_LIST})

set(LIBS ${LIBS} ${Threads_LIBRARIES} ${Boost_LIBRARIES})

message("-- CXXFLAGS: ${CMAKE_CXX_FLAGS}")

message("-- LIBS: ${LIBS}")

add_executable(${PROJECT_NAME} ${SOURCE_FILES})

target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})

CUDA_ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} ${LIBS} ${CUDA_LIBRARIES} ) target_link_libraries(${PROJECT_NAME} ${LIBS} ${CMAKE_THREAD_LIBS_INIT} xenoncat_avx1 xenoncat_avx2 )

redongh commented 7 years ago

i've created a gist (https://gist.github.com/redongh/b15b35b92990f4542d070ca6b1bd4df3) that embodies the changes mentioned my @montvid in form of a .patch for the ones still willing to build a version where cuda_tromp can be simultaneously run with gpu and cpu mining enabled. @montvid: can please elaborate or give an example on what you mean by setting the variables in your other comment on this issue?

There is a trick first in the command line one has to set the gpu variable and then only the cpu variable or else the gpu crashes

montvid commented 7 years ago

I mean in the command line during execution it is better to set the gpu and only then the cpu variables.