[Ethereum] Ubuntu 14.04 building from source problem with CMake & Cuda K80

cpp-ethereumminingsolo-mining

So I'm trying to get the K80 to work on Ubuntu 14.04 with Cuda instead of the OpenCL buy using https://github.com/Genoil/cpp-ethereum miner. I have followed the instructions for Ubuntu 14.04 and Cuda, and have followed the steps multiple times but now cannot get Cuda to work. here is a printout of 'Nvidia-smi'

> Fri Jun  2 09:16:29 2017
> +-----------------------------------------------------------------------------+
> | NVIDIA-SMI 375.26                 Driver Version: 375.26                    |
> |-------------------------------+----------------------+----------------------+
> | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
> | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
> |===============================+======================+======================|
> |   0  Tesla K80           Off  | 0000:00:1E.0     Off |                    0 |
> | N/A   79C    P0   147W / 149W |   2097MiB / 11439MiB |    100%      Default |
> +-------------------------------+----------------------+----------------------+
> 
> +-----------------------------------------------------------------------------+
> | Processes:                                                       GPU Memory |
> |  GPU       PID  Type  Process name                               Usage      |
> |=============================================================================|
> |    0     15713    C   ethminer                                      2097MiB |
> +-----------------------------------------------------------------------------+
> 

I have read that the k80 has 2 sets of processor it has 24gb of ram available in 2 * 12gb you can only see the 1 of the processor above.

I downloaded cpp-ethereum followed the readme, I've never used CMake before but here is the output

derp@derp:~/cpp-ethereum/build# cmake -DBUNDLE=cudaminer ..
-- ctest path: /usr/bin/ctest
 - CryptoPP header: /usr/include
 - CryptoPP lib   : /usr/lib/libcryptopp.so
 - LevelDB header: /usr/include
 - LevelDB lib: /usr/lib/x86_64-linux-gnu/libleveldb.so
 - Jsoncpp header: /usr/include/jsoncpp
 - Jsoncpp lib   : /usr/lib/x86_64-linux-gnu/libjsoncpp.so
 - json-rpc-cpp header: /usr/include
 - json-rpc-cpp lib   : /usr/lib/libjsonrpccpp-common.so;/usr/lib/libjsonrpccpp-server.so;/usr/lib/libjsonrpccpp-client.so
 - microhttpd header: /usr/include
 - microhttpd lib   : /usr/lib/x86_64-linux-gnu/libmicrohttpd.so
 - microhttpd dll   :
 - readline header: /usr/include
 - readline lib   : /usr/lib/x86_64-linux-gnu/libreadline.so
-- Could NOT find miniupnpc (missing:  MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY)
 - gmp header: /usr/include/x86_64-linux-gnu
 - gmp lib   : /usr/lib/x86_64-linux-gnu/libgmp.so
 - curl header: /usr/include
 - curl lib   : /usr/lib/x86_64-linux-gnu/libcurl.so
-- Could NOT find cpuid (missing:  CPUID_INCLUDE_DIR CPUID_LIBRARY)
 - opencl header: /usr/include
 - opencl lib   : /usr/lib/x86_64-linux-gnu/libOpenCL.so
 - CUDA header: /usr/local/cuda/include
 - CUDA lib   : /usr/local/cuda/lib64/libcudart.so
 - jsonrpcstub location    : /usr/bin/jsonrpcstub
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   thread
--   date_time
--   system
--   regex
--   chrono
--   filesystem
--   unit_test_framework
--   program_options
--   random
 - boost header: /usr/include
 - boost lib   : /usr/lib/x86_64-linux-gnu/libboost_thread.so;/usr/lib/x86_64-linux-gnu/libboost_date_time.so;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_regex.so;/usr/lib/x86_64-linux-gnu/libboost_chrono.so;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so;/usr/lib/x86_64-linux-gnu/libboost_program_options.so;/usr/lib/x86_64-linux-gnu/libboost_random.so;/usr/lib/x86_64-linux-gnu/libpthread.so
------------------------------------------------------------------------
--                  CMake Version                            3.2.2
-- CMAKE_BUILD_TYPE Build type                               Release
-- TARGET_PLATFORM  Target platform                          Linux
-- BUNDLE           Build bundle                             cudaminer
--------------------------------------------------------------- features
--                  Chromium support                         1
--                  Hardware identification support          FALSE
--                  HTTP Request support                     TRUE
-- VMTRACE          VM execution tracing                     OFF
-- PROFILING        Profiling support                        OFF
-- FATDB            Full database exploring
-- JSONRPC          JSON-RPC support                         ON
-- OLYMPIC          Default to the Olympic network           OFF
------------------------------------------------------------- components
-- MINER            Build miner                              ON
-- GUI              Build GUI components                     OFF
-- ETHASHCL         Build OpenCL components                  ON
-- ETHASHCUDA       Build CUDA components                    ON
-- ETHSTRATUM       Build Stratum components                 ON
------------------------------------------------------------------------

-- CXXFLAGS: -std=c++11 -Wall -Wno-unknown-pragmas -Wextra -Wno-error=parentheses -pedantic -DSHAREDLIB -fPIC  -fuse-ld=gold
creating build info...
createBuildInfo()
-- Configuring done
CMake Warning at libethcore/CMakeLists.txt:21 (add_library):
  Cannot generate a safe runtime search path for target ethcore because files
  in some directories may conflict with libraries in implicit directories:

    runtime library [libOpenCL.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /usr/local/cuda/lib64

  Some of these libraries may not be found correctly.


CMake Warning at ethminer/CMakeLists.txt:22 (add_executable):
  Cannot generate a safe runtime search path for target ethminer because
  files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libOpenCL.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /usr/local/cuda/lib64

  Some of these libraries may not be found correctly.


-- Generating done
-- Build files have been written to: /root/cpp-ethereum/build

But no halts or errors happen so then I run make -j8, this is the output.

derp@derp:~/cpp-ethereum/build# make -j8
Scanning dependencies of target ethstratum
Scanning dependencies of target ethash
Scanning dependencies of target devcore
Scanning dependencies of target BuildInfo.h
[  2%] [  4%] [  7%] [  9%] [ 11%] [ 14%] Building C object libethash/CMakeFiles/ethash.dir/internal.c.o
Building CXX object libstratum/CMakeFiles/ethstratum.dir/EthStratumClientV2.cpp.o
Building C object libethash/CMakeFiles/ethash.dir/io_posix.c.o
Building C object libethash/CMakeFiles/ethash.dir/io.c.o
Building CXX object libethash/CMakeFiles/ethash.dir/sha3_cryptopp.cpp.o
[ 16%] Building CXX object libstratum/CMakeFiles/ethstratum.dir/EthStratumClient.cpp.o
Building CXX object libdevcore/CMakeFiles/devcore.dir/StructuredLogger.cpp.o
Files "/root/cpp-ethereum/build/BuildInfo.h.tmp" to "/root/cpp-ethereum/build/BuildInfo.h" are different.
[ 16%] Built target BuildInfo.h
[ 19%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Guards.cpp.o
[ 21%] [ 23%] Building CXX object libdevcore/CMakeFiles/devcore.dir/TrieCommon.cpp.o
Building CXX object libdevcore/CMakeFiles/devcore.dir/RLP.cpp.o
[ 26%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Log.cpp.o
Linking CXX shared library libethash.so
[ 26%] Built target ethash
[ 28%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Common.cpp.o
[ 30%] Building CXX object libdevcore/CMakeFiles/devcore.dir/FixedHash.cpp.o
[ 33%] Building CXX object libdevcore/CMakeFiles/devcore.dir/FileSystem.cpp.o
/root/cpp-ethereum/libstratum/EthStratumClientV2.cpp: In member function 'void EthStratumClientV2::processReponse(Json::Value&)':
/root/cpp-ethereum/libstratum/EthStratumClientV2.cpp:350:12: warning: variable 'headerHash' set but not used [-Wunused-but-set-variable]
       h256 headerHash = h256(sHeaderHash);
            ^
/root/cpp-ethereum/libstratum/EthStratumClient.cpp: In member function 'void EthStratumClient::processReponse(Json::Value&)':
/root/cpp-ethereum/libstratum/EthStratumClient.cpp:398:12: warning: variable 'headerHash' set but not used [-Wunused-but-set-variable]
       h256 headerHash = h256(sHeaderHash);
            ^
[ 35%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Hash.cpp.o
[ 38%] Building CXX object libdevcore/CMakeFiles/devcore.dir/SHA3.cpp.o
[ 40%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Base64.cpp.o
[ 42%] Building CXX object libdevcore/CMakeFiles/devcore.dir/CommonJS.cpp.o
[ 45%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Worker.cpp.o
[ 47%] Building CXX object libdevcore/CMakeFiles/devcore.dir/RangeMask.cpp.o
[ 50%] Building CXX object libdevcore/CMakeFiles/devcore.dir/TrieDB.cpp.o
[ 52%] Building CXX object libdevcore/CMakeFiles/devcore.dir/TransientDirectory.cpp.o
[ 54%] Building CXX object libdevcore/CMakeFiles/devcore.dir/MemoryDB.cpp.o
[ 57%] Building CXX object libdevcore/CMakeFiles/devcore.dir/CommonIO.cpp.o
[ 59%] Building CXX object libdevcore/CMakeFiles/devcore.dir/TrieHash.cpp.o
[ 61%] Building CXX object libdevcore/CMakeFiles/devcore.dir/CommonData.cpp.o
Linking CXX shared library libethstratum.so
[ 61%] Built target ethstratum
[ 64%] Generating OpenCL Kernel Byte Array
Scanning dependencies of target ethash-cl
[ 66%] Building CXX object libethash-cl/CMakeFiles/ethash-cl.dir/ethash_cl_miner.cpp.o
[ 69%] Building NVCC (Device) object libethash-cuda/CMakeFiles/ethash-cuda.dir/ethash-cuda_generated_ethash_cuda_miner_kernel.cu.o
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
Linking CXX shared library libethash-cl.so
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
[ 69%] Built target ethash-cl
/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h(432): error: identifier "nullptr" is undefined

/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h(432): error: expected a ";"

/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h(190): error: expected a ";"

/usr/include/c++/4.8/exception(63): error: expected a ";"

/usr/include/c++/4.8/exception(68): error: expected a ";"

/usr/include/c++/4.8/exception(76): error: expected a ";"
/usr/include/c++/4.8/exception(83): error: expected a ";"

/usr/include/c++/4.8/exception(93): error: expected a "{"

/usr/include/c++/4.8/bits/exception_ptr.h(64): error: function "std::current_exception" returns incomplete type "std::__exception_ptr::exception_ptr"

/usr/include/c++/4.8/bits/exception_ptr.h(64): error: expected a "{"

/usr/include/c++/4.8/bits/exception_ptr.h(79): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(81): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(82): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(84): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(86): error: declaration is incompatible with previous "std::current_exception"
(64): here

/usr/include/c++/4.8/bits/exception_ptr.h(86): error: use of a local type to declare a function

/usr/include/c++/4.8/bits/exception_ptr.h(86): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(87): error: use of a local type to declare a function

/usr/include/c++/4.8/bits/exception_ptr.h(90): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(92): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(95): error: incomplete type is not allowed

/usr/include/c++/4.8/bits/exception_ptr.h(95): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(116): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(126): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(143): error: use of a local type to declare a function

/usr/include/c++/4.8/bits/exception_ptr.h(144): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(147): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(152): error: use of a local type to declare a function

/usr/include/c++/4.8/bits/exception_ptr.h(153): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(156): error: use of a local type to declare a function

/usr/include/c++/4.8/bits/exception_ptr.h(157): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(160): error: use of a local type to declare a function

/usr/include/c++/4.8/bits/exception_ptr.h(161): error: expected a ";"

/usr/include/c++/4.8/bits/exception_ptr.h(169): error: expected a ";"

/usr/include/c++/4.8/bits/nested_exception.h(57): error: incomplete type is not allowed

/usr/include/c++/4.8/bits/nested_exception.h(60): error: expected a ";"

/usr/include/c++/4.8/bits/nested_exception.h(66): error: expected a ";"

/usr/include/c++/4.8/bits/nested_exception.h(70): error: identifier "rethrow_exception" is undefined
/usr/include/c++/4.8/bits/nested_exception.h(73): error: function "std::nested_exception::nested_ptr" returns incomplete type "std::__exception_ptr::exception_ptr"

/usr/include/c++/4.8/new(95): error: expected a "{"

/usr/include/c++/4.8/new(110): error: identifier "__p" is undefined

/usr/include/c++/4.8/new(111): error: expected a "{"

/usr/include/c++/4.8/new(115): error: expected a "{"

/usr/include/c++/4.8/new(116): error: expected a "{"

/usr/include/c++/4.8/bits/cpp_type_traits.h(184): error: identifier "char16_t" is undefined

/usr/include/c++/4.8/bits/cpp_type_traits.h(191): error: identifier "char32_t" is undefined

/usr/include/c++/4.8/bits/cpp_type_traits.h(191): error: class "std::__is_integer<<error-type>>" has already been defined

/usr/include/c++/4.8/bits/cpp_type_traits.h(314): error: namespace "std::__gnu_cxx" has no member "__normal_iterator"

/usr/include/c++/4.8/bits/cpp_type_traits.h(314): error: expected a ">"

/usr/include/c++/4.8/cmath(80): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(80): error: expected a ";"

/usr/include/c++/4.8/cmath(105): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(105): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(105): error: expected a ";"

/usr/include/c++/4.8/cmath(124): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(124): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(124): error: expected a ";"

/usr/include/c++/4.8/cmath(143): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(143): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(143): error: expected a ";"

/usr/include/c++/4.8/cmath(162): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(162): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(162): error: expected a ";"

/usr/include/c++/4.8/cmath(183): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(183): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(183): error: expected a ";"

/usr/include/c++/4.8/cmath(202): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(202): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(202): error: expected a ";"

/usr/include/c++/4.8/cmath(221): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(221): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(221): error: expected a ";"

/usr/include/c++/4.8/cmath(240): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(240): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(240): error: expected a ";"

/usr/include/c++/4.8/cmath(259): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(259): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(259): error: expected a ";"

/usr/include/c++/4.8/cmath(278): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(278): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(278): error: expected a ";"

/usr/include/c++/4.8/cmath(297): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(297): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(297): error: expected a ";"

/usr/include/c++/4.8/cmath(328): error: "constexpr" is not a function or static data member

/usr/include/c++/4.8/cmath(337): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(337): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(337): error: expected a ";"

/usr/include/c++/4.8/cmath(356): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(356): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(356): error: expected a ";"

/usr/include/c++/4.8/cmath(375): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(375): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(375): error: expected a ";"

/usr/include/c++/4.8/cmath(406): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(406): error: variable "std::constexpr" has already been defined

/usr/include/c++/4.8/cmath(406): error: expected a ";"

/usr/include/c++/4.8/cmath(443): error: inline specifier allowed on function declarations only

/usr/include/c++/4.8/cmath(443): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(443): error: expected a ";"

Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_00006f93_00000000-17_ethash_cuda_miner_kernel.compute_61.cpp1.ii".
Compilation terminated.
CMake Error at ethash-cuda_generated_ethash_cuda_miner_kernel.cu.o.cmake:264 (message):
  Error generating file
  /root/cpp-ethereum/build/libethash-cuda/CMakeFiles/ethash-cuda.dir//./ethash-cuda_generated_ethash_cuda_miner_kernel.cu.o


make[2]: *** [libethash-cuda/CMakeFiles/ethash-cuda.dir/ethash-cuda_generated_ethash_cuda_miner_kernel.cu.o] Error 1
make[1]: *** [libethash-cuda/CMakeFiles/ethash-cuda.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX shared library libdevcore.so
[ 69%] Built target devcore
make: *** [all] Error 2

What am I doing wrong?

Thanks

Also I'm confused by this step, "sudo apt-get https://github.com/Genoil/cpp-ethereum/blob/master/README.md -y install software-properties-common" apt-get then a git repository, what is trying to be accomplished here?

Best Answer

This was caused by somebody who tried to make copatibility with Fedora work. add --std=c++11 to the NVCC flags in CMakelists.txt in libethash-cuda folder

So, actually, you have to make some change to the cloned source.

download:

git clone https://github.com/Genoil/cpp-ethereum.git  
cd cpp-ethereum/libethash-cuda  
vim CMakeLists.txt

Change from

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

To, by adding --std=c++11; :

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

More details can be checked https://blog.konpat.me/ethereum-cuda-mining-with-nvidia-docker/